stacker segment stack
dw 400 dup(?)
top label word
stacker ends
code segment
assume cs:code,ss:stacker
main proc near
call decibin
call crlf
call binihex
call crlf
mov ah,4ch
int 21h
main endp
decibin proc near
push ax
push cx
push dx
mov bx,0
L1:
mov ah,01h
int 21h
sub al,30h
cmp al,0d
jb exit
cmp al,9d
ja exit
xor ah,ah
xchg ax,bx
mov cx,10
mul cx
xchg bx,ax
add bx,ax
jmp L1
exit:
pop dx
pop cx
pop ax
ret
decibin endp
binihex proc near
push ax
push bx
push cx
push dx
mov ch,4d
L2:
mov cl,4d
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
dw 400 dup(?)
top label word
stacker ends
code segment
assume cs:code,ss:stacker
main proc near
call decibin
call crlf
call binihex
call crlf
mov ah,4ch
int 21h
main endp
decibin proc near
push ax
push cx
push dx
mov bx,0
L1:
mov ah,01h
int 21h
sub al,30h
cmp al,0d
jb exit
cmp al,9d
ja exit
xor ah,ah
xchg ax,bx
mov cx,10
mul cx
xchg bx,ax
add bx,ax
jmp L1
exit:
pop dx
pop cx
pop ax
ret
decibin endp
binihex proc near
push ax
push bx
push cx
push dx
mov ch,4d
L2:
mov cl,4d
rol bx,cl
mov al,bl
and al,0fh
add al,30h
cmp al,3ah