Compile a program to display the binary number in the BX register in hexadecimal form on the screen

code:

code segment
    assume cs:code
start:
    mov bx,1234H
    sub ax,ax
    mov ch,4
rotate:
    mov cl,4
    rol bx,cl
    mov al,bl
    and al,0fH
    add al,30H
    cmp al,3aH
    jl  print
    add al,7H
print:
    mov dl,al
    mov ah,2
    int 21H
    dec ch
    jnz rotate
    mov dl,'H'
    mov ah,2
    int 21h
    mov ah,4ch
    int 21h
code ends
    end start

0

Leave a Reply

Your email address will not be published.