summaryrefslogtreecommitdiff
path: root/programs/hex-to-bcd.s
blob: 53a3ff26f42fb5e9859ba2fcc2135ceaf8f66f0d (plain)
1
2
3
4
5
6
7
hex_to_bcd:
	pla #1		; Get argument.
	div #10		; Divide A by 10.
	lsl #4		; Shift the result left by 4 bits.
	oab		; Or the result, with the remainder.
	pha #1		; Push the packed BCD result to the stack.
	rts		; Return the result.