From adecc6f859c75ae3fcc31a2f0924296607f8411c Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Thu, 25 Feb 2016 02:16:29 -0500 Subject: cart build now only uses 4 banks, next commit will switch to a 32K cart --- bank7.s | 66 ++++++++++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 45 insertions(+), 21 deletions(-) (limited to 'bank7.s') diff --git a/bank7.s b/bank7.s index 32e5a34..4b8e207 100644 --- a/bank7.s +++ b/bank7.s @@ -30,12 +30,13 @@ screendata: ; uncompressed title screen bitmap, $1700 bytes .incbin "titledata.dat" - .res $44, $ff ; fudge factor, keep the DL from crossing a 1K boundary + ;.out .sprintf("next byte after titledata is %x", *) - ; 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" +; 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). @@ -44,14 +45,19 @@ CART_TARGET = 1 ; 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 - tay sta srcptr lda #$80 sta srcptr+1 +copy_pages: + ldy #0 @copypage: lda (srcptr),y sta (destptr),y @@ -64,10 +70,6 @@ copy_x_pages: init: rts -mem_msg: - scrcode "Sorry, this game requires at least 32K" -mem_msg_len = * - mem_msg - 1 - memory_error: lda #$20 ; red BG sta COLOR2 @@ -80,11 +82,21 @@ memory_error: @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 - bne memory_error + beq mem_ok + jmp memory_error +mem_ok: ; turn off ANTIC DMA to speed up copying to RAM lda #0 sta SDMCTL @@ -107,10 +119,19 @@ cartstart: 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 + ;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+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 @@ -118,18 +139,21 @@ cartstart: lda #3 ; bank 3... sta CCNTL ; ...select it - .out .sprintf("BANK2SIZE $%x (%d pages)", BANK2SIZE, (>BANK2SIZE)+1) - 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", cart_trailer - *) + .out .sprintf("=> %d bytes free in bank 7, at %x", cart_trailer - *, *) .endif ; fill with 1 bits until the cart trailer @@ -140,6 +164,6 @@ cartstart: ; 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) + .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) -- cgit v1.2.3