Reputation: 13
I am trying to learn how to convert a string to an integer. I think I am pretty close. My code works for numbers under 260. Once the numbers entered are greater than or equal to 260, then it just converts them to 0. I think it might have something to do with the size of a BYTE, but I'm not sure how to fix it. Any suggestions? Some Irvine functions are included, but I'm trying to write my own ReadInt function.
Upvotes: 1
Views: 966
Reputation: 993085
I can see the problem. Rather than giving away the answer completely, here's a hint:
The lodsb
instruction loads one byte into al
(which is the low 8 bits of eax
). The rest of eax
is unchanged. What might cause eax
to contain extra bits that aren't changed by lodsb
?
Upvotes: 1