lea si, input
xor cx,cx
mov cl, 4
check:
mov ah, 00
int 16h
cmp al, ‘0′
jb check
cmp al, ‘1′
ja check
mov [si], al
inc si
loop check
call convert
int 20h
input db 5 dup (’$')
;——————–convert——————–
convert:
dec si
mov ah, 09
lea dx, input
int 21h
mov ah, 02h
mov dl, 0ah
int 21h
mov dl, 0dh
int 21h
xor bx,bx
mov cl,0
xxx:
mov al, [si] ; al contains character not value
sub al,30h ; convert to value
shl al, cl
add bl,al
dec si
inc cl
cmp cl,4
jne xxx
add bl,30h ; 0-9
cmp bl,’9′
jbe print
add bl, 7h ; A-F
print:
mov ah, 02
mov dl,bl
int 21h
ret
All comments are moderated. Your comments will not appear here unless approved by the blog owner. Thank you.