Page 1 of 1
Tested on FCUEX 2.2.2 but no sprites on flashcard (solved!)
Posted: Tue Sep 03, 2019 12:11 am
by lazerbeat
I am working on a little program to make test scroll across the screen based on a user entered string
- scrollnesmod-1.png (1.62 KiB) Viewed 4660 times
This part works fine. I added in a little sprite field in the background on the scrolling text
- scrollnesmod-0.png (2.24 KiB) Viewed 4660 times
which works fine on FCUEX 2.2.2 but when I try it on my flash cart, I am using a famicom everdrive, the sprites don't show up in the background.
Does anyone have any idea what the issue might be?
I put a paste bin of the code here if anyone would be kind enough to look at it
https://pastebin.com/Wi44YFBf
Re: Tested fine on FCUEX 2.2.2 but no sprites on flashcard
Posted: Tue Sep 03, 2019 7:03 am
by gauauu
It looks like your sprite DMA call is too late in the frame, after VBlank has ended. You'll want to do any writes to the PPU as quickly as possible once VBlank starts.
Re: Tested fine on FCUEX 2.2.2 but no sprites on flashcard
Posted: Tue Sep 03, 2019 7:53 am
by NOOPr
The DMA routine must be called during V-Blank. So, try to call
updatesprites in
vblank.
Tip: try to change your code to work with NMI enabled rather than manual calling vblank and polling $2002, something like this:
Code: Select all
main_loop:
lda #0
sta nmiok
wait_nmi:
lda nmiok
beq wait_nmi
; game logic here
; ...
jmp main_loop
Code: Select all
nmi:
; preserve registers
pha
txa
pha
tya
pha
; Sprite DMA
lda #$00
sta $2003
lda #$02
sta $4014
; other vblank stuff here
; ...
lda #1
sta nmiok
; restore registers
pla
tay
pla
tax
pla
rti
Another tip: You don't need to test your game on the Everdrive to see the error, just do it in Mesen or Nestopia
Re: Tested on FCUEX 2.2.2 but no sprites on flashcard (solve
Posted: Tue Sep 03, 2019 4:12 pm
by lazerbeat
Thanks for the advice everyone that fixed the problem!
NOOPr wrote:
Tip: try to change your code to work with NMI enabled rather than manual calling vblank and polling $2002, something like this:
I will add this into the next version of my code. Thanks for the suggestion.