Skip to content

SRC Folder Overview

InsaneFirebat edited this page Aug 30, 2021 · 1 revision

main.asm

This is the starting point for the assembler. Other .asm files are referenced from here with the incsrc command.

macros.asm

This file contains macros for the assembler. When a macro is used elsewhere, the assembler replaces it with the code that is defined here. The most commonly used macros are for changing the width (8bit/16bit) of the accumulator (A) and index (X/Y) registers.

defines.asm

Defines are string replacements used by the assembler. They are used to label memory addresses and constant values so they are more humanly readable. During assembly, they will be converted into the proper binary values.

gamemode.asm

This file is for the game loop hijack where the game state code is located and executed. It's used to check inputs for matching controller shortcuts and execute them. At the end of any shortcut routines, the carry flag is either set to skip processing game state code, or cleared to continue execution when returning from the hijack.

save.asm

This is the savestate code which can be excluded if DFEATURE_SD2SNES is set to 0 as an assembler option in the build script.

infohud.asm

The bulk of the practice hack's features live here or are included here. Hijacks for timers, segments, and the HUD update routine are at the top. Subroutines are bundled into a common org. The main game loop routine handles input display, HUD display modes, and other features that need to be executed every frame. InfoHUD modes and room strats are incsrc'd from a separate file but still bundled in the common org when assembled. The very bottom of the file contains pointer tables for HUD graphics.

infohudmodes.asm

Due to the growing number of features, and the complexity of those new features, the HUD display modes were moved into a separate file to make infohud.asm easier to navigate.

menu.asm

The practice menu code starts here. Here you will find all of the framework needed to pause the game, draw the various menu options, navigate those options, and execute their functions. The data used to draw the menu options is incsrc'd here as mainmenu.asm and bundled in the same org.

mainmenu.asm

The data for each menu option is defined here. This is the primary starting point for contributors that don't have assembly knowledge. A clever system of macros are defined at the top of the file, along with some code specifically for Preset menus. The main menu section starts with a list of pointers to each menu item, followed by the menu macro (%cm_) which tells the code what type of option it is, what text to draw, and any other values and pointers needed. All of the options on the main menu are submenus, meaning they lead to another menu setup the same way (list of pointers, macros for each pointer, and any related code/data). Preset menus files are incsrc'd here but org'd separately.

presets.asm

Routines related to loading presets live here. Category preset data is incsrc'd at the bottom.

presets/*presets*_menu.asm

These files list the pointers and menu macros for a preset category. They are generated automatically by the teledump lua script.

presets/*presets*_data.asm

These files list the data that is loaded into memory by the preset routines. Each preset contains only the data that changed since the previous preset. These files are generated automatically by the teledump lua script.

minimap.asm

This file contains hijacks related to the HUD and minimap. Graphics for the HUD and map are included here as binary data files with the incbin command.

misc.asm

Despite the mundane name, this file contains a lot of critical code/data. Pause/unpause hooks, music/sound fx, artificial lag, copy protection, debug routines, door ASM and more!

init.asm

This file contains the SRAM initialization routine. All SRAM addresses should be initialized to a known/sane values before being used.

rng.asm

This file is for hijacks and code related to RNG features such as Phantoon's pattern selection.

fanfare.asm

Hijacks related to the item fanfare.

spriteprio.asm

This is an OAM routine hijack that allows Samus to be placed on the top graphics layer.