grimx
Apr 7 2008, 04:36 PM
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
grimx
Apr 7 2008, 04:54 PM
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 ??
grimx
Apr 9 2008, 04:21 PM
###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
grimx
Apr 14 2008, 07:33 PM
problem solved
i forgot to convert the numbers back to ascii to display them