public void SBC(int tmp)
    {            
            if ((m6502.p & F_D)	!=0)											
            {															
            int c = (m6502.p & F_C) ^ F_C;									
            int sum = m6502.a - tmp - c;										
            int lo = (m6502.a & 0x0f) - (tmp & 0x0f) - c; 					
            int hi = (m6502.a & 0xf0) - (tmp & 0xf0); 						
                    m6502.p = (m6502.p & ~(F_V | F_C))&0xFF;										
                    if (((m6502.a^tmp) & (m6502.a^sum) & F_N)!=0)							
                            m6502.p |= F_V;											
                    if ((lo & 0xf0)!=0)											
                            lo -= 6;											
                    if ((lo & 0x80)!=0)											
                            hi -= 0x10; 										
                    if ((hi & 0x0f00)!=0)										
                            hi -= 0x60; 										
                    if ((sum & 0xff00) == 0)								
                            m6502.p |= F_C;											
                    m6502.a = (lo & 0x0f) + (hi & 0xf0);							
            }															
            else														
            {															
            int c = (m6502.p & F_C) ^ F_C;									
            int sum = m6502.a - tmp - c;										
                    m6502.p = (m6502.p & ~(F_V | F_C))&0xFF;										
                    if (((m6502.a^tmp) & (m6502.a^sum) & F_N)!=0)						
                            m6502.p |= F_V;											
                    if ((sum & 0xff00) == 0)								
                            m6502.p |= F_C;											
                    m6502.a = sum & 0xFF;										
            }															
            SET_NZ(m6502.a);
        }