Question: Hello so I was working on my NASM assembly assignment where I am supposed to add two single - digit numbers where the answer can't
Hello so I was working on my NASM assembly assignment where I am supposed to add two "singledigit numbers" where the answer can't go past since is double digit. So i have my code below and when it gets to entering in the second number it does this weird thing where it won't let me answer the prompt that I gave and skips to the result message and cuts out of the program. I do all of my code in a Linux VM Also if there is a way to help with debugging where I can print what is coming out that would help a lot.
BITS
SECTION data
addmsg db "single
addmsg db "another
resultmsg db "The sum of these two numbers is:
newline db xA
SECTION bss
numstore resb
numstore resb
result resb
SECTION text
global start
start:
mov eax, ;sys callsyswrite
mov ebx, ; sys callstdout
mov ecx, addmsg ; The message
mov edx, ; length of message
int x ; call kernel
;Read in the first number
mov eax,
mov ebx,
mov ecx, numstore
mov edx,
int x
;Convert the first number from ASCII to integer
mov alnumstore
sub al
mov bl al
;Prompt user for the second number
mov eax,
mov ebx,
mov ecx, addmsg
mov edx,
int x
;Read in the second number
mov eax,
mov ebx,
mov ecx, numstore
mov edx,
int x
;Convert the second number from ASCII to integer then add to first number
mov alnumstore
sub al
add bl al
add bl
mov result bl
;mov eax,
;mov ebx,
;mov ecx, resultmsg
;mov edx,
;int x
;mov eax,
;mov ebx,
;mov ecx, result
;mov edx,
;int x
;mov eax,
;mov ebx,
;mov ecx, newline
;mov edx,
;int x
mov eax,
int x
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
