static void dec_r( void ) { UINT16 t; UINT8 r; IMMBYTE(r); t = RM(r) - 1; WM( r, t ); CLR_NZC; SET_N8(t); SET_Z8(t); SET_C8(~t); tms7000_icount -= 7; }
static void decd_r( void ) { UINT8 r; PAIR t; IMMBYTE(r); t.w.h = 0; t.w.l = RRF16(r); t.d -= 1; WRF16(r,t); CLR_NZC; SET_N8(t.b.h); SET_Z8(t.b.h); SET_C16(~(t.d)); tms7000_icount -= 11; }
static void cmp_ib( void ) { UINT16 t; UINT8 i; IMMBYTE(i); t = RDB - i; CLR_NZC; SET_N8(t); SET_Z8(t); if( t==0 ) SETC; else SET_C8( ~t ); tms7000_icount -= 7; }
static void cmp_rb( void ) { UINT16 t; UINT8 r; IMMBYTE(r); t = RDB - RM(r); CLR_NZC; SET_N8(t); SET_Z8(t); if( t==0 ) SETC; else SET_C8( ~t ); tms7000_icount -= 8; }
static void xchb_r( void ) { UINT16 t,u; UINT8 r; IMMBYTE(r); t = RDB; u = RM(r); WRA(t); WRB(u); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 8; }
static void rl_r( void ) { UINT16 t; UINT8 r; IMMBYTE(r); t = RM(r) << 1; CLR_NZC; SET_C8(t); if( pSR & SR_C ) t |= 0x01; SET_N8(t); SET_Z8(t); WM(r,t); tms7000_icount -= 7; }
static void dsb_i2b( void ) { UINT8 i; UINT16 t; IMMBYTE(i); t = bcd_sub( RDB, i ); if( !(pSR & SR_C) ) t = bcd_sub( t, 1 ); WRB(t); CLR_NZC; SET_C8(~t); SET_N8(t); SET_Z8(t); tms7000_icount -= 9; }
static void dsb_r2b( void ) { UINT8 r; UINT16 t; IMMBYTE(r); t = bcd_sub( RDB, RM(r) ); if( !(pSR & SR_C) ) t = bcd_sub( t, 1 ); WRB(t); CLR_NZC; SET_C8(~t); SET_N8(t); SET_Z8(t); tms7000_icount -= 10; }
static void dac_i2b( void ) { UINT8 i; UINT16 t; IMMBYTE(i); t = bcd_add( i, RDB ); if (pSR & SR_C) t = bcd_add( t, 1 ); WRB(t); CLR_NZC; SET_C8(t); SET_N8(t); SET_Z8(t); tms7000_icount -= 9; }
static void dac_r2a( void ) { UINT8 r; UINT16 t; IMMBYTE(r); t = bcd_add( RDA, RM(r) ); if (pSR & SR_C) t = bcd_add( t, 1 ); WRA(t); CLR_NZC; SET_C8(t); SET_N8(t); SET_Z8(t); tms7000_icount -= 10; }
static void cmpa_ind( void ) { UINT16 t; PAIR p; INT8 i; IMMBYTE(i); p.w.l = RRF16(i); t = RDA - RM(p.w.l); CLR_NZC; SET_N8(t); SET_Z8(t); if( t==0 ) SETC; else SET_C8( ~t ); tms7000_icount -= 11; }
static void swap_r_exl( void ) { UINT8 a,b,r; UINT16 t; IMMBYTE(r); if (r == 0) { /* opcode D7 00 (LVDP) mostly equivalent to MOVP P46,A??? (timings must be different, possibly the microcode polls the state of the VDP RDY line prior to doing the transfer) */ t=RM(0x012e); WRA(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 9; /* ?????? */ } else { /* stright swap Rn instruction */ a = b = RM(r); a <<= 4; b >>= 4; t = a+b; WM(r,t); CLR_NZC; pSR|=((t&0x0001)<<7); SET_N8(t); SET_Z8(t); tms7000_icount -=8; } }
static void swap_r( void ) { UINT8 a,b,r; UINT16 t; IMMBYTE(r); a = b = RM(r); a <<= 4; b >>= 4; t = a+b; WM(r,t); CLR_NZC; pSR|=((t&0x0001)<<7); SET_N8(t); SET_Z8(t); tms7000_icount -=8; }
static void rlc_r( void ) { UINT16 t; UINT8 r; int old_carry; old_carry = (pSR & SR_C); IMMBYTE(r); t = RM(r) << 1; CLR_NZC; SET_C8(t); if( old_carry ) t |= 0x01; SET_N8(t); SET_Z8(t); WM(r,t); tms7000_icount -= 7; }
/* $ca ORB immediate -**0- */ INLINE void orb_im( void ) { UINT8 t; IMMBYTE(t); B |= t; CLR_NZV; SET_NZ8(B); }
/* $c5 BITB immediate -**0- */ INLINE void bitb_im( void ) { UINT8 t,r; IMMBYTE(t); r = B&t; CLR_NZV; SET_NZ8(r); }
/* $c6 LDB immediate -**0- */ INLINE void ldb_im( void ) { IMMBYTE(B); CLR_NZV; SET_NZ8(B); }
/* $c1 CMPB immediate ?**** */ INLINE void cmpb_im( void ) { UINT16 t,r; IMMBYTE(t); r = B-t; CLR_NZVC; SET_FLAGS8(B,t,r); }
/* $c4 ANDB immediate -**0- */ INLINE void andb_im( void ) { UINT8 t; IMMBYTE(t); B &= t; CLR_NZV; SET_NZ8(B); }
/* $86 LDA immediate -**0- */ INLINE void lda_im( void ) { IMMBYTE(A); CLR_NZV; SET_NZ8(A); }
/* $8a ORA immediate -**0- */ INLINE void ora_im( void ) { UINT8 t; IMMBYTE(t); A |= t; CLR_NZV; SET_NZ8(A); }
/* $84 ANDA immediate -**0- */ INLINE void anda_im( void ) { UINT8 t; IMMBYTE(t); A &= t; CLR_NZV; SET_NZ8(A); }
/* $81 CMPA immediate ?**** */ INLINE void cmpa_im( void ) { UINT16 t,r; IMMBYTE(t); r = A-t; CLR_NZVC; SET_FLAGS8(A,t,r); }
/* $c8 EORB immediate -**0- */ M6800_INLINE void eorb_im( void ) { UINT8 t; IMMBYTE(t); B ^= t; CLR_NZV; SET_NZ8(B); }
/* $21 BRN relative ----- */ INLINE void brn( void ) { UINT8 t; IMMBYTE(t); }
/* $88 EORA immediate -**0- */ M6800_INLINE void eora_im( void ) { UINT8 t; IMMBYTE(t); A ^= t; CLR_NZV; SET_NZ8(A); }
INLINE void fetch_effective_address( void ) { UINT8 postbyte = ROP_ARG(PCD); PC++; switch(postbyte) { case 0x00: EA=X; break; case 0x01: EA=X+1; break; case 0x02: EA=X+2; break; case 0x03: EA=X+3; break; case 0x04: EA=X+4; break; case 0x05: EA=X+5; break; case 0x06: EA=X+6; break; case 0x07: EA=X+7; break; case 0x08: EA=X+8; break; case 0x09: EA=X+9; break; case 0x0a: EA=X+10; break; case 0x0b: EA=X+11; break; case 0x0c: EA=X+12; break; case 0x0d: EA=X+13; break; case 0x0e: EA=X+14; break; case 0x0f: EA=X+15; break; case 0x10: EA=X-16; break; case 0x11: EA=X-15; break; case 0x12: EA=X-14; break; case 0x13: EA=X-13; break; case 0x14: EA=X-12; break; case 0x15: EA=X-11; break; case 0x16: EA=X-10; break; case 0x17: EA=X-9; break; case 0x18: EA=X-8; break; case 0x19: EA=X-7; break; case 0x1a: EA=X-6; break; case 0x1b: EA=X-5; break; case 0x1c: EA=X-4; break; case 0x1d: EA=X-3; break; case 0x1e: EA=X-2; break; case 0x1f: EA=X-1; break; case 0x20: EA=Y; break; case 0x21: EA=Y+1; break; case 0x22: EA=Y+2; break; case 0x23: EA=Y+3; break; case 0x24: EA=Y+4; break; case 0x25: EA=Y+5; break; case 0x26: EA=Y+6; break; case 0x27: EA=Y+7; break; case 0x28: EA=Y+8; break; case 0x29: EA=Y+9; break; case 0x2a: EA=Y+10; break; case 0x2b: EA=Y+11; break; case 0x2c: EA=Y+12; break; case 0x2d: EA=Y+13; break; case 0x2e: EA=Y+14; break; case 0x2f: EA=Y+15; break; case 0x30: EA=Y-16; break; case 0x31: EA=Y-15; break; case 0x32: EA=Y-14; break; case 0x33: EA=Y-13; break; case 0x34: EA=Y-12; break; case 0x35: EA=Y-11; break; case 0x36: EA=Y-10; break; case 0x37: EA=Y-9; break; case 0x38: EA=Y-8; break; case 0x39: EA=Y-7; break; case 0x3a: EA=Y-6; break; case 0x3b: EA=Y-5; break; case 0x3c: EA=Y-4; break; case 0x3d: EA=Y-3; break; case 0x3e: EA=Y-2; break; case 0x3f: EA=Y-1; break; case 0x40: EA=U; break; case 0x41: EA=U+1; break; case 0x42: EA=U+2; break; case 0x43: EA=U+3; break; case 0x44: EA=U+4; break; case 0x45: EA=U+5; break; case 0x46: EA=U+6; break; case 0x47: EA=U+7; break; case 0x48: EA=U+8; break; case 0x49: EA=U+9; break; case 0x4a: EA=U+10; break; case 0x4b: EA=U+11; break; case 0x4c: EA=U+12; break; case 0x4d: EA=U+13; break; case 0x4e: EA=U+14; break; case 0x4f: EA=U+15; break; case 0x50: EA=U-16; break; case 0x51: EA=U-15; break; case 0x52: EA=U-14; break; case 0x53: EA=U-13; break; case 0x54: EA=U-12; break; case 0x55: EA=U-11; break; case 0x56: EA=U-10; break; case 0x57: EA=U-9; break; case 0x58: EA=U-8; break; case 0x59: EA=U-7; break; case 0x5a: EA=U-6; break; case 0x5b: EA=U-5; break; case 0x5c: EA=U-4; break; case 0x5d: EA=U-3; break; case 0x5e: EA=U-2; break; case 0x5f: EA=U-1; break; case 0x60: EA=S; break; case 0x61: EA=S+1; break; case 0x62: EA=S+2; break; case 0x63: EA=S+3; break; case 0x64: EA=S+4; break; case 0x65: EA=S+5; break; case 0x66: EA=S+6; break; case 0x67: EA=S+7; break; case 0x68: EA=S+8; break; case 0x69: EA=S+9; break; case 0x6a: EA=S+10; break; case 0x6b: EA=S+11; break; case 0x6c: EA=S+12; break; case 0x6d: EA=S+13; break; case 0x6e: EA=S+14; break; case 0x6f: EA=S+15; break; case 0x70: EA=S-16; break; case 0x71: EA=S-15; break; case 0x72: EA=S-14; break; case 0x73: EA=S-13; break; case 0x74: EA=S-12; break; case 0x75: EA=S-11; break; case 0x76: EA=S-10; break; case 0x77: EA=S-9; break; case 0x78: EA=S-8; break; case 0x79: EA=S-7; break; case 0x7a: EA=S-6; break; case 0x7b: EA=S-5; break; case 0x7c: EA=S-4; break; case 0x7d: EA=S-3; break; case 0x7e: EA=S-2; break; case 0x7f: EA=S-1; break; case 0x80: EA=X; X++; break; case 0x81: EA=X; X+=2; break; case 0x82: X--; EA=X; break; case 0x83: X-=2; EA=X; break; case 0x84: EA=X; break; case 0x85: EA=X+SIGNED(B); break; case 0x86: EA=X+SIGNED(A); break; case 0x87: EA=X+SIGNED(E); break; case 0x88: IMMBYTE(EA); EA=X+SIGNED(EA); break; case 0x89: IMMWORD(ea); EA+=X; break; case 0x8a: EA=X+SIGNED(F); break; case 0x8b: EA=X+D; break; case 0x8c: IMMBYTE(EA); EA=PC+SIGNED(EA); break; case 0x8d: IMMWORD(ea); EA+=PC; break; case 0x8e: EA=X+W; break; case 0x8f: EA=W; break; case 0x90: EA=W; EAD=RM16(EAD); break; case 0x91: EA=X; X+=2; EAD=RM16(EAD); break; case 0x92: IIError(); break; case 0x93: X-=2; EA=X; EAD=RM16(EAD); break; case 0x94: EA=X; EAD=RM16(EAD); break; case 0x95: EA=X+SIGNED(B); EAD=RM16(EAD); break; case 0x96: EA=X+SIGNED(A); EAD=RM16(EAD); break; case 0x97: EA=X+SIGNED(E); EAD=RM16(EAD); break; case 0x98: IMMBYTE(EA); EA=X+SIGNED(EA); EAD=RM16(EAD); break; case 0x99: IMMWORD(ea); EA+=X; EAD=RM16(EAD); break; case 0x9a: EA=X+SIGNED(F); EAD=RM16(EAD); break; case 0x9b: EA=X+D; EAD=RM16(EAD); break; case 0x9c: IMMBYTE(EA); EA=PC+SIGNED(EA); EAD=RM16(EAD); break; case 0x9d: IMMWORD(ea); EA+=PC; EAD=RM16(EAD); break; case 0x9e: EA=X+W; EAD=RM16(EAD); break; case 0x9f: IMMWORD(ea); EAD=RM16(EAD); break; case 0xa0: EA=Y; Y++; break; case 0xa1: EA=Y; Y+=2; break; case 0xa2: Y--; EA=Y; break; case 0xa3: Y-=2; EA=Y; break; case 0xa4: EA=Y; break; case 0xa5: EA=Y+SIGNED(B); break; case 0xa6: EA=Y+SIGNED(A); break; case 0xa7: EA=Y+SIGNED(E); break; case 0xa8: IMMBYTE(EA); EA=Y+SIGNED(EA); break; case 0xa9: IMMWORD(ea); EA+=Y; break; case 0xaa: EA=Y+SIGNED(F); break; case 0xab: EA=Y+D; break; case 0xac: IMMBYTE(EA); EA=PC+SIGNED(EA); break; case 0xad: IMMWORD(ea); EA+=PC; break; case 0xae: EA=Y+W; break; case 0xaf: IMMWORD(ea); EA+=W; break; case 0xb0: IMMWORD(ea); EA+=W; EAD=RM16(EAD); break; case 0xb1: EA=Y; Y+=2; EAD=RM16(EAD); break; case 0xb2: IIError(); break; case 0xb3: Y-=2; EA=Y; EAD=RM16(EAD); break; case 0xb4: EA=Y; EAD=RM16(EAD); break; case 0xb5: EA=Y+SIGNED(B); EAD=RM16(EAD); break; case 0xb6: EA=Y+SIGNED(A); EAD=RM16(EAD); break; case 0xb7: EA=Y+SIGNED(E); EAD=RM16(EAD); break; case 0xb8: IMMBYTE(EA); EA=Y+SIGNED(EA); EAD=RM16(EAD); break; case 0xb9: IMMWORD(ea); EA+=Y; EAD=RM16(EAD); break; case 0xba: EA=Y+SIGNED(F); EAD=RM16(EAD); break; case 0xbb: EA=Y+D; EAD=RM16(EAD); break; case 0xbc: IMMBYTE(EA); EA=PC+SIGNED(EA); EAD=RM16(EAD); break; case 0xbd: IMMWORD(ea); EA+=PC; EAD=RM16(EAD); break; case 0xbe: EA=Y+W; EAD=RM16(EAD); break; case 0xbf: IIError(); break; case 0xc0: EA=U; U++; break; case 0xc1: EA=U; U+=2; break; case 0xc2: U--; EA=U; break; case 0xc3: U-=2; EA=U; break; case 0xc4: EA=U; break; case 0xc5: EA=U+SIGNED(B); break; case 0xc6: EA=U+SIGNED(A); break; case 0xc7: EA=U+SIGNED(E); break; case 0xc8: IMMBYTE(EA); EA=U+SIGNED(EA); break; case 0xc9: IMMWORD(ea); EA+=U; break; case 0xca: EA=U+SIGNED(F); break; case 0xcb: EA=U+D; break; case 0xcc: IMMBYTE(EA); EA=PC+SIGNED(EA); break; case 0xcd: IMMWORD(ea); EA+=PC; break; case 0xce: EA=U+W; break; case 0xcf: EA=W; W+=2; break; case 0xd0: EA=W; W+=2; EAD=RM16(EAD); break; case 0xd1: EA=U; U+=2; EAD=RM16(EAD); break; case 0xd2: IIError(); break; case 0xd3: U-=2; EA=U; EAD=RM16(EAD); break; case 0xd4: EA=U; EAD=RM16(EAD); break; case 0xd5: EA=U+SIGNED(B); EAD=RM16(EAD); break; case 0xd6: EA=U+SIGNED(A); EAD=RM16(EAD); break; case 0xd7: EA=U+SIGNED(E); EAD=RM16(EAD); break; case 0xd8: IMMBYTE(EA); EA=U+SIGNED(EA); EAD=RM16(EAD); break; case 0xd9: IMMWORD(ea); EA+=U; EAD=RM16(EAD); break; case 0xda: EA=U+SIGNED(F); EAD=RM16(EAD); break; case 0xdb: EA=U+D; EAD=RM16(EAD); break; case 0xdc: IMMBYTE(EA); EA=PC+SIGNED(EA); EAD=RM16(EAD); break; case 0xdd: IMMWORD(ea); EA+=PC; EAD=RM16(EAD); break; case 0xde: EA=U+W; EAD=RM16(EAD); break; case 0xdf: IIError(); break; case 0xe0: EA=S; S++; break; case 0xe1: EA=S; S+=2; break; case 0xe2: S--; EA=S; break; case 0xe3: S-=2; EA=S; break; case 0xe4: EA=S; break; case 0xe5: EA=S+SIGNED(B); break; case 0xe6: EA=S+SIGNED(A); break; case 0xe7: EA=S+SIGNED(E); break; case 0xe8: IMMBYTE(EA); EA=S+SIGNED(EA); break; case 0xe9: IMMWORD(ea); EA+=S; break; case 0xea: EA=S+SIGNED(F); break; case 0xeb: EA=S+D; break; case 0xec: IMMBYTE(EA); EA=PC+SIGNED(EA); break; case 0xed: IMMWORD(ea); EA+=PC; break; case 0xee: EA=S+W; break; case 0xef: W-=2; EA=W; break; case 0xf0: W-=2; EA=W; EAD=RM16(EAD); break; case 0xf1: EA=S; S+=2; EAD=RM16(EAD); break; case 0xf2: IIError(); break; case 0xf3: S-=2; EA=S; EAD=RM16(EAD); break; case 0xf4: EA=S; EAD=RM16(EAD); break; case 0xf5: EA=S+SIGNED(B); EAD=RM16(EAD); break; case 0xf6: EA=S+SIGNED(A); EAD=RM16(EAD); break; case 0xf7: EA=S+SIGNED(E); EAD=RM16(EAD); break; case 0xf8: IMMBYTE(EA); EA=S+SIGNED(EA); EAD=RM16(EAD); break; case 0xf9: IMMWORD(ea); EA+=S; EAD=RM16(EAD); break; case 0xfa: EA=S+SIGNED(F); EAD=RM16(EAD); break; case 0xfb: EA=S+D; EAD=RM16(EAD); break; case 0xfc: IMMBYTE(EA); EA=PC+SIGNED(EA); EAD=RM16(EAD); break; case 0xfd: IMMWORD(ea); EA+=PC; EAD=RM16(EAD); break; case 0xfe: EA=S+W; EAD=RM16(EAD); break; case 0xff: IIError(); break; } hd6309_ICount -= index_cycle[postbyte]; }
/* $85 BITA immediate -**0- */ M6800_INLINE void bita_im( void ) { UINT8 t,r; IMMBYTE(t); r = A&t; CLR_NZV; SET_NZ8(r); }