aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2021-04-16 12:34:12 -0400
committerB. Watson <yalhcru@gmail.com>2021-04-16 12:34:12 -0400
commitf822c52838af6884792f3a1f16aad29f5174a913 (patch)
tree98beb304fe1787423fdb7a7efdd7cc0edda69e1c
parentd3d67168c37bf0d95477c8eb58b6dc24f7e815ad (diff)
downloadtaipan-f822c52838af6884792f3a1f16aad29f5174a913.tar.gz
Use full 8K banks for cartridge build
-rw-r--r--Makefile25
-rw-r--r--bank3.s14
-rw-r--r--checkbank0.pl19
3 files changed, 34 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 91fca46..e43624e 100644
--- a/Makefile
+++ b/Makefile
@@ -338,17 +338,10 @@ cartbank2.cfg: cartbank2.cfg.old cartbank2.cfg.new cartbank2.sh
romable_taimain.raw: cartbank2.cfg $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(TAIMAIN_HDRS) $(BIGNUM_SRC) $(BIGNUM_HDRS) $(TAIMAIN_LIBS) crt0_cart.s messages.c
$(CC) --config cartbank2.cfg -m taipan.map -t atari -T -I. -L. -DFONT_ADDR=0x9c00 --start-addr 0x400 -Wl -D__STACKSIZE__=0x200 -O -Wl -D__SYSTEM_CHECK__=1 -Wl -D__AUTOSTART__=1 -Wl -D__EXEHDR__=1 -DCART_TARGET=1 --asm-define CART_TARGET=1 -DBIGNUM=BIGFLOAT -o romable_taimain.raw $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(BIGNUM_SRC) $(TAIMAIN_LIBS) crt0_cart.s
-# 256 bytes of $ff filler, for the last page of each code bank. Wasting
-# this little bit of space simplifies the copying code in bank7.s (no
-# partial last page to copy), and guarantees I don't accidentally end
-# up with a 0 in the "cart present" byte of the cart trailer.
-fill256:
- $(PERLF) -Mbytes -e 'print chr(0xff) x 256' > fill256
-
# 8192 bytes of $ff filler, for unused banks. Possibly these will be
# used for something like an interactive game manual/tutorial.
-blankbank:
- $(PERLF) -Mbytes -e 'print chr(0xff) x 8192' > blankbank
+#blankbank:
+# $(PERLF) -Mbytes -e 'print chr(0xff) x 8192' > blankbank
splitrom.raw.0: splitrom.raw.2
@@ -358,17 +351,15 @@ splitrom.raw.1: splitrom.raw.2
# with 3 chunks, the cart won't work correctly, so stop the build here
# in that case.
splitrom.raw.2: romable_taimain.raw
- split -b 7936 -a 1 -d romable_taimain.raw splitrom.raw.
+ split -b 8192 -a 1 -d romable_taimain.raw splitrom.raw.
[ -e splitrom.raw.3 ] && echo "*** romable_taimain.raw too big" && rm -f splitrom.raw.* && exit 1 || exit 0
-bank0: splitrom.raw.0 fill256
- cat splitrom.raw.0 fill256 > bank0
-
-bank1: splitrom.raw.1 fill256
- cat splitrom.raw.1 fill256 > bank1
+bank0: splitrom.raw.0 checkbank0.pl
+ cat splitrom.raw.0 > bank0
+ $(PERLF) checkbank0.pl bank0
-#bank2: splitrom.raw.2 fill256
-# cl65 -l bank2.lst -m bank2.map -t none -o bank2 bank2.s
+bank1: splitrom.raw.1
+ cat splitrom.raw.1 > bank1
bank2: rodata.8000 bank2.s taifont romable_taimain.raw
$(CC) -l bank2.lst -m bank2.map -t none -o bank2 bank2.s
diff --git a/bank3.s b/bank3.s
index 2f7733c..9a1fce1 100644
--- a/bank3.s
+++ b/bank3.s
@@ -38,9 +38,9 @@ mem_msg:
scrcode "Need at least 32K"
mem_msg_len = * - mem_msg - 1
-; copy_31_pages:
-; copy 7936 bytes from $8000-$9dff to (destptr).
-; on exit, destptr points to the next 7936 byte chunk.
+; copy_32_pages:
+; copy 8192 bytes from $8000-$9fff to (destptr).
+; on exit, destptr points to the next 8192 byte chunk.
; copy_x_pages:
; as above, but accepts number of pages to copy in X register.
@@ -49,8 +49,8 @@ mem_msg_len = * - mem_msg - 1
; as copy_x_pages, but the caller must set up srcptr as well
; as the X reg.
-copy_31_pages:
- ldx #$1f
+copy_32_pages:
+ ldx #$20
copy_x_pages:
lda #$0
sta srcptr
@@ -113,11 +113,11 @@ mem_ok:
; I can shrink the code down to fit in 0 and 1 only.
lda #0 ; bank 0...
sta CCNTL ; ...select it
- jsr copy_31_pages
+ jsr copy_32_pages
lda #1 ; bank 1...
sta CCNTL ; ...select it
- jsr copy_31_pages
+ jsr copy_32_pages
; tail end of the code is stored in this bank.
lda #<code_tail
diff --git a/checkbank0.pl b/checkbank0.pl
new file mode 100644
index 0000000..2f0d78a
--- /dev/null
+++ b/checkbank0.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl -w
+
+# Check a cart bank (normally bank0) and warn if there's a zero
+# byte in the 'cart present' location. According to the atari800
+# docs, sometimes bank 0 comes up mapped to the right cart area,
+# which means the OS might try to initialize/run it (which wouldn't
+# work).
+
+die "usage: $0 <filename>\n" unless @ARGV == 1;
+
+use bytes;
+
+undef $/;
+$_ = <>;
+$byte = ord substr($_, 8188, 1);
+if($byte == 0) {
+ warn "$0: $ARGV[0] has zero byte (cart present) in trailer (\$9ffc)\n";
+}
+exit 0;