[Writing a two-digit number]                           [Assembler][/][8086]

Let's suppose we want to write out a two-digit number in any numerical
system between [2..10]. Value comes in AL, the base of the numerical system
comes in AH.

MACRO   Write2Digit
LOCAL   zeros, convert

        mov     byte ptr aam_operand,ah
        call    convert

zeros   db      '00$'

aam_operand     equ $+1
convert:
        aam
        xchg    al,ah
        mov     ah,9
        pop     dx
        int     21h

        ENDM

When we want to write decimal numbers only, then it is unnecessary to
rewrite the AAM's operand.
                                                     Gem writer: Ervin Toth
                                                   last updated: 1998-03-16
