Reputation: 1
I made a little QUIZ on assembly8086 I can not print the score of the Quiz, it's a number between 1 and 10.
During the program, I add one number to the register BX like that:
proc Grade
mov bx, offset score
add [bx], 1
ret
At the end of the program I want to print the value of the register BX at base 10, And I need it to be in procedure.
I would be happy if you could help me, good day (:
Upvotes: 0
Views: 55
Reputation: 9899
it's a number between 1 and 10.
Since you have this very limited range, you can get by with this simple solution:
mov dl, [bx] ;Score from 1 to 10
cmp dl, 10
jb IsBelow10
mov dl, 49 ;Display character "1"
mov ah, 02h
int 21h
mov dl, 0 ;Prepare to display character "0"
IsBelow10:
add dl, 48 ;Converts number into character
mov ah, 02h
int 21h
You tagged it 8086 so I think DOS calls for outputting are what you need.
Upvotes: 1