It is currently Sun Aug 25, 2019 10:16 pm

All times are UTC - 7 hours





Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
PostPosted: Thu Aug 15, 2019 8:05 am 
Offline

Joined: Sat May 26, 2018 6:14 am
Posts: 92
Location: Italy
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.

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


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:


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             


Thanks a lot! :)


Top
 Profile  
 
PostPosted: Thu Aug 15, 2019 3:19 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 4208
Location: A world gone mad
User: please do not make duplicate posts. Please see this thread for details of technical problems this forum is currently encountering, which could lead to duplicate posts: viewtopic.php?f=13&t=19133

Moderator: lock thread, duplicate post reference: viewtopic.php?f=2&t=19202


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group