aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2016-02-05 18:19:38 -0500
committerB. Watson <yalhcru@gmail.com>2016-02-05 18:19:38 -0500
commitf417950fe61e814ac19212e7e3fbf44f355e37e6 (patch)
tree1e27d86932ed18bb146a35cd789ae5b6e9a3a90e
parent1b5679337664d22912c7233bc2b80199eefe685a (diff)
downloadtaipan-f417950fe61e814ac19212e7e3fbf44f355e37e6.tar.gz
abort loading if BASIC or a cart is present
-rw-r--r--Makefile13
-rw-r--r--cartmsg.txt1
-rw-r--r--checkmem.s74
3 files changed, 85 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 90a45ac..02237bc 100644
--- a/Makefile
+++ b/Makefile
@@ -131,8 +131,8 @@ taipan.atr: all
# The game binary is a multi-part binary load file. This rule
# depends on all the pieces, and just concatenates them.
-$(XEX): taimain.xex taifont.xex newtitle.xex comptitle.xex
- perl multixex.pl comptitle.xex newtitle.xex taifont.xex taimain.xex > $(XEX)
+$(XEX): checkmem.xex taimain.xex taifont.xex newtitle.xex comptitle.xex
+ perl multixex.pl checkmem.xex comptitle.xex newtitle.xex taifont.xex taimain.xex > $(XEX)
perl size.pl $(TAIMAIN_ADDR) $(STACK_SIZE)
# Bitmap data for the title screen, 256x184 = 47104 pixels, 8 bits
@@ -152,6 +152,13 @@ comptitle.xex: titledata.dat titlecomp.pl comptitle.s.in
perl titlecomp.pl 133 < titledata.dat
cl65 -l comptitle.lst -o comptitle.xex -t none --asm-define destination=$(TITLE_DATA_ADDR) comptitle.s
+# tiny 1-sector memory checker, aborts the laod if a cart is present.
+checkmem.xex: cartmsg.dat checkmem.s
+ cl65 -o checkmem.xex -t none checkmem.s
+
+cartmsg.dat: cartmsg.txt text2screen.pl
+ perl text2screen.pl cartmsg.txt > cartmsg.dat
+
# Init segment that loads after the title screen data. It sets up
# a custom display list and sets the GTIA for narrow playfield,
# then waits for a keypress. Afterwards, it restores the OS's
@@ -236,7 +243,7 @@ convfont: convfont.c
# Obligatory clean and distclean rules.
clean:
- rm -f *.o *.lst convfont *.xex AUTORUN.SYS taipan.atr ver.dat help.dat tags
+ rm -f *.o *.lst convfont *.xex AUTORUN.SYS taipan.atr ver.dat help.dat tags cartmsg.dat
distclean: clean
rm -f *~ core .*.swp 1.* 2.* 1 2 3 map map.* *.map a b c foo bar baz comptitle.s comptitle.dat
diff --git a/cartmsg.txt b/cartmsg.txt
new file mode 100644
index 0000000..350e093
--- /dev/null
+++ b/cartmsg.txt
@@ -0,0 +1 @@
+48K required. Remove cartridge.
diff --git a/checkmem.s b/checkmem.s
new file mode 100644
index 0000000..b48c12b
--- /dev/null
+++ b/checkmem.s
@@ -0,0 +1,74 @@
+
+; initial load segment for taipan. intended to be a tiny (1-sector)
+; routine that checks for the presence of BASIC or a cartridge, and
+; aborts the load if found.
+
+; cl65 -o checkmem.xex -t none checkmem.s
+
+ .include "atari.inc"
+
+start = $0600 ; use page 6 for now
+
+ .word $ffff
+ .word start
+ .word end-1
+
+ .org start
+
+msg:
+ .incbin "cartmsg.dat"
+msglen = * - msg - 1
+
+S: .byte "S:",0
+init:
+ ldx #6*$10 ; CLOSE #6
+ lda #CLOSE
+ sta ICCOM,x
+ jsr CIOV
+
+ ; GRAPHICS 0
+ ldx #6*$10 ; IOCB #6
+ lda #OPEN
+ sta ICCOM,x
+ lda #$1c ; $c = read/write
+ sta ICAX1,x
+ lda #0 ; aux2 byte zero
+ sta ICAX2,x
+ lda #<S
+ sta ICBAL,x
+ lda #>S
+ sta ICBAH,x
+ jsr CIOV
+
+ lda RAMTOP
+ cmp #$c0
+ bcs done ; if ramtop is $c000, we're OK
+
+ ; if ramtop is below $c000, we have a cartridge (or XL BASIC)
+ lda #<msg
+ sta FR0
+ lda #>msg
+ sta FR0+1
+
+ ldy #msglen
+msgloop:
+ lda (FR0),y
+ sta (SAVMSC),y
+ dey
+ bpl msgloop
+
+wait4key:
+ lda CH
+ cmp #$ff
+ beq wait4key
+ jmp WARMSV
+
+done:
+ rts
+
+end:
+ .word INITAD
+ .word INITAD+1
+ .word init
+
+