diff options
-rw-r--r-- | bank7.s | 66 | ||||
-rw-r--r-- | taipan.c | 14 |
2 files changed, 59 insertions, 21 deletions
@@ -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 + 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) @@ -769,6 +769,10 @@ void new_gun(void) { return; } +#ifdef CART_TARGET +# pragma code-name (push, "HIGHCODE") +#endif + /* cprintfancy_centered() does this for 0 to 999999: | 999999 | | 99999 | @@ -805,15 +809,25 @@ void cprintfancy_centered(unsigned long num) { } #endif +#ifdef CART_TARGET +# pragma code-name (pop) +#endif + /* if BIGNUM, cprintfancy() just converts to bignum and uses cprintfancy_big() to do the work. A bit slower, but fast enough, and avoids duplicate logic. */ #ifdef BIGNUM +# ifdef CART_TARGET +# pragma code-name (push, "HIGHCODE") +# endif void cprintfancy(unsigned long num) { bignum(b); ulong_to_big(num, b); cprintfancy_big(b); } +# ifdef CART_TARGET +# pragma code-name (pop) +# endif #else /* replaces old fancy_numbers. same logic, but stuff is just printed on the screen rather than being kept in a buffer. |