Zero Star Climbs Out of Two Years of Pure SNES Assembly

Inkbox spent two years writing every instruction of Zero Star by hand in 65c816 assembly so a Super Nintendo from 1990 could run a dungeon crawler of his own design. The result sits on itch.io as a 129-kilobyte ROM you load in Mesen or bsnes, pay what you want, and play tonight. Mountains of an imagined far east rise in shifting mazes. You climb them, throw talismans, and cut through flocks of jungle fowl until the counters on screen run out of room.
The SNES silicon runs at around 3.58 MHz, and the core is a Ricoh 5A22 processor. RAM is divided into two banks, with 128 kilobytes to play with and 64 kilobytes of video memory and an additional 64 kilobytes reserved for the audio processor. Inkbox did an excellent job of working within the confines of a very tiny four-megabyte cartridge, a size that would be difficult to find on a genuine game, and to make matters even more intriguing, the file is only a fraction of that size. That meant Inkbox had to be creative with his choices, such as not using bitmaps for tiles or pre-made maps, and instead handling collision detection by referencing the tile beneath the player rather than having a huge list of objects to examine.

Nintendo Switch 2 System
- The next evolution of Nintendo Switch
- One system, three play modes: TV, Tabletop, and Handheld
- Larger, vivid, 7.9” LCD touch screen with support for HDR and up to 120 fps

Background mode 1 allows you to have three layers on the screen at once, which is really impressive. Layer one contains the walkable world in 4-bit color, while Layer 2 sits on top and carries the HUD, which includes a level counter ticking up to ten thousand, a chicken count that retains its leading zeros, and a coin tally all displayed in packed binary-coded decimal, which is simply a fancy way of saying the processor does the carrying for free. Then there’s Layer 3, which depicts the faraway mountains in a crisp two bits per pixel. The use of 16×16 tiles allows you to stretch a 32×32 tilemap across a considerably bigger playfield, and the fact that the mountains drift in the background while the foreground remains perfectly still adds to the scene’s depth. This is accomplished by employing horizontal-blank DMA to rewrite scroll registers between scan lines.

World data is stored in RAM bank two because it’s a complicated beast, but essentially it’s a generator that stamps out random chambers and carves one-tile tunnels between them to keep the maze from fragmenting. The finished result is a 192×168 tile grid that is approximately 63 kilobytes in size, and the greatest part is that it can theoretically continue to grow until you are either too rich with ten thousand chickens or have reached level 10,000. When it comes to sprites, there are certain limitations: you can only have a total of 128 objects, with 32 per scan line, thus anything off-screen is swapped out to tile zero to keep the line from overrunning.

Chickens wander, flee, or chase based on a few simple states assigned to each item. When you hit one, the screen goes black for a frame due to some creative color math, and an explosive cloud appears in place of the bird. The four talismans you can gather all have the same throw animation: fire creates a trail of smoke, ice freezes a target in place, gold spawns several extra things, and peach does the same. When it comes to collision detection, however, things become clever; the processor only analyzes opponents that are visible on the screen, so it never wastes cycles on objects that are far away.

The audio is handled by a separate SPC700 CPU with 64 kilobytes of RAM. Inkbox ended up designing a completely new driver for that chip in its own assembly language, which was then built and copied across during start up. The samples are all in BRR format, and Dr Matt’s music is carried by five voices, with the remaining three voices covering sound effects for printing talismans and empty pockets. The driver is currently available on GitHub, so anyone looking to build their own SNES homebrew can simply pop it in and go. Hornests provided the background graphics, and the translucent cartridge shells came from a small-run board company. Mouse Bite Labs has also released the open designs that Inkbox utilized to get started.
[Source]
Zero Star Climbs Out of Two Years of Pure SNES Assembly
#Star #Climbs #Years #Pure #SNES #Assembly