Related, but not helpful to my current situation: nasm dos interrupt (output string)
(I just wanted to clarify this is not a duplicate)
What I am trying to do is create a prompt that will say "Enter a Base 10 number: " to the user. After that, I will convert that number to binary, octal, and hexadecimal. I'm coming across an issue, however, and I'm sure it's very simple but I've been staring at this code way too long to understand what's wrong.
What happens is it outputs the "Enter a Base Ten Number: ", then blinks about 3 times and automatically shuts down my DOSbox emulator. Any ideas?
Here is the code:
org 0x100
mov bx, 1 ;init bx to 1
mov ax, 0100h
mov dx, msg ;message's address in dx
mov cx, len
mov ah, 0x40
int 0x21
msg db 'Enter a Base Ten Number: '
len equ $ -msg
;all of the code above runs fine it seems. It gets to this point
;but does not then run the following code
mov ah, 9
int 21h
while:
cmp ax, 13 ;is char = carriage return?
je endwhile ;if so, we're done
shl bx, 1 ;multiplies bx by 2
and al, 01h ;convert character to binary
or bl, al ;"add" the low bit
int 21h
jmp while
endwhile