flat assembler
Message board for the users of flat assembler.
Index
> Main > Comparing two words in memory |
Author |
|
magicSqr 06 Nov 2011, 22:51
you can't compare 2 memory values, you need to place one in a register first.
Code: mov ax, [bx] cmp ax, [magic] or, since you know the value you're looking for... Code: cmp word [magic], 0x424D Quote:
Not sure what you're trying to do at the arrowed part tho ¿ You need to open the file for reading, read the first word from the file, then compare it to 0x424D. magic² |
|||
06 Nov 2011, 22:51 |
|
Trinitek 07 Nov 2011, 01:00
Oh. Nevermind. I forgot that it swaps the placement of the bits when I got the word from the image header.
Thanks for telling me that I had to put the value into a register first. I completely forgot about that as well. Everything seems to be in working order as of now... |
|||
07 Nov 2011, 01:00 |
|
Madis731 07 Nov 2011, 18:28
and FASM also allows you to do this:
Code: cmp word[bx],"BM" ; Now there's no "magic", just constant |
|||
07 Nov 2011, 18:28 |
|
Trinitek 08 Nov 2011, 00:07
Madis731 wrote: and FASM also allows you to do this: Thanks Madis, but I already figured it out. Apparently, there's a problem with how I load the binary file using FILE. I'll have to look into that, but it's working as of now. |
|||
08 Nov 2011, 00:07 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.