0

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 (:

rkhb
  • 14,159
  • 7
  • 32
  • 60
  • 2
    Possible duplicate of [Assembly, printing ascii number](http://stackoverflow.com/questions/15621258/assembly-printing-ascii-number) – David Hoelzer Apr 29 '17 at 11:21

1 Answers1

1

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 so I think DOS calls for outputting are what you need.

Fifoernik
  • 9,779
  • 1
  • 21
  • 27