aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile16
-rw-r--r--bank2.old.s13
-rw-r--r--bank2.s18
-rw-r--r--bank3.s162
-rw-r--r--bank7.s169
-rw-r--r--taipan.c7
6 files changed, 190 insertions, 195 deletions
diff --git a/Makefile b/Makefile
index 98ba69f..76bbbd9 100644
--- a/Makefile
+++ b/Makefile
@@ -348,22 +348,22 @@ bank0: splitrom.raw.0 fill256
bank1: splitrom.raw.1 fill256
cat splitrom.raw.1 fill256 > bank1
-bank2: splitrom.raw.2 fill256
+#bank2: splitrom.raw.2 fill256
+# cl65 -l bank2.lst -m bank2.map -t none -o bank2 bank2.s
+
+bank2: rodata.8000 bank2.s taifont romable_taimain.raw
cl65 -l bank2.lst -m bank2.map -t none -o bank2 bank2.s
-bank3: rodata.8000 bank3.s taifont romable_taimain.raw
+bank3: bank3.s titledata.dat ver.dat help.dat newtitle.s
cl65 -l bank3.lst -m bank3.map -t none -o bank3 bank3.s
-bank7: bank7.s titledata.dat ver.dat help.dat newtitle.s
- cl65 --asm-define BANK2SIZE=`$(PERL) -e 'print -s "splitrom.raw.2"'` -l bank7.lst -m bank7.map -t none -o bank7 bank7.s
-
# raw ROM, for burning to EPROM/flash.
-taipan.rom: bank0 bank1 bank2 bank3 bank7 blankbank
- cat bank0 bank1 bank2 bank3 blankbank blankbank blankbank bank7 > taipan.rom
+taipan.rom: bank0 bank1 bank2 bank3
+ cat bank0 bank1 bank2 bank3 > taipan.rom
# .cart version with atari800-compatible header.
taipan.cart: taipan.rom mkcart
- ./mkcart -otaipan.cart -t13 taipan.rom
+ ./mkcart -otaipan.cart -t12 taipan.rom
./mkcart -ctaipan.cart
cart: checkenv taipan.cart
diff --git a/bank2.old.s b/bank2.old.s
new file mode 100644
index 0000000..6f36b38
--- /dev/null
+++ b/bank2.old.s
@@ -0,0 +1,13 @@
+
+start = $8000
+end = $9fff
+ .org start
+ .incbin "splitrom.raw.2"
+
+ .if * > end
+ .fatal "bank2 code too large"
+ .else
+ .out .sprintf("=> %d bytes free in bank 2", end - *)
+ .endif
+
+ .res end-*+1, $ff
diff --git a/bank2.s b/bank2.s
index 6f36b38..1b68038 100644
--- a/bank2.s
+++ b/bank2.s
@@ -1,13 +1,17 @@
-start = $8000
-end = $9fff
- .org start
- .incbin "splitrom.raw.2"
+ .include "atari.inc"
- .if * > end
+ ; where the font lives. Must agree with bank3.s.
+font = $9c00
+
+ .org $8000
+ .incbin "rodata.8000"
+
+ .if * > font
.fatal "bank2 code too large"
.else
- .out .sprintf("=> %d bytes free in bank 2", end - *)
+ .out .sprintf("=> %d bytes free in bank 2", font - *)
.endif
- .res end-*+1, $ff
+ .res font - *, $ff
+ .incbin "taifont"
diff --git a/bank3.s b/bank3.s
index f719409..229826d 100644
--- a/bank3.s
+++ b/bank3.s
@@ -1,17 +1,163 @@
+; bank 3 of the cartridge image, to be built with -t none.
+; this bank is the fixed bank, always mapped at $a000-$bfff, in
+; the "left cartridge" area.
+
+ .macpack atari ; for scrcode (screen code) macro
+
.include "atari.inc"
- ; where the font lives. Must agree with bank7.s.
+; zero page temporaries
+destptr = FR0
+srcptr = FR1
+
+; where the romable_taimain code was org'ed.
+codedest = $0400
+
+; address of the font, which lives in bank 3 of the cart.
font = $9c00
- .org $8000
- .incbin "rodata.8000"
+; cc65's atari.inc fails to define this standard Atari label.
+CCNTL = $d500
+
+; cart_trailer is my name for what the OS calls CARTLOC.
+; cc65's atari.inc doesn't define it either.
+cart_trailer = $bffa
+
+ .org $a000 ; left cartridge
+
+screendata:
+ ; uncompressed title screen bitmap, $1700 bytes
+ .incbin "titledata.dat"
+
+ ;.out .sprintf("next byte after titledata is %x", *)
+
+; message to print when someone tries to boot the cart
+; in a 16K Atari.
+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_x_pages:
+; as above, but accepts number of pages to copy in X register.
+
+; copy_pages:
+; as copy_x_pages, but the caller must set up srcptr as well
+; as the X reg.
+
+copy_31_pages:
+ ldx #$1f
+copy_x_pages:
+ lda #$0
+ sta srcptr
+ lda #$80
+ sta srcptr+1
+copy_pages:
+ ldy #0
+@copypage:
+ lda (srcptr),y
+ sta (destptr),y
+ dey
+ bne @copypage
+ inc srcptr+1
+ inc destptr+1
+ dex
+ bne @copypage
+init:
+ rts
- .if * > font
- .fatal "bank3 code too large"
+memory_error:
+ lda #$20 ; red BG
+ sta COLOR2
+ ldy #mem_msg_len
+@mloop:
+ lda mem_msg,y
+ sta (SAVMSC),y
+ dey
+ bpl @mloop
+@hang:
+ bmi @hang
+
+ .out .sprintf("fudge factor: %d bytes", $b744-*)
+ .res $b744-*, $ff ; fudge factor, keep the DL from crossing a 1K boundary
+
+ ; newtitle.s is the display list and menu code. CART_TARGET is used
+ ; for conditional assembly (to make it work from ROM).
+CART_TARGET = 1
+ .include "newtitle.s"
+
+cartstart:
+ lda RAMTOP
+ cmp #$80
+ beq mem_ok
+ jmp memory_error
+
+mem_ok:
+; turn off ANTIC DMA to speed up copying to RAM
+ lda #0
+ sta SDMCTL
+ sta DMACTL
+
+; copy code to RAM
+ lda #<codedest
+ sta destptr
+ lda #>codedest
+ sta destptr+1
+
+ ; banks 0 and 1 are full of code (minus the top page), bank 2
+ ; is partially full. At some point, bank 2 might disappear, if
+ ; 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
+
+ lda #1 ; bank 1...
+ sta CCNTL ; ...select it
+ jsr copy_31_pages
+
+ ; tail end of the code is stored in this bank.
+ lda #<code_tail
+ sta srcptr
+ lda #>code_tail
+ sta srcptr+1
+ ldx #(>code_tail_size)+1
+ jsr copy_pages
+
+ ; bank 2 contains our font, RODATA, and some code (HIGHCODE seg) that
+ ; runs from ROM rather than being copied to RAM. It stays enabled the
+ ; entire time the game is running.
+ lda #2 ; bank 2...
+ sta CCNTL ; ...select it
+
+ lda #1
+ sta COLDST ; System Reset = reboot
+ jsr start ; 'start' is from newtitle.s
+ jsr codedest ; run the game (romable_taimain)
+ jmp cartstart ; redisplay title screen if "play again? N"
+
+code_tail:
+ .incbin "splitrom.raw.2"
+ code_tail_size = * - code_tail + 1
+ .out .sprintf("code_tail_size $%x (%d pages)", code_tail_size, (>code_tail_size)+1)
+
+ .if * > cart_trailer
+ .fatal "bank7 code too large"
.else
- .out .sprintf("=> %d bytes free in bank 3", font - *)
+ .out .sprintf("=> %d bytes free in bank 3, at %x", cart_trailer - *, *)
.endif
- .res font - *, $ff
- .incbin "taifont"
+ ; fill with 1 bits until the cart trailer
+ .res cart_trailer - *, $ff
+
+ ; trailer (some docs called it a 'header' but, eh, it doesn't come at
+ ; the head of the cart...)
+ ; see Mapping the Atari's entry for 'Cartridge B' or the Tech Ref Manual
+ ; for a description of this.
+ .word cartstart ; entry point
+ .byte 0 ; 0 = cartridge present
+ .byte 4 ; init and run the cart, don't boot the disk, non-diagnostic
+ .word init ; init address (just an RTS)
diff --git a/bank7.s b/bank7.s
deleted file mode 100644
index 4b8e207..0000000
--- a/bank7.s
+++ /dev/null
@@ -1,169 +0,0 @@
-
-; bank 7 of the cartridge image, to be built with -t none.
-; this bank is the fixed bank, always mapped at $a000-$bfff, in
-; the "left cartridge" area.
-
- .macpack atari ; for scrcode (screen code) macro
-
- .include "atari.inc"
-
-; zero page temporaries
-destptr = FR0
-srcptr = FR1
-
-; where the romable_taimain code was org'ed.
-codedest = $0400
-
-; address of the font, which lives in bank 3 of the cart.
-font = $9c00
-
-; cc65's atari.inc fails to define this standard Atari label.
-CCNTL = $d500
-
-; cart_trailer is my name for what the OS calls CARTLOC.
-; cc65's atari.inc doesn't define it either.
-cart_trailer = $bffa
-
- .org $a000 ; left cartridge
-
-screendata:
- ; uncompressed title screen bitmap, $1700 bytes
- .incbin "titledata.dat"
-
- ;.out .sprintf("next byte after titledata is %x", *)
-
-; message to print when someone tries to boot the cart
-; in a 16K Atari.
-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_x_pages:
-; as above, but accepts number of pages to copy in X register.
-
-; copy_pages:
-; as copy_x_pages, but the caller must set up srcptr as well
-; as the X reg.
-
-copy_31_pages:
- ldx #$1f
-copy_x_pages:
- lda #$0
- sta srcptr
- lda #$80
- sta srcptr+1
-copy_pages:
- ldy #0
-@copypage:
- lda (srcptr),y
- sta (destptr),y
- dey
- bne @copypage
- inc srcptr+1
- inc destptr+1
- dex
- bne @copypage
-init:
- rts
-
-memory_error:
- lda #$20 ; red BG
- sta COLOR2
- ldy #mem_msg_len
-@mloop:
- lda mem_msg,y
- sta (SAVMSC),y
- dey
- bpl @mloop
-@hang:
- bmi @hang
-
- .out .sprintf("fudge factor: %d bytes", $b744-*)
- .res $b744-*, $ff ; fudge factor, keep the DL from crossing a 1K boundary
-
- ; newtitle.s is the display list and menu code. CART_TARGET is used
- ; for conditional assembly (to make it work from ROM).
-CART_TARGET = 1
- .include "newtitle.s"
-
-cartstart:
- lda RAMTOP
- cmp #$80
- beq mem_ok
- jmp memory_error
-
-mem_ok:
-; turn off ANTIC DMA to speed up copying to RAM
- lda #0
- sta SDMCTL
- sta DMACTL
-
-; copy code to RAM
- lda #<codedest
- sta destptr
- lda #>codedest
- sta destptr+1
-
- ; banks 0 and 1 are full of code (minus the top page), bank 2
- ; is partially full. At some point, bank 2 might disappear, if
- ; 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
-
- lda #1 ; bank 1...
- sta CCNTL ; ...select it
- jsr copy_31_pages
-
- ;lda #2 ; bank 2...
- ;sta CCNTL ; ...select it
- ;ldx #(>BANK2SIZE)+1 ; BANK2SIZE defined on the command line
- ;jsr copy_x_pages
- ;.out .sprintf("BANK2SIZE $%x (%d pages)", BANK2SIZE, (>BANK2SIZE)+1)
-
- ; tail end of the code is now stored in this bank instead of bank 2.
- lda #<code_tail
- sta srcptr
- lda #>code_tail
- sta srcptr+1
- ldx #(>code_tail_size)+1
- jsr copy_pages
-
- ; bank 3 contains our font, RODATA, and some code that runs from ROM
- ; rather than being copied to RAM. It stays enabled the entire time
- ; the game is running.
- lda #3 ; bank 3...
- sta CCNTL ; ...select it
-
- lda #1
- sta COLDST ; System Reset = reboot
- jsr start ; 'start' is from newtitle.s
- jsr codedest ; run the game (romable_taimain)
- jmp cartstart ; redisplay title screen if "play again? N"
-
-code_tail:
- .incbin "splitrom.raw.2"
- code_tail_size = * - code_tail + 1
- .out .sprintf("code_tail_size $%x (%d pages)", code_tail_size, (>code_tail_size)+1)
-
- .if * > cart_trailer
- .fatal "bank7 code too large"
- .else
- .out .sprintf("=> %d bytes free in bank 7, at %x", cart_trailer - *, *)
- .endif
-
- ; fill with 1 bits until the cart trailer
- .res cart_trailer - *, $ff
-
- ; trailer (some docs called it a 'header' but, eh, it doesn't come at
- ; the head of the cart...)
- ; see Mapping the Atari's entry for 'Cartridge B' or the Tech Ref Manual
- ; for a description of this.
- .word cartstart ; entry point
- .byte 0 ; 0 = cartridge present
- .byte 4 ; init and run the cart, don't boot the disk, non-diagnostic
- .word init ; init address (just an RTS)
diff --git a/taipan.c b/taipan.c
index 2855589..5726f50 100644
--- a/taipan.c
+++ b/taipan.c
@@ -2097,7 +2097,9 @@ void final_stats(void)
for the xex build, exit(0) gets us back to DOS.
for the cartridge, it returns us to the title screen. */
-#ifndef CART_TARGET
+#ifdef CART_TARGET
+ __asm__("jmp $e477"); /* COLDSV, coldstart vector */
+#else
/* exit(0) works by itself in DOS 2.0S or 2.5, or any DUP.SYS
style DOS that reopens the E: device when entering the menu.
However, command-line DOSes (XL and Sparta) don't do this,
@@ -2111,9 +2113,8 @@ void final_stats(void)
color1save and color2save in newtitle.s. */
POKE(709, PEEK(0xcd));
POKE(710, PEEK(0xce));
-#endif
-
exit(0);
+#endif
}
char have_no_cargo(void) {