It is currently Fri Apr 28, 2017 10:56 am

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Mon Oct 12, 2015 1:06 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 677
You can, of course, overlap OBJ tables and BG tile data, and use literally the same tiles for both. But only for 4bpp BG layers; otherwise you get a format mismatch. And of course both sprite tables combined would only cover half of the valid BG data range.


Top
 Profile  
 
PostPosted: Thu Oct 15, 2015 7:15 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1509
Location: DIGDUG
I need some help. I've been trying to write a "Hello World" SNES program, but so far it's been a total failure. I've modified it to just fill all BG tilemaps with tiles and display 2 sprites (and turn the background green)...

Except I'm getting nothing. Nothing but a blank green screen.

Here's the source files and snes file...I just want it to show ANYTHING at all on the screen. Can anyone explain to me what I'm doing wrong? I want to understand this, but the documents for SNES are hard to understand...especially VRAM writes / registers.

http://dl.dropboxusercontent.com/s/bsl0 ... /Hello.zip

EDIT: DON'T USE THIS CODE. BROKEN. LEFT HERE FOR REFERENCE.

Compiles with ca65.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Last edited by dougeff on Thu Mar 02, 2017 10:01 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Oct 15, 2015 12:59 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1509
Location: DIGDUG
Solved...

Apparently I needed to add this at the end...
Code:
lda #$1f
sta $212C ;enable main screen!!!


It only took me about 3 hours to figure out that :P

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Thu Oct 15, 2015 1:07 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1509
Location: DIGDUG
There's my lovely little sprites. Yay!


Attachments:
sprites1.gif
sprites1.gif [ 6.71 KiB | Viewed 692 times ]

_________________
nesdoug.com -- blog/tutorial on programming for the NES
Top
 Profile  
 
PostPosted: Thu Oct 15, 2015 2:10 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1509
Location: DIGDUG
I'd say I have success. The above link has been updated, if anyone wants to see source code for a working "Hello World" for the SNES.


Attachments:
sprites2.gif
sprites2.gif [ 25.86 KiB | Viewed 683 times ]

_________________
nesdoug.com -- blog/tutorial on programming for the NES
Top
 Profile  
 
PostPosted: Tue Feb 28, 2017 10:23 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1509
Location: DIGDUG
I got a Super Everdrive yesterday, tried this file, and none of the sprites appear on screen. (Sprites are letters, BG is numbers). Any ideas?

BTW, my loop is this...

Forever:
Jmp Forever

And my NMI/IRQ is...
Rti

Am I supposed to do something each frame to get sprites to work? I know you have to continually send sprite data on NES. (Or else they all jump to the corner of the screen)

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Tue Feb 28, 2017 11:23 am 
Offline

Joined: Sun Mar 27, 2011 10:49 am
Posts: 129
You should use bsnes(-plus) for testing, rather than Snes9X. It's more accurate, so if it works on there it'll be more likely to work on hardware.

Three guesses (in order from most to least likely):

You're writing data to VRAM during not-vblank

OR

You're relying on uninitialized RAM somehow

OR

Your header data is invalid somehow, causing the Super Everdrive to map it improperly


Top
 Profile  
 
PostPosted: Tue Feb 28, 2017 1:45 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1509
Location: DIGDUG
I did test with higan/bsnes accuracy. It looks fine.

On hardware, Bg is fine. No sprites.

Tried pushing sprites every frame. No difference.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Tue Feb 28, 2017 4:40 pm 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 677
OAM persists on SNES. You don't need to resend it.

Also, if you're actually using an interrupt, you need to clear the IRQ flag by reading $4211, or it will keep firing ad infinitum. According to fullsnes you don't actually have to read $4210 in an NMI, but it's good practice anyway (and I'm not sure I'm impressed by his excuse).

Do games work properly on your SNES?


Top
 Profile  
 
PostPosted: Tue Feb 28, 2017 6:35 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 18208
Location: NE Indiana, USA (NTSC)
93143 wrote:
According to fullsnes you don't actually have to read $4210 in an NMI, but it's good practice anyway (and I'm not sure I'm impressed by his excuse).

I'd say that reading $4210 on Super NES is approximately as required as reading $2002 on NES, but at least $2002 clears the PPU's first/second write latch.


Top
 Profile  
 
PostPosted: Wed Mar 01, 2017 1:20 am 
Offline

Joined: Fri Jul 04, 2014 9:31 pm
Posts: 677
93143 wrote:
and I'm not sure I'm impressed by his excuse

...that sounded really rude, didn't it?

His explanation was that the NMI flag is cleared at the end of VBlank, so unless you're disabling and re-enabling NMI, you shouldn't have to clear it yourself. I'm pretty sure nocash knows more about the SNES than I do, but it's not obvious to me what happens if your NMI routine ends before the flag is cleared.


Top
 Profile  
 
PostPosted: Wed Mar 01, 2017 1:25 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1509
Location: DIGDUG
Quote:
Do games work properly on your SNES?


Yes.
No problems with games, nor with the Everdrive.

It's a code problem. I just don't know enough SNES programming to understand, or fix.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Wed Mar 01, 2017 8:30 am 
Offline

Joined: Sun Mar 27, 2011 10:49 am
Posts: 129
Mind posting your code so that we can take a look?


Top
 Profile  
 
PostPosted: Wed Mar 01, 2017 1:28 pm 
Offline

Joined: Tue Nov 20, 2012 1:59 pm
Posts: 64
Are you writing correctly to the second OAM table? It's been a while since my SNES days, but I do seem to recall having a similar problem and it was caused by (IIRC) not correctly writing to the second OAM table that contains the X coordinates MSB and the sprite size.

Also, the way OAM works on the SNES seems weird to me. IIRC, you have the set the sprite number multiplied by either 2 or 4 when you write the OAM address low.


Top
 Profile  
 
PostPosted: Wed Mar 01, 2017 1:51 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1509
Location: DIGDUG
Quote:
Mind posting your code so that we can take a look?


It's the Dropbox link above...the only thing I've changed from that is the Vectors.

Quote:
Writing to the second OAM table


I don't think so.
CORRECTION - I think I'm filling it with zeros.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Nicole and 11 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