Hello to everyone, I'm creating a new prototype for NES. I've an "action space matrix" where the player can move in 4 directions as you can see in the image.
I need to change the background into the matrix at runtime with some wall sprites. The matrix PPU address start at 2103 and it end at 2376. I created a loop to change the background tile by tile, row by row:
;2103 -> 2116
;2120 -> 2136
;...
;2303 -> 2376
when the loop goes to #$16 on the X register I need to "jump" from $2116 to $2120 and continue to write on PPU that auto increment by one every time. So, what's the best way to do that? I've to reset the address in this way at next row? Or there is a more efficent way?
Thanks a lot!
I need to change the background into the matrix at runtime with some wall sprites. The matrix PPU address start at 2103 and it end at 2376. I created a loop to change the background tile by tile, row by row:
;2103 -> 2116
;2120 -> 2136
;...
;2303 -> 2376
Code:
generate_random_walls:
lda $2002
lda #$21
sta $2006
lda #$03
sta $2006
ldx #$00
ldy #$00
.gen_random_walls_loop:
lda #$C2
sta $2007
inx
cpx #$14
bne .gen_random_walls_loop
.go_next_row:
lda $2002
lda #$21
sta $2006
lda #$03
sta $2006
ldx #$00
ldy #$00
.gen_random_walls_loop:
lda #$C2
sta $2007
inx
cpx #$14
bne .gen_random_walls_loop
.go_next_row:
when the loop goes to #$16 on the X register I need to "jump" from $2116 to $2120 and continue to write on PPU that auto increment by one every time. So, what's the best way to do that? I've to reset the address in this way at next row? Or there is a more efficent way?
Code:
lda $2002
lda #$21
sta $2020
lda #$03
sta $2006
lda #$21
sta $2020
lda #$03
sta $2006
Thanks a lot!