home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / Z80 emulator / 68K version / cmd_xx.c < prev    next >
Encoding:
Text File  |  1995-11-01  |  16.8 KB  |  790 lines  |  [TEXT/CWIE]

  1. // -----    MAIN COMMAND DISPATCHER -----------------------------------------------
  2.  
  3. cmd_xx:
  4.  
  5. // -----    increment T cycle counter by 4  (( actually: decrement ))
  6. #if exact_timing
  7.     subq.l    #4,cc
  8.     bmi.s    cycle00
  9. #endif
  10.  
  11.  
  12. // -----    debugger related testings
  13. #if PC_PROFILE || pc_firstuse
  14.     movea.l    cnt_pc,a0
  15.     addq.l    #1,(a0,ip.w*4)
  16. #if pc_firstuse
  17.     bne.s    pcp1
  18.     }; Do_1st_Loc ( ip ); asm {
  19. pcp1:
  20. #endif
  21. #endif
  22.  
  23.  
  24. // ------    get instruction    
  25.     move.b    (ip)+,db
  26.  
  27.  
  28. // -----    debugger related testings
  29. #if CMD_PROFILE || cmd_firstuse
  30.     movea.l    cnt_xx,a0
  31. //    addq.l    #1,(a0,db.l*4)
  32.     lsl    #2,db
  33.     addq.l    #1,(a0,db.l)
  34.     lsr    #2,db
  35. #if cmd_firstuse
  36.     bne.s    cmdp1
  37.     }; Do_1st_Instr ( ip ); asm {
  38. cmdp1:
  39. #endif
  40. #endif
  41.  
  42.  
  43. // -----    increment r register
  44. #if EXACT_R
  45.     addq.b    #1,r
  46. #endif
  47.  
  48. // -----    perform instruction
  49. xx_im0:    dc.w    0x41FB, 0x4A06        // lea    *+$08(D4.l*2),A0
  50.     adda.w    (a0),a0
  51.     jmp    (a0)
  52.  
  53. xx_tab:    dc.w    nxtcmnd,    xx1,    xx2,    xx3,    xx4,    xx5,    xx6,    xx7
  54.     dc.w    xx8,    xx9,    xx10,    xx11,    xx12,    xx13,    xx14,    xx15
  55.     dc.w    xx16,    xx17,    xx18,    xx19,    xx20,    xx21,    xx22,    xx23
  56.     dc.w    xx24,    xx25,    xx26,    xx27,    xx28,    xx29,    xx30,    xx31
  57.     dc.w    xx32,    xx33,    xx34,    xx35,    xx36,    xx37,    xx38,    cmd_daa    
  58.     dc.w    xx40,    xx41,    xx42,    xx43,    xx44,    xx45,    xx46,    xx47
  59.     dc.w    xx48,    xx49,    xx50,    xx51,    xx52,    xx53,    xx54,    xx55
  60.     dc.w    xx56,    xx57,    xx58,    xx59,    xx60,    xx61,    xx62,    xx63
  61.     dc.w    nxtcmnd,    xx65,    xx66,    xx67,    xx68,    xx69,    xx70,    xx71
  62.     dc.w    xx72,    nxtcmnd,    xx74,    xx75,    xx76,    xx77,    xx78,    xx79
  63.     dc.w    xx80,    xx81,    nxtcmnd,    xx83,    xx84,    xx85,    xx86,    xx87
  64.     dc.w    xx88,    xx89,    xx90,    nxtcmnd,    xx92,    xx93,    xx94,    xx95
  65.     dc.w    xx96,    xx97,    xx98,    xx99,    nxtcmnd,    xx101,    xx102,    xx103
  66.     dc.w    xx104,    xx105,    xx106,    xx107,    xx108,    nxtcmnd,    xx110,    xx111
  67.     dc.w    xx112,    xx113,    xx114,    xx115,    xx116,    xx117,    xx118,    xx119
  68.     dc.w    xx120,    xx121,    xx122,    xx123,    xx124,    xx125,    xx126,    nxtcmnd
  69.     dc.w    xx128,    xx129,    xx130,    xx131,    xx132,    xx133,    xx134,    xx135
  70.     dc.w    xx136,    xx137,    xx138,    xx139,    xx140,    xx141,    xx142,    xx143
  71.     dc.w    xx144,    xx145,    xx146,    xx147,    xx148,    xx149,    xx150,    xx151
  72.     dc.w    xx152,    xx153,    xx154,    xx155,    xx156,    xx157,    xx158,    xx159
  73.     dc.w    xx160,    xx161,    xx162,    xx163,    xx164,    xx165,    xx166,    xx167
  74.     dc.w    xx168,    xx169,    xx170,    xx171,    xx172,    xx173,    xx174,    xx175
  75.     dc.w    xx176,    xx177,    xx178,    xx179,    xx180,    xx181,    xx182,    xx183
  76.     dc.w    xx184,    xx185,    xx186,    xx187,    xx188,    xx189,    xx190,    xx191
  77.     dc.w    xx192,    xx193,    xx194,    xx195,    xx196,    xx197,    xx198,    xx199
  78.     dc.w    xx200,    xx201,    xx202,    cmd_CB,    xx204,    xx205,    xx206,    xx207
  79.     dc.w    xx208,    xx209,    xx210,    xx211,    xx212,    xx213,    xx214,    xx215
  80.     dc.w    xx216,    xx217,    xx218,    xx219,    xx220,    cmd_IX,    xx222,    xx223
  81.     dc.w    xx224,    xx225,    xx226,    xx227,    xx228,    xx229,    xx230,    xx231
  82.     dc.w    xx232,    xx233,    xx234,    xx235,    xx236,    cmd_ED,    xx238,    xx239
  83.     dc.w    xx240,    xx241,    xx242,    xx243,    xx244,    xx245,    xx246,    xx247
  84.     dc.w    xx248,    xx249,    xx250,    xx251,    xx252,    cmd_IY,    xx254,    xx255
  85.  
  86. /* -----    most frequent instructions  (profiled 29.Mar.95)
  87.  
  88. 10 :     003028B5 djnz N
  89. 00 :     002D93FE nop
  90. 20 :     0023A24B jr nz,N    
  91. ED :     0014A967     
  92. 23 :     000F425A inc hl    
  93. CD :     000D99AC call NN
  94. 28 :     000CC95F jr z,N    
  95. 77 :     000CB4E2 ld (hl),a    
  96. C1 :     000BF390 pop bc    
  97. C5 :     000BD970 push bc    
  98. 78 :     000B690E ld a,b    
  99. D9 :     000A9BC2 exx    
  100. C9 :     000A46ED ret    
  101. B1 :     0009E30F or a,c    
  102. 0B :     00099EC6 dec bc    
  103. E6 :     000A19AC and a,N    
  104. D3 :     000989EF out (N),a    
  105. FD :     0008554E         
  106. DD :     0007EFE8         
  107. EDA0 :     00079454 ldi
  108. 7E :     000717A4 ld a,(hl)    
  109. A7 :     000700C6 and a,a    
  110. 7C :     000650C1 ld a,h
  111. EDA8 :     00060640 ldd
  112. 1A :     0005841D ld a,(de)    
  113. 24 :     00058340 inc h    
  114. 15 :     000561E9 dec d    
  115.  
  116. ----------------------------------------------- */
  117.  
  118.  
  119.     
  120.  
  121. // =====    CALLING & JUMPING ===================================
  122.  
  123. #define    if_nc    btst   #0,f;   bne   nxtirpt    
  124. #define    if_c    btst   #0,f;   beq   nxtirpt    
  125. #define    if_po    btst   #1,f;   bne   nxtirpt    
  126. #define    if_pe    btst   #1,f;   beq   nxtirpt    
  127. #define    if_nz    btst   #2,f;   bne   nxtirpt    
  128. #define    if_z    btst   #2,f;   beq   nxtirpt    
  129. #define    if_p    btst   #3,f;   bne   nxtirpt    
  130. #define    if_m    btst   #3,f;   beq   nxtirpt    
  131.  
  132. #define    get_pc    move.w    (ip)+,core
  133.  
  134. #define    push_pc    move.w    ip,d0    ;\
  135.         rol.w    #8,d0    ;\
  136.         move.w    d0,-(rp)
  137.  
  138. #define    jump    rol.w    #8,core    ;\
  139.         bra    nxtjmp        
  140.  
  141. #define    ret    move.w    (rp)+,core;\
  142.         jump
  143.  
  144. #define    rst(ADR)    more7        ;\
  145.         push_pc        ;\
  146.         move.w    ADR,core    ;\
  147.         bra    nxtjmp
  148.  
  149. xx199:    do_info_rst0;  more7;  bra exit_rst0    // -----    RST 0
  150. xx207:    do_info_rst8;    rst(#8)    // -----    rst 8
  151. xx215:    do_info_rst16;    rst(#16)    // -----    rst 16
  152. xx223:    do_info_rst24;    rst(#24)    // -----    rst 24
  153. xx231:    do_info_rst32;    rst(#32)    // -----    rst 32
  154. xx239:    do_info_rst40;    rst(#40)    // -----    rst 40
  155. xx247:    do_info_rst48;    rst(#48)    // -----    rst 48
  156. xx255:    do_info_rst56;    rst(#56)    // -----    rst 56
  157.  
  158. xx192:    more1; if_nz;  more6; ret    // -----    ret nz
  159. xx200:    more1; if_z;   more6; ret    // -----    ret z
  160. xx208:    more1; if_nc;  more6; ret    // -----    ret nc
  161. xx216:    more1; if_c;   more6; ret    // -----    ret c
  162. xx224:    more1; if_po;  more6; ret    // -----    ret po  ==  ret V=0
  163. xx232:    more1; if_pe;  more6; ret    // -----    ret pe  ==  ret V=1
  164. xx240:    more1; if_p;   more6; ret    // -----    ret p
  165. xx248:    more1; if_m;  more6; ret    // -----    ret m
  166. xx201:    more6;          ret    // -----    ret
  167.  
  168. xx196:    more6;  get_pc;    if_nz;    more7;  push_pc;    jump    // -----    call nz,nn
  169. xx204:    more6;  get_pc;    if_z;    more7;  push_pc;    jump    // -----    call z,nn
  170. xx212:    more6;  get_pc;    if_nc;    more7;  push_pc;    jump    // -----    call nc,nn
  171. xx220:    more6;  get_pc;    if_c;    more7;  push_pc;    jump    // -----    call c,nn
  172. xx228:    more6;  get_pc;    if_po;    more7;  push_pc;    jump    // -----    call po,nn
  173. xx236:    more6;  get_pc;    if_pe;    more7;  push_pc;    jump    // -----    call pe,nn
  174. xx244:    more6;  get_pc;    if_p;    more7;  push_pc;    jump    // -----    call p,nn
  175. xx252:    more6;  get_pc;    if_m;    more7;  push_pc;    jump    // -----    call m,nn
  176. xx205:    more6;  get_pc;        more7;  push_pc;    jump    // -----    call nn
  177.  
  178. xx194:    more6;  get_pc;    if_nz;    jump    // -----    jp nz,nn
  179. xx202:    more6;  get_pc;    if_z;    jump    // -----    jp z,nn
  180. xx210:    more6;  get_pc;    if_nc;    jump    // -----    jp nc,nn
  181. xx218:    more6;  get_pc;    if_c;    jump    // -----    jp c,nn
  182. xx226:    more6;  get_pc;    if_po;    jump    // -----    jp po,nn
  183. xx234:    more6;  get_pc;    if_pe;    jump    // -----    jp pe,nn
  184. xx242:    more6;  get_pc;    if_p;    jump    // -----    jp p,nn
  185. xx250:    more6;  get_pc;    if_m;    jump    // -----    jp m,nn
  186. xx195:    more6;  get_pc;        jump    // -----    jp nn
  187.     
  188. xx233:    movea.l    AHL,ip        // -----    jp (hl)
  189.     bra    nxtirpt
  190.  
  191.  
  192. // =====    LOAD R,R ==========================================
  193.  
  194. #define    load(Z,Q);    move.b  Q,Z;    m_next
  195.  
  196. xx65:    load(RB,RC)
  197. xx66:    load(RB,RD)
  198. xx67:    load(RB,RE)
  199. xx68:    load(RB,RH)
  200. xx69:    load(RB,RL)
  201. xx70:    more3;    movea.l    AHL,a0;    load(RB,(a0))
  202. xx71:    load(RB,a)
  203.  
  204. xx72:    load(RC,RB)
  205. xx74:    load(RC,RD)
  206. xx75:    load(RC,RE)
  207. xx76:    load(RC,RH)
  208. xx77:    load(RC,RL)
  209. xx78:    more3;    movea.l    AHL,a0;    load(RC,(a0))
  210. xx79:    load(RC,a)
  211.  
  212. xx80:    load(RD,RB)
  213. xx81:    load(RD,RC)
  214. xx83:    load(RD,RE)
  215. xx84:    load(RD,RH)
  216. xx85:    load(RD,RL)
  217. xx86:    more3;    movea.l    AHL,a0;    load(RD,(a0))
  218. xx87:    load(RD,a)
  219.  
  220. xx88:    load(RE,RB)
  221. xx89:    load(RE,RC)
  222. xx90:    load(RE,RD)
  223. xx92:    load(RE,RH)
  224. xx93:    load(RE,RL)
  225. xx94:    more3;    movea.l    AHL,a0;    load(RE,(a0))
  226. xx95:    load(RE,a)
  227.  
  228. xx96:    load(RH,RB)
  229. xx97:    load(RH,RC)
  230. xx98:    load(RH,RD)
  231. xx99:    load(RH,RE)
  232. xx101:    load(RH,RL)
  233. xx102:    more3;    movea.l    AHL,a0;    load(RH,(a0))
  234. xx103:    load(RH,a)
  235.  
  236. xx104:    load(RL,RB)
  237. xx105:    load(RL,RC)
  238. xx106:    load(RL,RD)
  239. xx107:    load(RL,RE)
  240. xx108:    load(RL,RH)
  241. xx110:    more3;    movea.l    AHL,a0;    load(RL,(a0))
  242. xx111:    load(RL,a)
  243.  
  244. xx120:    load(a,RB)
  245. xx121:    load(a,RC)
  246. xx122:    load(a,RD)
  247. xx123:    load(a,RE)
  248. xx124:    load(a,RH)
  249. xx125:    load(a,RL)
  250.  
  251. xx126:    more3;    movea.l    AHL,a0;    load(a,(a0))    // ld a,(hl)
  252. xx10:    more3;    movea.l    ABC,a0;    load(a,(a0))    // ld a,(bc)
  253. xx26:    more3;    movea.l    ADE,a0;    load(a,(a0))    // ld a,(de)
  254.     
  255. xx6:    more3;    load(RB,(ip)+)    // ----- ld b,n
  256. xx14:    more3;    load(RC,(ip)+)    // ----- ld c,n
  257. xx22:    more3;    load(RD,(ip)+)    // ----- ld d,n
  258. xx30:    more3;    load(RE,(ip)+)    // ----- ld e,n
  259. xx38:    more3;    load(RH,(ip)+)    // ----- ld h,n
  260. xx46:    more3;    load(RL,(ip)+)    // ----- ld l,n
  261. xx62:    more3;    load(a,(ip)+)    // ----- ld a,n
  262.  
  263.     
  264. #if rom_protection
  265. sto_b:    bra    store_byte
  266. #define    ldxhl(Q)    more3        ;\
  267.         move.l    AHL,a0    ;\
  268.         move.b    Q,db    ;\
  269.         if_rom(sto_b)    ;\
  270.         load((a0),db)
  271. #else
  272. #define    ldxhl(Q)    more3        ;\
  273.         movea.l    AHL,a0    ;\
  274.         load((a0),Q)
  275. #endif
  276.  
  277. xx119:    ldxhl(a)
  278. xx112:    ldxhl(RB)
  279. xx113:    ldxhl(RC)
  280. xx114:    ldxhl(RD)
  281. xx115:    ldxhl(RE)
  282. xx116:    ldxhl(RH)
  283. xx117:    ldxhl(RL)
  284.  
  285. #if rom_protection
  286. sto_a:    move.b    a,db
  287.     bra    store_byte
  288. #endif
  289.     
  290. xx2:    more3        // -----    ld (bc),a
  291.     move.l    ABC,a0
  292.     if_rom(sto_a)
  293.     move.b    a,(a0)
  294.     m_next
  295.  
  296. xx18:    more3        // -----    ld (de),a
  297.     move.l    ADE,a0
  298.     if_rom(sto_a)
  299.     move.b    a,(a0)
  300.     m_next
  301.     
  302. xx50:    more8        // -----    ld (nn),a
  303.     more1
  304.     move.w    (ip)+,core
  305.     rol.w    #8,core
  306.     movea.l    core,a0
  307.     if_rom(sto_a)
  308.     move.b    a,(a0)
  309.     m_next
  310.  
  311. xx58:    more8        // -----    ld a,(nn)
  312.     more1
  313.     move.w    (ip)+,core
  314.     rol.w    #8,core
  315.     movea.l    core,a0
  316.     load(a,(a0))
  317.     
  318. #if rom_protection
  319. sto_n:    move.b    (ip)+,db
  320.     bra    store_byte
  321. #endif
  322.     
  323. xx54:    more6            // -----    ld (hl),n
  324.     move.l    AHL,a0
  325.     if_rom(sto_n)
  326.     move.b    (ip)+,(a0)
  327.     m_next
  328.  
  329.  
  330. // =====    INC R  &  DEC R =====================================
  331.  
  332. #define    id_flags    move    ccr,d0    ;\
  333.         and.b    #1,f    ;\
  334.         and.b    #0xfe,d0    ;\
  335.         or.b    d0,f
  336.  
  337. #define    incr(R)    addq.b    #1,R;    id_flags
  338. #define    decr(R)    subq.b    #1,R;    id_flags
  339.  
  340. xx4:    incr(RB);    m_next    // -----    inc b
  341. xx5:    decr(RB);    m_next    // ----- dec b
  342. xx12:    incr(RC);    m_next    // ----- inc c
  343. xx13:    decr(RC);    m_next    // ----- dec c
  344. xx20:    incr(RD);    m_next    // -----    inc d
  345. xx21:    decr(RD);    m_next    // ----- dec d
  346. xx28:    incr(RE);    m_next    // -----    inc e
  347. xx29:    decr(RE);    m_next    // ----- dec e
  348. xx36:    incr(RH);    m_next    // -----    inc h
  349. xx37:    decr(RH);    m_next    // ----- dec h
  350. xx44:    incr(RL);    m_next    // -----    inc l
  351. xx45:    decr(RL);    m_next    // ----- dec l
  352. xx60:    incr(a);    m_next    // -----    inc a
  353. xx61:    decr(a);    m_next    // -----    dec a
  354.     
  355. #if rom_protection
  356. inc_xhl:    move.b    (a0),db
  357.     addq.b    #1,db
  358.     bra.s    id_xhl
  359. dec_xhl:    move.b    (a0),db
  360.     subq.b    #1,db
  361. id_xhl:    id_flags
  362.     bra    store_byte
  363. #endif
  364.  
  365. xx52:    more7        // -----    inc (hl)
  366.     move.l    AHL,a0
  367. incx:    if_rom(inc_xhl)
  368.     incr((a0))
  369.     m_next
  370.  
  371. xx53:    more7        // -----    dec (hl)
  372.     move.l    AHL,a0
  373. decx:    if_rom(dec_xhl)
  374.     decr((a0))
  375.     m_next
  376.  
  377.  
  378.  
  379. // =====    ARITHMETICS / BOOLEAN ==============================
  380.  
  381. // ----------------------------------------------- add a,r    
  382. #define    adda(R)    add.b    R,a    ;\
  383.         move    ccr,f    ;\
  384.         m_next
  385.         
  386. xx128:    adda(RB)
  387. xx129:    adda(RC)    
  388. xx130:    adda(RD)
  389. xx131:    adda(RE)
  390. xx132:    adda(RH)
  391. xx133:    adda(RL)
  392. xx134:    more3;    movea.l    AHL,a0;    adda((a0))
  393. xx135:    adda(a)
  394.  
  395. // ----------------------------------------------- adc a,r    
  396. #define    adca(R)    move.b    R,d0    ;\
  397.         lsr.b    #1,f    ;\
  398.         cmp    d0,d0    ;\
  399.         addx.b    d0,a    ;\
  400.         move    ccr,f    ;\
  401.         m_next
  402.  
  403. xx136:    adca(RB)
  404. xx137:    adca(RC)
  405. xx138:    adca(RD)
  406. xx139:    adca(RE)
  407. xx140:    adca(RH)
  408. xx141:    adca(RL)
  409. xx142:    more3;    movea.l    AHL,a0;    adca((a0))
  410. xx143:    adca(a)
  411.  
  412. // ----------------------------------------------- sub a,r    
  413. #define    suba(R)    sub.b    R,a    ;\
  414.         move    ccr,f    ;\
  415.         m_next
  416.  
  417. xx144:    suba(RB)
  418. xx145:    suba(RC)
  419. xx146:    suba(RD)
  420. xx147:    suba(RE)
  421. xx148:    suba(RH)
  422. xx149:    suba(RL)
  423. xx150:    more3;    movea.l    AHL,a0;    suba((a0))
  424. xx151:    suba(a)
  425.  
  426. // ----------------------------------------------- sbc a,r    
  427. #define    sbca(R)    move.b    R,d0    ;\
  428.         lsr.b    #1,f    ;\
  429.         cmp    d0,d0    ;\
  430.         subx.b    d0,a    ;\
  431.         move    ccr,f    ;\
  432.         m_next
  433.  
  434. xx152:    sbca(RB)
  435. xx153:    sbca(RC)
  436. xx154:    sbca(RD)
  437. xx155:    sbca(RE)
  438. xx156:    sbca(RH)
  439. xx157:    sbca(RL)
  440. xx158:    more3;    movea.l    AHL,a0;    sbca((a0))
  441. xx159:    sbca(a)
  442.  
  443. // ------------------------------------------------- and a,r
  444. #define    anda(R)    and.b    R,a        ;\
  445.         move.b    (logflags,a.w),f    ;\
  446.         m_next
  447.  
  448. xx160:    anda(RB)
  449. xx161:    anda(RC)
  450. xx162:    anda(RD)
  451. xx163:    anda(RE)
  452. xx164:    anda(RH)
  453. xx165:    anda(RL)
  454. xx166:    more3;    movea.l    AHL,a0;    anda((a0))
  455. xx167:    move.b    (logflags,a.w),f
  456.     m_next
  457.  
  458. // ------------------------------------------------- xor a,r
  459. #define    xora(R)    move.b    R,d0        ;\
  460.         eor.b    d0,a        ;\
  461.         move.b    (logflags,a.w),f    ;\
  462.         m_next
  463.     
  464. xx168:    xora(RB)
  465. xx169:    xora(RC)
  466. xx170:    xora(RD)
  467. xx171:    xora(RE)
  468. xx172:    xora(RH)
  469. xx173:    xora(RL)
  470. xx174:    more3;    movea.l    AHL,a0;    xora((a0))
  471. xx175:    eor.b    a,a
  472.     move.b    #0x06,f        // SZPC = 0110
  473.     m_next
  474.  
  475. // ------------------------------------------------- or a,r
  476. #define    ora(R)    or.b    R,a        ;\
  477.         move.b    (logflags,a.w),f    ;\
  478.         m_next            ;\
  479.     
  480. xx176:    ora(RB)
  481. xx177:    ora(RC)
  482. xx178:    ora(RD)
  483. xx179:    ora(RE)
  484. xx180:    ora(RH)
  485. xx181:    ora(RL)
  486. xx182:    more3;    movea.l    AHL,a0;    ora((a0))
  487. xx183:    move.b    (logflags,a.w),f
  488.     m_next
  489.  
  490. // --------------------------------------------------- cp a,b
  491. #define    cpa(R)    cmp.b    R,a    ;\
  492.         move    ccr,f    ;\
  493.         m_next
  494.  
  495. xx184:    cpa(RB)
  496. xx185:    cpa(RC)
  497. xx186:    cpa(RD)
  498. xx187:    cpa(RE)
  499. xx188:    cpa(RH)
  500. xx189:    cpa(RL)
  501. xx190:    more3;    movea.l    AHL,a0;    cpa((a0))
  502. xx191:    move.b    #0x04,f
  503.     m_next
  504.  
  505. // --------------------------------------- immediate arguments
  506. xx198:    more3;    adda((ip)+)    // -----    add a,n
  507. xx206:    more3;    adca((ip)+)    // -----     adc a,n
  508. xx214:    more3;    suba((ip)+)    // -----    sub a,n
  509. xx222:    more3;    sbca((ip)+)    // -----    sbc a,n
  510. xx230:    more3;    anda((ip)+)    // -----    and a,n
  511. xx238:    more3;    xora((ip)+)    // -----    xor a,n
  512. xx246:    more3;    ora((ip)+)        // -----    or a,n
  513. xx254:    more3;    cpa((ip)+)        // -----    cp a,n
  514.  
  515.  
  516. // =====    SHIFT/ROTATE A ====================================
  517.  
  518. xx7:    bclr    #0,f    // -----    rlca
  519.     rol.b    #1,a
  520.     bcc    nxtcmnd
  521.     bset    #0,f
  522.     m_next
  523.     
  524. xx15:    bclr    #0,f    // ----- rrca
  525.     ror.b    #1,a
  526.     bcc    nxtcmnd
  527.     bset    #0,f
  528.     m_next
  529.  
  530. xx23:    roxr.b    #1,f    // -----    rla
  531.     roxl.b    #1,a
  532.     roxl.b    #1,f
  533.     m_next
  534.     
  535. xx31:    roxr.b    #1,f    // -----    rra
  536.     roxr.b    #1,a
  537.     roxl.b    #1,f
  538.     m_next
  539.  
  540.  
  541. // =====    WORD INSTRUCTIONS ==========================
  542.  
  543. xx3:    more2;    addq.w    #1,BC;    m_next    // -----    inc bc    
  544. xx11:    more2;    subq.w    #1,BC;    m_next    // -----     dec bc
  545. xx19:    more2;    addq.w    #1,DE;    m_next    // -----    inc de
  546. xx27:    more2;    subq.w    #1,DE;    m_next    // -----    dec de
  547. xx35:    more2;    addq.w    #1,HL;    m_next    // -----    inc hl
  548. xx43:    more2;    subq.w    #1,HL;    m_next    // -----    dec hl
  549. xx51:    more2;    addq.w    #1,rp;    m_next    // -----    inc sp    1.11.95
  550. xx59:    more2;    subq.w    #1,rp;    m_next    // -----    dec sp    1.11.95
  551.  
  552. xx1:    more6        // -----    ld bc,NN    
  553.     move.b    (ip)+,RC
  554.     move.b    (ip)+,RB
  555.     m_next
  556.     
  557. xx17:    more6        // ----- ld de,nn
  558.     move.b    (ip)+,RE
  559.     move.b    (ip)+,RD
  560.     m_next
  561.     
  562. xx33:    more6        // -----    ld hl,nn
  563.     move.b    (ip)+,RL
  564.     move.b    (ip)+,RH
  565.     m_next
  566.  
  567. xx49:    more6        // -----    ld sp,nn
  568.     move.w    (ip)+,core
  569.     rol.w    #8,core
  570.     movea.l    core,rp
  571.     bne    nxtcmnd
  572.     adda.l    #0x00010000,rp        // falls sp := ramend    korr. 6.3.95 kio
  573.     m_next
  574.  
  575. xx42:    more8        // -----    ld hl,(nn)
  576.     more4
  577.     move.w    (ip)+,core
  578.     rol.w    #8,core
  579.     movea.l    core,a0
  580.     move.b    (a0)+,RL
  581.     move.b    (a0),RH
  582.     m_next
  583.  
  584.  
  585.  
  586. xx9:    more7        // ----- add hl,bc
  587.     lsr.b    #1,f
  588.     move.w    BC,d0
  589.     add.w    d0,HL
  590.     roxl.b    #1,f
  591.     m_next
  592.     
  593. xx25:    more7        // -----    add hl,de
  594.     lsr.b    #1,f
  595.     move.w    DE,d0
  596.     add.w    d0,HL
  597.     roxl.b    #1,f
  598.     m_next
  599.     
  600. xx41:    more7        // -----    add hl,hl
  601.     ror.b    #1,f
  602.     lsl.w    HL
  603.     roxl.b    #1,f    
  604.     m_next
  605.     
  606. xx57:    more7        // -----    add hl,sp
  607.     lsr.b    #1,f
  608.     move.w    rp,d0
  609.     add.w    d0,HL
  610.     roxl.b    #1,f
  611.     m_next
  612.     
  613. #if rom_protection
  614. sto_hl:    move.w    HL,d0
  615.     bra    store_word
  616. #endif
  617.  
  618. ed_63:    more4        // -----    ld (nn),hl  (( ED instr. ))
  619. xx34:    more8        // -----    ld (nn),hl
  620.     more4
  621.     move.w    (ip)+,core
  622.     rol.w    #8,core
  623.     movea.l    core,a0
  624.     if_rom(sto_hl)
  625.     move.b    RL,(a0)+
  626.     move.b    RH,(a0)
  627.     m_next    
  628.     
  629.  
  630. // =====    PUSH, POP and EX ================================
  631.  
  632. xx193:    more6
  633.     move.b    (rp)+,RC    // -----    pop bc
  634.     move.b    (rp)+,RB
  635.     m_next
  636.     
  637. xx197:    more7
  638.     move.b    RB,-(rp)    // -----    push bc
  639.     move.b    RC,-(rp)
  640.     m_next
  641.     
  642. xx209:    more6
  643.     move.b    (rp)+,RE    // -----    pop de
  644.     move.b    (rp)+,RD
  645.     m_next
  646.  
  647. xx213:    more7
  648.     move.b    RD,-(rp)    // -----    push de
  649.     move.b    RE,-(rp)
  650.     m_next
  651.  
  652. xx225:    more6
  653.     move.b    (rp)+,RL    // -----    pop hl
  654.     move.b    (rp)+,RH
  655.     m_next
  656.     
  657. xx229:    more7
  658.     move.b    RH,-(rp)    // -----    push hl
  659.     move.b    RL,-(rp)
  660.     m_next
  661.         
  662. xx241:    more6
  663.     move.b    (rp)+,db        // -----    pop af
  664.     lea    m68flags,a0    //  A=hi;  F=lo  !!
  665.     move.b    (a0,db.l),f
  666.     move.b    (rp)+,a
  667.     m_next
  668.  
  669. xx245:    more7
  670.     move.b    a,-(rp)        // -----    push af
  671.     move.b    f,db        //  A=hi;  F=lo !!
  672.     lea    z80flags,a0
  673.     move.b    (a0,db.l),-(rp)    
  674.     m_next
  675.     
  676.  
  677. xx8:    swap    a        // -----    ex af,af'
  678.     swap    f
  679.     m_next
  680.     
  681. xx217:    move.w    BC,d0        // -----    exx
  682.     move.w    BC2,BC
  683.     move.w    d0,BC2
  684.     move.w    DE,d0
  685.     move.w    DE2,DE
  686.     move.w    d0,DE2
  687.     move.w    HL,d0
  688.     move.w    HL2,HL
  689.     move.w    d0,HL2
  690.     m_next
  691.  
  692. xx227:    more8
  693.     more7    
  694.     move.w    (rp)+,d0        // -----    ex (sp),hl
  695.     rol.w    #8,d0
  696.     move.b    RH,-(rp)
  697.     move.b    RL,-(rp)
  698.     move.w    d0,HL
  699.     m_next
  700.  
  701. xx235:    move.w    DE,d0        // -----    ex de,hl
  702.     move.w    HL,DE
  703.     move.w    d0,HL
  704.     m_next
  705.  
  706. xx249:    more2
  707.     move.w    HL,core        // -----    ld sp,hl
  708.     movea.l    core,rp
  709.     bne    nxtirpt
  710.     adda.l    #0x00010000,rp    // if sp==0  =>  sp:= ramend
  711.     m_next
  712.     
  713.  
  714. // =====    LOST & FOUND =======================================
  715.     
  716. xx47:    not.b    a;    m_next    // -----    cpl
  717. xx55:    bset    #0,f;    m_next    // -----    scf
  718. xx63:    bchg    #0,f;    m_next    // -----    ccf
  719.     
  720. xx118:    do_info_halt        // -----    halt
  721.     bra    exit_halt
  722.  
  723.  
  724. xx243:    do_info_di            // -----    di
  725.     clr.w    IFF1        // disable iff1 and iff2
  726.     m_next
  727.  
  728. xx251:    do_info_ei            // -----    ei
  729.     move.w    #0xFFFF,IFF1    // enable iff1 & iff2
  730.     bra    check_wuff    // !!! next instr should be performed first!
  731.  
  732. xx211:    // -----    out(N),a
  733.     more7
  734.     sto_cc
  735.     move.b    a,-(a7)        //  Do_Output ( (a<<8) + *ip++, a )
  736.     move.b    a,d0        //
  737.     asl.w    #8,d0        //
  738.     move.b    (ip)+,d0        //
  739.     move.w    d0,-(a7)        //
  740.     jsr    Do_Output        //
  741.     addq.l    #4,a7        //
  742.     load_rom_end
  743.     m_next
  744.     
  745. xx219:    // -----    in a,(N)        setzt keine Flags !
  746.     more7
  747.     sto_cc
  748.     move.b    a,d0        // a = Do_Input ( (a<<8) + *ip++ )
  749.     asl.w    #8,d0        //
  750.     move.b    (ip)+,d0        //
  751.     move.w    d0,-(a7)        //
  752.     jsr    Do_Input        //
  753.     addq.l    #2,a7        //
  754.     move.b    d0,a        //
  755.     load_rom_end
  756.     m_next
  757.  
  758.  
  759. // -----    END OF MAIN COMMAND DISPATCHER -------------------------------------------
  760.     
  761.  
  762. #undef    load
  763. #undef    ldxhl
  764. #undef    adda
  765. #undef    adca
  766. #undef    suba
  767. #undef    sbca
  768. #undef    anda
  769. #undef    ora
  770. #undef    xora
  771. #undef    cpa
  772. #undef    if_nz
  773. #undef    if_z
  774. #undef    if_nc
  775. #undef    if_c
  776. #undef    if_po
  777. #undef    if_pe
  778. #undef    if_p
  779. #undef    if_m
  780. #undef    get_pc
  781. #undef    push_pc
  782. #undef    jump
  783. #undef    ret
  784. #undef    rst
  785.  
  786.  
  787.     
  788.  
  789.  
  790.