;	WinSTon

;	NEG Dn
;	NEG <ea>

;	XNZVC
;	*****

PUBLIC _neg_dn_byte
PUBLIC _neg_dn_word
PUBLIC _neg_dn_long
PUBLIC _neg_ea_byte
PUBLIC _neg_ea_word
PUBLIC _neg_ea_long

;-----------------------------------------------------------------------
;NEG.B Dn
_neg_dn_byte PROC NEAR
	xor		bl,bl
	mov		edx,DECODE_1[ecx]						;DReg
	sub		bl,[edx]								;0-Dn
	mov		[edx],bl
	SET_NZV_CX_SAME
_neg_dn_byte ENDP

;NEG.W Dn
_neg_dn_word PROC NEAR
	xor		bx,bx
	mov		edx,DECODE_1[ecx]						;DReg
	sub		bx,[edx]								;0-Dn
	mov		[edx],bx
	SET_NZV_CX_SAME
_neg_dn_word ENDP

;NEG.L Dn
_neg_dn_long PROC NEAR
	xor		ebx,ebx
	mov		edx,DECODE_1[ecx]						;DReg
	sub		ebx,[edx]								;0-Dn
	mov		[edx],ebx
	SET_NZV_CX_SAME
_neg_dn_long ENDP

;-----------------------------------------------------------------------
;NEG.B <ea>
_neg_ea_byte PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		dl,dl
	sub		dl,bl									;0-<ea>
	mov		bl,dl									;Store
	WRITE_BYTE_NZV_CX_SAME
_neg_ea_byte ENDP

;NEG.W <ea>
_neg_ea_word PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		dx,dx
	sub		dx,bx									;0-<ea>
	mov		bx,dx									;Store
	WRITE_WORD_NZV_CX_SAME
_neg_ea_word ENDP

;NEG.L <ea>
_neg_ea_long PROC NEAR
	EFFADDR_READ									;Read <ea>
	xor		edx,edx
	sub		edx,ebx									;0-<ea>
	mov		ebx,edx									;Store
	WRITE_LONG_NZV_CX_SAME
_neg_ea_long ENDP
