static void rr_b( void ) { UINT16 t; int old_bit0; t = RDB; old_bit0 = t & 0x0001; t = t >> 1; CLR_NZC; if( old_bit0 ) { SETC; t |= 0x80; } SET_N8(t); SET_Z8(t); WRB(t); tms7000_icount -= 5; }
static void djnz_b( void ) { UINT16 t; t = RDB - 1; WRB( t ); CLR_NZC; SET_N8(t); SET_Z8(t); if( t != 0 ) { INT8 s; SIMMBYTE(s); pPC += s; tms7000_icount -= 7; } else { pPC++; tms7000_icount -= 2; } CHANGE_PC; }
static void mov_a2b( void ) { UINT16 t; t = RDA; WRB(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 6; }
static void mov_i2b( void ) { UINT16 t; IMMBYTE(t); WRB(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 7; }
static void pop_b( void ) { UINT16 t; PULLBYTE(t); WRB(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 6; }
static void mov_r2b( void ) { UINT8 r; UINT16 t; IMMBYTE(r); t = RM(r); WRB(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 8; }
static void inc_b( void ) { UINT16 t; t = RDB + 1; WRB( t ); CLR_NZC; SET_C8(t); SET_N8(t); SET_Z8(t); tms7000_icount -= 5; }
static void movp_p2b( void ) { UINT8 p; UINT16 t; IMMBYTE(p); t=RM(0x0100+p); WRB(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 8; }
static void xchb_a( void ) { UINT16 t,u; t = RDB; u = RDA; WRA(t); WRB(u); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 6; }
static void sub_ib( void ) { UINT16 t; UINT8 i; IMMBYTE(i); t = RDB - i; WRB(t); CLR_NZC; SET_C8(~t); SET_N8(t); SET_Z8(t); tms7000_icount -= 7; }
static void xor_i2b( void ) { UINT8 t; UINT8 v; IMMBYTE(v); t = v ^ RDB; WRB(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 7; }
static void sub_rb( void ) { UINT16 t; UINT8 r; IMMBYTE(r); t = RDB - RM(r); WRB(t); CLR_NZC; SET_C8(~t); SET_N8(t); SET_Z8(t); tms7000_icount -= 8; }
static void and_r2b( void ) { UINT8 t; UINT8 v; IMMBYTE(v); t = RM(v) & RDB; WRB(t); CLR_NZC; SET_N8(t); SET_Z8(t); tms7000_icount -= 8; }
static void sbb_ib( void ) { UINT16 t; UINT8 i; IMMBYTE(i); t = RDB - i - ((pSR & SR_C) ? 0 : 1); WRB(t); CLR_NZC; SET_C8(~t); SET_N8(t); SET_Z8(t); tms7000_icount -= 7; }
static void add_i2b( void ) { UINT16 t; UINT8 v; IMMBYTE(v); t = v + RDB; WRB(t); CLR_NZC; SET_C8(t); SET_N8(t); SET_Z8(t); tms7000_icount -= 7; }
static void adc_r2b( void ) { UINT16 t; UINT8 v; IMMBYTE(v); t = RM(v) + RDB + GET_C; WRB(t); CLR_NZC; SET_C8(t); SET_N8(t); SET_Z8(t); tms7000_icount -= 8; }
static void rl_b( void ) { UINT16 t; t = RDB << 1; CLR_NZC; SET_C8(t); if( pSR & SR_C ) t |= 0x01; SET_N8(t); SET_Z8(t); WRB(t); tms7000_icount -= 5; }
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 tms7000_reset(void) { // tms7000.architecture = (int)param; /*memory_install_read8_handler(cpu, ADDRESS_SPACE_PROGRAM, 0x0000, 0x007f, 0x0000, 0x0000, tms7000_internal_r); memory_install_write8_handler(cpu, ADDRESS_SPACE_PROGRAM, 0x0000, 0x007f, 0x0000, 0x0000, tms7000_internal_w); memory_install_read8_handler(cpu, ADDRESS_SPACE_PROGRAM, 0x0100, 0x01ff, 0x0000, 0x0000, tms70x0_pf_r); memory_install_write8_handler(cpu, ADDRESS_SPACE_PROGRAM, 0x0100, 0x01ff, 0x0000, 0x0000, tms70x0_pf_w);*/ tms7000.idle_state = 0; tms7000.irq_state[ TMS7000_IRQ1_LINE ] = CLEAR_LINE; tms7000.irq_state[ TMS7000_IRQ2_LINE ] = CLEAR_LINE; tms7000.irq_state[ TMS7000_IRQ3_LINE ] = CLEAR_LINE; WM( 0x100 + 9, 0 ); /* Data direction regs are cleared */ WM( 0x100 + 11, 0 ); // if( tms7000.architecture == TMS7000_NMOS ) // { WM( 0x100 + 4, 0xff ); /* Output 0xff on port A */ WM( 0x100 + 8, 0xff ); /* Output 0xff on port C */ WM( 0x100 + 10, 0xff ); /* Output 0xff on port D */ // } // else // { // WM( 0x100 + 4, 0xff ); /* Output 0xff on port A */ // } pSP = 0x01; /* Set stack pointer to r1 */ pSR = 0x00; /* Clear status register (disabling interrupts */ WM( 0x100 + 0, 0 ); /* Write a zero to IOCNT0 */ /* On TMS70x2 and TMS70Cx2 IOCNT1 is zero */ WRA( tms7000.pc.b.h ); /* Write previous PC to A:B */ WRB( tms7000.pc.b.l ); pPC = RM16(0xfffe); /* Load reset vector */ CHANGE_PC; tms7000_div_by_16_trigger = -16; }
static void swap_b( void ) { UINT8 a,b; UINT16 t; a = b = RDB; a <<= 4; b >>= 4; t = a+b; WRB(t); CLR_NZC; pSR|=((t&0x0001)<<7); SET_N8(t); SET_Z8(t); tms7000_icount -=8; }
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 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 rlc_b( void ) { UINT16 t; int old_carry; old_carry = (pSR & SR_C); t = RDB << 1; CLR_NZC; SET_C8(t); if( old_carry ) t |= 0x01; SET_N8(t); SET_Z8(t); WRB(t); tms7000_icount -= 5; }
static void rrc_b( void ) { UINT16 t; int old_bit0; t = RDB; old_bit0 = t & 0x0001; /* Place carry bit in 9th position */ t |= ((pSR & SR_C) << 1); t = t >> 1; CLR_NZC; if( old_bit0 ) SETC; SET_N8(t); SET_Z8(t); WRB(t); tms7000_icount -= 5; }
static void clr_b( void ) { WRB(0); tms7000_icount -= 5; }
static void stsp( void ) { WRB(pSP); tms7000_icount -= 6; }