;this program converts a hex number in dx to ASCII codes .model small .stack 100h .data num = 0e39fh .code mov ax,@data mov ds,ax mov ax,0b800h mov es,ax mov ax,3 int 10h mov bx,0 mov di,num shr di,12 ;leave only the last 4 bits call convert mov di,num shr di,8 ;leave only the last 8 bits call convert mov di,num shr di,4 ;leave only the last 12 bits call convert mov di,num ;do not change the number call convert mov ah,4ch int 21h ;*********************** convert: AND di,0fh ;make di 0 in all places except last 4 bits mov ax,di cmp ax,10 ;check # vs char jb digit add ax,7 ;if character: add 55 digit: add ax,48 ;if #: add 48 mov es:[bx],al ;print to screen add bx,2 ;advance bx to next block ret end