;	WinSTon

;	SUB <ea>,Dn
;	SUB Dn,<ea>

;	XNZVC
;	*****

PUBLIC _sub_ea_dn_byte
PUBLIC _sub_ea_dn_word
PUBLIC _sub_ea_dn_long
PUBLIC _sub_dn_ea_byte
PUBLIC _sub_dn_ea_word
PUBLIC _sub_dn_ea_long

;-----------------------------------------------------------------------
;SUB.B <ea>,Dn
_sub_ea_dn_byte PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		al,al									;Clear NZVC(ignore X)
	mov		edx,DECODE_2[ecx]						;DReg
	sub		[edx],bl								;Dest Dn
	SET_NZV_CX_SAME
_sub_ea_dn_byte ENDP

;SUB.W <ea>,Dn
_sub_ea_dn_word PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		al,al									;Clear NZVC(ignore X)
	mov		edx,DECODE_2[ecx]						;DReg
	sub		[edx],bx								;Dest Dn
	SET_NZV_CX_SAME
_sub_ea_dn_word ENDP

;SUB.L <ea>,Dn
_sub_ea_dn_long PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		al,al									;Clear NZVC(ignore X)
	mov		edx,DECODE_2[ecx]						;DReg
	sub		[edx],ebx								;Dest Dn
	SET_NZV_CX_SAME
_sub_ea_dn_long ENDP

;-----------------------------------------------------------------------
;SUB.B Dn,<ea>
_sub_dn_ea_byte PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		al,al									;Clear NZVC(ignore X)
	mov		edx,DECODE_2[ecx]						;DReg
	sub		bl,[edx]								;Src Dn
	WRITE_BYTE_NZV_CX_SAME
_sub_dn_ea_byte ENDP

;SUB.W Dn,<ea>
_sub_dn_ea_word PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		al,al									;Clear NZVC(ignore X)
	mov		edx,DECODE_2[ecx]						;DReg
	sub		bx,[edx]								;Src Dn
	WRITE_WORD_NZV_CX_SAME
_sub_dn_ea_word ENDP

;SUB.L Dn,<ea>
_sub_dn_ea_long PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		al,al									;Clear NZVC(ignore X)
	mov		edx,DECODE_2[ecx]						;DReg
	sub		ebx,[edx]								;Src Dn
	WRITE_LONG_NZV_CX_SAME
_sub_dn_ea_long ENDP
