org $1000
	again:  lea msg,a1
		moveq #value,d1

		move.b #1,d0
		trap #15

		clr.l d1
		move.b #4,d0
		trap #15

		cmpi #127,d1
		bgt again

		cmpi #0,d1
		blt again

		clr.l d2
		divu #16,d1
		move.l d1,d2
		lea msg1,a1
		moveq #value1,d1
		move.b #1,d0
		trap #15

		clr.l d1
		move.w d2,d1
		bsr print
		swap d2
		move.w d2,d1
		bsr print
		clr.l d1
		move.b #0,d0
		trap #15
		stop #$2700
		
	print:	cmpi.b #9,d1
		bgt ABCDEF
		addi.b #48,d1
	output:	move.b #6,d0
		trap #15
		rts
		
	ABCDEF: addi.b #55,d1
		bra output

		
	   MSG: DC.B 'Enter your number between(0 and 127): '
	 VALUE: EQU *-MSG
	  MSG1: DC.B 'The representation of your number in Hexa is: '
	VALUE1: EQU  *-MSG1
	  
	  	end $1000

    Source: geocities.com/wonlin/Assembly

               ( geocities.com/wonlin)