I have a compile error when I compare two BYTE
.386
.model flat,stdcall ; FLAT memory model & STDCALL calling
option casemap:none ; set code to case sensitive
include \masm32\include\masm32rt.inc
helper PROTO :BYTE,:BYTE
.stack 4096 ; reserve 4096-byte stack
.data
.code
start:
invoke helper,'a','z'
exit
PUBLIC start
helper proc startChar:BYTE, endChar:BYTE
inc endChar
cmp startChar,endChar ; compile error here, can only do cmp startChar, 'z', how can I compare startChar and endChar?
ret
helper endp
end start
lingjie,
You cannot compare memory to memory. Move one into a register and do the compare.
cmp startChar,endChar
changes to:
mov eax,startChar
cmp eax,endChar
Paul
If you continue to declare them as BYTES, you should do the following to avoid another error message or an error in the result:
mov al,startChar
cmp al,endChar
Raymond
mov ax word ptr startChar
cmp ah,al