Initializing the SNES takes LOTS OF CODE. Now, resources for SNES are hard to come by, so I forced myself to dive into Neviksti and Marc's initialization files. Now, believe me, it's a lot to deal with, so what I'll do is try to provide you with some important things that Neviksti's Init SNES file does. You could also take your own peak into his file, but if your the lazy coder, don't think it will be a quick & easy glimpse.
Notes on Macro Init SNES
- At one point, all the memory is cleared, so don't worry about having to clear any more memory after using this macro.
- The macro disables interrupts and switches to native mode right when it is called.
- It turns off decimal mode.
- It loads
#$1FFF(from bank 0) into the stack pointer register, which is the top of the SNES' scratchpad RAM.
- It sets the data bank = program bank before and after initialization
- Sets Direct Page to
$0000 (bank 0)
- Sets SNES to Normal Access time. (writes a 0 to
$420D) Notes: You can use fast mode without worry on an emulator. Using fast mode on a real SNES requires your flash to be 120ns or faster.
- Enables interrupts before finishing.
That's about all you need to know on that part. You don't need to understand all of what I said just yet. Just make sure you put the macro in right at the beginning of your code and your all set. OK, NEXT UP IS YOUR FIRST PROGRAM, REALLY THIS TIME!
Tutorial by [[bazz]]