I am currently working on a project in an introduction to assembly course in which we are asked to subtract a single digit integer from a three digit integer and display a two digit output. (implying the 3 digit integer is > 100 yet < 108)
I seem to be having issues dealing with this variable at every step. I wrote the below program to see if I could put it into the ax 16 bit register and move it back and can't seem to do even that.
I understand there may be an issue with the ascii value of it being larger than 1 byte, although seeing as 'ax' is a 2 byte register it doesn't seem like it would be problematic.
I am using the online rextester.com nasm compiler.
section .bss
input: resb 1
section .text
global _start
_start:
mov eax,3
mov ebx,0
mov ecx,input
mov edx,3
int 80h
mov [input],ax
mov ax,[input]
mov eax,4
mov ebx,1
mov ecx,input
mov edx,1
int 80h
mov eax,1
mov ebx,0
int 80h
the output of this is garbage but without the mov I get the first digit of the int.