;	WinSTon

;	CMPM (Ay)+,(Ax)+

;	XNZVC
;	-****

PUBLIC _cmp_an_an_byte
PUBLIC _cmp_an_an_word
PUBLIC _cmp_an_an_long

;-----------------------------------------------------------------------
;CMPM.B (Ay)+,(Ax)+
_cmp_an_an_byte PROC NEAR
	mov		edx,DECODE_2[ecx]
	mov		ebx,[edx]
	cmp		edx,OFFSET _Regs+(15*4)
	jl		no_ay_a7								;Is (a7) or (a8)?
	add		DWORD PTR [edx],SIZE_BYTE				;Yes, add SIZE_WORD
no_ay_a7:
	add		DWORD PTR [edx],SIZE_BYTE
	MASK_24BIT_ADDR(ebx)							;as 24-bit address in PC memory
	mov		bl,BYTE PTR _STRam[ebx]					;(Ay)+

	mov		edx,DECODE_1[ecx]
	mov		ecx,[edx]
	cmp		edx,OFFSET _Regs+(15*4)
	jl		no_ax_a7								;Is (a7) or (a8)?
	add		DWORD PTR [edx],SIZE_BYTE				;Yes, add SIZE_WORD
no_ax_a7:
	add		DWORD PTR [edx],SIZE_BYTE
	MASK_24BIT_ADDR(ecx)							;as 24-bit address in PC memory
	mov		cl,BYTE PTR _STRam[ecx]					;(Ax)+

	cmp		cl,bl									;Compare, set condition codes
	SET_NZVC
_cmp_an_an_byte ENDP

;CMPM.W (Ay)+,(Ax)+
_cmp_an_an_word PROC NEAR
	mov		edx,DECODE_2[ecx]
	mov		ebx,[edx]
	add		DWORD PTR [edx],SIZE_WORD
	MASK_24BIT_ADDR(ebx)							;as 24-bit address in PC memory
	mov		bx,WORD PTR _STRam[ebx]					;(Ay)+
	SWAP_ENDIAN_WORD_BX

	mov		edx,DECODE_1[ecx]
	mov		ecx,[edx]
	add		DWORD PTR [edx],SIZE_WORD
	MASK_24BIT_ADDR(ecx)							;as 24-bit address in PC memory
	mov		cx,WORD PTR _STRam[ecx]					;(Ax)+
	SWAP_ENDIAN_WORD_CX

	cmp		cx,bx									;Compare, set condition codes
	SET_NZVC
_cmp_an_an_word ENDP

;CMPM.L (Ay)+,(Ax)+
_cmp_an_an_long PROC NEAR
	mov		edx,DECODE_2[ecx]
	mov		ebx,[edx]
	add		DWORD PTR [edx],SIZE_LONG
	MASK_24BIT_ADDR(ebx)							;as 24-bit address in PC memory
	mov		ebx,DWORD PTR _STRam[ebx]				;(Ay)+
	SWAP_ENDIAN_LONG_EBX

	mov		edx,DECODE_1[ecx]
	mov		ecx,[edx]
	add		DWORD PTR [edx],SIZE_LONG
	MASK_24BIT_ADDR(ecx)							;as 24-bit address in PC memory
	mov		ecx,DWORD PTR _STRam[ecx]				;(Ax)+
	SWAP_ENDIAN_LONG_ECX

	cmp		ecx,ebx									;Compare, set condition codes
	SET_NZVC
_cmp_an_an_long ENDP
