CC=cl65 SYS=atari # the meaning of the -l flag is different between cc65-2.13.3 # and the later github cc65, so it's commented out here. #COPT=-O -l -T COPT=-O -T # for older cc65, we need a custom linker file. #CFLAGS=-t $(SYS) -C custom.cfg -I. -L. $(COPT) # for recent git cc65, we can reserve memory on the command line. # -D__RESERVED_MEMORY__=1056 because cc65's default end of memory # is $BC20, and we want it to end just below our font, which starts # at $B800. # -D__SYSTEM_CHECK__=1 stops cl65 from prepending a bit of code that # checks to make sure there's enough memory. Older cc65 didn't do this, # and I never missed it. CFLAGS=-t $(SYS) -I. -L. -Wl -D__SYSTEM_CHECK__=1 -Wl -D__RESERVED_MEMORY__=1056 $(COPT) AS=ca65 ASFLAGS= AR=ar65 VERSION="v0.99alpha-$(shell date +%Y%m%d)-$(shell git rev-parse --short HEAD 2>/dev/null || echo UNKNOWN)" # A few files have no make rules here. LORCHA.DAT is generated as a # side-effect of generating taifont.xex. It's a 49-byte (7x7) blob of # Atari "internal" screen codes. # TITLE.DAT is generated by Atari BASIC code in TITLE.LST, # except last time I modified it, I exited the emulator without # saving the damn BASIC source, so TITLE.LST is outdated. TITLE.DAT # is a complete 960-byte dump of GR.0 screen memory, which gets # turned into title.xex and prepended to the main .xex. When # it loads, it goes straight to screen memory. # TITLE.DAT, LORCHA.DAT, and PORTSTAT.DAT aren't deleted by a # 'make clean'. # romfont is the 1K font extracted from the Atari 800 OS, with a # command like: # dd if=atariosb.rom of=1 bs=256 skip=8 count=4 # ...where atariosb.rom comes from e.g. the PC-Xformer 2.5 zip file. XEX=taipan.xex all: $(XEX) ver: @echo $(VERSION) $(XEX): taimain.xex taifont.xex title.xex cat taifont.xex title.xex taimain.xex > $(XEX) title.xex: TITLE.DAT perl title.pl TITLE.DAT > title.xex taimain.xex: taipan.c rand.s draw_lorcha.s taifont.xex cl65 -DVERSION=\"$(VERSION)\" --mapfile taipan.map $(CFLAGS) -o taimain.xex taipan.c rand.s draw_lorcha.s timed_getch.s jsleep.s portstat.s taifont.xex: convfont romfont font cat romfont font | ./convfont -x > taifont.xex touch draw_lorcha.s taifont: convfont romfont font cat romfont font | ./convfont > taifont convfont: convfont.c gcc -Wall -o convfont convfont.c test: all atari800 -nobasic $(XEX) .s.o: $(AS) $(ASFLAGS) -o $@ $< .c.o: $(CC) $(CFLAGS) -c -o $@ $< clean: rm -f *.o *.lst convfont *.xex distclean: clean rm -f *~ core .*.swp 1.* 2.* 1 2 3 map map.* *.map a b c foo bar baz %.xex: %.c $(CC) --mapfile map $(CFLAGS) -o $@ $< lorchatest: lorchatest.c draw_lorcha.s taifont.xex cl65 -t atari -O -T -o lorchatest1.xex lorchatest.c draw_lorcha.s cat taifont.xex lorchatest1.xex > lorchatest.xex atari800 -nobasic lorchatest.xex PORTSTAT.DAT: mkportstats.xex atari800 -nobasic mkportstats.xex