Thanks for your effort. I have just taken a look at it and I would have initialized $2100 with zero brightness, since you probably will show your first image on screen coming from a fade-out (black to the image).psycopathicteen wrote:Okay, I'm finished with the snes initiation code.
Somebody know if there have ever been a commercial game's source code leaked to the internet? I've read about how programmers did the game in those times, such as Secret of Evermore and its customized scripting system; I would like to know the inner of SNES games: how they manage events, the command scripts, drawing into VRAM, sprite creation, movement and collision, and so on.
So far, I reverse-ingeneered some games (Final Fantasy 6, Romancing Saga 3 and Treasure Hunter G) and all of them are different:
* FF6 uses different NMI routines for different kind of scenes (intro, worldmap and menus, at least, but I suppose they are different from NMI used in battles and cities), and the intro is built through a event queue (a RAM array) filled with routines that draw the Magitek armors, print the credits, set the HDMAs and manage the timing. The command script for the game is separated from the text script.
* RS3 uses different NMI routines for maps, battles, military battles and menus, pretty much like FF6. I didn't make through the event system, although I disassembled all the text scripting engine. The command script is not fully separated from the text script: the text script engine checks and writes some flags and variables to trigger some events or print different texts, so the text is mixed with those commands.
* THG is pretty tough, since it uses a mix between the previous: in each scene, the command script dictates which graphic chunk is to be decompressed, which VRAM address it has to be sent to, the CGRAM palette and some (so far) undefined things; there are 48 different commands. One of the commands points to a bunch of events that may occur in the current scene, and they are stored in a RAM array; there are 14 commands that defines each event. Finally, each scene has a bunch of dialogue pointers which are treated different from the events and which have their own 208 commands: variable and flag checking, text printing... pretty much like RS3. And my personal opinion is that the game was programmed in C, considering some data which looks like structs, the routine calling system, and so on...