;	WinSTon

;	SUBQ #<data>,Dn
;	SUBQ #<data>,An
;	SUBQ #<data>,<ea>

;	XNZVC
;	*****

PUBLIC _subq_imm_dn_byte
PUBLIC _subq_imm_dn_word
PUBLIC _subq_imm_dn_long
PUBLIC _subq_imm_an_word
PUBLIC _subq_imm_an_long
PUBLIC _subq_imm_ea_byte
PUBLIC _subq_imm_ea_word
PUBLIC _subq_imm_ea_long

;-----------------------------------------------------------------------
;SUBQ.B #<data>,Dn
_subq_imm_dn_byte PROC NEAR
	mov		ebx,DECODE_2[ecx]						;Data 0..7 (0 is '8')
	mov		edx,DECODE_1[ecx]						;<ea>
	sub		[edx],bl
	SET_NZV_CX_SAME
_subq_imm_dn_byte ENDP

;SUBQ.W #<data>,Dn
_subq_imm_dn_word PROC NEAR
	mov		ebx,DECODE_2[ecx]						;Data 0..7 (0 is '8')
	mov		edx,DECODE_1[ecx]						;<ea>
	sub		[edx],bx
	SET_NZV_CX_SAME
_subq_imm_dn_word ENDP

;SUBQ.L #<data>,Dn
_subq_imm_dn_long PROC NEAR
	mov		ebx,DECODE_2[ecx]						;Data 0..7 (0 is '8')
	mov		edx,DECODE_1[ecx]						;<ea>
	sub		[edx],ebx
	SET_NZV_CX_SAME
_subq_imm_dn_long ENDP

;-----------------------------------------------------------------------
;SUBQ.W #<data>,An
_subq_imm_an_word PROC NEAR
	mov		ebx,DECODE_2[ecx]						;Data 0..7 (0 is '8')
	mov		edx,DECODE_1[ecx]						;<ea>
	sub		[edx],ebx								;- Use all 32-bits
	FRET
_subq_imm_an_word ENDP

;SUBQ.L #<data>,An
_subq_imm_an_long PROC NEAR
	mov		ebx,DECODE_2[ecx]						;Data 0..7 (0 is '8')
	mov		edx,DECODE_1[ecx]						;<ea>
	sub		[edx],ebx
	FRET
_subq_imm_an_long ENDP

;-----------------------------------------------------------------------
;SUBQ.B #<data>,<ea>
_subq_imm_ea_byte PROC NEAR
	EFFADDR_READ									;Read <ea>
	mov		edx,DECODE_2[ecx]						;Data 0..7 (0 is '8')
	sub		bl,dl
	WRITE_BYTE_NZV_CX_SAME
_subq_imm_ea_byte ENDP

;SUBQ.W #<data>,<ea>
_subq_imm_ea_word PROC NEAR
	EFFADDR_READ									;Read <ea>
	mov		edx,DECODE_2[ecx]						;Data 0..7 (0 is '8')
	sub		bx,dx
	WRITE_WORD_NZV_CX_SAME
_subq_imm_ea_word ENDP

;SUBQ.L #<data>,<ea>
_subq_imm_ea_long PROC NEAR
	EFFADDR_READ									;Read <ea>
	mov		edx,DECODE_2[ecx]						;Data 0..7 (0 is '8')
	sub		ebx,edx
	WRITE_LONG_NZV_CX_SAME
_subq_imm_ea_long ENDP
