* code傪侾俇恑俀乛係寘暥帤楍偵捈偡
* void make_hex2(int code,unchar hex[2],int mode)
* void make_hex4(int code,unchar hex[4],int mode)

	.text

	.xdef	_make_hex4
_make_hex4:
	move.l	12(sp),d2
	move.l	8(sp),a0	* hex
	move.l	4(sp),d0	* code
	lsr.l	#8,d0
	bsr	hex2
	move.l	12(sp),d2
	bra	hex1
*
	.xdef	_make_hex2
_make_hex2:
	move.l	12(sp),d2
	move.l	8(sp),a0	* hex
hex1:
	move.l	4(sp),d0	* code
hex2:
	move.b	#'a'-10-'0',d1	* mode=1
	tst.l	d2
	bne	l1
	move.b	#'A'-10-'0',d1	* mode=0
l1:	* high
	move.w	d0,d2
	lsr.w	#4,d0		* 忋埵係價僢僩
	bsr	hex4
	move.w	d2,d0
hex4:	* low
	and.b	#$0f,d0		* 壓埵係價僢僩:0乣15
	add.b	#'0',d0
	cmp.b	#'9',d0		* 10乣15?
	ble	l3		* no
	* 10乣15
	add.b	d1,d0
l3:	move.b	d0,(a0)+
	rts
	.end
