public ascbin,ascint,binasc
extrn data (ascii,kanal,zwisu,result)


ASCII_TO_BIN segment code
rseg ASCII_TO_BIN

ascbin: mov a,ascii
        anl a,#0fh
        mov b,#100
        mul ab
        mov zwisu,a
        mov a,ascii+1
        anl a,#0fh
        mov b,#10
        mul ab
        add a,zwisu
        mov zwisu,a
        mov a,ascii+2
        anl a,#0fh
        add a,zwisu
        ret

ascint: mov a,kanal
        anl a,#0fh
        mov b,#100
        mul ab
        mov result+1,a
        mov result,b
        mov a,kanal+1
        anl a,#0fh
        mov b,#10
        mul ab
        add a,result+1
        mov result+1,a
        mov a,kanal+2
        anl a,#0fh
        add a,result+1
        mov result+1,a
        ret

binasc: mov b,#100
        div ab
        add a,#30h
        mov ascii,a
        mov a,#10
        xch a,b
        div ab
        add a,#30h
        mov ascii+1,a
        xch a,b
        add a,#30h
        mov ascii+2,a
        ret

end

