include/system.h
The system library's one header: its types, its functions and its macros. More…
#include "types.h"#include "fixed_math.h"#include "edition.h"#include "system/asm.h"#include "system/definitions.h"#include "system/globals.h"#include "game/main_routine.h"#include "system/mul_fx.h"
Included by battle_internal.h, turn_end_tables.c, battle_effect_internal.h, field_engine_internal.h, field_internal.h, field_psynergy_internal.h, script_commands_internal.h, menu_internal.h, actor_wait_until_landed.c, emote_pop_tilted.c, field_effect_wave_scroll.c, map_metatile_set.c, whirlwind_update.c, world_map_gauge.c, world_map_objects.c, shop_internal.h, irq_table.c, math_table.c, window_internal.h, battle.h, battle_camera.h, battle_effect_state.h, battle_random.h, battle_state.h, battle_effect.h, field.h, flag_call.h, hanging_vine.h, lucky_dice.h, map.h, map_grid.h, script.h, script_commands.h, script_inline.h, world_map.h, game.h, inventory.h, main_routine_state.h, graphics.h, palette_buffers.h, jupiter_lighthouse_aerie.h, mars_lighthouse_shared.h, scene.h, scene_puzzles.h, staff_credit.h, title.h, trial_road.h, tundaria_tower.h, sound.h, sound_driver_symbols.h and 3 more.
Macros
| Name | Description | |
|---|---|---|
#define | SET_RGB (lvalue, r, g, b) | The io_reg group. |
#define | syRandomBelow (n) (syRandom() * (n) >> 16) | Random numbers. |
#define | OAM_DEPTH_WINDOW 240 | Depth slots of syOAMAddSpriteAtDepth: a higher slot is drawn in front. |
#define | OAM_DEPTH_FRONT 255 | |
#define | EFFECT_SPRITE_FRONT_DEPTH 250 | The depth slot the field Psynergy's effect sprites take: in front of every actor, whose slots are clamped below OAM_DEPTH_WINDOW, and among the window sprites' slots. |
#define | BATTLE_FAR_DEPTH toFIXED(32767) | The far depth well past the battlefield: the largest whole 16.16 number. |
#define | DMA0_STOP () | Stops DMA 0, which a scene may have left copying a line each HBlank: drops its start timing and repeat, then its enable, and reads the control back. |
#define | DMA_FILL16 (value, destination, size) | Fills size bytes at destination with the halfword value by DMA3, from a volatile copy of it on the stack. |
#define | DMA_FILL32 (value, destination, size) | Fills size bytes at destination with the word value by DMA3. |
#define | DMA_FILL32_CELL (cell, value, destination, size) | DMA_FILL32 through cell, a word the caller declares, so that a function filling several blocks sets one word before each (fdActorSystemInit's two fills). |
#define | CPU_FILL32 (value, destination, size) | pret's CpuFill32: repeats one word through the BIOS CpuSet service. |
#define | IO_WRITE16 (v, reg) | The io_write group. |
#define | IO_WRITE32 (v, reg) IO_WRITE16(v, reg) | Writes a value to a 32-bit register or memory location, in IO_WRITE16's shape. |
#define | IO_WRITE8 (v, reg) IO_WRITE16(v, reg) | Writes a value to an 8-bit register or memory location, in IO_WRITE16's shape. |
#define | syIORead16 (reg, variable) (*(variable) = *(reg)) | Reads a 16-bit register or memory location into the variable at variable: the battle engine's mosaic fade saves its background controls so, and Gaia Rock's slate and Anemos Inner Sanctum's symbol their blend levels. |
#define | IME_SAVE (ime, saved) | The irq_lock group. |
#define | IME_DISABLE (ime) | Disables interrupts by writing the pointer's own low halfword through it: REG_IME's address ends in 0x208, whose bit 0 is clear. |
#define | IME_RESTORE (ime, saved) | Restores IME from saved. |
#define | IRQ_LOCK (saved) | Disables interrupts and saves IME in saved; IRQ_UNLOCK restores it. |
#define | IRQ_UNLOCK (saved) | Restores the IME value saved by IRQ_LOCK. |
#define | IO_WRITE_QUEUE_PUSH (address, value, control) | Queues one register write with interrupts off; a write to a full queue is dropped. |
#define | IO_WRITE_QUEUE_PUSH_IME (ime, address, value, control) | Like IO_WRITE_QUEUE_PUSH, but keeps IME's address in the caller's ime variable while disabling and restoring interrupts. |
#define | IWRAM_FILL_WORDS (destination, size, value) | syWordsFill as a statement of its own, as twelve fills in the battle engine, its effects and the field engine's Psynergy are written: among them the battle camera's and the transition's curtain tiles, which The Broken Seal fills by DMA with DMA_FILL32_CELL. |
#define | IWRAM_COPY_WORDS (destination, source, size) | syWordsCopy as a statement of its own, as IWRAM_FILL_WORDS is: the link code copies the Djinn recovery table into its send buffer so, in the lobby and in the battle, as The Broken Seal's does. |
#define | RAM_CODE_LOAD (to, code, bytes) | The ram_code group. |
#define | RAM_CODE_LOAD_SLOT (slot, code, bytes) | As RAM_CODE_LOAD, into heap slot slot's block; syHeapSlotRelease frees it. |
Enumerations
| Name | Description | |
|---|---|---|
enum | CARTRIDGE_LANGUAGE { CARTRIDGE_LANGUAGE_ENGLISH, CARTRIDGE_LANGUAGE_GERMAN, CARTR … } | The cartridge's language, from its header (syGetLanguage). |
enum | anonymous enum { ENGINE_SUPER_LUCKY_DICE, ENGINE_LUCKY_WHEELS, ENGINE_LUCKY_D … } | The engines the main routine runs, how the game starts, and the overlays it loads. |
Functions
| Name | Description | |
|---|---|---|
void | fdPaletteCycleStart (void) | The event group. |
void | syCopyEventWords (Uint32 *dest, Uint32 *src, Uint32 byteCount) | Unused: copies byteCount bytes a word at a time. |
void | sySortEvents (void) | Bubble-sorts the event table by priority, highest first, so each pass runs its events from the highest priority down; removed events (EVENT_PRIORITY_REMOVED) rise to the front. |
void | syEventNoOperationA (void) | Unused: an empty function. |
void | syEventNoOperationB (void) | Unused: an empty function. |
Sint32 | sySuspendOverlayEvents (void) | Suspends every event whose function is in an overlay (EVENT_IN_OVERLAY) unless its flags hold EVENT_FLAG_KEEP_RUNNING, as sySuspendEvent does. |
Sint32 | syResumeOverlayEvents (void) | Resumes every event whose function is in an overlay, flagged or not. |
void | mnResumeFieldEvents (void) | Resumes the overlay events and tileset animations when a menu closes, and clears FLAG_WEATHER_HELD and FLAG_PALETTE_BLEND_HELD: undoes mnSuspendFieldEvents. |
Sint32 | mnSuspendFieldEvents (void) | Suspends the overlay events and tileset animations while a menu is open, and sets FLAG_PALETTE_BLEND_HELD and FLAG_WEATHER_HELD, so that the field's palette blend and weather stand still behind it (see mnResumeFieldEvents, which undoes it). |
Sint32 | syCountEventsInPass (Sint32 pass) | Returns how many events run in pass pass (EVENT_PASS_VBLANK or EVENT_PASS_TICK); before the event table is set up, the pass's high byte. |
void | syRunPassBeforeTickEvents (Sint32 pass) | Runs pass pass's events in table order, up to the first event of the tick pass: the VBlank handler's pass, whose events sort before the tick's. |
void | syInstallIWRAMAndIRQs (void) | The irq group. |
void | syIRQIgnore (void) | The handler of every interrupt nobody has claimed. |
void | sySynch (Sint32 ticks) | The system library's functions in the order of its stub table (src/system/stubs.s). |
void | syInitEvent (void) | Empties the event table: every slot gets no function, priority EVENT_PRIORITY_EMPTY and no flags. |
Sint32 | sySetEvent (EVENT_FUNC callback, Sint32 priority) | Adds an event running callback with priority priority, or gives an event already running it the new priority, and re-sorts the table. |
Sint32 | syCloseEvent (EVENT_FUNC callback) | Removes the event running callback: clears its function and gives it priority EVENT_PRIORITY_REMOVED, which no pass matches. |
Sint32 | sySuspendEvent (EVENT_FUNC callback) | Suspends the event running callback, or every event when callback is null, by setting EVENT_SUSPENDED in its priority's high byte, which then matches neither pass. |
Sint32 | syResumeEvent (EVENT_FUNC callback) | Resumes the event running callback, or every event when callback is null, by clearing EVENT_SUSPENDED. |
void | syExecuteEvent (Sint32 pass) | Runs one pass of the events: every event whose priority's high byte matches pass's (EVENT_PASS_VBLANK or EVENT_PASS_TICK), in table order. |
Uint32 | syRandom (void) | Advances the game's random number generator (the C library's classic linear congruential one), stores the new seed and returns its bits 8 to 23, 0 to 65535. |
ANGLE | syAtan (FIXED x, FIXED y) | Returns the angle of the vector (x, y), from 0 to TRIG_TURN - 1, measured from the y axis: 0 along +y, a quarter turn along +x; (0, 0) gives 0. |
Sint32 | sySquart (Sint32 value) | Returns the integer square root of value, rounded down. |
FIXED | sySquartFX (FIXED value) | Square root of a 16.16 fixed-point value, in 16.16. |
FIXED | sySin (ANGLE angle) | The sine of angle, a whole turn being TRIG_TURN, in 16.16. |
FIXED | syCos (ANGLE angle) | The cosine of angle, a whole turn being TRIG_TURN, in 16.16; it falls through into sySin a quarter turn on. |
void | syVectorAddPolarOffset (FIXED radius, ANGLE angle, POINT pos) | Moves the point pos by radius in direction angle on the ground plane: x by the cosine, z by the sine. |
void | syIntFunction (Uint32 irq, Sint32 vcount, INTERRUPT_HANDLER handler) | Installs handler for interrupt irq and enables that interrupt, or with a null handler disables it and installs the do-nothing handler. |
void | syHeapInit (void) | Empties the heap: clears the heap slots (both pool pointers and every slot) and sets the pools' next addresses to IwramHeap and EwramHeap. |
void * | syHeapSlotAllocate (Sint32 slot, Sint32 size) | Returns heap slot slot's block, first allocating size bytes for it (rounded up to words), from IWRAM when they fit and EWRAM otherwise. |
void * | syHeapSlotAllocateEWRAM (Sint32 slot, Sint32 size) | As syHeapSlotAllocate, but tries EWRAM first, for blocks that need room more than speed: the battle, shop and save state, among others. |
void | syHeapSlotRelease (Sint32 slot) | Releases heap slot slot's block, and with it every later block of the same pool, by setting the pool's next free address back to the block's start. |
Sint32 | syHeapGetRemainingEWRAM (void) | Returns the EWRAM bytes left to allocate, up to the end of EWRAM. |
void * | syHeapAllocate (Sint32 size) | Allocates size bytes (rounded up to words) with no heap slot, from IWRAM when they fit and EWRAM otherwise, and advances that pool's next address. |
void * | syHeapAllocateEWRAM (Sint32 size) | As syHeapAllocate, but tries EWRAM first. |
void | syHeapRelease (void *buf) | Releases buf, a block taken with no heap slot, and every later block of its pool, as syHeapSlotRelease does. |
void | syPrint (const Uint8 *src) | Prints the string text (at most DEBUG_TEXT_MAX_LENGTH characters) at the debug text cursor, wrapping from the end of the screen to its start, when debug text is on; the cursor moves past it. |
void | syPrintHex (Uint32 value, Sint32 digits) | Prints the last digits hexadecimal digits of value. |
void | syPrintDecimal (Sint32 value, Sint32 digits) | Prints the last digits characters of value in signed decimal. |
void | syPrintBlanks (Uint32 count) | Writes count blank characters at the debug text cursor and moves it on. |
Sint32 | syDecompressByteLZ (const void *src, void *dest) | As syDecompressTaggedLZ, with the byte LZ decoder. |
Sint32 | syDecompressTaggedLZ (const void *src, void *dest) | Decompresses the tagged LZ data at src to dest with a heap copy of its ARM decoder, and returns what the decoder returns. |
void | syVRAMCacheReset (void) | Frees every VRAM block and every cache entry. |
Sint32 | syVRAMCacheFreeEntry (Uint32 no) | Frees cache entry id and the VRAM it holds; returns -1 for an entry out of range. |
Sint32 | syVRAMCacheReleaseVRAM (Uint32 no) | Gives back entry id's blocks but keeps the entry taken, with size 1, so a later syVRAMCacheLoad can refill it. |
Sint32 | syVRAMCacheLoad (Uint32 no, Uint32 size, const void *src) | Loads size bytes from src into the sprite VRAM of cache entry id, reusing its blocks when the size is unchanged (src 0 loads nothing, VRAM_CACHE_CLEAR clears); returns the first sprite tile number, or 0 when it does not fit. |
Sint32 | syVRAMCacheFindFreeEntry (void) | Returns the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are in use. |
void | syPrintClear (void) | Blanks the debug text screen, homes the cursor and points BG0 at it. |
Sint32 | syOAMMatrixAllocateFromTransform (AFFINE_TRANSFORM *src) | Hands out the next OAM affine matrix for a sprite drawn with src's scale and rotation and fills it in. |
void | syOAMAddSpriteAtDepthClamped (void *entry, Sint32 slot) | As syOAMAddSpriteAtDepth, with the depth clamped below OAM_DEPTH_WINDOW, so that the sprite stays behind the windows' sprites. |
void | syWindowLoadGraphics (void) | Loads the window font and border tiles into BG character block 0, the window palette into WINDOW_PALETTE with its gradient colours, and the basic sprite palettes. |
void | syPaletteLoadBasicSpriteColors (void) | Loads the basic sprite palettes. |
void | syInitMatrix (void) | Sets up the one-level matrix stack and makes the current matrix the unit matrix. |
void | syUnitMatrixCurrent (void) | Resets CurrentMatrix to the unit matrix. |
void | syPushMatrix (void) | Saves CurrentMatrix into the save area (one level deep; a second save is ignored). |
void | syPopMatrix (void) | Restores CurrentMatrix from the save area, if syPushMatrix saved it. |
void | syMatrixRotate (Sint32 *angles) | Rotates CurrentMatrix about the X, Y and Z axes by angles, in that order. |
void | syRotX (ANGLE angle) | Rotates CurrentMatrix about the X axis by angle. |
void | syRotY (ANGLE angle) | Rotates CurrentMatrix about the Y axis by angle. |
void | syRotZ (ANGLE angle) | Rotates CurrentMatrix about the Z axis by angle. |
void | syMatrixTranslateVector (const POINT pos) | Translates CurrentMatrix by pos (x, y, z in 16.16). |
void | syMatrixScaleVector (const VECTOR scale) | Scales CurrentMatrix by scale (x, y, z factors in 16.16). |
void | syMatrixRotateTranslate (Sint32 *angles, POINT pos) | Rotates CurrentMatrix by angles and translates it by pos. |
void | syMatrixRotateTranslateScale (Sint32 *angles, POINT pos, VECTOR scale) | Rotates by angles, scales the rows by scale, translates by pos. |
void | syLookAtLoad (POINT camera, POINT target) | Makes the camera at eye looking at target the whole of CurrentMatrix. |
Sint32 | syConvert3Dto2D (const POINT point, struct PROJECTED_POINT *screen) | Projects point through CurrentMatrix into screen; returns its scale. |
void | syPerspective (Sint32 fieldOfView, FIXED nearDepth, FIXED farDepth) | Sets the projection from a vertical field of view (1/65536 turns). |
void | sySetScreenDist (Uint32 focal, Uint32 nearDepth, Uint32 farDepth) | Sets the projection's focal length and depth range directly. |
void | syCopyBuildStamp (void) | Copies the build stamp resource (three words) into BuildStampWork and writes the zero word that ends it. |
Sint32 | syDummyReturnZero (Sint32 resourceId, const Uint8 *table) | An exported stub that ignores its arguments and returns 0. |
void * | syResourceGetTableEntry (Sint32 resourceId) | Returns the ROM address of resource index from the resource directory. |
void | syResourceReservedNoOperation (Sint32 unused) | An exported stub that does nothing with its argument. |
void | syOverlayLoad (Uint32 index, void *dest) | Decodes the compressed code resource index to dest and resolves its long branches there, with a RAM copy of the ARM function that does what syCodeResolveLongBranches does; the copy is allocated and freed again. |
void | syScreenFadeToBlack (Sint32 frames) | Fades out to black over frames frames. |
void | syScreenFadeFromBlack (Sint32 frames) | Fades in from black. |
void | syScreenFadeToWhite (Sint32 frames) | Fades out to white. |
void | syScreenFadeFromWhite (Sint32 frames) | Fades in from white. |
void | syScreenFadeStart ( Sint8 bright, Sint32 layer, Uint32 start, Sint32 target, Sint32 frames) | Starts a fade of any layers, toward white when bright is 1, black when 0. |
void | syScreenFadeWait (void) | Waits a tick at a time until the running fade has finished. |
void | syDummyReservedNoOperationA (void) | Unused: five empty exports the stub table reserves. |
void | syDummyReservedNoOperationB (void) | |
void | syDummyReservedNoOperationC (void) | |
void | syDummyReservedNoOperationD (void) | |
void | syDummyReservedNoOperationE (void) | |
void | sySerialInit (void) | Resets the serial port into multiplayer mode, installs the serial and timer 3 interrupt handlers, clears SerialStateWork and points its packet buffers into its storage, clears the bulk transfer state and sets SerialExchangeActive, which starts the per-tick exchange. |
Sint32 | sySerialPollAndTransfer (void *send, void *receive) | Looks for the link partner and, once connected, does one exchange. |
void | syIOWriteQueueStore8 (Uint32 addr, Uint32 value) | |
void | syIOWriteQueueStore16 (Uint32 addr, Uint32 value) | |
void | syIOWriteQueueStore32 (Uint32 addr, Uint32 value) | |
void | syIOWriteQueueSetBits8 (Uint32 addr, Uint32 value) | |
void | syIOWriteQueueSetBits16 (Uint32 addr, Uint32 value) | |
void | syIOWriteQueueSetBits32 (Uint32 addr, Uint32 value) | |
void | syIOWriteQueueClearBits8 (Uint32 addr, Uint32 value) | |
void | syIOWriteQueueClearBits16 (Uint32 addr, Uint32 value) | |
void | syIOWriteQueueClearBits32 (Uint32 addr, Uint32 value) | |
void | syInputResetKeyRepeat (void) | Restarts the key repeat delay, so held keys wait the full delay again. |
void | syLookAt (POINT camera, POINT target) | Multiplies the camera at eye looking at target into CurrentMatrix. |
Uint32 | sySerialWaitForStatusMask (Sint32 mask) | Waits for the status bits in mask; returns this console's multiplayer id. |
void | sySerialRemoveIRQHandlers (void) | Clears SerialExchangeActive, which stops the per-tick exchange, and removes the link interrupt handlers. |
Sint32 | sySoundLoadReverbCode (Sint32 code) | Checks reverb code code's range and returns 0, loading nothing. |
Sint32 | sySerialStartSend (void *src, Sint32 size) | Starts sending size bytes from src to the partner in blocks of SERIAL_BLOCK_BYTES: sets the send source, size and block number that sySerialStepBlockTransfer works from. |
Sint32 | sySerialStartReceive (void *dest) | Starts receiving the partner's blocks into dest: sets the receive destination and clears the received size. |
void | sySerialWaitForSend (void) | Waits a tick at a time until the queued send is done, giving up after SERIAL_TRANSFER_TIMEOUT_TICKS ticks. |
void | sySerialWaitForReceive (void) | Waits a tick at a time until the queued receive is done, giving up after SERIAL_TRANSFER_TIMEOUT_TICKS ticks. |
void | sySerialWaitForTransfers (void) | Waits until both the send and the receive have finished, giving up after SERIAL_TRANSFER_TIMEOUT_TICKS ticks. |
Sint32 | sySerialGetActiveTransfers (void) | Returns SERIAL_SENDING while a send runs and SERIAL_RECEIVING while a receive runs. |
void | sySerialStepBlockTransfer (void) | Runs each VBlank after the exchange, called by syVBlankHandler: moves the bulk transfer on by one SERIAL_BLOCK_BYTES block each way. |
Sint32 | sySetEventFlags (EVENT_FUNC callback, Uint32 mask) | Stores mask as the flags of the event running callback (EVENT_FLAG_KEEP_RUNNING). |
struct UNIT * | gmUnitGet (Uint32 unitId) | Returns the unit of unitId: ISAAC to PIERS the characters, the ENEMY_BATTLE_SIZE from FIRST_ENEMY_UNIT the enemies of the current battle; NULL for anything else. |
Sint32 | syGameFlagGet (Sint32 flag) | Returns 1 when flags is set and 0 when it is clear. |
void | syGameFlagClear (Sint32 flag) | Clears flags. |
Uint32 | syGameFlagToggle (Sint32 flag) | Unused: flips flags and returns its new value. |
Sint32 | syGameFlagGetByte (Sint32 flag) | Returns the whole byte flags is in, a counter kept among the flags. |
Uint8 | syGameFlagIncrementByte (Sint32 flag) | Unused: adds 1 to the byte flags is in, stopping at GAME_FLAG_BYTE_MAX, and returns it. |
Uint8 | syGameFlagDecrementByte (Sint32 flag) | Unused: takes 1 from the byte flags is in, stopping at 0, and returns it. |
Sint32 | syGameFlagGetNibble (Uint32 flag) | Unused: returns the four bits a flag is in, 0 to 15. |
void | syGameFlagSetNibble (Sint32 flag, Sint32 value) | Unused: sets the four bits flags is in. |
Sint32 | syFindEvent (EVENT_FUNC callback) | Unused: returns the table index of the event running callback, or -1. |
Sint32 | syVRAMCacheCountFreeBlocks (void) | Counts the free blocks of the sprite VRAM cache. |
void | syWaitForVBlankInterrupt (void) | The tick and the console: waiting, interrupts, sleep, the cartridge's language and its build stamp. |
void | syVBlankHandler (void) | The VBlank interrupt handler, installed by syInit. |
void | syHalt (void) | The Game Pak interrupt's handler, in IWRAM: stops the console for good once the cartridge is pulled (the BIOS's Stop, again after any wake). |
void | BiosSoundBiasOff (void) | The BIOS's SoundBias: Off ramps the sound output's bias down before the console sleeps, On back up once it wakes, so the speaker does not click. |
void | BiosSoundBiasOn (void) | |
Sint32 | syGetLanguage (void) | Returns the language of this cartridge from the last letter of the game code in its header, as an CARTRIDGE_LANGUAGE. |
Sint32 | btRunStub (Sint32 entrance) | |
void | fdLuckyDiceRun (void) | Runs the Lucky Dice minigame until the player quits or cannot afford a throw. |
void | syOAMResetTick (void) | Sprites: their depth slots, affine matrices, VRAM and colours. |
void | syOAMAddSpriteAtDepth (void *entry, Sint32 slot) | Links a sprite entry at the head of depth slot slot's list (clamped to the RENDER_DEPTH_SLOT_COUNT slots) for this tick, and marks the slot taken. |
void | syOAMBuildBuffer (void *buf) | Builds this tick's OAM list in buffer, a scratch block of OAM_SIZE bytes, running its ARM function from a copy on the stack. |
struct SPR_ANIMATION * | fdSpriteAnimationAllocate (Sint32 id) | Takes a free sprite animation and starts it on animation id's first animation. |
Sint32 | fdSpritePictureCacheFindByTag (Sint32 key) | Returns the pictures loaded into the sprite picture cache with this tag, or 0. |
Sint32 | syPaletteGetBasicSpriteColors (void) | Returns the basic sprite palettes (SystemBasicColorPalette). |
Sint32 | syVRAMCacheAllocateBlocks (Uint32 id, Uint32 size) | Finds the first run of free blocks that holds size bytes and gives it to entry id, writing id into VramCacheBlockOwners for each block. |
Sint32 | syVRAMCacheFreeBlocks (Sint32 id) | Frees every block entry id owns in VramCacheBlockOwners. |
Sint32 | syVRAMCacheAllocateEntry (Sint32 size) | Takes a free cache entry, gives it size bytes of sprite VRAM and returns its number. |
Sint32 | syVRAMCacheReload (Sint32 id, const void *src) | Copies src again into entry id's VRAM, keeping its size. |
void | syMatrixSetRotateY (ANGLE angle) | Matrices and the projection. |
void | syTranslate (FIXED x, FIXED y, FIXED z) | Translates CurrentMatrix by x, y and z in 16.16. |
void | syMatrixSetTranslation (const POINT pos) | Sets the current matrix's translation and keeps its rotation. |
void | syMatrixScaleUniform (FIXED scale) | Scales CurrentMatrix by scale on all three axes. |
void | syScale (FIXED x, FIXED y, FIXED z) | Scales CurrentMatrix by x, y and z in 16.16. |
void | syScreenFadeUpdate (void) | Screen fades. |
void | syDecompressHalfwords (const void *src, void *dest) | Decompresses the halfword LZ stream at src to dest, with a copy of the ARM decoder on the stack. |
Sint32 | syDecompressMoveToFrontLZ (const void *src, void *dest) | As syDecompressTaggedLZ, with the move-to-front LZ decoder. |
Sint32 | mnAbilityIconLoadIntoSlot (Sint32 resource, Sint32 index) | Builds the icon of ability resource in a transfer block taken from HEAP_SLOT_ICON_TRANSFER, reloads VRAM cache entry index with it and returns the entry's first tile. |
void | syStringFormatDecimal (Sint32) | Writes a value to NumberTextBuffer right-aligned: spaces, a sign and its decimal digits. |
void | syStringFormatHex (Uint32) | Writes value as HEX_DIGITS hexadecimal digits to the number buffer. |
Sint32 | fdTilesetAnimationResumeAllStub (void) | Declarations other modules' code shares. |
Sint32 | fdTilesetAnimationSuspendAllStub (void) | |
void * | memcpy (void *dest, const void *src, unsigned long size) | |
Sint32 | syAffineMatrixBuild (Sint32 angle, Sint32 xScale, Sint32 yScale) | The affine group. |
void | BiosCpuSet (const void *src, void *dest, Uint32 control) | The dma group. |
static __inline__ void | BiosStop (void) | The BIOS's Stop (SWI 03h): stops the CPU and the screen until an enabled interrupt wakes them. |
static __inline__ void | syDMAXCopy (const void *src, void *dest, Uint32 control, volatile Uint32 *channel) | Starts a transfer on DMA channel channel: its source, destination and control written in one store. |
static __inline__ void | syCopyWords (volatile void *destination, const volatile void *source, Sint32 count) | Copies count words, a constant from 2 to 4, from source to destination with one block load and store: the pointers in r0 and r1, as syDMAXCopy takes them, and the words in r2 up. agscc's own block moves leave the pointers to the allocator and stop at three words: a 16-byte struct copy compiles to 12 and 4, and a struct copy of two or three words does not match either. |
void | sySoundSuspendDirectSoundStub (void) | The tick group. |
void | IwramSoundRenderVBlank (Sint32) | |
void | syHeapFillFreeWords (Uint32 value) | The heap_release group. |
static __inline__ void * | syHeapCallAlternatePool (void *(*allocate)(Sint32), Sint32 size) | A block of size bytes from the allocator given (syHeapAllocate or syHeapAllocateEWRAM), with no heap slot. |
void | syInputUpdateKeyRepeatAndDirection (void) | The input group. |
void | syInputHandleKeyInterrupt (void) | The keypad interrupt's handler. |
static inline void | syIRQLock (volatile Uint32 *saved) | Disables interrupts, keeping IME in a variable of the caller's that an interrupt may read. |
static inline void | syIRQUnlock (volatile Uint32 *saved) | Restores the IME that syIRQLock kept. |
void | syIOWriteQueueFlushPending (void) | The io_write_queue group. |
static inline FIXED | syMathMulFX (FIXED a, FIXED b) | The iwram_call group. |
static inline FIXED | syDivFX (FIXED divisor, FIXED value) | value * toFIXED(1) / divisor: the 16.16 ratio of two 16.16 numbers. |
static inline Sint32 | sySquartIWRAM (Sint32 value) | The integer square root, rounded down, of a value from 0; 0 for a negative one. |
static inline void | syMultiMatrix (const MATRIX matrix) | Multiplies matrix, a 3 by 3 matrix and a translation in 16.16 fixed point, into the current transform. |
static inline Sint32 | syCalcPoint (const POINT vector, POINT result) | Writes to result the 16.16 point vector moved by the current matrix: turned by its 3 by 3 part, then offset by its translation. |
static inline Sint32 | syIntegerDivide (Sint32 dividend, Sint32 divisor) | The quotient, rounded toward zero. |
static inline Uint32 | syIntegerDivideUnsigned (Uint32 dividend, Uint32 divisor) | The unsigned quotient, rounded down. |
static inline void * | syDecompressSpritePicture (const void *src, void *dest) | Unpacks a PICTURE_FORMAT_COMPRESSED picture into destination, a byte above 223 leaving that many less 223 bytes there untouched, and returns NULL; one whose first halfword is 0 is not packed, and comes back as the data after that halfword for the caller to decode. |
static inline Sint32 | syWordsClear (void *dest, Sint32 size) | Clears size bytes, rounded down to whole words, from destination. |
static inline Sint32 | syWordsFill (void *dest, Sint32 size, Uint32 value) | As syWordsClear, filling with value. |
static inline void | syWordsCopy (void *dest, const void *src, Sint32 size) | Copies size bytes, rounded down to whole words, from source to destination. |
FIXED | syIWRAMMulFX (FIXED a, FIXED b) | |
Sint32 | __divsi3 (Sint32 numerator, Sint32 denominator) | The compiler library's signed division and remainder, which the overlays import from the IWRAM functions (system/iwram_entry.s). |
Sint32 | __modsi3 (Sint32 numerator, Sint32 denominator) | |
void | syMatrixRewindStack (void) | The matrix group. |
void | syGetMatrix (MATRIX dest) | Copies CurrentMatrix to dest. |
void | syLoadMatrix (const MATRIX src) | Copies the matrix at src into CurrentMatrix. |
void | syMatrixBuildLookAt (POINT eye, POINT target, MATRIX out) | Builds in out the camera matrix of an eye at eye looking at target. |
static __inline__ void | syUnitMatrix (MATRIX matrix) | Sets a twelve-word matrix to the unit matrix: toFIXED(1) (1.0) on the rotation's diagonal, the rest 0. |
void | syColorBufferHalve (void *src, void *dest, Sint32 size) | The colour buffer functions (system/decompress_byte_lz.s), each of which copies its ARM kernel onto the stack by DMA and runs it there. |
Sint32 | syColorBufferScaleThreeQuarters (void *src, void *dest, Sint32 size) | Copies size bytes of colour levels at three quarters of each, returning what the kernel leaves in r0. |
void | syColorBufferDarken (void *src, Sint32 amount, void *dest, Sint32 size) | Copies size bytes of colour levels, each lowered by amount. |
void | syColorBufferBrighten (void *src, Sint32 amount, void *dest, Sint32 size) | Copies size bytes of colour levels, each raised by amount. |
void | syColorBufferHalveNonzero (Uint8 *src, Uint8 *dest, Sint32 size) | Copies size bytes of 8-bit pixels from source to destination, then halves each colour number left in source, so a drawing fades as it is shown: Lucky Wheels' trails (CANVAS_FADE_HALF). |
void | syColorBufferScaleNonzeroThreeQuarters (Uint8 *src, Uint8 *dest, Sint32 size) | syColorBufferHalveNonzero, taking each colour number to three quarters, for the trails that fade more slowly. |
Sint32 | syMathUnsignedMultiplyHighAdd (Sint32 value, Uint32 magic, Sint32 multiplier) | The high word of value times magic, plus value times multiplier: a division by a constant (system/trig.s). |
Uint32 | syBupFindLatestSector (Sint32 partId) | The save group. |
Uint32 | syBupReadPart (Sint32 partId, void *dest) | Loads the current copy of part partId (12,272 bytes) into dest. |
Uint32 | syBupDeletePart (Sint32 partId) | Invalidates the current copy of part partId. |
Sint32 | syBupCompareBytes (Uint8 *left, Uint8 *right, Sint32 count) | The save in flash. |
Sint32 | syBupChecksumSector (void) | Sums the 12,272 payload bytes of the workspace's three-sector buffer, the checksum its header keeps. |
Sint32 | syBupReadSector (Sint32 index) | Reads the three flash sectors from index on into the workspace's sector buffer. |
Uint32 | syBupWriteSector (Sint32 sector) | Programs the workspace's three-sector buffer into flash from sector sector on and verifies each, through the SDK's flash library's function for this chip, calling the progress function before the first and after each. |
Bool | syBupInvalidateSector (Sint32 index) | Overwrites sector index with a header for no part (BUP_PART_NONE) and clears its occupied entry. |
Uint32 | syBupSelectWriteSector (Sint32 partId) | Picks the free place, three sectors from a multiple of three, to write part partId to, at random among them. |
Uint32 | syBupGetLatestCounter (Sint32 partId) | Returns the highest counter among the copies of part partId. |
void | syBupSetProgressCallback (void (*progress)(Sint32 step)) | Sets the function the save calls between sector writes (0 for none) and starts its count again at 0 of BUP_SECTORS_PER_PART; does nothing while no save workspace (heap slot HEAP_SLOT_BUP) is allocated. |
Sint32 | syBupWritePart (Sint32 partId, void *src) | Saves the 12,272 bytes at src, three sectors less the header, as part partId: writes the new copy with the next counter, then invalidates the old one, updating the workspace's sector tables. |
Bool | syBupInitState (void) | Allocates the save workspace (heap slot HEAP_SLOT_BUP), installs the BUP_FLASH_TIMER handler of the SDK's flash library, identifies the flash chip (BUP_FLASH_IDENTIFY_ATTEMPTS tries, a tick apart) and reads each part's place, three sectors at a time, into the workspace's occupied, partId and counter tables: a place counts as taken when its signature and checksum are good, and of two copies of a part only the newer stays taken. |
Sint32 | syBupLoadFileSummaries (void) | Reads the summary of the latest save in each of the BUP_FILE_COUNT files, with its second play time from its next sector, clearing it first; returns how many files have one. |
void | syBupReleaseState (void) | Removes the flash timer handler and frees the save workspace's heap slot, with every block allocated after it in the same pool. |
Sint32 | fdAreaGetNameIndexStub (Sint32 scene, Sint32 entrance) | The scene group. |
Sint32 | sySerialPollStatus (void) | The serial group. |
Sint32 | sySerialExchangePayloads (void *send, void *receive) | Once connected (SERIAL_PHASE_CONNECTED), gathers the received payloads into receive and builds the next packet from send. |
void | sySerialPrepareSendPacket (void *payload) | Builds the packet to send in sendBuf[0] (SERIAL_PACKET): the packet number, the consoles not yet heard from, the checksum and the 24-byte payload. |
Uint8 | sySerialCollectReceivedPayloads (void *payload) | Swaps in the packets the interrupt handler finished, then copies the payload of each one whose checksum is good to payload (24 bytes per console), and records the consoles heard from in currentMask and receivedMask. |
void | sySerialEnableTransferTimer (void) | Lets the timer start transfers again once a link mode is set, by setting SerialStateWork.transferEnabled. |
void | sySerialDisableTransfer (void) | Disables the serial and timer 3 interrupts, stops the transfer timer and clears SerialStateWork.transferEnabled. |
void | syLinkBattleResetTransferState (void) | Clears the serial transfer for a link battle with interrupts off: nothing to send or receive, no flags, and status SERIAL_STATUS_RUNNING. |
void | sySerialHandleTransferInterrupt (void) | The serial and timer 3 interrupt, installed by sySerialInit: each one moves a halfword. |
Variables
| Name | Description | |
|---|---|---|
extern Uint16 | SleepActive | 1 while the CPU is stopped for sleep, until L and R wake it. |
extern const Uint8 | RomStart [] | The cartridge's first byte, as the link places it: the start of RomStart (rom_start.c). |
extern Uint32 | RandWork | syRandom's seed; Lucky Wheels seeds it with the play time, and a link battle's parent sends it as the turn's BattleRandomSeed. |
extern Uint8 | ResourceExecuteTransferCode [] | The function that runs the queued register writes, which syIOWriteQueueFlushPending copies onto its stack and runs. |
extern Uint8 | ResourceExecuteTransferSize [] | The size of ResourceExecuteTransferCode. |
extern const Uint8 | syResourcePatchThumbBranch [] | The ARM function that resolves a loaded overlay's long branches, run from a heap copy by syOverlayLoad. |
extern Uint8 | syResourcePatchThumbBranchCodeSize [] | The size of syResourcePatchThumbBranch (decompress_tagged_lz.s). |
extern Uint8 | OamDepthMasks [] | Which of the 256 depth slots of OamDepthLists hold sprites this tick, a bit a slot; syOAMResetTick clears it. |
extern void * | OamDepthLists [] | The 256 depth slots' list heads that every drawn sprite is linked into (syOAMAddSpriteAtDepth); syOAMResetTick empties them each tick. |
extern Uint8 | SpriteColorTables [][256] | Five tables that map a picture's 256 colour indices onto a sprite's palette, one for each palette a field sprite can take (field/sprite_color_tables.c). |
extern Uint16 | GraphicsExpandNibbleTable [] | Two 16-entry colour maps for 4bpp pixels: the first draws colour 1 as colour 10, the second leaves every colour as it is. |
extern const Uint8 | SystemBasicColorPalette [] | The basic sprite palettes, loaded for the debug text (syPaletteGetBasicSpriteColors). |
extern void * | ResourceDirectoryTable [] | Resources and decompression. |
extern const Uint8 | syDecompressHalfwordLZ [] | The halfword LZ decoder that syDecompressHalfwords runs from its stack. |
extern Uint8 | syDecompressHalfwordsCodeSize [] | The size of syDecompressHalfwordLZ, copied onto the stack by syDecompressHalfwords. |
extern const Uint16 | WindowPalette [] | Windows and their text. |
extern Uint8 | LinkTimeLabelString [] | The link battle timer's heading: TIME; TMPO. in Spanish, TEMPS in French. |
extern Uint8 | DebugTextEnabled | The debug text and the number strings it prints. |
extern Uint16 * | DebugTextCursor | Where the debug text writes next on its screen in BG0. |
extern Uint8 | NumberTextBuffer [] | The digits syStringFormatHex and syStringFormatDecimal write, right-aligned up to NumberTextHexEnd and NumberTextDecimalEnd. |
extern const Uint8 | StringHexDigits [] | The hexadecimal digits 0 to F, which syStringFormatHex writes from. |
extern Uint8 | NumberTextDecimalEnd [] | The end of syStringFormatDecimal's digits: syPrintDecimal prints the last places before it. |
extern Uint8 | NumberTextHexEnd [] | The end of syStringFormatHex's digits: syPrintHex prints the last places before it. |
Description
The system library's one header: its types, its functions and its macros. A
file that uses the system library includes this and nothing else of it, as a
Saturn program includes SGL's sgl.h. The name is the staff roll's: under
Programming, its first heading is System.
As SGL's sgl.h takes its types from sl_def.h, this takes the system library's
types and constants from system/definitions.h and its variables from
system/globals.h, and keeps the functions: the io_reg, event and irq groups'
first, then the stub table's prototypes, then each other group's inlines and
macros in turn.
The two inlines only the system library's own parts call,
sySerialAddErrorFlag and syUnitMatrixCurrentInline, are in
src/system/system_internal.h, not here: each inline that names a variable's
address takes a constant-pool label where it is defined, and a unit's later
functions number theirs after it. The game's units never defined those two,
and gmMainRoutineStateInitDefaults (game/game_units.c) compiles as the ROM
has it only with its labels numbered as they were.
Macros in detail
SET_RGB
#define SET_RGB(lvalue, r, g, b)
The io_reg group. The hardware's I/O registers and their bits. Stores an RGB
colour, built in a local of its own, as the palette functions several scenes
copy store each colour (scene/shared/palette_cycle_fade.c and its kin).
Referenced by fdPaletteCycleFade(), scChampaCliffCavesFadeColors() and scPaletteSetColorsFade().
Definition at line 33 of file system.h.
syRandomBelow
#define syRandomBelow(n) (syRandom() * (n) >> 16)
Random numbers. A random number from 0 to n - 1: n times a 16-bit random draw, over 65536.
Referenced by btAIChooseAction(), btAIChooseTarget(), btAutoBattleBuildActions(), btBuildEnemyActions(), btEnemyCalculateCoinReward(), btEnemyCalculateExperienceReward(), btFleePlayRun(), btFormationBuildEnemyList(), btStagingRunFlee(), fdEffectUpdateMarsSpark(), fdEffectWanderAroundAnchor(), fdEncounterCountStepsAndSelectFormation(), fdPsynergyGrowth(), fdPsynergyGrowthOnTarget(), fdPsynergyParch(), fdPsynergyRetreat(), fdRetreatUpdateSpark(), fdScoopDigUpItem(), fdTalkToActor(), fdWeatherUpdateLightning(), gmDataTransferGiveDefaultDjinn(), gmMainRoutineStateInitDefaults(), gmUnitLevelUp(), mnAbilityApplyToTargets(), mnForgeRollResult(), mnWindowSpriteUpdateAll(), scActorEmitMist(), scActorEmitSmoke(), scActorEmitSmokeUnused(), scAirsRockInsideLandInHall(), scAnemosInnerSanctumDullahanOpenTheWay(), scAnkohlRuinsLandFromFall(), scAquaRockInsideDrawSplashes(), scContigoRaiseLeaves(), scContigoSelectLuckyWheelsPrize(), scContigoWhirlLeaf(), scDehkanPlateauCrackPillar(), scDehkanPlateauLandFromFall(), scDustBurst(), scDustScatter(), scFlameThrowerSendSpark(), scGabombaStatueLandFromFall(), scGabombaStatueLayChannel(), scGabombaStatueLayPath(), scGabombaStatueLookAround(), scGabombaStatueWatchTheChargesStick(), scGaiaRockCircleLeaf(), scGaiaRockInsideCaskBursts(), scGaiaRockInsideFlickerPour(), scGaiaRockInsideLayMaze() and 48 more.
Definition at line 236 of file system.h.
OAM_DEPTH_WINDOW
#define OAM_DEPTH_WINDOW 240
Depth slots of syOAMAddSpriteAtDepth: a higher slot is drawn in front. The
windows' sprites, icons and cursors take the slots from OAM_DEPTH_WINDOW up,
in front of the field engine's and the battle engine's, and OAM_DEPTH_FRONT
is in front of everything.
Referenced by btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btPlaybackRun(), dbPsynergyTest2StartRocks(), fdEffectUpdateSparkles(), fdGroundParticlesDraw(), fdGroundParticlesUpdate(), fdMotesUpdate(), fdPsynergyCyclone(), fdPsynergyEndRing(), fdPsynergyGrindOnTarget(), fdPsynergyPound(), fdPsynergyRing(), fdPsynergyTremorOnTarget(), fdRisingParticlesUpdate(), fdSummonTabletPlayRunes(), fdTeleportPlaySparks(), fdTeleportPlayWhirl(), fdWeatherUpdateRain(), mnBattleCommandRowRun(), mnBattleDjinnMenuRun(), mnBattleDjinnMenuShowChangePreview(), mnBattleItemMenuRun(), mnBattleMenuUpdateEachTick(), mnBattlePsynergyMenuRun(), mnBattleStatusScreenRun(), mnBattleSummonMenuRun(), mnBattleTargetRunSelection(), mnIconMenuDrawIcons(), mnIconPushSlots(), mnItemIconGridDraw(), mnSelectionMenuDraw(), mnSelectionMenuDrawArrow(), mnStatusScreenShowMemberStatus(), scChampaCliffCavesStartFlash(), scEasternAlhafraStartFallingRocks(), scEpilogueLoadPortraitFrame(), scJupiterLighthouseStartBeam(), scMagmaRockInsideStartFallingRocks(), scMagmaRockStartFallingRocks(), scProxStartFallingRocks(), scTundariaTowerStartFallingRocks(), scVenusLighthouseEntranceStartDust() and syOAMAddSpriteAtDepthClamped().
Definition at line 288 of file system.h.
OAM_DEPTH_FRONT
#define OAM_DEPTH_FRONT 255
Referenced by fdEffectSpriteInit(), mnArrowSetPos(), mnCommandIconCreate(), mnCursorCreate(), mnDjinnShowJoinedMessage(), mnForgeRun(), mnGlyphAddBlankSprite(), mnGlyphDraw(), mnGlyphDrawAsSprite(), mnItemMenuRunList(), mnNameEntryEditMemberName(), mnPartyShowJoinedMessage(), mnPartyShowPairJoinedMessage(), mnPauseMenuChoose(), mnPsynergyMenuRunList(), mnSettingsMenuRun(), mnShopDrawStock(), mnShopRun(), mnTitleCreate(), mnWindowSpriteCreate(), mnWindowSpriteCreateCommandIcon(), mnWindowSpritePulse(), mnWindowSpriteUpdateAll(), scAnkohlRuinsDrawSand(), scClearEnterPassword(), scGaugeUpdate(), scTitleUpdateSpriteReveal() and scTrialRoadDrawRaceMap().
Definition at line 289 of file system.h.
EFFECT_SPRITE_FRONT_DEPTH
#define EFFECT_SPRITE_FRONT_DEPTH 250
The depth slot the field Psynergy's effect sprites take: in front of every
actor, whose slots are clamped below OAM_DEPTH_WINDOW, and among the window
sprites' slots.
Referenced by fdParticleBurstStart(), fdPsynergyBlaze(), fdPsynergyLash(), fdPsynergyParch() and scNorthernReachesShatterIceWall().
Definition at line 293 of file system.h.
BATTLE_FAR_DEPTH
#define BATTLE_FAR_DEPTH toFIXED(32767)
The far depth well past the battlefield: the largest whole 16.16 number.
Referenced by btEffectRunThor() and btStagingDispatchAction().
Definition at line 321 of file system.h.
DMA0_STOP
#define DMA0_STOP()
Stops DMA 0, which a scene may have left copying a line each HBlank: drops its start timing and repeat, then its enable, and reads the control back.
Referenced by fdLineScrollStop(), gmMainRoutineRun(), syInit() and syVBlankHandler().
Definition at line 384 of file system.h.
DMA_FILL16
#define DMA_FILL16(value, destination, size)
Fills size bytes at destination with the halfword value by DMA3, from a
volatile copy of it on the stack.
Referenced by mnMemoryFillHalfwordsDMA(), mnScanlineWindowFillSpans(), scAirsRockInsideWakeEntranceStatue(), scAirsRockInsideWakeHallStatue(), scAirsRockWhirlwindClearsFog(), scAirsRockWhirlwindClearsWall(), scAirsRockWhirlwindOpensTheTop(), scJupiterLighthouseFlashSky() and scShamanVillageBlowAwaySand().
Definition at line 394 of file system.h.
DMA_FILL32
#define DMA_FILL32(value, destination, size)
Fills size bytes at destination with the word value by DMA3.
Referenced by fdActorRelease(), fdActorShowItemIconById(), fdEffectInitSlots(), fdEffectStartBlankOverlay(), fdFadeOverlayFillTiles(), fdGroundParticlesStart(), fdHangingVineInit(), fdHeadingShow(), fdLineScrollInitWave(), fdMapGridLoadMap(), fdMapScreenInit(), fdMotesStart(), fdPaletteFadeInit(), fdParticleFree(), fdParticleInit(), fdPsynergyStartMindReadWave(), fdRopeInit(), fdScreenTransitionAllocateAndClearState(), fdScreenTransitionFillTilemapAndColorTile(), fdScreenTransitionStartDissolveHeld(), fdScreenTransitionStartWindowHeld(), fdSpriteAnimationClear(), fdTightropeInit(), fdWeatherStartRain(), fdWorldMapLoadGraphics(), mnDebugMenuInit(), mnDebugShortcutInit(), mnDebugSoundTestInit(), mnDebugWarpInit(), mnEndingImageInitStrips(), mnFileListSelectFile(), mnIconMenuOpen(), mnInitState(), mnPauseMenuInit(), mnShopInitState(), mnTitlePaletteFadeInit(), mnTitlePlaceLogoPiece(), scAirsRockInsidePoundStake(), scAirsRockInsideStepOntoStake(), scPrepareMap(), syBupInitState(), syBupLoadExtraSummary(), syBupLoadFileSummaries(), syHeapInit(), syInit(), syPrintClear() and sySerialInit().
Definition at line 404 of file system.h.
DMA_FILL32_CELL
#define DMA_FILL32_CELL(cell, value, destination, size)
DMA_FILL32 through cell, a word the caller declares, so that a function
filling several blocks sets one word before each (fdActorSystemInit's two
fills).
Referenced by fdActorSystemConfigure(), fdActorSystemInit(), fdEffectInitSparkles(), fdEffectStartFadeOverlay(), fdHeadingClose(), fdRisingParticlesStart(), fdSpriteDestroy(), fdSpriteViewerRun(), fdWeatherStartLightning(), fdWeatherStartLightningFlash(), fdWorldMapInitPerspective(), gmMainRoutineStateInitDefaults(), mnCreditsClearBuffer(), mnEndingImageShow(), mnTitleIntroShowLighthouse() and mnTitleIntroUpdateLogo().
Definition at line 416 of file system.h.
CPU_FILL32
#define CPU_FILL32(value, destination, size)
pret's CpuFill32: repeats one word through the BIOS CpuSet service.
Referenced by sySerialTestRun().
Definition at line 426 of file system.h.
IO_WRITE16
#define IO_WRITE16(v, reg)
The io_write group. The register writes and reads the whole game makes
through a local. Writes a value to a 16-bit register or memory location,
through a local of its own.
Referenced by btBackgroundShowZoomedPage(), btClearBg0Vofs(), btElementGlowInitStarField(), btElementGlowPlay(), btHighlightSetModes(), btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btTransitionResetBg0Scroll(), fdEffectStartFadeOverlay(), fdEffectStartWindowHBlankDMA(), fdGroundParticlesStart(), fdHoverGlowUpdate(), fdMapGridLoadMap(), fdMapScreenShow(), fdMotesStart(), fdPsynergyArrow(), fdPsynergyCyclone(), fdPsynergyEndRing(), fdPsynergyParch(), fdPsynergyRing(), fdPsynergyUpdateBurst(), fdPsynergyUpdatePound(), fdPsynergyUpdateRing(), fdStartEncounterTransition(), fdWeatherStartRain(), fdWorldMapEndStillImage(), fdWorldMapInitPerspective(), fdWorldMapPresentStillImage(), mnCreditsRun(), mnEndingImageStart(), mnFileListUpdatePulse(), mnGraphicsInstallBg1VCountHandler(), mnSaveDeletePartMasked(), mnSaveWritePartMasked(), scAirsRockInsideWakeEntranceStatue(), scAirsRockInsideWakeHallStatue(), scAirsRockWhirlwindClearsFog(), scAirsRockWhirlwindClearsWall(), scAirsRockWhirlwindOpensTheTop(), scAnkohlRuinsInitSand(), scCrackedTileFall(), scIdejimaApplyWaveLines(), scInit(), scIsletsStartWaveDMA(), scJupiterLighthouseFlashSky(), scLemuriaPalaceDrawMaps(), scLemuriaPalaceFadeMapsIn(), scLemuriaPalaceFadeMapsOut(), scLemuriaPalaceLoadMaps(), scLemuriaSpringDrainSpring() and 18 more.
Definition at line 539 of file system.h.
IO_WRITE32
#define IO_WRITE32(v, reg) IO_WRITE16(v, reg)
Writes a value to a 32-bit register or memory location, in IO_WRITE16's
shape.
Referenced by btElementGlowInitStarField(), fdSpriteAnimationReset(), mnBattleTargetRunSelection(), mnSaveBuildFileSummary(), sySoundSetFixedSampleFrequency(), sySoundTestRun() and syVBlankHandler().
Definition at line 548 of file system.h.
IO_WRITE8
#define IO_WRITE8(v, reg) IO_WRITE16(v, reg)
Writes a value to an 8-bit register or memory location, in IO_WRITE16's
shape.
Referenced by fdMapScreenShow(), fdPsynergyReveal(), mnTitleIntroRun(), scTaopoSwampSinkInMud(), sySuspendEvent() and sySuspendOverlayEvents().
Definition at line 552 of file system.h.
syIORead16
#define syIORead16(reg, variable) (*(variable) = *(reg))
Reads a 16-bit register or memory location into the variable at variable:
the battle engine's mosaic fade saves its background controls so, and Gaia
Rock's slate and Anemos Inner Sanctum's symbol their blend levels.
Referenced by btTransitionRunMosaicFadeOut(), scAnemosInnerSanctumLightSymbol(), scGaiaRockInsideRaiseSandTablet() and scGaiaRockInsideReadSandTablet().
Definition at line 557 of file system.h.
IME_SAVE
#define IME_SAVE(ime, saved)
The irq_lock group. Turning interrupts off around a change the interrupt
handlers also make, and back on as they were. Saves IME through ime, a
pointer to REG_IME, into saved.
Referenced by syIRQLock().
Definition at line 562 of file system.h.
IME_DISABLE
#define IME_DISABLE(ime)
Disables interrupts by writing the pointer's own low halfword through it:
REG_IME's address ends in 0x208, whose bit 0 is clear.
Referenced by syIRQLock().
Definition at line 570 of file system.h.
IME_RESTORE
#define IME_RESTORE(ime, saved)
Restores IME from saved.
Definition at line 577 of file system.h.
IRQ_LOCK
#define IRQ_LOCK(saved)
Disables interrupts and saves IME in saved; IRQ_UNLOCK restores it.
Referenced by btAppendLinkedActions(), btBackgroundSetPaletteLevel(), btEffectProcessPendingBlock2Transfer(), btEffectProcessPendingStampTransfer(), btEffectTransferCanvas(), btEffectTransferFullScreenImage(), btEffectTransferHalvedCanvas(), mnSaveDeletePartMasked(), mnSaveWritePartMasked(), scLinkLobbyInitSerial(), scLobbyResetTransferState(), scSettlementsCycleWaterColors(), syCloseEvent(), syFindEvent(), syIntFunction(), syLinkBattleResetTransferState(), syResumeEvent(), syResumeOverlayEvents(), sySerialInit(), sySerialStartReceive(), sySerialStartSend(), sySetEvent(), sySetEventFlags(), sySuspendEvent(), sySuspendOverlayEvents() and syWaitForVBlankInterrupt().
Definition at line 584 of file system.h.
IRQ_UNLOCK
#define IRQ_UNLOCK(saved)
Restores the IME value saved by IRQ_LOCK.
Referenced by btAppendLinkedActions(), btEffectProcessPendingBlock2Transfer(), btEffectProcessPendingStampTransfer(), btEffectTransferCanvas(), btEffectTransferFullScreenImage(), btEffectTransferHalvedCanvas(), mnSaveDeletePartMasked(), mnSaveWritePartMasked(), scLinkLobbyInitSerial(), scLobbyResetTransferState(), scSettlementsCycleWaterColors(), syCloseEvent(), syFindEvent(), syIntFunction(), syLinkBattleResetTransferState(), syResumeEvent(), syResumeOverlayEvents(), sySerialInit(), sySerialStartReceive(), sySerialStartSend(), sySetEvent(), sySetEventFlags(), sySuspendEvent() and sySuspendOverlayEvents().
Definition at line 593 of file system.h.
IO_WRITE_QUEUE_PUSH
#define IO_WRITE_QUEUE_PUSH(address, value, control)
Queues one register write with interrupts off; a write to a full queue is
dropped. control is an IO_WRITE_ width, with IO_WRITE_SET or
IO_WRITE_CLEAR, to write value to address; or a DMA control word, to copy
by DMA 3 from value to address.
Referenced by btBackgroundSetMode(), btEffectConfigureEffectDisplay(), btEffectEndCanvasLayer(), btEffectHideBg1AndRestoreBackdrop(), btEffectOpenCanvasLayer(), btEffectRunAzul(), btEffectRunBackgroundFadeIn(), btEffectRunCanvasBurst(), btEffectRunCharon(), btEffectRunCloudSwirl(), btEffectRunCoatlicue(), btEffectRunGeode(), btEffectRunJudgment(), btEffectRunMegiddo(), btEffectRunMeteorBlow(), btEffectRunSerac(), btEffectRunShatteringOpening(), btEffectRunTorch(), btEffectRunUlysses(), btEffectStartCanvasLayer(), btEffectStartElementStreaks(), btElementGlowPlay(), btIrisWipeScreen(), btTransitionRun(), fdMapScreenShow(), fdMapScreenUpdateMarkers(), fdPaletteFadeUpdate(), fdScreenTransitionStart(), fdScreenTransitionUpdateDissolve(), fdWorldMapUpdateRegionTint(), mnBattleCommandRowRun(), mnCreditsLoadBackground(), mnEndingImageShow(), mnTitlePaletteFadeUpdate(), scApojiiIslandsCycleAquaStoneColors(), scApojiiIslandsCycleFallsColors(), scApojiiIslandsCycleSeaColors(), scApojiiIslandsDouseAquaStone(), scAquaRockInsideBlockMoaiWithPillar(), scClearFadeInBlend(), scInit(), scMarsLighthouseHallCycleHallInscriptions(), scMarsLighthouseHallCycleLedgeInscription(), scMarsLighthouseHallFadeDoorway(), scMarsLighthouseHallStartDoorways(), scShamanVillageUpdateLettering(), scStaffCreditPlayLighthouseTransition(), scStaffCreditShowBeacon(), scTitleRevealScreen(), scTreasureIsleCycleWaterColors() and 3 more.
Definition at line 625 of file system.h.
IO_WRITE_QUEUE_PUSH_IME
#define IO_WRITE_QUEUE_PUSH_IME(ime, address, value, control)
Like IO_WRITE_QUEUE_PUSH, but keeps IME's address in the caller's ime
variable while disabling and restoring interrupts.
Referenced by btElementGlowPlay().
Definition at line 645 of file system.h.
IWRAM_FILL_WORDS
#define IWRAM_FILL_WORDS(destination, size, value)
syWordsFill as a statement of its own, as twelve fills in the battle engine,
its effects and the field engine's Psynergy are written: among them the
battle camera's and the transition's curtain tiles, which The Broken Seal
fills by DMA with DMA_FILL32_CELL.
Referenced by btBackgroundInit(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunEclipse(), btEffectRunIris(), btEffectRunJudgment(), btEffectRunMeteorBlow(), btEffectRunStarfieldFall(), btEffectRunUlysses(), btEffectSetupBlendedDisplay(), btRun(), btTransitionRun(), fdBattleEffectStartCanvasSprite(), fdBgMapDrawClipped16x16(), fdPsynergyEndRing(), fdPsynergyLoadResources(), fdPsynergyPound(), fdPsynergyRing() and fdPsynergyStartSceneSprite().
Definition at line 745 of file system.h.
IWRAM_COPY_WORDS
#define IWRAM_COPY_WORDS(destination, source, size)
syWordsCopy as a statement of its own, as IWRAM_FILL_WORDS is: the link code
copies the Djinn recovery table into its send buffer so, in the lobby and in
the battle, as The Broken Seal's does.
Referenced by btLinkBattleSendParty() and scLinkLobbySendPartyRecords().
Definition at line 754 of file system.h.
RAM_CODE_LOAD
#define RAM_CODE_LOAD(to, code, bytes)
The ram_code group. Copying an ARM function to RAM to run it there: the
decoders, the overlay loader's branch patcher and the battle effects' canvas
functions. Copies the function code, bytes long (its linked size), into a
block taken with syHeapAllocate and points to at it; syHeapRelease frees
it.
Referenced by btBackgroundLoad(), btRenderDrawModelList(), btRenderRunFillMeshKernel(), btRenderTransformVertices(), fdSpriteComposePicture(), fdTileMapConvertBuffer(), fdTileMapDrawRowsFromRam(), mnCreditsLoadBackground(), mnEndingImageShow(), mnGlyphDraw(), mnIconDecode(), mnIconDecompress(), mnMessageFind(), mnScanlineWindowFillSpans(), syDecompressByteLZ(), syDecompressMoveToFrontLZ(), syDecompressTaggedLZ() and syOverlayLoad().
Definition at line 804 of file system.h.
RAM_CODE_LOAD_SLOT
#define RAM_CODE_LOAD_SLOT(slot, code, bytes)
As RAM_CODE_LOAD, into heap slot slot's block; syHeapSlotRelease frees it.
Referenced by fdActorSystemConfigure(), fdWorldMapInitPerspective(), mnMessageDecode() and mnMessageDecodeRaw().
Definition at line 815 of file system.h.
Enumerations in detail
CARTRIDGE_LANGUAGE
enum CARTRIDGE_LANGUAGE
The cartridge's language, from its header (syGetLanguage).
| Enumerator | Value | Description |
|---|---|---|
CARTRIDGE_LANGUAGE_ENGLISH | 1 | |
CARTRIDGE_LANGUAGE_GERMAN | ||
CARTRIDGE_LANGUAGE_FRENCH | ||
CARTRIDGE_LANGUAGE_ITALIAN | ||
CARTRIDGE_LANGUAGE_SPANISH |
Definition at line 223 of file system.h.
anonymous enum
enum { ENGINE_SUPER_LUCKY_DICE, ENGINE_LUCKY_WHEELS, ENGINE_LUCKY_DICE, ENGINE_BATTLE }
The engines the main routine runs, how the game starts, and the overlays it
loads. Engine ids above the scene table's rows, as The Broken Seal's ENGINE_
values (where 507 is ENGINE_NONE, running nothing): the engines other than
the field engine, which gmMainRoutineRun runs in place of a scene.
| Enumerator | Value | Description |
|---|---|---|
ENGINE_SUPER_LUCKY_DICE | 507 | Super Lucky Dice (fdSuperLuckyDiceRun), from Contigo's dealer |
ENGINE_LUCKY_WHEELS | 508 | Lucky Wheels (fdLuckyWheelsRun) |
ENGINE_LUCKY_DICE | 509 | Lucky Dice (fdLuckyDiceRun) |
ENGINE_BATTLE | 510 | a battle; the entrance is the formation |
Definition at line 250 of file system.h.
Functions in detail
sySin
FIXED sySin(ANGLE angle)
The sine of angle, a whole turn being TRIG_TURN, in 16.16.
Referenced by btEffectRunAzul(), btEffectRunBackstab(), btEffectRunBallLightning(), btEffectRunBind(), btEffectRunBolt(), btEffectRunBreak(), btEffectRunBreaths(), btEffectRunBurstShower(), btEffectRunCanvasBurst(), btEffectRunCards(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCloudSwirl(), btEffectRunCoatlicue(), btEffectRunCondemn(), btEffectRunCool(), btEffectRunCruelRuin(), btEffectRunCrystal(), btEffectRunCybele(), btEffectRunDaedalus(), btEffectRunDaedalusStrike(), btEffectRunDeathPlunge(), btEffectRunDjinnBeams(), btEffectRunDjinnHeal(), btEffectRunDjinniCharge(), btEffectRunDjinniEntrance(), btEffectRunDjinniSign(), btEffectRunDragonCloud(), btEffectRunDragonFire(), btEffectRunEclipse(), btEffectRunElementBurst(), btEffectRunElementCards(), btEffectRunElementPillar(), btEffectRunFallingSword(), btEffectRunFire(), btEffectRunFirePuppet(), btEffectRunFlare(), btEffectRunFlora(), btEffectRunFlurry(), btEffectRunFormChange(), btEffectRunFrost(), btEffectRunFume(), btEffectRunGaspFamily(), btEffectRunGatheringLights(), btEffectRunGeode(), btEffectRunGeyser(), btEffectRunGround(), btEffectRunHail(), btEffectRunHaunt() and 245 more.
Definition at line 79 of file system.h.
syCos
FIXED syCos(ANGLE angle)
The cosine of angle, a whole turn being TRIG_TURN, in 16.16; it falls
through into sySin a quarter turn on.
Referenced by btEffectDrawShadedDisc(), btEffectDrawShadedDiscQuarter(), btEffectRunAzul(), btEffectRunBackstab(), btEffectRunBallLightning(), btEffectRunBind(), btEffectRunBolt(), btEffectRunBreak(), btEffectRunBreaths(), btEffectRunBurstShower(), btEffectRunCanvasBurst(), btEffectRunCards(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCloudSwirl(), btEffectRunCondemn(), btEffectRunCool(), btEffectRunCruelRuin(), btEffectRunCrystal(), btEffectRunCybele(), btEffectRunDaedalus(), btEffectRunDaedalusStrike(), btEffectRunDeathPlunge(), btEffectRunDjinnBeams(), btEffectRunDjinnHeal(), btEffectRunDjinniCharge(), btEffectRunDjinniEntrance(), btEffectRunDragonCloud(), btEffectRunDragonFire(), btEffectRunEclipse(), btEffectRunElementBurst(), btEffectRunElementCards(), btEffectRunElementPillar(), btEffectRunFallingSword(), btEffectRunFire(), btEffectRunFirePuppet(), btEffectRunFlare(), btEffectRunFlora(), btEffectRunFlurry(), btEffectRunFormChange(), btEffectRunFrost(), btEffectRunFume(), btEffectRunGaspFamily(), btEffectRunGeode(), btEffectRunGeyser(), btEffectRunGround(), btEffectRunHail(), btEffectRunHaures(), btEffectRunHealingMotes() and 182 more.
Definition at line 82 of file system.h.
syHeapSlotRelease
void syHeapSlotRelease(Sint32 slot)
Releases heap slot slot's block, and with it every later block of the same
pool, by setting the pool's next free address back to the block's start.
Referenced by btBackgroundFree(), btCanvasBlitMirroredQuarters(), btEffectEndElementStreaks(), btEffectRunAnnihilation(), btEffectRunAzul(), btEffectRunBackgroundFadeIn(), btEffectRunBackstab(), btEffectRunBallLightning(), btEffectRunBolt(), btEffectRunBubbleColumn(), btEffectRunBurstShower(), btEffectRunByIdRange(), btEffectRunCanvasBurst(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCloudSwirl(), btEffectRunCoatlicue(), btEffectRunCool(), btEffectRunCruelRuin(), btEffectRunDaedalus(), btEffectRunDaedalusStrike(), btEffectRunDjinniCharge(), btEffectRunDjinniSign(), btEffectRunEclipse(), btEffectRunElementBurst(), btEffectRunElementPillar(), btEffectRunFirePuppet(), btEffectRunFlare(), btEffectRunFlashingStrike(), btEffectRunFlora(), btEffectRunFlurry(), btEffectRunFormChange(), btEffectRunFromTable(), btEffectRunFume(), btEffectRunGaspFamily(), btEffectRunGeode(), btEffectRunGround(), btEffectRunHaures(), btEffectRunHeavyBlow(), btEffectRunHurricane(), btEffectRunIris(), btEffectRunJudgment(), btEffectRunLightSurge(), btEffectRunMegaera(), btEffectRunMeteorBlow(), btEffectRunMirroredWall(), btEffectRunOdyssey(), btEffectRunPlumeEdge(), btEffectRunProjectileVolley() and 141 more.
Definition at line 90 of file system.h.
syHeapRelease
void syHeapRelease(void *buf)
Releases buf, a block taken with no heap slot, and every later block of its
pool, as syHeapSlotRelease does.
Referenced by btAbilityApplyToTarget(), btAppendLinkedActions(), btAwardSpoils(), btBackgroundLoad(), btBuildUnitActions(), btEffectRunAzul(), btEffectRunBallLightning(), btEffectRunBreaths(), btEffectRunCards(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCoatlicue(), btEffectRunCruelRuin(), btEffectRunCrystal(), btEffectRunDaedalus(), btEffectRunDaedalusStrike(), btEffectRunDeathPlunge(), btEffectRunDiamondBerg(), btEffectRunDjinniCharge(), btEffectRunDjinniSign(), btEffectRunEclipse(), btEffectRunElementCards(), btEffectRunFirePuppet(), btEffectRunFlora(), btEffectRunFormChange(), btEffectRunFume(), btEffectRunGaspFamily(), btEffectRunGeode(), btEffectRunGeyser(), btEffectRunHaures(), btEffectRunHeavyBlow(), btEffectRunIris(), btEffectRunJudgment(), btEffectRunLeapingStrike(), btEffectRunLegend(), btEffectRunLifeShear(), btEffectRunLightSurge(), btEffectRunLiquifier(), btEffectRunMegiddo(), btEffectRunMeteorBlow(), btEffectRunMirroredWall(), btEffectRunMoloch(), btEffectRunOdyssey(), btEffectRunRadiantFire(), btEffectRunRagingHeat(), btEffectRunRisingDragon(), btEffectRunRisingDragonEnemy(), btEffectRunRushingStrike(), btEffectRunSabreDance() and 121 more.
Definition at line 97 of file system.h.
syIOWriteQueueStore8
void syIOWriteQueueStore8(Uint32 addr, Uint32 value)
Definition at line 164 of file system.h.
syIOWriteQueueStore16
void syIOWriteQueueStore16(Uint32 addr, Uint32 value)
Referenced by btEffectHideBg1AndRestoreBackdrop(), btElementGlowPlay(), btHighlightSetModes(), btMotionCallBeast(), btMotionDismissBeast(), btTransitionRun(), mnBattleCommandRowRun() and scQueueIOWrite16().
Definition at line 165 of file system.h.
syIOWriteQueueStore32
void syIOWriteQueueStore32(Uint32 addr, Uint32 value)
Definition at line 166 of file system.h.
syIOWriteQueueSetBits8
void syIOWriteQueueSetBits8(Uint32 addr, Uint32 value)
Definition at line 167 of file system.h.
syIOWriteQueueSetBits16
void syIOWriteQueueSetBits16(Uint32 addr, Uint32 value)
Referenced by btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btPlaybackRun() and btTransitionRun().
Definition at line 168 of file system.h.
syIOWriteQueueSetBits32
void syIOWriteQueueSetBits32(Uint32 addr, Uint32 value)
Definition at line 169 of file system.h.
syIOWriteQueueClearBits8
void syIOWriteQueueClearBits8(Uint32 addr, Uint32 value)
Definition at line 170 of file system.h.
syIOWriteQueueClearBits16
void syIOWriteQueueClearBits16(Uint32 addr, Uint32 value)
Referenced by btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btPlaybackRun() and btTransitionRun().
Definition at line 171 of file system.h.
syIOWriteQueueClearBits32
void syIOWriteQueueClearBits32(Uint32 addr, Uint32 value)
Definition at line 172 of file system.h.
syHalt
void syHalt(void)
The Game Pak interrupt's handler, in IWRAM: stops the console for good once the cartridge is pulled (the BIOS's Stop, again after any wake).
Referenced by syInit().
Definition at line 211 of file system.h.
BiosSoundBiasOff
void BiosSoundBiasOff(void)
The BIOS's SoundBias: Off ramps the sound output's bias down before the console sleeps, On back up once it wakes, so the speaker does not click.
Referenced by sySynch().
Definition at line 214 of file system.h.
BiosSoundBiasOn
void BiosSoundBiasOn(void)
Referenced by sySynch().
Definition at line 215 of file system.h.
btRunStub
Sint32 btRunStub(Sint32 entrance)
Referenced by gmMainRoutineRun().
Definition at line 259 of file system.h.
syOAMBuildBuffer
void syOAMBuildBuffer(void *buf)
Builds this tick's OAM list in buffer, a scratch block of OAM_SIZE bytes,
running its ARM function from a copy on the stack.
Referenced by sySynch().
Definition at line 277 of file system.h.
fdTilesetAnimationResumeAllStub
Sint32 fdTilesetAnimationResumeAllStub(void)
Declarations other modules' code shares.
Referenced by mnResumeFieldEvents().
Definition at line 368 of file system.h.
fdTilesetAnimationSuspendAllStub
Sint32 fdTilesetAnimationSuspendAllStub(void)
Referenced by mnSuspendFieldEvents().
Definition at line 369 of file system.h.
memcpy
void *memcpy(void *dest, const void *src, unsigned long size)
Referenced by btIrisDrawPillar(), fdPsynergyUpdateArrow(), gmDataTransferApply() and sySortEvents().
Definition at line 370 of file system.h.
BiosCpuSet
void BiosCpuSet(const void *src, void *dest, Uint32 control)
The dma group. DMA and the BIOS copy service: fills, and one transfer on a
channel. The BIOS CpuSet service (bios.s).
Definition at line 380 of file system.h.
BiosStop
static __inline__ void BiosStop(void)
The BIOS's Stop (SWI 03h): stops the CPU and the screen until an enabled interrupt wakes them. The one BIOS call the game makes in place, a swi, which no C compiles to; the BIOS's arithmetic and decompression it never calls: the system library brings its own.
Referenced by sySynch().
Definition at line 438 of file system.h.
syDMAXCopy
static __inline__ void syDMAXCopy(const void *src, void *dest, Uint32 control, volatile Uint32 *channel)
Starts a transfer on DMA channel channel: its source, destination and
control written in one store. A channel's three registers, source,
destination and control (GBATEK's DMAxSAD, DMAxDAD and DMAxCNT), take one
stmia of three registers, which no agscc pattern emits without an ldmia to
pair it. The arguments are in the registers a call would pass them, as SGL's
slDMAXCopy takes them.
Referenced by btAutoBattleBuildActions(), btBackgroundLoad(), btBackgroundSetMode(), btBackgroundSetPaletteLevel(), btBackgroundShowZoomedPage(), btDMAStopDMA3(), btEffectArmBg1HBlankDMA(), btEffectArmBg2AffineHBlankDMA(), btEffectArmMeteorBlowPaletteDMA(), btEffectArmPaletteHBlankDMA(), btEffectArmWin0HBlankDMA(), btEffectBuildBlitter(), btEffectBuildWindowEdgeTable(), btEffectRunAtalanta(), btEffectRunAttackSlash(), btEffectRunCastingImpact(), btEffectRunCoatlicue(), btEffectRunCriticalHit(), btEffectRunCruelRuin(), btEffectRunDaedalus(), btEffectRunFlora(), btEffectRunIris(), btEffectRunJudgment(), btEffectRunNeptune(), btEffectRunNereidCopy(), btEffectRunTorch(), btEffectStepPaletteToResource(), btElementGlowInitStarField(), btRenderDrawMeshWireframe(), btRenderDrawTexturedMesh(), btRenderFillMesh(), btShiftVRAMTiles(), btTransitionUploadTileVariant(), CopyScrollMap(), dbIncreaseItemAndLevelSelectItem(), dbShopTestSelectItem(), fdActorCreate(), fdActorRestore(), fdActorTableSnapshot(), fdBattleEffectShiftRowsDown(), fdBattleEffectStartCanvasSprite(), fdBattleEffectUploadCanvas(), fdBlendScriptStart(), fdEffectStartWindowHBlankDMA(), fdGroundParticlesStart(), fdHeadingClose(), fdHeadingShow(), fdLineScrollArmDMA(), fdLuckyDiceRun(), fdLuckyWheelsFinishTick() and 124 more.
Definition at line 450 of file system.h.
syCopyWords
static __inline__ void syCopyWords(volatile void *destination, const volatile void *source, Sint32 count)
Copies count words, a constant from 2 to 4, from source to destination
with one block load and store: the pointers in r0 and r1, as syDMAXCopy takes
them, and the words in r2 up. agscc's own block moves leave the pointers to
the allocator and stop at three words: a 16-byte struct copy compiles to 12
and 4, and a struct copy of two or three words does not match either.
References Sint32.
Referenced by syVBlankHandler().
Definition at line 471 of file system.h.
sySoundSuspendDirectSoundStub
void sySoundSuspendDirectSoundStub(void)
The tick group. The tick loop's globals: the frames a tick takes, the CPU
load display and the VBlank flags, which sySynch() (system/system_frame.c)
and the VBlank handler share. Stops the sound DMA and its timer.
Definition at line 502 of file system.h.
IwramSoundRenderVBlank
void IwramSoundRenderVBlank(Sint32)
void IwramSoundRenderVBlank(Sint32) __attribute__((long_call))
Referenced by syVBlankHandler() and syWaitForVBlankInterrupt().
Definition at lines 508 and 510 of file system.h.
syHeapCallAlternatePool
static __inline__ void *syHeapCallAlternatePool(void *(*allocate)(Sint32), Sint32 size)
A block of size bytes from the allocator given (syHeapAllocate or
syHeapAllocateEWRAM), with no heap slot.
References Sint32.
Referenced by scAnemosInnerSanctumDullahanStartLightSprites(), scAquaRockInsideStartPillars(), scAquaRockInsideStartSplashes(), scAquaRockStartBubbles(), scEpilogueLoadPortraitFrame(), scGaiaRockInsideLayMaze(), scLemuriaPalaceLoadMaps(), scLightSpritesInitChannelPieces() and scLightSpritesInitEnergyBlockGlow().
Definition at line 519 of file system.h.
syIRQLock
static inline void syIRQLock(volatile Uint32 *saved)
Disables interrupts, keeping IME in a variable of the caller's that an interrupt may read.
Definition at line 601 of file system.h.
syIRQUnlock
static inline void syIRQUnlock(volatile Uint32 *saved)
Restores the IME that syIRQLock kept.
Referenced by btBackgroundSetPaletteLevel().
Definition at line 610 of file system.h.
syMathMulFX
static inline FIXED syMathMulFX(FIXED a, FIXED b)
The iwram_call group. The functions resident in IWRAM, called at their fixed
addresses: the fixed-point multiply and divides, the square root, word fills
and copies, the matrix multiply and the picture decoder. The 16.16 product of
two 16.16 numbers (syMulFX), written as a call.
Referenced by btGeyserDraw(), scAirsRockInsideStatueBreathesPooledWhirlwind(), scAirsRockInsideStatueBreathesWhirlwind(), scAirsRockStatueBreathesWhirlwind(), scGabombaStatueMoveCharge(), scVenusLighthouseEntranceUpdateBlastColumn(), scWhirlwindSpawn(), scWorldMapCircleEcho() and scWorldMapSpawnSparkPair().
Definition at line 669 of file system.h.
syDivFX
static inline FIXED syDivFX(FIXED divisor, FIXED value)
value * toFIXED(1) / divisor: the 16.16 ratio of two 16.16 numbers.
Referenced by btCameraSetCommandView(), btCameraSetRange(), btCameraSetView(), btCameraSetViewAtDepth(), btEffectRunThor(), btElementGlowUpdateStarField(), btRenderDrawTexturedMesh(), btRenderFillMesh(), btStagingDispatchAction(), fdActorSetMoveTarget(), fdActorUpdateAllMotion(), fdActorUpdateAllOnField(), fdCameraFollowLeaderInBounds(), fdCameraFollowWatchedInBounds(), fdCameraResetViewDefaults(), fdEncounterCountStepsAndSelectFormation(), fdMapScreenUpdateMarkers(), fdMapScreenUpdateScroll(), fdSuperLuckyDiceResetViewDefaults(), fdWorldMapBuildScanlineTable(), fdWorldMapInitPerspective(), fdWorldMapStartZoom(), fdWorldMapUpdateView(), mnWindowDrawZoomBorder() and syPerspective().
Definition at line 675 of file system.h.
sySquartIWRAM
static inline Sint32 sySquartIWRAM(Sint32 value)
The integer square root, rounded down, of a value from 0; 0 for a negative one. A 16.16 square comes back as 8.8.
References Sint32.
Referenced by btEffectRunDjinnHeal(), btEffectRunHaunt(), btEffectRunHealingMotes(), btEffectRunProcne(), btEffectRunSerac(), btEffectRunStatBoost(), btEffectRunTargetMotes(), btEffectRunTorch(), btEffectSetApproachMotion(), btMotionApproachTarget(), fdActorApproachWatchedActor(), fdActorFindNearestFacingTarget(), fdActorMoveTowardTarget(), fdActorSetMoveTarget(), fdActorUpdateAllMotion(), fdActorUpdateAllOnField(), fdCameraFollowLeaderInBounds(), fdCameraFollowWatchedInBounds(), fdFindNearbyTalkTarget(), fdLuckyDiceRun(), fdMapScreenUpdateMarkers(), fdMapScreenUpdateScroll(), fdMeasurePsynergyReach(), fdParticleUpdateMotion(), fdRopeLayTied(), fdScreenTransitionUpdateScanlineTable(), fdSuperLuckyDiceRun(), fdTightropeRecoil(), fdWorldMapBuildScanlineTable(), scAnemosInnerSanctumSendSpark(), scLemuriaSpringUpdateTossSimulation(), scPosDistance(), scPosDistanceAbove(), scPosFlatDistance(), syMatrixBuildLookAt() and sySquartFX().
Definition at line 682 of file system.h.
syMultiMatrix
static inline void syMultiMatrix(const MATRIX matrix)
Multiplies matrix, a 3 by 3 matrix and a translation in 16.16 fixed point, into the current transform.
Referenced by btCameraApplyTransform(), syLookAt(), syMatrixRotate(), syMatrixRotateTranslate(), syMatrixRotateTranslateScale(), syMatrixScaleUniform(), syMatrixScaleVector(), syMatrixTranslateVector(), syRotX(), syRotY(), syRotZ(), syScale() and syTranslate().
Definition at line 689 of file system.h.
syCalcPoint
static inline Sint32 syCalcPoint(const POINT vector, POINT result)
Writes to result the 16.16 point vector moved by the current matrix: turned by its 3 by 3 part, then offset by its translation.
Referenced by btCameraSetCommandView(), btCameraSetDefaultView(), btCameraSetView(), btCameraSetViewAtDepth(), btCameraUpdate(), btEffectRunJuggle(), btEffectRunProcne(), btRenderDrawMeshWireframe(), btRenderDrawTexturedMesh(), btRenderFillMesh(), fdCameraResetViewDefaults(), fdSuperLuckyDiceResetViewDefaults(), fdWorldMapBuildScanlineTable(), fdWorldMapInitPerspective(), fdWorldMapUpdateView() and syConvert3Dto2D().
Definition at line 696 of file system.h.
syIntegerDivide
static inline Sint32 syIntegerDivide(Sint32 dividend, Sint32 divisor)
The quotient, rounded toward zero.
References Sint32.
Referenced by fdPaletteFadeBuild(), fdPaletteFadeCalculateSteps(), fdScreenTransitionUpdate(), fdScreenTransitionUpdateDissolve(), fdScreenTransitionUpdateFromCenter(), fdScreenTransitionUpdateScanlineTable(), mnTitlePaletteFadeBuildColors(), mnTitlePaletteFadeCalculateSteps(), syAffineMatrixBuild() and syOAMMatrixAllocateFromTransform().
Definition at line 702 of file system.h.
syIntegerDivideUnsigned
static inline Uint32 syIntegerDivideUnsigned(Uint32 dividend, Uint32 divisor)
The unsigned quotient, rounded down.
Referenced by syAtan() and syConvert3Dto2D().
Definition at line 708 of file system.h.
syDecompressSpritePicture
static inline void *syDecompressSpritePicture(const void *src, void *dest)
Unpacks a PICTURE_FORMAT_COMPRESSED picture into destination, a byte above
223 leaving that many less 223 bytes there untouched, and returns NULL; one
whose first halfword is 0 is not packed, and comes back as the data after
that halfword for the caller to decode.
Referenced by fdPsynergyDecodePicture() and fdSpriteComposePicture().
Definition at line 717 of file system.h.
syWordsClear
static inline Sint32 syWordsClear(void *dest, Sint32 size)
Clears size bytes, rounded down to whole words, from destination. Returns the address after the last word.
References Sint32.
Referenced by btEffectClearTintTimers(), btEffectEndCanvasLayer(), btEffectEndElementStreaks(), btEffectOpenCanvasLayer(), btEffectRunBackgroundFadeIn(), btEffectRunBurstShower(), btEffectRunCanvasBurst(), btEffectRunCastingImpact(), btEffectRunCrystal(), btEffectRunDjinniEntrance(), btEffectRunFlashingStrike(), btEffectRunFlora(), btEffectRunGaspFamily(), btEffectRunHaures(), btEffectRunImpactBurst(), btEffectRunLobbedShells(), btEffectRunMirroredWall(), btEffectRunMoteFountain(), btEffectRunSerac(), btEffectRunShatteringOpening(), btEffectRunSpiderWeb(), btEffectRunUlysses(), btEffectRunWyrdCurse(), btEffectSetupCanvasTileMap(), btEffectStartCanvasLayer(), btEffectStartElementStreaks(), btShiftVRAMTiles(), fdLuckyWheelsRun(), fdPictureShiftColumnsByWave(), fdPictureSinkColumnsByWave(), fdSpriteComposePicture(), gmBattleUnitSet(), mnDisplayScrollDrawMessageLine(), mnTextDrawStringAsTiles(), scGaugeDraw(), scGeyserStart(), scStaffCreditShowBeacon(), scTrialRoadStartFountains(), scWorldMapStartPlacedActors() and sySoundSetFixedSampleFrequency().
Definition at line 724 of file system.h.
syWordsFill
static inline Sint32 syWordsFill(void *dest, Sint32 size, Uint32 value)
As syWordsClear, filling with value.
References Sint32.
Referenced by btEffectBuildCanvasTilemap(), btEffectProcessPendingBlock2Transfer(), btEffectProcessPendingStampTransfer(), btEffectRunBackgroundFadeIn(), btEffectRunCastingImpact(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCoatlicue(), btEffectRunCrescentSlash(), btEffectRunCruelRuin(), btEffectRunEclipse(), btEffectRunJudgment(), btEffectRunShatteringOpening(), btEffectRunUlysses(), btEffectSetupCanvasTileMap(), btEffectTransferCanvas(), btEffectTransferFullScreenImage(), btTransitionBuildAffineTilemap(), btTransitionBuildFlatTilemap(), fdBattleEffectUploadCanvas(), fdLuckyWheelsTransferCanvas(), mnDjinnMenuRunPreview(), mnItemMenuRun(), mnOpenBackdropScreen(), mnPsynergyMenuRun(), mnTextClearCanvas(), mnTextDrawStringAsTiles(), mnTextFillCanvasBackground(), mnTextScrollCanvasUp(), mnWatchStart(), mnWindowDrawOpened(), mnWindowSystemInitField() and scStaffCreditDrawGlowRings().
Definition at line 730 of file system.h.
syWordsCopy
static inline void syWordsCopy(void *dest, const void *src, Sint32 size)
Copies size bytes, rounded down to whole words, from source to destination.
References Sint32.
Referenced by btEffectConvertBackgroundToBlueRamp(), btEffectProcessPendingBlock2Transfer(), btEffectProcessPendingStampTransfer(), btEffectRunAtalanta(), btEffectRunBackgroundFadeIn(), btEffectRunBallLightning(), btEffectRunBurstShower(), btEffectRunCanvasBurst(), btEffectRunCatastrophe(), btEffectRunCharon(), btEffectRunCloudSwirl(), btEffectRunCoatlicue(), btEffectRunCruelRuin(), btEffectRunDaedalus(), btEffectRunDjinniEntrance(), btEffectRunEclipse(), btEffectRunElementBurst(), btEffectRunHealingMotes(), btEffectRunJudgment(), btEffectRunMars(), btEffectRunMirroredWall(), btEffectRunNeptune(), btEffectRunQuake(), btEffectRunShatteringOpening(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunTargetMotes(), btEffectRunThor(), btEffectRunTumblingQuads(), btEffectRunVoidBeam(), btEffectTransferCanvas(), btEffectTransferFullScreenImage(), btEffectUpdatePhasePalette(), btPaletteMirrorBgColors(), btResourceLoadAndDecompress(), fdPaletteFadeUpdate(), fdTileMapConvertBuffer(), mnCreditsDrawLine(), mnDjinnMenuRun(), mnDjinnMenuRunPreview(), mnItemMenuConfirmEquip(), mnItemMenuRun(), mnOpenBackdropScreen(), mnPsynergyMenuRun(), mnStatusPanelDraw(), mnStatusScreenRun(), mnWatchStart(), scApojiiIslandsCycleFallsColors(), scApojiiIslandsCycleSeaColors(), scClearEnterPassword() and 8 more.
Definition at line 736 of file system.h.
__divsi3
Sint32 __divsi3(Sint32 numerator, Sint32 denominator)
The compiler library's signed division and remainder, which the overlays
import from the IWRAM functions (system/iwram_entry.s).
Referenced by sySoundSetFixedSampleFrequency().
Definition at line 768 of file system.h.
__modsi3
Sint32 __modsi3(Sint32 numerator, Sint32 denominator)
Referenced by scClearEnterPassword().
Definition at line 769 of file system.h.
syUnitMatrix
static __inline__ void syUnitMatrix(MATRIX matrix)
Sets a twelve-word matrix to the unit matrix: toFIXED(1) (1.0) on the
rotation's diagonal, the rest 0. SGL's slUnitMatrix: three stmia of four
registers, which no C store or copy compiles to. It destroys r0 to r4, the
registers every function of the system library treats as scratch.
Referenced by btMatrixSetUnit().
Definition at line 783 of file system.h.
syColorBufferHalve
void syColorBufferHalve(void *src, void *dest, Sint32 size)
The colour buffer functions (system/decompress_byte_lz.s), each of which
copies its ARM kernel onto the stack by DMA and runs it there. Copies size
bytes of colour levels, halving each.
Referenced by btEffectProcessPendingBlock2Transfer(), btEffectTransferCanvas(), btEffectTransferFullScreenImage() and btEffectTransferHalvedCanvas().
Definition at line 829 of file system.h.
syColorBufferScaleThreeQuarters
Sint32 syColorBufferScaleThreeQuarters(void *src, void *dest, Sint32 size)
Copies size bytes of colour levels at three quarters of each, returning
what the kernel leaves in r0.
Referenced by btEffectProcessPendingBlock2Transfer(), btEffectTransferCanvas(), btEffectTransferFullScreenImage() and btElementGlowUploadStarField().
Definition at line 832 of file system.h.
syColorBufferDarken
void syColorBufferDarken(void *src, Sint32 amount, void *dest, Sint32 size)
Copies size bytes of colour levels, each lowered by amount.
Referenced by btEffectProcessPendingBlock2Transfer(), btEffectTransferCanvas() and btEffectTransferFullScreenImage().
Definition at line 834 of file system.h.
syColorBufferBrighten
void syColorBufferBrighten(void *src, Sint32 amount, void *dest, Sint32 size)
Copies size bytes of colour levels, each raised by amount.
Referenced by btEffectTransferCanvas().
Definition at line 836 of file system.h.
syColorBufferHalveNonzero
void syColorBufferHalveNonzero(Uint8 *src, Uint8 *dest, Sint32 size)
Copies size bytes of 8-bit pixels from source to destination, then halves
each colour number left in source, so a drawing fades as it is shown: Lucky
Wheels' trails (CANVAS_FADE_HALF).
Referenced by fdLuckyWheelsTransferCanvas().
Definition at line 840 of file system.h.
syColorBufferScaleNonzeroThreeQuarters
void syColorBufferScaleNonzeroThreeQuarters(Uint8 *src, Uint8 *dest, Sint32 size)
syColorBufferHalveNonzero, taking each colour number to three quarters, for
the trails that fade more slowly.
Referenced by fdLuckyWheelsTransferCanvas().
Definition at line 843 of file system.h.
syMathUnsignedMultiplyHighAdd
Sint32 syMathUnsignedMultiplyHighAdd(Sint32 value, Uint32 magic, Sint32 multiplier)
The high word of value times magic, plus value times multiplier: a division
by a constant (system/trig.s).
Referenced by mnStringFormatNumber().
Definition at line 848 of file system.h.
fdAreaGetNameIndexStub
Sint32 fdAreaGetNameIndexStub(Sint32 scene, Sint32 entrance)
The scene group. The running scene's overlay area, a field position, and the area name a scene and entrance show.
Referenced by mnAreaNameWindowShow(), mnDebugSceneSelectDrawRow(), mnMessageDecode() and mnSaveBuildFileSummary().
Definition at line 873 of file system.h.
Variables in detail
SleepActive
extern Uint16 SleepActive
1 while the CPU is stopped for sleep, until L and R wake it.
Referenced by syInputHandleKeyInterrupt() and sySynch().
Definition at line 217 of file system.h.
RandWork
extern Uint32 RandWork
syRandom's seed; Lucky Wheels seeds it with the play time, and a link
battle's parent sends it as the turn's BattleRandomSeed.
Referenced by btAppendLinkedActions(), fdLuckyWheelsStart(), scGabombaStatueLayChannel(), scGaiaRockInsideLayMaze(), scTrialRoadDealStageOrder() and syRandom().
Definition at line 239 of file system.h.
ResourceExecuteTransferCode
extern Uint8 ResourceExecuteTransferCode[]
The function that runs the queued register writes, which
syIOWriteQueueFlushPending copies onto its stack and runs.
Referenced by syIOWriteQueueFlushPending().
Definition at line 242 of file system.h.
ResourceExecuteTransferSize
extern Uint8 ResourceExecuteTransferSize[]
The size of ResourceExecuteTransferCode.
Referenced by syIOWriteQueueFlushPending().
Definition at line 244 of file system.h.
syResourcePatchThumbBranch
extern const Uint8 syResourcePatchThumbBranch[]
The ARM function that resolves a loaded overlay's long branches, run from a
heap copy by syOverlayLoad.
Referenced by syOverlayLoad().
Definition at line 263 of file system.h.
syResourcePatchThumbBranchCodeSize
extern Uint8 syResourcePatchThumbBranchCodeSize[]
The size of syResourcePatchThumbBranch (decompress_tagged_lz.s).
Referenced by syOverlayLoad().
Definition at line 265 of file system.h.
OamDepthMasks
extern Uint8 OamDepthMasks[]
Which of the 256 depth slots of OamDepthLists hold sprites this tick, a bit a
slot; syOAMResetTick clears it.
Referenced by syOAMAddSpriteAtDepth(), syOAMAddSpriteAtDepthClamped() and syOAMResetTick().
Definition at line 280 of file system.h.
OamDepthLists
extern void *OamDepthLists[]
The 256 depth slots' list heads that every drawn sprite is linked into
(syOAMAddSpriteAtDepth); syOAMResetTick empties them each tick.
Referenced by syOAMAddSpriteAtDepth() and syOAMAddSpriteAtDepthClamped().
Definition at line 283 of file system.h.
SystemBasicColorPalette
extern const Uint8 SystemBasicColorPalette[]
The basic sprite palettes, loaded for the debug text
(syPaletteGetBasicSpriteColors).
Referenced by syPaletteGetBasicSpriteColors(), syPaletteLoadBasicSpriteColors() and syWindowLoadGraphics().
Definition at line 313 of file system.h.
ResourceDirectoryTable
extern void *ResourceDirectoryTable[]
Resources and decompression. Each resource's ROM address by resource id
(syResourceGetTableEntry).
Referenced by syResourceGetTableEntry().
Definition at line 328 of file system.h.
syDecompressHalfwordLZ
extern const Uint8 syDecompressHalfwordLZ[]
The halfword LZ decoder that syDecompressHalfwords runs from its stack.
Referenced by syDecompressHalfwords().
Definition at line 331 of file system.h.
syDecompressHalfwordsCodeSize
extern Uint8 syDecompressHalfwordsCodeSize[]
The size of syDecompressHalfwordLZ, copied onto the stack by
syDecompressHalfwords.
Referenced by syDecompressHalfwords().
Definition at line 334 of file system.h.
WindowPalette
extern const Uint16 WindowPalette[]
Windows and their text. The window font's 16 colours, loaded as BG palette 15
(syWindowLoadGraphics).
Referenced by syWindowLoadGraphics().
Definition at line 340 of file system.h.
LinkTimeLabelString
extern Uint8 LinkTimeLabelString[]
The link battle timer's heading: TIME; TMPO. in Spanish, TEMPS in
French.
Referenced by mnLinkCreateCountdownLabelWindow().
Definition at line 344 of file system.h.
DebugTextEnabled
extern Uint8 DebugTextEnabled
The debug text and the number strings it prints. Nonzero lets syPrint write;
the power-on set-up and the credits clear it.
Referenced by btDebugBattleRunMenu(), mnCreditsRun(), mnEndingImageStart(), syInit(), syPrint() and syPrintBlanks().
Definition at line 348 of file system.h.
DebugTextCursor
extern Uint16 *DebugTextCursor
Where the debug text writes next on its screen in BG0.
Referenced by syPrint(), syPrintBlanks() and syPrintClear().
Definition at line 350 of file system.h.
NumberTextBuffer
extern Uint8 NumberTextBuffer[]
The digits syStringFormatHex and syStringFormatDecimal write, right-aligned
up to NumberTextHexEnd and NumberTextDecimalEnd.
Referenced by mnStringFormatNumberToHalfwords(), syStringFormatDecimal() and syStringFormatHex().
Definition at line 353 of file system.h.
NumberTextDecimalEnd
extern Uint8 NumberTextDecimalEnd[]
The end of syStringFormatDecimal's digits: syPrintDecimal prints the last
places before it.
Referenced by syPrintDecimal().
Definition at line 362 of file system.h.
NumberTextHexEnd
extern Uint8 NumberTextHexEnd[]
The end of syStringFormatHex's digits: syPrintHex prints the last places
before it.
Referenced by syPrintHex().
Definition at line 365 of file system.h.