aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile82
1 files changed, 81 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index c72c325..36f950f 100644
--- a/Makefile
+++ b/Makefile
@@ -61,7 +61,7 @@ STACK_SIZE=0x200
# and the later github cc65, so it's been removed here.
#CFLAGS=-t $(SYS) -T -I. -L. -Wl -D__SYSTEM_CHECK__=1 -Wl -D__RESERVED_MEMORY__=1056 $(COPT)
-CFLAGS=-t $(SYS) -T -I. -L. -Wl -D__SYSTEM_CHECK__=1 -DFONT_ADDR=$(FONT_ADDR) --start-addr $(TAIMAIN_ADDR) -Wl -D__STACKSIZE__=$(STACK_SIZE) $(COPT)
+CFLAGS=-t $(SYS) -T -I. -L. -Wl -D__SYSTEM_CHECK__=1 -DFONT_ADDR=$(FONT_ADDR) --start-addr $(TAIMAIN_ADDR) -Wl -D__STACKSIZE__=$(STACK_SIZE) $(COPT) $(EXTRACFLAGS)
AS=ca65
ASFLAGS=
@@ -240,6 +240,66 @@ PORTSTAT.DAT: mkportstats.xex
convfont: convfont.c
$(HOSTCC) $(HOSTCFLAGS) -DFONT_ADDR=$(FONT_ADDR) -o convfont convfont.c
+# Cartridge-related targets. Build as a cart isn't really supported yet.
+
+# mkcart turns a raw binary into an atar800 .cart image with 16-byte header.
+mkcart: mkcart.c
+ $(HOSTCC) $(HOSTCFLAGS) -o mkcart mkcart.c
+
+# cc65 doc atari.html explains how to produce a raw binary file.
+# we build it for $03ff because cc65-produced atari binaries always
+# have an RTS as the first byte (for compatibility with SpartaDOS).
+# the "tail -c+2" stuff removes the first byte, so we end up with
+# a romable_taimain.raw that's ready to be copied to $0400 and run
+# via "JSR $0400".
+romable_taimain.raw: $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(TAIMAIN_HDRS)
+ rm -f taimain.xex
+ $(MAKE) TAIMAIN_ADDR=0x3ff EXTRACFLAGS="-Wl -D__AUTOSTART__=1 -Wl -D__EXEHDR__=1 -DCART_TARGET=1 --asm-define CART_TARGET=1" taimain.xex
+ tail -c+2 taimain.xex > romable_taimain.raw
+ rm -f taimain.xex
+
+# 512 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, and
+# guarantees I don't accidentally end up with a 0 in the "cart present"
+# byte of the cart trailer.
+fill512:
+ perl -Mbytes -e 'print chr(0xff) x 512' > fill512
+
+# 8192 bytes of $ff filler, for unused banks. Possibly these will be
+# used for something like an interactive game manual/tutorial.
+blankbank:
+ perl -Mbytes -e 'print chr(0xff) x 8192' > blankbank
+
+splitrom.raw.0:
+splitrom.raw.1:
+splitrom.raw.2:
+splitrom.raw.3:
+ split -b 7680 -a 1 -d romable_taimain.raw splitrom.raw.
+
+bank0: splitrom.raw.0 fill512
+ cat splitrom.raw.0 fill512 > bank0
+
+bank1: splitrom.raw.1 fill512
+ cat splitrom.raw.1 fill512 > bank1
+
+bank2: splitrom.raw.2 fill512
+ cat splitrom.raw.2 fill512 > bank2
+
+bank3: splitrom.raw.3 bank3.s taifont
+ cl65 -l bank3.lst -m bank3.map -t none -o bank3 bank3.s
+
+bank7: bank7.s titledata.dat
+ cl65 -l bank7.lst -m bank7.map -t none -o bank7 bank7.s
+
+taipan.rom: bank0 bank1 bank2 bank3 bank7 blankbank
+ cat bank0 bank1 bank2 bank3 blankbank blankbank blankbank bank7 > taipan.rom
+
+cart: taipan.cart
+
+taipan.cart: taipan.rom mkcart
+ ./mkcart -otaipan.cart -t13 taipan.rom
+ ./mkcart -ctaipan.cart
+
# Rules for building various file types with the cc65 toolchain.
.s.o:
$(AS) $(ASFLAGS) -o $@ $<
@@ -269,6 +329,26 @@ lorchatest: lorchatest.c draw_lorcha.s taifont.xex
cat taifont.xex lorchatest1.xex > lorchatest.xex
atari800 -nobasic lorchatest.xex
+#### cruft, from when I was planning to use a 32K cart:
+# this was a blind alley: zlib is too slow to decompress, plus there's
+# no need to compress taimain.xex since I'm able to use a 64K cart.
+
+# gzip2deflate downloaded from https://github.com/pfusik/zlib6502
+# I could have used deflator.c that ships with cc65's source, but
+# it's deprecated by its own upstream (same author as gzip2deflate).
+gzip2deflate: gzip2deflate.c
+ $(HOSTCC) $(HOSTCFLAGS) -o gzip2deflate gzip2deflate.c
+
+zlibtest.xex: gzip2deflate zlibtest.c zlibtestdata.s romable_taimain.raw
+ gzip -9c < romable_taimain.raw | ./gzip2deflate > rom.dfl
+ $(CC) -t atari -m zlibtest.map -l zlibtest.lst -Wl -D__SYSTEM_CHECK__=1 --start-addr 0x7000 -o zlibtest.xex zlibtest.c zlibtestdata.s
+romable_taimain.xex: $(TAIMAIN_C_SRC) $(TAIMAIN_ASM_SRC) $(TAIMAIN_HDRS)
+ rm -f taimain.xex
+ $(MAKE) TAIMAIN_ADDR=0x3ff EXTRACFLAGS="-DCART_TARGET=1 --asm-define CART_TARGET=1"
+ mv taimain.xex romable_taimain.xex
+
+###
+
soundtest: sounds.c
cl65 -DTESTXEX -t atari -o sounds.xex sounds.c
atari800 -nobasic sounds.xex