op_pc.b 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. bcc(0x90, !regs.p.c),
  2. bcs(0xb0, regs.p.c),
  3. bne(0xd0, !regs.p.z),
  4. beq(0xf0, regs.p.z),
  5. bpl(0x10, !regs.p.n),
  6. bmi(0x30, regs.p.n),
  7. bvc(0x50, !regs.p.v),
  8. bvs(0x70, regs.p.v) {
  9. 1:if(!$1) last_cycle();
  10. rd.l = op_readpc();
  11. if($1) {
  12. aa.w = regs.pc.d + (int8)rd.l;
  13. regs.pc.w = aa.w;
  14. } else {
  15. end;
  16. }
  17. 2:op_io_cond6(aa.w);
  18. 3:last_cycle();
  19. op_io();
  20. }
  21. bra(0x80) {
  22. 1:rd.l = op_readpc();
  23. aa.w = regs.pc.d + (int8)rd.l;
  24. regs.pc.w = aa.w;
  25. 2:op_io_cond6(aa.w);
  26. 3:last_cycle();
  27. op_io();
  28. }
  29. brl(0x82) {
  30. 1:rd.l = op_readpc();
  31. 2:rd.h = op_readpc();
  32. 3:last_cycle();
  33. op_io();
  34. regs.pc.w = regs.pc.d + (int16)rd.w;
  35. }
  36. jmp_addr(0x4c) {
  37. 1:rd.l = op_readpc();
  38. 2:last_cycle();
  39. rd.h = op_readpc();
  40. regs.pc.w = rd.w;
  41. }
  42. jmp_long(0x5c) {
  43. 1:rd.l = op_readpc();
  44. 2:rd.h = op_readpc();
  45. 3:last_cycle();
  46. rd.b = op_readpc();
  47. regs.pc.d = rd.d & 0xffffff;
  48. }
  49. jmp_iaddr(0x6c) {
  50. 1:aa.l = op_readpc();
  51. 2:aa.h = op_readpc();
  52. 3:rd.l = op_readaddr(aa.w);
  53. 4:last_cycle();
  54. rd.h = op_readaddr(aa.w + 1);
  55. regs.pc.w = rd.w;
  56. }
  57. jmp_iaddrx(0x7c) {
  58. 1:aa.l = op_readpc();
  59. 2:aa.h = op_readpc();
  60. 3:op_io();
  61. 4:rd.l = op_readpbr(aa.w + regs.x.w);
  62. 5:last_cycle();
  63. rd.h = op_readpbr(aa.w + regs.x.w + 1);
  64. regs.pc.w = rd.w;
  65. }
  66. jmp_iladdr(0xdc) {
  67. 1:aa.l = op_readpc();
  68. 2:aa.h = op_readpc();
  69. 3:rd.l = op_readaddr(aa.w);
  70. 4:rd.h = op_readaddr(aa.w + 1);
  71. 5:last_cycle();
  72. rd.b = op_readaddr(aa.w + 2);
  73. regs.pc.d = rd.d & 0xffffff;
  74. }
  75. jsr_addr(0x20) {
  76. 1:aa.l = op_readpc();
  77. 2:aa.h = op_readpc();
  78. 3:op_io();
  79. 4:regs.pc.w--;
  80. op_writestack(regs.pc.h);
  81. 5:last_cycle();
  82. op_writestack(regs.pc.l);
  83. regs.pc.w = aa.w;
  84. }
  85. jsr_long(0x22) {
  86. 1:aa.l = op_readpc();
  87. 2:aa.h = op_readpc();
  88. 3:op_writestackn(regs.pc.b);
  89. 4:op_io();
  90. 5:aa.b = op_readpc();
  91. 6:regs.pc.w--;
  92. op_writestackn(regs.pc.h);
  93. 7:last_cycle();
  94. op_writestackn(regs.pc.l);
  95. regs.pc.d = aa.d & 0xffffff;
  96. if(regs.e) regs.s.h = 0x01;
  97. }
  98. jsr_iaddrx(0xfc) {
  99. 1:aa.l = op_readpc();
  100. 2:op_writestackn(regs.pc.h);
  101. 3:op_writestackn(regs.pc.l);
  102. 4:aa.h = op_readpc();
  103. 5:op_io();
  104. 6:rd.l = op_readpbr(aa.w + regs.x.w);
  105. 7:last_cycle();
  106. rd.h = op_readpbr(aa.w + regs.x.w + 1);
  107. regs.pc.w = rd.w;
  108. if(regs.e) regs.s.h = 0x01;
  109. }
  110. rti(0x40) {
  111. 1:op_io();
  112. 2:op_io();
  113. 3:regs.p = op_readstack();
  114. if(regs.e) regs.p |= 0x30;
  115. if(regs.p.x) {
  116. regs.x.h = 0x00;
  117. regs.y.h = 0x00;
  118. }
  119. 4:rd.l = op_readstack();
  120. 5:if(regs.e) last_cycle();
  121. rd.h = op_readstack();
  122. if(regs.e) {
  123. regs.pc.w = rd.w;
  124. end;
  125. }
  126. 6:last_cycle();
  127. rd.b = op_readstack();
  128. regs.pc.d = rd.d & 0xffffff;
  129. }
  130. rts(0x60) {
  131. 1:op_io();
  132. 2:op_io();
  133. 3:rd.l = op_readstack();
  134. 4:rd.h = op_readstack();
  135. 5:last_cycle();
  136. op_io();
  137. regs.pc.w = rd.w;
  138. regs.pc.w++;
  139. }
  140. rtl(0x6b) {
  141. 1:op_io();
  142. 2:op_io();
  143. 3:rd.l = op_readstackn();
  144. 4:rd.h = op_readstackn();
  145. 5:last_cycle();
  146. rd.b = op_readstackn();
  147. regs.pc.d = rd.d & 0xffffff;
  148. regs.pc.w++;
  149. if(regs.e) regs.s.h = 0x01;
  150. }