I'm wondering how the SNES finds the reset vector in my ROM file. I understand that the 65816 processor looks at the last 16 bytes for the reset, NMI, IRQ, etc. addresses(both for emulation and native mode).
I have written a little program, that will load some sprite data into VRAM, set some registers, and display a sprite. This is working fine. But here is what I don't understand: I made my ROM 32 kilobytes in size, the idea being that I (for now) have only one bank to deal with(so my ROM's $0000 - $7FFF are mapped to $00:$8000-$00:$FFFF). Now, I wrote the address of my reset routine ($21b5 + $8000) to the emulation mode reset vector at $7FFC and $7FFD of my ROM.
Now, when I load my ROM into a emulator and look into the memory debugger, I see that my reset vector is (mirrored?) at $FF:$FFFC and $FF:$FFFD. This is confusing me, how does the SNES know how to map/mirror $00:$7FFC to $FF:$FFFC? Again, the ROM is running fine and showing all the sprites I draw exactly the way I want them to show.
Thing is, I was planing to burn this ROM on a EPROM and try run it on a console, since I did that on a NES in the past for fun. If I've understood the SNES specs correctly, the smallest possible EROM size is 1 Mbit, so I'd have to mirror my ROM four times to fit into a 1Mbit EROM nicely. Yet how does the SNES find my reset vector?
EDIT: I assume it has something to do with the Map Mode($FFD5) set in the header, yet it eludes me.
Question about the SNES reset vector
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
Re: Question about the SNES reset vector
It doesn't. It just checks $FFFC in bank $00, and it's the cartridge's job to ensure that the correct memory is mapped there.
-
- Posts: 17
- Joined: Wed Apr 26, 2017 2:26 pm
Re: Question about the SNES reset vector
Thank you for your quick reply! I just found a document showing that the SNES will on reset "Jump to the address indicated by Reset Vector (00FFDH, 00FFCH)". Now off to some joypad input and movement
Re: Question about the SNES reset vector
A SNES ROM image is easily well-defined for any power of two in size; for the ones that are 32 KiB and smaller the map mode doesn't matter.
Re: Question about the SNES reset vector
00fffd, you forgot an f.Reset Vector (00FFDH, 00FFCH)
Also, this is actually at position 007ffc-d of the ROM, due to the way ROMs are always loaded to 8000-ffff in the memory map. (At least for LoROM)
This is my very dumb answer. One of the pins isn't connected. A15. Maybe one of the smart kids can explain it better.how does the SNES know how to map/mirror $00:$7FFC to $FF:$FFFC?
Edit. Bazz explains it here...
https://www.cs.umb.edu/~bazz/snes/cartridges/lorom.html
"The 32K gets mapped twice for the whole 64K, because of the A15 ordeal."
Last edited by dougeff on Fri Oct 20, 2017 5:41 pm, edited 1 time in total.
nesdoug.com -- blog/tutorial on programming for the NES
-
- Posts: 17
- Joined: Wed Apr 26, 2017 2:26 pm
Re: Question about the SNES reset vector
Yes, just a typo. I found that article about the "missing" A15 pin, information on the SNES from a system architecture point of view is quiet rare - then again, Nintendo was and still is very, very, very protective of their IPs.dougeff wrote:00fffd, you forgot an f.Reset Vector (00FFDH, 00FFCH)
Also, this is actually at position 007ffc-d of the ROM, due to the way ROMs are always loaded to 8000-ffff in the memory map. (At least for LoROM)
This is my very dumb answer. One of the pins isn't connected. A15.how does the SNES know how to map/mirror $00:$7FFC to $FF:$FFFC?
But I think I got it now and will once again embark om my quest to write the most glorious RPG there ever was - right after I get this sprite to move not just in one direction.