prtvx68k.lib

来自「open source of basic interpreter of 68」· LIB 代码 · 共 35 行

LIB
35
字号
*
*  prtvx68k.lib      library routine to display a hex value (68000)
*
*  This routine translates a value, passed in the D0 reg, into ASCII hex
*  characters and uses the _outch routine to display those characters
*  on the active output device.
*
*  This routine preserves all registers.
*

_prtvalx
	movem.l	d0/d1/d2,-(a7)		save regs
	exg	d0,d1			save value in d1
	moveq.l	#7,d2			get a counter
_prtvx1
	clr.b	d0			start with empty byte
	asl.l	#1,d1			move high nybble of d1...
	roxl.l	#1,d0			into low nybble of d0
	asl.l	#1,d1
	roxl.l	#1,d0
	asl.l	#1,d1
	roxl.l	#1,d0
	asl.l	#1,d1
	roxl.l	#1,d0
	add.b	#'0',d0			make it ASCII
	cmp.b	#'9',d0			test for decimal
	ble	_prtvx2			branch if OK
	addq.b	#7,d0			adjust for hex
_prtvx2
	jsr	_outch			send it
	dbra	d2,_prtvx1		do all eight bytes
	movem.l	(a7)+,d0/d1/d2		restore regs
	rts

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?