Problem: Write an Assembly Language Program to convert ASCII to Hexadecimal number.
Title: 8086 ALP to convert ASCII to Hexadecimal number
.model small .stack 10h .data ascii db 00h hex db 00h,00h .code start: mov ax,@data mov ds,ax mov es,ax mov ah,00h ;;request byte input int 16h cld ;;store it mov di,offset ascii stosb mov cl,4 ;; shift factor mov si,offset ascii mov di,offset hex+1 lodsb mov ah,al shr ah,cl and ah,0fh ;;bits for high nibble and al,0fh ;;bits for low nibble std cmp al,0ah ;; low-nibble conversion jb non_char1 add al,07h non_char1: add al,30h stosb cmp ah,0ah ;; high-nibble conversion jb non_char2 add ah,07h non_char2: add ah,30h mov al,ah stosb cld print: ;; print hex mov ah,40h mov bx,01h mov cx,02h mov dx,offset hex int 21h bye: mov ah,4ch int 21h end start
Pingback: Assembly Language Program to print Strings in multiple lines (8086)