It is currently Mon Sep 16, 2019 1:03 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue Sep 03, 2019 12:11 am 
Offline

Joined: Tue Jul 09, 2013 7:13 am
Posts: 63
I am working on a little program to make test scroll across the screen based on a user entered string

Attachment:
scrollnesmod-1.png
scrollnesmod-1.png [ 1.62 KiB | Viewed 174 times ]


This part works fine. I added in a little sprite field in the background on the scrolling text

Attachment:
scrollnesmod-0.png
scrollnesmod-0.png [ 2.24 KiB | Viewed 174 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


Attachments:
scrollnesmod.nes [40.02 KiB]
Downloaded 6 times


Last edited by lazerbeat on Tue Sep 03, 2019 4:10 pm, edited 1 time in total.
Top
 Profile  
 
PostPosted: Tue Sep 03, 2019 7:03 am 
Offline
User avatar

Joined: Sat Jan 09, 2016 9:21 pm
Posts: 624
Location: Central Illinois, USA
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.

_________________
My games: http://www.bitethechili.com


Top
 Profile  
 
PostPosted: Tue Sep 03, 2019 7:53 am 
Offline
User avatar

Joined: Tue Feb 27, 2018 10:41 am
Posts: 57
Location: Brazil
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:
main_loop:
   lda #0
   sta nmiok
wait_nmi:
   lda nmiok
   beq wait_nmi

   ; game logic here
   ; ...

   jmp main_loop

Code:
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

_________________
itch.io | github


Top
 Profile  
 
PostPosted: Tue Sep 03, 2019 4:12 pm 
Offline

Joined: Tue Jul 09, 2013 7:13 am
Posts: 63
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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