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 "single-digit numbers" where the answer can't go past 9 since 10 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 32
SECTION .data
add1msg db "single ",0
add2msg db "another ",0
resultmsg db "The sum of these two numbers is: ",0
newline db 0xA
SECTION .bss
numstore1 resb 1
numstore2 resb 1
result resb 1
SECTION .text
global _start
_start:
mov eax, 4 ;sys call(sys_write)
mov ebx, 1 ; sys call(std_out)
mov ecx, add1msg ; The message
mov edx, 7 ; length of message
int 0x80 ; call kernel
;Read in the first number
mov eax, 3
mov ebx, 0
mov ecx, numstore1
mov edx, 1
int 0x80
;Convert the first number from ASCII to integer
mov al,[numstore1]
sub al,'0'
mov bl, al
;Prompt user for the second number
mov eax, 4
mov ebx, 1
mov ecx, add2msg
mov edx, 8
int 0x80
;Read in the second number
mov eax, 3
mov ebx, 0
mov ecx, numstore2
mov edx, 1
int 0x80
;Convert the second number from ASCII to integer then add to first number
mov al,[numstore2]
sub al,'0'
add bl, al
add bl,48
mov [result], bl
;mov eax, 4
;mov ebx, 1
;mov ecx, resultmsg
;mov edx, 33
;int 0x80
;mov eax, 3
;mov ebx, 0
;mov ecx, result
;mov edx, 1
;int 0x80
;mov eax, 4
;mov ebx, 1
;mov ecx, newline
;mov edx, 1
;int 0x80
mov eax, 1
int 0x80

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!