Convert string to int. x86 32 bit Assembler using Nasm

后端 未结 3 1377
遇见更好的自我
遇见更好的自我 2020-12-06 21:11

So I\'m trying to convert a string to a number so I can add another number to it later. here is what I have to far in my .text for the conversion. num2Entered is what the us

3条回答
  •  一向
    一向 (楼主)
    2020-12-06 22:01

    "123"
     |||     val = 0
     |||______ val = val + ('3' - 48) * 10power0       [val now is 3]
     ||_______ val = 3   + ('2' - 48) * 10power1       [val now is 23] 
     |________ val = 23  + ('1' - 48) * 10power2       [val now is 123]
    
    note: ascii of '1' means 49, '2' means 50 and so on
    

提交回复
热议问题