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.
I am trying to learn how to convert a string to an integer. I
Share
I can see the problem. Rather than giving away the answer completely, here’s a hint:
The
lodsbinstruction loads one byte intoal(which is the low 8 bits ofeax). The rest ofeaxis unchanged. What might causeeaxto contain extra bits that aren’t changed bylodsb?