FreeBSD/sys/contrib/x86emu/x86emu.c
/*
 * REMARKS:
 * Implements the SUB instruction and side effects.
 */
Implements the SUB instruction and side effects.
Implements the SUB instruction and side effects .
static uint8_t 
sub_byte(struct x86emu *emu, uint8_t d, uint8_t s)
{
	uint32_t res;	
	uint32_t bc;
	res = d - s;
	CONDITIONAL_SET_FLAG(res & 0x80, F_SF);
	CONDITIONAL_SET_FLAG((res & 0xff) == 0, F_ZF);
	CONDITIONAL_SET_FLAG(PARITY(res & 0xff), F_PF);
	bc = (res & (~d | s)) | (~d & s);
	CONDITIONAL_SET_FLAG(bc & 0x80, F_CF);
	CONDITIONAL_SET_FLAG(XOR2(bc >> 6), F_OF);
	CONDITIONAL_SET_FLAG(bc & 0x8, F_AF);
	return (uint8_t) res;
}
static uint8_t sub_byte ( struct x86emu * emu , uint8_t d , uint8_t s ) { uint32_t res ; uint32_t bc ; res = d - s ; CONDITIONAL_SET_FLAG ( res & 0x80 , F_SF ) ; CONDITIONAL_SET_FLAG ( ( res & 0xff ) == 0 , F_ZF ) ; CONDITIONAL_SET_FLAG ( PARITY ( res & 0xff ) , F_PF ) ; bc = ( res & ( ~ d | s ) ) | ( ~ d & s ) ; CONDITIONAL_SET_FLAG ( bc & 0x80 , F_CF ) ; CONDITIONAL_SET_FLAG ( XOR2 ( bc >> 6 ) , F_OF ) ; CONDITIONAL_SET_FLAG ( bc & 0x8 , F_AF ) ; return ( uint8_t ) res ; }
REMARKS:
 Implements the SUB instruction and side effects.
REMARKS : Implements the SUB instruction and side effects .
/* all operands in native machine order */ /* calculate the borrow chain.  See note at top */