;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 al, byte ptr 400h   ;grab input
        mov bl, '0'             ;ascii counter
;number of 100's
hnl:    cmp al, 100
        jb  hnc                 ;no hundreds left to count
        sub al, 100
        add bl, 1               ;count a hundred
        jmp hnl
hnc:    mov byte ptr 401h, bl   ;output the number of hundreds in ascii
;
        mov bl, '0'             ;ascii count for tens
tnl:    cmp al, 10
        jb  tnc
        sub al, 10
        add bl, 1
        jmp tnl
tnc:    mov byte ptr 402h, bl   ;output the number of tens in ascii
;
        add al, '0'             ;convert 1 col to ascii
        mov byte ptr 403h, al   ;output the number of ones in ascii
        hlt
        end