These two lines are your problem:
sub eax,my1337Sk1LLz ;subtracts 1337h from usPop in eax mov Difference, eax ;stores eax into Difference
eax
is 32 bits, but both my1337Sk1LLz
and Difference
are 16 bits.
There are two ways you might get around this:
- Changing the size of
my1337Sk1LLz
andDifference
. Right now you have the types asWORD
andSWORD
, respectively. You can change those toDWORD
andSDWORD
to make them 32-bit. - Zero-extending and truncating. You’ll need another register. I’ll use
edx
since you don’t seem to be using it there. First, you’ll need to sign-extendmy1337Sk1LLz
:movzx edx, my1337Sk1LLz ; move, zero-extended, my1337Sk1LLz into EDX
Then you can do the subtraction:sub eax, edx ; they're the same size now so we can do this
Then you can store the low word ofeax
intoDifference
, discarding the high word:mov Difference, ax