OK,let's say I have 3 name table files.
Lev1.nam
Lev2.nam
Lev3.nam
And to load Background I'm using this code:
Pretty basic code,right?
The addrLO,and addrHI are declared in $10 and $11.
So here's my question:
It is possible to "load files by ID?"
I mean...For example.
If $44 have value 00 then Lev1 is loaded,If $44 have 01 then Lev2 is loaded.
One more question:It have to be ZP?(Zero page)
Lev1.nam
Lev2.nam
Lev3.nam
And to load Background I'm using this code:
Code:
LoadBackground:
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$20
STA $2006 ; write the high byte of $2000 address
LDA #$00
STA $2006 ; write the low byte of $2000 address
lda #low(Lev1)
sta addrLO
Lda #high(Lev1) ; start out at 0
sta addrHI
ldx #4
ldy #0
LoadBackgroundLoop:
LDA [addrLO], y ; load data from address (background + the value in x)
STA $2007 ; write to PPU
INy ; X = X + 1
BNE LoadBackgroundLoop ; Branch to LoadBackgroundLoop if compare was Not Equal to zero
inc addrHI
dex
bne LoadBackgroundLoop
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$20
STA $2006 ; write the high byte of $2000 address
LDA #$00
STA $2006 ; write the low byte of $2000 address
lda #low(Lev1)
sta addrLO
Lda #high(Lev1) ; start out at 0
sta addrHI
ldx #4
ldy #0
LoadBackgroundLoop:
LDA [addrLO], y ; load data from address (background + the value in x)
STA $2007 ; write to PPU
INy ; X = X + 1
BNE LoadBackgroundLoop ; Branch to LoadBackgroundLoop if compare was Not Equal to zero
inc addrHI
dex
bne LoadBackgroundLoop
Pretty basic code,right?
The addrLO,and addrHI are declared in $10 and $11.
So here's my question:
It is possible to "load files by ID?"
I mean...For example.
If $44 have value 00 then Lev1 is loaded,If $44 have 01 then Lev2 is loaded.
One more question:It have to be ZP?(Zero page)