Checkpoint

This commit is contained in:
Lucas Scharenbroich 2022-08-01 21:46:00 -05:00
parent 7a6c4e5ff4
commit 5883de1f71
3 changed files with 41 additions and 3 deletions

View File

@ -169,4 +169,37 @@ _ScanlineBG0XPos
cmp :last_line_x2
jne :loop
rts
rts
; Unrolled copy routine to move BankTable entries into BNK_ADDR position. This is a bit different than the
; other routines, because we don't need to put values into the code fields, but just copy one-byte values
; into an internal array in bank 00 space. The reason for this is because the code sequence
;
; lda #ADDR
; tcs
; plb
;
; Take only 9 cycles, but the alternative is slower
;
; pea #$BBBB
; plb
; plb = 13 cycles
;
; If for some reason it becimes important to preserve the accumulator, or save the 208 bytes of
; bank 00 memory, then we can change it. The advantage right now is that updating the array can
; be done 16-bits at a time and without having to chunk up the writes across multiple banks. This
; is quite a bit faster than the other routines.
CopyTableToBankBytes
tsx ; save the stack
sei
jmp $0000
lda: 2,y
pha
lda: 0,y
pha
bottom
txs ; restore the stack
cli ; turn interrupts back on
rts

View File

@ -5,10 +5,12 @@
DP_ADDR equ entry_1-base+1 ; offset to patch in the direct page for dynamic tiles
BG1_ADDR equ entry_2-base+1 ; offset to patch in the Y-reg for BG1 (dp),y addressing
STK_ADDR equ entry_3-base+1 ; offset to patch in the stack (SHR) right edge address
BNK_ADDR equ entry_0-base+1 ; offset to patch in the address of a Bank 0 memory location to load the bank register
DP_ENTRY equ entry_1-base
TWO_LYR_ENTRY equ entry_2-base
ONE_LYR_ENTRY equ entry_3-base
BANK_ENTRY equ entry_0-base
CODE_ENTRY_OPCODE equ entry_jmp-base
CODE_ENTRY equ entry_jmp-base+1 ; low byte of the page-aligned jump address
@ -66,6 +68,9 @@ BankPatchNum equ *-BankPatches
; the code is assembled on a page boundary to help with alignment
ds \,$00 ; pad to the next page boundary
base
entry_0 lda #0000 ; Used to set per-scanline bank register
tcs
plb
entry_1 ldx #0000 ; Used for LDA 00,x addressing (Dynamic Tiles)
entry_2 ldy #0000 ; Used for LDA (00),y addressing (Second Layer; BG1)
entry_3 lda #0000 ; Sets screen address (right edge)

View File

@ -245,8 +245,8 @@ BuildBank
plb
plb
; Change the patched value to one of DP_ENTRY, TWO_LYR_ENTRY or ONE_LYR_ENTRY based on the capabilities
; that the engine needs.
; Change the patched value to one of BANK_ENTRY, DP_ENTRY, TWO_LYR_ENTRY or ONE_LYR_ENTRY based
; on the capabilities that the engine needs.
lda #DP_ENTRY
sta :entryOffset