;program converts a binary number in memory (00-FF) into THREE
;decimal, ASCII digits ('0'--'9')
;input 400h
;output is 401h, 402h, and 403h
;
        mov dl, byte ptr 400h   ;grab input
        mov bl, '0'             ;ascii counter
;number of 100's
hnl:    cmp dl, 100
        jb  hnc                 ;no hundreds left to count
        sub dl, 100
        add bl, 1               ;count a hundred
        jmp hnl
hnc:    mov byte ptr 401h, bl   ;output the number of hundreds in ascii
        mov ah, 0eh             ;write TELETYPE ascii code
        mov al, bl              ;ascii character to print
        mov bh, 0               ;page to write
        int 10h                 ;video output interrupt (BIOS ROM call)
;
        mov bl, '0'             ;ascii count for tens

tnl:    cmp dl, 10
        jb  tnc
        sub dl, 10
        add bl, 1
        jmp tnl
tnc:    mov byte ptr 402h, bl   ;output the number of tens in ascii
        mov ah, 0eh
        mov al, bl              ;ascii character to print
        mov bh, 0               ;page to write
        int 10h

;
        add dl, '0'             ;convert 1 col to ascii
        mov byte ptr 403h, dl   ;output the number of ones in ascii
        mov ah, 0eh
        mov al, dl              ;ascii character to print
        mov bh, 0               ;page to write
        int 10h

        int 20h                 ;return to DOS
        end