Hello,
I'm programming a small NES game, and I want to add a status bar to it, to display the score, etc. Without using tons of sprites. I'm using the NROM mapper so I'm trying to wait for the sprite zero hit to split the screen, so I added this to my game, after reading many posts about it and reading the nerdy nights tutorials code:At start I placed it at the beginning of the NMI, or at the end but then I saw that I should put it after updating the graphics, so I put it after loading the sprites... I also tried waiting for the VBLANK... None of it works... On some attempts it just froze the game, on others it did nothing... I started writing NES games two years ago, some parts of the code are also two years old, I don't code NES games very often because I quickly get discouraged by issues with the PPU...
Can someone please help me to understand where this code should run and why?
Thanks a lot.
Mibi88
EDIT:
I'm saving in the zeropage, in one byte the state of my program, if I'm on the title screen, in game or on the game over screen. Just at the start of the NMI I'm loading the sprites with
I'm programming a small NES game, and I want to add a status bar to it, to display the score, etc. Without using tons of sprites. I'm using the NROM mapper so I'm trying to wait for the sprite zero hit to split the screen, so I added this to my game, after reading many posts about it and reading the nerdy nights tutorials code:
Code:
LDA #$00 STA PPUADDR STA PPUADDR STA PPUSCRL ; X scroll STA PPUSCRL ; Y scroll LDA #%10010000 STA PPUCTRL LDA #%00011110 STA PPUMASKWAITS0CLEAR: LDA $2002 AND %01000000 BNE WAITS0CLEARWAITS0SET: LDA $2002 AND %01000000 BEQ WAITS0SET ; Wait for the scanline LDX #$06WAITSCANLINE: DEX BNE WAITSCANLINE LDA scroll STA PPUSCRL ; X scroll LDA #$00 STA PPUSCRL ; Y scroll LDA #%10010000 STA PPUCTRL
Can someone please help me to understand where this code should run and why?
Thanks a lot.
Mibi88
EDIT:
I'm saving in the zeropage, in one byte the state of my program, if I'm on the title screen, in game or on the game over screen. Just at the start of the NMI I'm loading the sprites with
Code:
LDA #$02 ; Copy the sprite data into the PPU. STA PPUOAM
Statistics: Posted by Mibi88 — Sat May 18, 2024 5:12 am — Replies 3 — Views 362