;BINIHEX--G5_3

prognam segment 	        ;define code segment
main	proc far
        assume cs:prognam
start:				;starting execution addr
;set up stack for return
	push	ds		;save old data segment
	sub	ax,ax		;put zero in AX		
	push	ax		;save zero on stack

;main part of program
        mov     ch,4	        ;number of digits
rotate: mov  	cl,4            ;set count to 4 bits
        rol  	bx,cl       	;left digit to right
        mov  	al,bl       	;  move to AL
        and  	al,0fh      	;mask off left digit
        add  	al,30h      	;convert hex to ASCII
        cmp  	al,3ah      	;is it > 9 ?
        jl   	printit     	;jump if digit = 0 to 9
        add  	al,7h       	;digit is A to F
printit:
        mov     dl,al	        ;put ASCII char in DL
        mov  	ah,2        	;display output funct
        int  	21h         	;call DOS
        dec  	ch          	;done 4 digits?
        jnz  	rotate      	;not yet
        ret	         	;return to DOS
main	endp			;end of main part of prog.

prognam ends	                ;end of segment

        end        	        ;end of assembly

