Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- segment data
- nl: db 10,13,'$'
- message: db 10,13,'Enter 2 hexadecimal numbers: $'
- segment stack stack
- resb 256
- segment code
- ..start:
- mov cx,2
- LOOP_TWO:
- push cx
- mov ax,data
- mov ds,ax
- mov dx,message
- mov ah,9
- int 21h
- xor ax,ax
- mov ah,1h
- int 21h
- mov dl,al
- sub dl,30h
- cmp dl,31h
- jl to_upper_1
- sub dl,20h
- to_upper_1:
- cmp dl,9h
- jle m1
- sub dl,7h
- m1:
- mov cl,4h
- shl dl,cl
- int 21h
- sub al,30h
- cmp al,31h
- jl to_upper_2
- sub al,20h
- to_upper_2:
- cmp al,9h
- jle m2
- sub al,7h
- m2:
- add dl,al
- jmp outbin
- ; OUTPUT BINARY AHEAD ;
- outbin:
- push dx
- mov dx,nl
- mov ah,9h
- int 21h
- pop dx
- mov cx,8
- shl dx,8h
- mov bx,dx
- mov ah,2h
- l1:
- xor dx,dx
- sal bx,1
- adc dl,30h
- int 21h
- loop l1
- pop cx
- cmp cx,2
- dec cx
- jnz LOOP_TWO
- exit:
- mov ax,4c00h
- int 21h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement