From 861d56e556b597115ad01b4b4cc0e5b932545ce9 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 10 Jan 2020 16:35:34 -0500 Subject: Added GPLv2. We're now Free Software!!! --- programs/hex-to-bcd.s | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 programs/hex-to-bcd.s (limited to 'programs/hex-to-bcd.s') diff --git a/programs/hex-to-bcd.s b/programs/hex-to-bcd.s new file mode 100644 index 0000000..53a3ff2 --- /dev/null +++ b/programs/hex-to-bcd.s @@ -0,0 +1,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. -- cgit v1.2.3-13-gbd6f