aboutsummaryrefslogtreecommitdiff
path: root/conio/mul40.s
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-03-20 03:46:20 -0400
committerB. Watson <yalhcru@gmail.com>2021-03-20 03:46:20 -0400
commit2316ea0e05c00eb65d83cfe6def57e9840910096 (patch)
tree1006dba3f7063020c2794b7cfd7f2abe297e4ff0 /conio/mul40.s
parent973610d41860bc177dc37d3f62b9f2f38aad97cd (diff)
downloadtaipan-2316ea0e05c00eb65d83cfe6def57e9840910096.tar.gz
Fix build on cc65 >= 2.18 (without breaking <= 2.17)
Diffstat (limited to 'conio/mul40.s')
-rw-r--r--conio/mul40.s20
1 files changed, 20 insertions, 0 deletions
diff --git a/conio/mul40.s b/conio/mul40.s
new file mode 100644
index 0000000..99dd006
--- /dev/null
+++ b/conio/mul40.s
@@ -0,0 +1,20 @@
+; Compatibility wrapper for cc65's mul40 or _mul40 library routine.
+; Necessary because cc65 <= 2.17 has "mul40" as part of its atari
+; library, but 2.18 and up made it a C-callable routine on all
+; platforms, meaning its name grew a _ in front, "_mul40".
+
+; The .VERSION pseudo-variable is documented as "major version
+; times $100, plus minor version times $10". Whoever came up with
+; this design must have thought the minor version would never exceed
+; 15... starting with 2.16, the minor nybble overflows into the major
+; one, meaning cc65-2.17's .VERSION is actually $0310. Which is fine,
+; so long as there's never a cc65 major version 3.x (if this happens,
+; versions 3.0 and 3.1 will fail to build this correctly, then 3.2
+; will work again).
+
+.if .VERSION <= $0310 ; $0310 == 2.17
+ .import mul40
+.else
+ .import _mul40
+mul40 = _mul40
+.endif