Example #1
0
/* $19 DAA inherent (A) -**0* */
INLINE void daa( void )
{
	UINT8 msn, lsn;
	UINT16 t, cf = 0;
	msn=A & 0xf0; lsn=A & 0x0f;
	if( lsn>0x09 || CC&0x20 ) cf |= 0x06;
	if( msn>0x80 && lsn>0x09 ) cf |= 0x60;
	if( msn>0x90 || CC&0x01 ) cf |= 0x60;
	t = cf + A;
	CLR_NZV; /* keep carry from previous operation */
	SET_NZ8((UINT8)t); SET_C8(t);
	A = t;
}
Example #2
0
static void sub_ba( void )
{
	UINT16	t;

	t = RDA - RDB;
	WRA(t);

	CLR_NZC;
	SET_C8(~t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 5;
}
Example #3
0
static void sbb_ba( void )
{
	UINT16	t;

	t = RDA - RDB - ((pSR & SR_C) ? 0 : 1);
	WRA(t);

	CLR_NZC;
	SET_C8(~t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 5;
}
Example #4
0
static void adc_b2a( void )
{
	UINT16	t;

	t = RDA + RDB + GET_C;
	WRA(t);

	CLR_NZC;
	SET_C8(t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 5;
}
Example #5
0
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;
}
Example #6
0
static void dec_a( void )
{
	UINT16 t;

	t = RDA - 1;

	WRA( t );

	CLR_NZC;
	SET_N8(t);
	SET_Z8(t);
	SET_C8(~t);

	tms7000_icount -= 5;
}
Example #7
0
static void sbb_ra( void )
{
	UINT16	t;
	UINT8	r;

	IMMBYTE(r);
	t = RDA - RM(r) - ((pSR & SR_C) ? 0 : 1);
	WRA(t);

	CLR_NZC;
	SET_C8(~t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 8;
}
Example #8
0
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;
}
Example #9
0
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;
}
Example #10
0
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;
}
Example #11
0
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;
}
Example #12
0
static void add_r2a( void )
{
	UINT16	t;
	UINT8	v;

	IMMBYTE(v);

	t = RM(v) + RDA;
	WRA(t);

	CLR_NZC;
	SET_C8(t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 8;
}
Example #13
0
static void cmp_ba( void )
{
	UINT16 t;

	t = RDA - RDB;

	CLR_NZC;
	SET_N8(t);
	SET_Z8(t);

	if( t==0 )
		SETC;
	else
		SET_C8( ~t );

	tms7000_icount -= 5;
}
Example #14
0
static void sub_ir( void )
{
	UINT16	t;
	UINT8	r,i;

	IMMBYTE(i);
	IMMBYTE(r);
	t = RM(r) - i;
	WM(r,t);

	CLR_NZC;
	SET_C8(~t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 9;
}
Example #15
0
static void sub_rr( void )
{
	UINT16	t;
	UINT8	r,s;

	IMMBYTE(s);
	IMMBYTE(r);
	t = RM(r) - RM(s);
	WM(r,t);

	CLR_NZC;
	SET_C8(~t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 10;
}
Example #16
0
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;
}
Example #17
0
static void adc_i2a( void )
{
	UINT16	t;
	UINT8	v;

	IMMBYTE(v);

	t = v + RDA + GET_C;
	WRA(t);

	CLR_NZC;
	SET_C8(t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 7;
}
Example #18
0
static void sbb_ir( void )
{
	UINT16	t;
	UINT8	r,i;

	IMMBYTE(i);
	IMMBYTE(r);
	t = RM(r) - i - ((pSR & SR_C) ? 0 : 1);
	WM(r,t);

	CLR_NZC;
	SET_C8(~t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 9;
}
Example #19
0
static void adc_r2r( void )
{
	UINT16	t;
	UINT8	i,j;

	IMMBYTE(i);
	IMMBYTE(j);

	t = RM(i)+RM(j) + GET_C;
	WM(j,t);

	CLR_NZC;
	SET_C8(t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 10;
}
Example #20
0
static void dac_b2a( void )
{
	UINT16	t;

	t = bcd_add( RDA, RDB );

	if (pSR & SR_C)
		t = bcd_add( t, 1 );

	WRA(t);

	CLR_NZC;
	SET_C8(t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 7;
}
Example #21
0
static void dsb_b2a( void )
{
	UINT16	t;

	t = bcd_sub( RDA, RDB );

	if( !(pSR & SR_C) )
		t = bcd_sub( t, 1 );

	WRA(t);

	CLR_NZC;
	SET_C8(~t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 7;
}
Example #22
0
static void inc_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;
}
Example #23
0
static void add_i2r( void )
{
	UINT16	t;
	UINT8	i,j;

	IMMBYTE(i);
	IMMBYTE(j);

	t = i+RM(j);
	WM(j,t);

	CLR_NZC;
	SET_C8(t);
	SET_N8(t);
	SET_Z8(t);

	tms7000_icount -= 9;
}
Example #24
0
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;
}
Example #25
0
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;
}
Example #26
0
static void cmpa_inx( void )
{
	UINT16	t;
	PAIR	i;

	IMMWORD( i );
	t = RDA - RM(i.w.l + RDB);

	CLR_NZC;
	SET_N8(t);
	SET_Z8(t);

	if( t==0 )
		SETC;
	else
		SET_C8( ~t );

	tms7000_icount -= 14;
}
Example #27
0
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;
}
Example #28
0
void daa()
{
  uint8_t m, l;
  uint16_t t, cf = 0;

  m = ra & 0xf0;
  l = ra & 0x0f;
  if (l > 0x09 || cch )
    cf |= 0x06;
  if (m > 0x80 && l > 0x09 )
    cf |= 0x60;
  if (m > 0x90 || ccc )
    cf |= 0x60;
  t = cf + ra;
  SET_NZ8((uint8_t)t);
  SET_C8(t);
  PUT_V;
  ccv = 0;
  ra = (uint8_t)t;
}
Example #29
0
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;
}
Example #30
0
static void cmp_ir( void )
{
	UINT16	t;
	UINT8	i,r;

	IMMBYTE(i);
	IMMBYTE(r);
	t = RM(r) - i;

	CLR_NZC;
	SET_N8(t);
	SET_Z8(t);

	if( t==0 )
		SETC;
	else
		SET_C8( ~t );

	tms7000_icount -= 9;
}