Hello!
I'm kind of new in assembly programming and I've been struggling with the following problem today:
How to print an integer, using BIOS interrupt 10h, with its 0Eh in AH register, as its function to print a character to the screen...
For example, how to print the last digit of 2005.
here's what I've tried, using division by 10:
mov ax, 2005
mov cx, 10
div cx ; now, AH should contain the remainder (5) and AL = 200
mov al, ah ; because AL should contain the character to print
add al, 48 ; because ASCII code for 5 is 53 (decimal).
mov ah, 0Eh; the function for the 10h interrupt
int 10h
I can't understand why 0 is printed to the screen instead of 5. If i change the line
add al, 48
to
add al, 49
it prints out 1.
... am I missing something? is it because I use decimal format for integers instead of the hexadecimal one?
Thank you in advance!