aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile47
1 files changed, 37 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 6418e9f..e1a9c8d 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,30 @@ REV=`git rev-parse --short HEAD 2>/dev/null || echo UNKNOWN`
#VERSION="v$(VER)-$(TODAY)-$(BRANCH)-$(REV)"
VERSION="v$(VER)-$(TODAY)-$(REV)"
+# Memory layout. Controlled by the Makefile from now on, no longer
+# hardcoded addresses in various scripts. These are in hex. If any
+# of them are changed, you *must* run 'make clean'.
+
+# Font.
+FONT_ADDR=0x2000
+
+# Title screen data will be decompressed to this address.
+TITLE_DATA_ADDR=0x2400
+
+# Title display list, decompression code, and menu code. Should be
+# TITLE_DATA_ADDR plus 0x1744.
+TITLE_CODE_ADDR=0x3b44
+
+# Main game start address. All the code in TAIMAIN_C_SRC and
+# TAIMAIN_ASM_SRC loads here. We get this address by looking for
+# 'C code can load at' message when making newtitle.xex. It's the
+# next byte after the end of the display list.
+#TAIMAIN_ADDR=0x3d00
+TAIMAIN_ADDR=0x3cc7
+
+# Size of cc65 parameter stack in bytes.
+STACK_SIZE=0x200
+
# for older cc65, we need a custom linker file.
#CFLAGS=-t $(SYS) -C custom.cfg -I. -L. $(COPT)
@@ -35,8 +59,8 @@ VERSION="v$(VER)-$(TODAY)-$(REV)"
# and I never missed it.
# The meaning of the -l flag is different between cc65-2.13.3
# and the later github cc65, so it's been removed here.
-#CFLAGS=-t $(SYS) -T -I. -L. -DVERSION=\"$(VERSION)\" -Wl -D__SYSTEM_CHECK__=1 -Wl -D__RESERVED_MEMORY__=1056 $(COPT)
-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 -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)
AS=ca65
ASFLAGS=
AR=ar65
@@ -93,17 +117,17 @@ $(XEX): taimain.xex taifont.xex newtitle.xex comptitle.xex
# using GTIA narrow playfield. The original title screen for the Apple
# is a 280x192 bitmap with a few blank lines at the top & bottom. I
# squished it horizontally to 256 pixels and got rid of the blank lines,
-# to save load time. Note that titledata.xex is no longer built into
+# to save load time. Note that titledata.dat is not built into
# the game binary as-is: it's now used as input for creating
# comptitle.xex, the compressed title screen.
-titledata.xex: newtitle.pl newtitle.png
- perl newtitle.pl > titledata.xex
+titledata.dat: newtitle.pl newtitle.png
+ perl newtitle.pl > titledata.dat
# compressed title, for faster loading. see titlecompression.txt
# for gory details.
-comptitle.xex: titledata.xex titlecomp.pl comptitle.s.in
- perl titlecomp.pl 151 < titledata.xex
- cl65 -l comptitle.lst -o comptitle.xex -t none comptitle.s
+comptitle.xex: titledata.dat titlecomp.pl comptitle.s.in
+ perl titlecomp.pl 151 < titledata.dat
+ cl65 -l comptitle.lst -o comptitle.xex -t none --asm-define destination=$(TITLE_DATA_ADDR) comptitle.s
# Init segment that loads after the title screen data. It sets up
# a custom display list and sets the GTIA for narrow playfield,
@@ -114,7 +138,7 @@ comptitle.xex: titledata.xex titlecomp.pl comptitle.s.in
# to get cc65 to build an init segment (would need a custom linker
# script at least).
newtitle.xex: newtitle.s ver.dat help.dat
- cl65 -l newtitle.lst -m newtitle.map -o newtitle.xex -t none newtitle.s
+ cl65 -l newtitle.lst -m newtitle.map -o newtitle.xex -t none --asm-define screendata=$(TITLE_DATA_ADDR) --asm-define origin=$(TITLE_CODE_ADDR) newtitle.s
# Version number in Atari screen-data form
ver.dat: text2screen.pl
@@ -175,7 +199,7 @@ PORTSTAT.DAT: mkportstats.xex
# I converted them manually from eyeballing a screenshot of the Apple
# combat screen).
convfont: convfont.c
- $(HOSTCC) $(HOSTCFLAGS) -o convfont convfont.c
+ $(HOSTCC) $(HOSTCFLAGS) -DFONT_ADDR=$(FONT_ADDR) -o convfont convfont.c
# Rules for building various file types with the cc65 toolchain.
.s.o:
@@ -197,6 +221,9 @@ distclean: clean
push:
sh push.sh
+size: clean all
+ perl size.pl $(STACK_SIZE)
+
# Cruft. Was used for testing the enemy ship animation.
lorchatest: lorchatest.c draw_lorcha.s taifont.xex
cl65 -t atari -O -T -o lorchatest1.xex lorchatest.c draw_lorcha.s