I'm using MASM (although this code is coming from TASM).
In the .data section:
In the .code section:
Is it possible to replace the last two .code lines with mov esi, org_val, then mov al, esi?
In the .data section:
fsize dd ? ;Size of the file
org_val db ? ;The value to search for
In the .code section:
mov ecx,fsize
mov esi, offset org_val
mov al, byte ptr
Is it possible to replace the last two .code lines with mov esi, org_val, then mov al, esi?
If you do that you'll end up loading in ESI a dword, but org_val is only a byte. the mov al, esi is not possible because the src operand size is smaller than dest. The real equivalent would be this:
mov ecx, fsize
mov al, org_val
(ESI will be no longer loaded with a known value though)Ok, I getcha. Thanks.
Your second sentence, though, has me a little confused. Wouldn't al be the dest and esi the source in mov al, esi? Or am I worse off than I thought? :-)
Your second sentence, though, has me a little confused. Wouldn't al be the dest and esi the source in mov al, esi? Or am I worse off than I thought? :-)
Your second sentence, though, has me a little confused. Wouldn't al be the dest and esi the source in mov al, esi? Or am I worse off than I thought? :-)
I'm definitely wrong here. Yes, ESI is the source here but the mismatched operands sizes problem still apply, AL is too small for ESI to fit in. Sometimes however, the processor allows mismatched sizes, for instance the MOVZX and MOVSX instructions which both allows a smaller (but not bigger) source.Ok. Thanks for clearing everything up. :-)