aboutsummaryrefslogtreecommitdiffstats
path: root/usr/build.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xusr/build.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr/build.sh b/usr/build.sh
index 93815d2..5d494cf 100755
--- a/usr/build.sh
+++ b/usr/build.sh
@@ -10,7 +10,12 @@ sdasgb -o "$B/crt0.rel" usr/crt0.s
sdasgb -o "$B/libc.rel" usr/libc.s
sdcc -msm83 -c -Iusr usr/libc.c -o "$B/libc_c.rel"
sdcc -msm83 -c -Iusr "$SRC" -o "$B/prog.rel"
-# link: crt0 first (=> _start at 0x4000), then libc, program, and sm83 lib
+# link: crt0 first (=> _start at 0x4000), then libc, program, and sm83 lib.
+# TRAP: only _CODE/_DATA have pinned bases. sm83.lib modules (long div/mod/
+# shift helpers) link into their own areas, which sdldgb places after _DATA -
+# i.e. code in the $A000 RAM window ("buffer too small" from makebin, or
+# garbage at runtime). Don't use long division/shifts in programs; see
+# usr/uptime.c for the inlined-arithmetic workaround.
sdldgb -n -m -w -j -i "$B/prog.ihx" \
-b _CODE=0x4000 -b _DATA=0xa000 \
-k "$LIBDIR" -l sm83 \