grimx Posted April 7, 2008 Report Share Posted April 7, 2008 (edited) ok i have ###abbrev .lcomm num1, 4 .lcomm num2, 4 .lcomm ans, 4 .section text .globl _start _start: get input for num1 ###abbrev ## using system calls read to get inputs get input for num2 ###abbrev movl num1, %eax addl num2, %eax ##how do i change the ascii char's into decimal ## so i can put the them into the ans buffer for output ## sorry thats about as clear as i can state my problem ## going to use system call write for output of ans buffer Edited April 14, 2008 by grimx Quote Link to comment Share on other sites More sharing options...
grimx Posted April 7, 2008 Author Report Share Posted April 7, 2008 (edited) ok i got it: ok so you zero out ah and subtract 48 from al to get the decimal from ascii ?? so i need to do that for num1 and num2, before i add them and the result should be in decimal ?? Edited April 7, 2008 by grimx Quote Link to comment Share on other sites More sharing options...
grimx Posted April 9, 2008 Author Report Share Posted April 9, 2008 (edited) ###abbrev .lcomm num1, 4 .lcomm num2, 4 .lcomm ans, 4 .section text .globl _start _start: get input for num1 ###abbrev ## using system calls read to get inputs get input for num2 ###abbrev i tryed this on both num1 and num2, it didn't work i also tried it on all three (num1, num2) added them togather and put them in ans, and tried it, it still doesn't work. What Am I Doing Wrong ##abbrev movl $0, %ecx conversion_loop: subb $48, num1(, %ecx, 1) inc %ecx cmp $3, %ecx jne conversion_loop ## abbev movl num1, %eax addl num2, %eax ### abbrev Edited April 9, 2008 by grimx Quote Link to comment Share on other sites More sharing options...
grimx Posted April 14, 2008 Author Report Share Posted April 14, 2008 problem solved i forgot to convert the numbers back to ascii to display them Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.