Inline CopyChars subroutine back to Bank 3
parent
9711b4ecc1
commit
8eed2bd31a
|
@ -20,7 +20,6 @@ SEGMENTS {
|
||||||
AREADATA: load = PRG1, type = ro, optional = yes;
|
AREADATA: load = PRG1, type = ro, optional = yes;
|
||||||
ENEMYDATA: load = PRG1, type = ro, optional = yes;
|
ENEMYDATA: load = PRG1, type = ro, optional = yes;
|
||||||
CHARS: load = PRG2, type = ro, optional = yes;
|
CHARS: load = PRG2, type = ro, optional = yes;
|
||||||
COPYCHARS: load = PRG2, type = ro, optional = yes;
|
|
||||||
SOUNDENGINE: load = PRG2, type = ro, optional = yes;
|
SOUNDENGINE: load = PRG2, type = ro, optional = yes;
|
||||||
BANK3: load = PRG3, type = ro, optional = yes;
|
BANK3: load = PRG3, type = ro, optional = yes;
|
||||||
BANKSWITCH: load = PRG3, type = ro, optional = yes;
|
BANKSWITCH: load = PRG3, type = ro, optional = yes;
|
||||||
|
|
49
src/main.asm
49
src/main.asm
|
@ -714,7 +714,7 @@ ColdBoot:
|
||||||
jsr MoveAllSpritesOffscreen
|
jsr MoveAllSpritesOffscreen
|
||||||
jsr InitializeNameTables ; initialize both name tables
|
jsr InitializeNameTables ; initialize both name tables
|
||||||
inc DisableScreenFlag ; set flag to disable screen output
|
inc DisableScreenFlag ; set flag to disable screen output
|
||||||
jsr CopyCharsBankSwitch
|
jsr CopyChars ; Copy graphic tiles to CHR RAM
|
||||||
lda Mirror_PPU_CTRL_REG1
|
lda Mirror_PPU_CTRL_REG1
|
||||||
ora #%10000000 ; enable NMIs
|
ora #%10000000 ; enable NMIs
|
||||||
jsr WritePPUReg1
|
jsr WritePPUReg1
|
||||||
|
@ -17340,11 +17340,27 @@ EnemyDataBankSwitch:
|
||||||
ldx XStore
|
ldx XStore
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Graphic tiles and the graphics init copy routine are located in Bank 2; we switch back to Bank 0 when we are done
|
; Graphic tiles are located in Bank 2; we switch back to Bank 0 when we are done
|
||||||
CopyCharsBankSwitch:
|
CopyChars:
|
||||||
ldx #$02
|
ldx #$02
|
||||||
jsr BankSwitch
|
jsr BankSwitch
|
||||||
jsr CopyChars
|
lda #<Chars ; load the source address into a pointer in zero page
|
||||||
|
sta CharsCopy
|
||||||
|
lda #>Chars
|
||||||
|
sta CharsCopy+1
|
||||||
|
ldy #$0 ; starting index into the first page
|
||||||
|
sty PPU_CTRL_REG2 ; turn off rendering just in case
|
||||||
|
sty PPU_ADDRESS ; load the destination address into the PPU
|
||||||
|
sty PPU_ADDRESS
|
||||||
|
ldx #$20 ; number of 256-byte pages to copy
|
||||||
|
LoopCopyChars:
|
||||||
|
lda (CharsCopy),y ; copy one byte
|
||||||
|
sta PPU_DATA
|
||||||
|
iny
|
||||||
|
bne LoopCopyChars ; repeat until we finish the page
|
||||||
|
inc CharsCopy+1 ; go to the next page
|
||||||
|
dex
|
||||||
|
bne LoopCopyChars ; repeat until we've copied enough pages
|
||||||
ldx #$00
|
ldx #$00
|
||||||
jsr BankSwitch
|
jsr BankSwitch
|
||||||
rts
|
rts
|
||||||
|
@ -17382,28 +17398,3 @@ BankTable:
|
||||||
|
|
||||||
Chars:
|
Chars:
|
||||||
.incbin "chars.bin"
|
.incbin "chars.bin"
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------------
|
|
||||||
; GRAPHICS INIT LOADING
|
|
||||||
|
|
||||||
.segment "COPYCHARS"
|
|
||||||
|
|
||||||
CopyChars:
|
|
||||||
lda #<Chars ; load the source address into a pointer in zero page
|
|
||||||
sta CharsCopy
|
|
||||||
lda #>Chars
|
|
||||||
sta CharsCopy+1
|
|
||||||
ldy #$0 ; starting index into the first page
|
|
||||||
sty PPU_CTRL_REG2 ; turn off rendering just in case
|
|
||||||
sty PPU_ADDRESS ; load the destination address into the PPU
|
|
||||||
sty PPU_ADDRESS
|
|
||||||
ldx #$20 ; number of 256-byte pages to copy
|
|
||||||
LoopCopyChars:
|
|
||||||
lda (CharsCopy),y ; copy one byte
|
|
||||||
sta PPU_DATA
|
|
||||||
iny
|
|
||||||
bne LoopCopyChars ; repeat until we finish the page
|
|
||||||
inc CharsCopy+1 ; go to the next page
|
|
||||||
dex
|
|
||||||
bne LoopCopyChars ; repeat until we've copied enough pages
|
|
||||||
rts
|
|
||||||
|
|
Loading…
Reference in New Issue