.model small .586 .stack 100h .data .code main proc mov ax,@data mov ds,ax xor al,al ;clear ax mov cx,16 ;print all 16 hex digits lp1: push ax call out1hex call pcrlf pop ax inc al loop lp1 Mov ax, 4c00h Int 21h Main endp Pcrlf proc ;print carriage return/line feed Mov dl,0ah ;line feed Mov ah,2 Int 21h ;print it Mov dl,0dh ;carriage return Mov ah,2 Int 21h Ret Pcrlf endp Out1hex proc ;output lower 4-bits of AL as Hex char And al,0fh ;make sure AL value is 0 to F Cmp al,9 ;is 4 bit value above 9? Ja ischar Add al,30h ;convert to ascii digit '0' to '9' Jmp printit Ischar: add al,37h ;convert to ascii digit 'A' to 'F' Printit: Mov dl,al Mov ah,2 Int 21h ;print it using DOS single char output Ret Out1hex endp End main