getting started on SNES
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
Re: getting started on SNES
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.
Re: getting started on SNES
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.
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.
Last edited by dougeff on Thu Mar 02, 2017 10:01 pm, edited 1 time in total.
nesdoug.com -- blog/tutorial on programming for the NES
Re: getting started on SNES
Solved...
Apparently I needed to add this at the end...
It only took me about 3 hours to figure out that
Apparently I needed to add this at the end...
Code: Select all
lda #$1f
sta $212C ;enable main screen!!!
nesdoug.com -- blog/tutorial on programming for the NES
Re: getting started on SNES
There's my lovely little sprites. Yay!
- Attachments
-
- sprites1.gif (6.71 KiB) Viewed 6831 times
nesdoug.com -- blog/tutorial on programming for the NES
Re: getting started on SNES
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 (25.86 KiB) Viewed 6822 times
nesdoug.com -- blog/tutorial on programming for the NES
Re: getting started on SNES
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)
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
-
- Posts: 271
- Joined: Sun Mar 27, 2011 10:49 am
- Location: Victoria, BC
Re: getting started on SNES
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
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
Re: getting started on SNES
I did test with higan/bsnes accuracy. It looks fine.
On hardware, Bg is fine. No sprites.
Tried pushing sprites every frame. No difference.
On hardware, Bg is fine. No sprites.
Tried pushing sprites every frame. No difference.
nesdoug.com -- blog/tutorial on programming for the NES
Re: getting started on SNES
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?
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?
Re: getting started on SNES
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.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).
Re: getting started on SNES
...that sounded really rude, didn't it?93143 wrote:and I'm not sure I'm impressed by his excuse
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.
Re: getting started on SNES
Yes.Do games work properly on your SNES?
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
-
- Posts: 271
- Joined: Sun Mar 27, 2011 10:49 am
- Location: Victoria, BC
Re: getting started on SNES
Mind posting your code so that we can take a look?
Re: getting started on SNES
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.
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.
Re: getting started on SNES
It's the Dropbox link above...the only thing I've changed from that is the Vectors.Mind posting your code so that we can take a look?
I don't think so.Writing to the second OAM table
CORRECTION - I think I'm filling it with zeros.
nesdoug.com -- blog/tutorial on programming for the NES