summaryrefslogtreecommitdiff
path: root/programs/hex-to-bcd.s
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2020-01-10 16:35:34 -0500
committermrb0nk500 <b0nk@b0nk.xyz>2020-01-10 16:35:34 -0500
commit861d56e556b597115ad01b4b4cc0e5b932545ce9 (patch)
treed24d9718da054658a833b932595819c030065d1a /programs/hex-to-bcd.s
parent1dfc78b8bf5b708cb1118a9d6646397772a1b894 (diff)
Added GPLv2.
We're now Free Software!!!
Diffstat (limited to 'programs/hex-to-bcd.s')
-rw-r--r--programs/hex-to-bcd.s7
1 files changed, 7 insertions, 0 deletions
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.