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 turn_end_tables.c, battle_effect_internal.h, menu_internal.h, colosso_task.c, kolima_palette.c, lemurian_ship_ripple.c, map_grid_panel.c, mercury_lighthouse_lights.c, pushed_actor.c, sol_sanctum_elemental_star_lights.c, bupdata.c, math_table.c, number_text.c, sprite_metadata.c, ability_staging.h, battle.h, battle_effect_state.h, battle_state.h, battle_effect_table.h, field_effect.h, ground_mask.h, map_grid.h, script.h, script_inline.h, speaker.h, weather.h, inventory.h, system_call.h, graphics.h, palette_buffers.h, djinn_menu.h, icon_menu.h, select.h and settings_menu.h.
Macros
| Name | Description | |
|---|---|---|
#define | SpriteAnimations | SPR_ANIMATION) that fdSpriteAnimationAllocate takes from. |
#define | OAM_DEPTH_WINDOW 240 | Depth slots of syOAMAddSpriteAtDepth: a higher slot is drawn in front. |
#define | OAM_DEPTH_FRONT 255 | |
#define | syRandom16Below (count) ((syRandom() * (count)) >> 16) | A random whole number from 0 to count - 1, from syRandom. |
#define | PROJECTION_FAR_DEPTH_MAX toFIXED(32767) | The far depth well past everything drawn, the largest whole 16.16 number: the battle's, Thor's and Lucky Dice's projections. |
#define | DMA_FILL16 (value, destination, size) | The dma group. |
#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 the caller's own volatile word cell, so a function that fills several blocks keeps one word for all of them and forms its address once. |
#define | CPU_FILL32 (value, destination, size) | pret's CpuFill32: repeats one word through the BIOS CpuSet service. |
#define | DMA0_STOP () | Stops DMA 0, which a scene may have left repeating each HBlank for a line effect: drops its start timing and repeat, then its enable, and reads the control back. |
#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 a variable. |
#define | IME_SAVE (ime, saved) | Saves the original IME value in saved. |
#define | IME_DISABLE (ime) | Disables interrupts. |
#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) | The io_write_queue group. |
#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_COPY_WORDS (destination, source, size) | syWordsCopy as a statement of its own: how the link battle and the Battle Arena copy the Djinn recovery table into the send buffer, as The Lost Age writes it there and in its IWRAM_FILL_WORDS fills. |
#define | syMulFX (left, right) | (left * right) >> 16 with a 64-bit product: the 16.16 product of two 16.16 numbers. |
#define | RAM_CODE_LOAD (to, code, bytes) | Allocates a heap copy; release it with syHeapRelease when finished. |
#define | RAM_CODE_LOAD_SLOT (slot, code, bytes) | Allocates a heap-slot copy; release it with syHeapSlotRelease. |
Enumerations
| Name | Description | |
|---|---|---|
enum | CARTRIDGE_LANGUAGE { CARTRIDGE_LANGUAGE_ENGLISH, CARTRIDGE_LANGUAGE_GERMAN, CARTR … } | The cartridge's language, from its header (syGetLanguage). |
Functions
| Name | Description | |
|---|---|---|
static __inline__ void * | syHeapCallAlternatePool (void *(*allocate)(Sint32), Sint32 size) | The heap_release group. |
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 in its priority's high byte. |
void | syExecuteEvent (Sint32 pass) | Runs one pass of the events: every event whose priority's high byte matches pass's (EVENT_PASS_TICK or EVENT_PASS_VBLANK), 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, a bit at a time; a negative value gives 0. |
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, read from TrigSineTable, 256 entries for the first quarter turn. |
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 64 words of HeapSlots (both pool pointers and every heap 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 | syHeapGetRemainingIWRAM (void) | Returns the IWRAM bytes left to allocate, up to RamIWRAMHeapEnd (the address of CartridgeResetMarker), the end the allocators test. |
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 (1 to HEX_DIGITS; anything else prints all of them). |
void | syPrintDecimal (Sint32 value, Sint32 digits) | Prints the last digits characters of value in signed decimal (1 to DECIMAL_DIGITS_MAX; anything else prints DECIMAL_DIGITS_MAX). |
void | syPrintBlanks (Uint32 count) | Writes count blank characters (WINDOW_TILE_BLANK) at the debug text cursor and moves it on. |
Sint32 | syDecompressByteLZ (const void *src, void *dest) | |
Sint32 | syDecompressTaggedLZ (const void *src, void *dest) | |
void | syVRAMCacheReset (void) | Frees every block and every cache entry. |
Sint32 | syVRAMCacheFreeEntry (Uint32 id) | Frees cache entry id: its blocks go back and the entry is marked free (offset VRAM_CACHE_OFFSET_FREE). |
Sint32 | syVRAMCacheReleaseVRAM (Uint32 id) | Gives back entry id's blocks but keeps the entry taken, with size 1, so a later syVRAMCacheLoad can refill it. |
Sint32 | syVRAMCacheLoad (Uint32 id, Uint32 size, const void *src) | Gives cache entry id size bytes of sprite VRAM and copies src there, or clears them for VRAM_CACHE_CLEAR, or leaves them for a null src. |
Sint32 | syVRAMCacheFindFreeEntry (void) | Returns the number of the first free cache entry, or VRAM_CACHE_ENTRY_COUNT when all are taken. |
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 | syOAMAddSpriteAtDepth (void *slotEntry, Sint32 slot) | Links a sprite entry into depth slot slot (clamped to the RENDER_DEPTH_SLOT_COUNT slots) for this tick. |
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 (palettes 0 to 13). |
void | syInitMatrix (void) | Allocates the one-level save area (heap slot HEAP_SLOT_MATRIX_STACK), clears MatrixStackDepth and resets CurrentMatrix to 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 by angles[0], angles[1] and angles[2] about the X, Y and Z axes, in that order, with one combined matrix. |
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 in one matrix. |
void | syMatrixRotateTranslateScale (Sint32 *angles, POINT pos, VECTOR scale) | Rotates by angles, scales each rotation row by scale and translates by pos, in one matrix. |
void | syLookAtLoad (POINT camera, POINT target) | Makes the camera at eye looking at target the whole of CurrentMatrix. |
Sint32 | syConvert3Dto2D (const POINT point, Sint32 *screen) | Reads three word-aligned coordinates from point, transforms them by CurrentMatrix and projects them to the screen: screen[0] and screen[1] are its pixel position and screen[2] its whole-unit depth. |
void | syPerspective (Uint32 fieldOfView, FIXED nearDepth, FIXED farDepth) | Sets ProjectionWork from a vertical field of view (1/65536 turns): the focal length, in 16.16 pixels, is 80 (half the screen height) over the tangent of half the angle. |
void | sySetScreenDist (Uint32 focal, Uint32 nearDepth, Uint32 farDepth) | Sets ProjectionWork's focal length and depth range directly. |
void | syCopyBuildStamp (void) | Copies the build stamp resource (twelve digits) into BuildStampWork in high IWRAM and writes the zero word that ends it. |
Sint32 | syDummyReturnZero (Sint32 resourceId, const Uint8 *table) | An exported stub that ignores its arguments and reports 0. |
void * | syResourceGetTableEntry (Sint32 index) | 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) | |
void | syScreenFadeFromBlack (Sint32 frames) | |
void | syScreenFadeToWhite (Sint32 frames) | |
void | syScreenFadeFromWhite (Sint32 frames) | |
void | syScreenFadeStart ( Sint8 bright, Sint32 layer, Uint32 start, Sint32 target, Sint32 frames) | |
void | syScreenFadeWait (void) | Waits a tick at a time until the running fade has finished. |
void | syDummyReservedNoOperationA (void) | Unused: five empty exports of the system library's stub table, which nothing calls. |
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 (as sySerialExchangePayloads). |
void | syIOWriteQueueStore8 (Uint32 addr, Uint32 value) | Queue one register write of a width (8, 16 or 32 bits): a store, or the value's bits set or cleared (system/system_io_write_queue.c). |
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 a tick at a time until every status bit in mask is set in LinkStatusWork, then 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) | Copies the mixer code for reverb code code (enum SoundReverbCode; anything else loads SOUND_REVERB_MONO) from ROM into IwramSoundReverbCode. |
Sint32 | sySerialStartSend (void *src, Sint32 size) | Starts sending size bytes from src to the partner in 20-byte blocks: 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) | |
void | sySerialWaitForReceive (void) | |
void | sySerialWaitForTransfers (void) | Waits until both the send and the receive have finished, giving up after SERIAL_TRANSFER_TIMEOUT_TICKS. |
Sint32 | sySerialGetActiveTransfers (void) | Returns bit 0 while a send runs and bit 1 while a receive runs. |
void | sySerialStepBlockTransfer (void) | Runs each VBlank after the exchange, called by syVBlankHandler: moves the bulk transfer on by one 20-byte block each way. |
Sint32 | sySetEventFlags (EVENT_FUNC callback, Uint32 mask) | Stores mask as the flags of the event running callback; EVENT_FLAG_KEEP_RUNNING keeps it running while the overlay events are suspended. |
void | BiosSoundBiasOff (void) | The system library's own functions and globals: interrupts, BIOS sound bias, random numbers and sleep. |
void | BiosSoundBiasOn (void) | |
static __inline__ void | BiosHalt (void) | The BIOS's Halt (SWI 02h): halts the CPU until an interrupt. |
static __inline__ void | BiosStop (void) | The BIOS's Stop (SWI 03h): stops the CPU and the screen until an enabled interrupt wakes them. |
ANIMATION_METADATA * | syResourceGetMetadataRecord (Uint32 descriptorId) | Returns the metadata of the sprite whose id is in descriptorId's SPRITE_ID_MASK bits (sprite_metadata.c); the one entry of its stub table (src/system/sprite_stubs.s). |
ANIMATION_METADATA * | syResourceGetMetadataRecordStub (Uint32 descriptorId) | The sprite module's one stub call: a sprite's animation metadata. |
void | syHalt (void) | Stops the console for good with the BIOS Stop call: in the German, French, Spanish and Italian editions, what pulling the Game Pak out does. |
void | MixerEnter (void) | Runs the sound for this VBlank, the music players and then the game's own mixer in IWRAM; the last thing syVBlankHandler does. |
void | syInit (void) | Powers the game up: stops any HBlank DMA left running, sets the cartridge wait states, clears IWRAM, installs the interrupt handlers and the resident IWRAM code, loads the window graphics and the sound driver, then enters gmMainRoutineRun and never returns. |
void | syIdleForever (void) | Unused: waits out ticks forever; the tick loop still runs the events. |
Sint32 | syGetLanguage (void) | Returns the language of this cartridge from the header's game code letter, an CARTRIDGE_LANGUAGE. |
void | syCodeResolveLongBranches (Uint16 *entries, Sint32 byteLength) | Unused: resolves the Thumb long branches (BL pairs) of a block of code whose branch offsets are stored from the start of the block. |
void | syIRQIgnore (void) | The handler of every interrupt nobody has claimed. |
void | syInstallIWRAMAndIRQs (void) | Copies the resident code to IWRAM, points the BIOS interrupt vector (IrqVector) at its dispatcher, installs the default handler table and enables the VBlank and keypad interrupts (and, in the German, French, Spanish and Italian editions, the cartridge-removed interrupt, which halts the game). |
void | syInputUpdateKeyRepeatAndDirection (void) | Works out this tick's repeating and newly pressed keys, once a tick after VBlank (sySynch()). |
void | syVBlankHandler (void) | The VBlank interrupt handler, installed by syInit. |
void | sySoundReservedNoOperationA (void) | Unused: two empty functions after the reverb loader, which nothing calls. |
void | sySoundReservedNoOperationB (void) | |
void | syInputHandleKeyInterrupt (void) | The keypad interrupt, from the handler table: A+B+Select+Start was pressed, so it sets ResetRequested for the tick loop and disarms the interrupt. |
Sint32 | syDecompressMoveToFrontLZ (const void *src, void *dest) | |
void | syIOWriteQueueFlushPending (void) | Runs the queued register writes and empties the queue, with a copy of the executor function on the stack. |
void | syScreenFadeUpdate (void) | Steps the screen fade once a VBlank, called by syVBlankHandler: sets BLDCNT to brighten or darken the chosen layers, moves BLDY one step from the start level to the target level and counts ScreenFadeFramesLeft down; at the end it clears ScreenFadeFrames, which syScreenFadeWait waits on. |
void | syOAMResetTick (void) | Starts a new tick of sprites: frees the affine matrices and empties the RENDER_DEPTH_SLOT_COUNT depth slots sprites are linked into. |
void | syOAMBuildBuffer (void *work) | Builds this tick's OAM list in work from the sprites linked into the depth slots, with a RAM copy of the ARM builder. |
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 | syVRAMCacheGetLongestFreeRun (void) | Unused: returns the length, in blocks, of the longest run of free blocks. |
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, Sint32 src) | Copies src again into entry id's VRAM, keeping its size. |
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. |
Sint32 | syFindEvent (EVENT_FUNC callback) | Unused: returns the table index of the event running callback, or -1. |
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 EVENT_FLAG_KEEP_RUNNING asks to keep it running, as sySuspendEvent does. |
Sint32 | syResumeOverlayEvents (void) | Resumes every event whose function is in an overlay, flagged or not. |
const Uint8 * | syPaletteGetBasicSpriteColors (void) | Returns the basic sprite palettes (BasicSpritePalettes). |
void | syStringFormatHex (Uint32 value) | Writes value as HEX_DIGITS hexadecimal digits to the number buffer. |
void | syStringFormatDecimal (Sint32 number) | Writes number to the number buffer as DECIMAL_DIGITS_MAX + 1 characters: spaces, a sign (a space or '-') and its decimal digits, right-aligned. |
void * | memcpy (void *dest, const void *src, unsigned long size) | Copies size bytes from source to destination, for the modern build. |
void | syHeapReservedNoOperation (void) | Unused: reserved empty memory export. |
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. |
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. |
void | syColorBufferBrighten (Uint8 *buf, Uint32 amount, Uint8 *dest, Uint32 bytes) | |
void | syColorBufferDarken (Uint8 *buf, Uint32 amount, Uint8 *dest, Uint32 bytes) | |
void | syColorBufferScaleThreeQuarters (Uint8 *buf, Uint8 *dest, Uint32 bytes) | |
void | syColorBufferHalve (Uint8 *buf, Uint8 *dest, Uint32 bytes) | |
void | syColorBufferBrightenPartial (Uint8 *buf, Uint32 amount, Uint8 *dest, Uint32 bytes) | |
void | syColorBufferDarkenPartial (Uint8 *buf, Uint32 amount, Uint8 *dest, Uint32 bytes) | |
void | syColorBufferScaleNonzeroThreeQuarters (Uint8 *buf, Uint8 *dest, Uint32 bytes) | |
void | syColorBufferHalveNonzero (Uint8 *buf, Uint8 *dest, Uint32 bytes) | |
Bool | syBupInitState (void) | Allocates the save state (heap slot HEAP_SLOT_BUP), installs the SDK's flash library's BUP_FLASH_TIMER handler, identifies the flash chip (up to eight tries, a tick apart) and scans all 16 sectors into the save state's occupied, partId and counter tables: a sector counts as taken when its signature and checksum are good, and of two copies of a part only the newer stays taken. |
Uint32 | syBupSelectWriteSector (Sint32 partId) | Picks the free sector to write part partId to, at random, or returns BUP_SECTOR_COUNT for none. |
Uint32 | syBupWriteSector (Sint32 sector) | Programs the save state's sector buffer into flash sector sector and verifies it, through the SDK's flash library's function for this chip. |
Sint32 | syBupReadSector (Sint32 index) | Reads flash sector index into the save state's sector buffer. |
Uint16 | syBupEraseSector (Uint16 sector) | Unused: erases flash sector sector with the SDK's flash library's function for this chip. |
Bool | syBupWritePart (Sint32 partId, void *src) | Saves 4080 bytes from src as part partId: writes the new copy with the next counter, then invalidates the old one, updating the save state's sector tables. |
Uint32 | syBupReadPart (Sint32 partId, void *dest) | Loads the current copy of part partId (4080 bytes) into dest. |
Uint32 | syBupDeletePart (Sint32 partId) | Invalidates the current copy of part partId. |
Sint32 | syBupChecksumSector (void) | Sums the first BUP_CHECKSUM_BYTES payload bytes of the save state's sector buffer; the final eight payload bytes are excluded. |
Uint32 | syBupFindLatestSector (Sint32 partId) | Returns the occupied sector holding the newest copy of part partId, or BUP_SECTOR_COUNT. |
Bool | syBupInvalidateSector (Sint32 index) | Overwrites sector index with a header for no part (BUP_PART_NONE) and clears its occupied entry. |
Sint32 | syBupCompareBytes (Uint8 *left, Uint8 *right, Sint32 count) | Compares count bytes, as memcmp does. |
Uint32 | syBupGetLatestCounter (Sint32 partId) | Returns the highest counter among the copies of part partId. |
Sint32 | syBupLoadFileSummaries (void) | Reads the summary at the start of each of the three save files into the save state's summary table for the file list, and each file's second copy of the play time, from BUP_SECOND_PLAY_TIME_OFFSET in its second part, into its secondPartPlayTime (zero when it has none). |
Uint32 | syBupReleaseState (void) | Removes the flash timer handler and frees the save state's heap slot, with every block allocated after it in the same pool. |
void | sySerialEnableTransferTimer (void) | Lets the timer start transfers again once a link mode is set, by setting SerialStateWork.transferEnabled. |
void | sySerialDisableTransfer (void) | Unused: disables the serial and timer 3 interrupts, stops the transfer timer and clears SerialStateWork.transferEnabled. |
Sint32 | sySerialPollStatus (void) | As sySerialPollAndTransfer, without exchanging data: sySynch() calls it once a tick while SerialExchangeActive is set, and the VBlank handler does the exchange. |
Sint32 | sySerialExchangePayloads (void *send, void *receive) | |
void | sySerialPrepareSendPacket (void *payload) | Builds the packet to send in sendBuf[0]: [0] the packet number, [1] the consoles not yet heard from, [2] the checksum and [4] 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 | sySerialHandleTransferInterrupt (void) | The serial and timer 3 interrupt, installed by sySerialInit: each one moves a halfword. |
void | syLinkBattleResetTransferState (void) | sySerialResetTransferState as a function, for the link set-up and a link battle that fails. |
void | sySerialTestDelay (void) | An empty function the link test calls to waste time. |
void | sySerialTestRun (void) | A link cable test left in the game: it shows a row of tiles, receives blocks into the map grid metatile buffer and shows them as tiles, and sends a part of the ROM when A or B is held. |
static __inline__ void | syDMAXCopy (const volatile void *src, volatile void *dest, Uint32 control, volatile Uint32 *channel) | Starts a DMA transfer: stores the source, destination and control words into channel's registers with one stmia. |
static __inline__ void | syDMAWait (DMA_REGISTERS volatile *channel) | Waits until channel's transfer is done: SGL's slDMAWait. |
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. |
static inline FIXED | syDivFX (FIXED divisor, FIXED value) | value * toFIXED(1) / divisor: the 16.16 ratio of two 16.16 numbers. |
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 Sint32 | sySquartIWRAM (Sint32 value) | The integer square root, rounded down, of a value from 0; 0 for a negative one. |
static inline Sint32 | syCalcPoint (const POINT vector, POINT result) | Transforms a vector of three 16.16 coordinates by CurrentMatrix into result. |
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, CurrentMatrix. |
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 sprite's codec 3 picture straight into its pixels at destination, where a byte above 223 skips that many less 223 transparent pixels, and returns null. |
static inline void | syWordsCopy (volatile void *dest, const volatile void *src, Sint32 size) | Copies size bytes, rounded down to whole words, from source to destination. |
static inline Sint32 | syMulFX (Sint32 left, Sint32 right) | (left * right) >> 16 with a 64-bit product: the 16.16 product of two 16.16 numbers. |
static __inline__ Sint32 | syCallReturnIp (Sint32 left, Sint32 right, void *routine) | Calls an IWRAM function that returns through ip instead of lr, with left and right in r0 and r1, and returns its r0: how the Thumb C reaches SGL's slMulFX, the multiply in IWRAM, keeping lr and r3. |
static __inline__ void | syUnitMatrix (MATRIX matrix) | The matrix group. |
static __inline__ void | syUnitMatrixCurrentInline (void) | Resets the current matrix to the unit matrix: syUnitMatrix's stores, with CurrentMatrix's address in r3, which the stores then set to 0. |
static __inline__ Sint32 | sySerialAddErrorFlag (Sint32 status) | The serial group. |
static __inline__ void | sySerialResetTransferState (void) | Abandons any send or receive and clears the block transfer's state, with interrupts held off: what a failed link battle or Battle Arena exchange does. |
static __inline__ const Sint32 * | syVector3Coordinates (const VECTOR3 *vector) | The vector3 group. |
Variables
| Name | Description | |
|---|---|---|
extern Uint16 | SleepActive | 1 while the CPU is stopped for sleep, until L and R wake it. |
extern Uint8 | NumberBufferDecimalEnd [] | NumberBuffer + 10, the decimal form's units digit (the form ends at + 11); syPrintDecimal starts n characters before it, so it prints n + 1. |
extern Uint8 | NumberBufferHexEnd [] | The end of the hexadecimal form in NumberBuffer. |
extern const Uint8 | LinkTimeLabelString [] | The link battle timer's heading: TIME; TMPO. in Spanish, TEMPS in French. |
extern void * | ResourceDirectoryTable [] | Each resource's ROM address by resource id (syResourceGetTableEntry). |
extern ANIMATION_METADATA | SpriteAnimationMetadata [] | Every sprite animation's metadata, by number (graphics/sprite/sprites.s). |
extern Uint8 | syResourcePatchThumbBranchCodeSize [] | The size of syResourcePatchThumbBranch (decompress_tagged_lz.s). |
extern const Uint16 | WindowPalette [] | The window font's 16 colours, loaded as BG palette 15 (syWindowLoadGraphics). |
extern Uint8 | IwramSoundReverbCode [] | The 152 bytes of IWRAM-resident sound code (0x03000bd8, not the mixer at 0x03007000) that sySoundLoadReverbCode overwrites with a reverb code from IwramSoundReverbCodes. |
extern Uint16 * | DebugTextCursor | Where the debug text writes next on its 32 by 20 screen in BG0. |
extern Uint8 | DebugTextEnabled | Nonzero lets syPrint write; the power-on set-up and the credits clear it. |
extern Uint8 | BupBuffer [] | The buffer a save file is built in and written from, in two halves; its summary's 16-byte header lies just before it. |
extern Sint16 | BupSlot | The current save file, or -1 for none (a new game). |
extern Uint8 | IwramSoundReverbCodes [] | The five reverb codes' mixer code, SOUND_REVERB_CODE_SIZE bytes each. |
extern Uint8 | syOAMBuildBufferKernelCodeSize [] | The size of syOAMBuildBufferKernel (decompress_byte_lz.s). |
extern const Uint8 | syOAMBuildBufferKernel [] | The ARM OAM list builder, run from a heap copy by syOAMBuildBuffer. |
extern const Uint8 | syResourceExecuteTransfer [] | The ARM register-write executor, run from a stack copy by syIOWriteQueueFlushPending. |
extern const Uint8 | syResourcePatchThumbBranch [] | The ARM function that resolves a loaded overlay's long branches, run from a heap copy by syOverlayLoad. |
extern const Uint8 | RomLanguageCode | The game code's last letter in the cartridge header: J in Japanese, E, D, F, S or I (syGetLanguage). |
extern const Uint8 | BasicSpritePalettes [] | The basic sprite palettes 0 to 13, 224 colours (syPaletteLoadBasicSpriteColors). |
extern Uint8 | fdTileCopyStrided [] | The sprite tile uploader, run from HEAP_SLOT_PICTURE_UPLOADER. |
extern Uint8 | fdTileCopyStridedCodeSize [] | The size of fdTileCopyStrided (map_grid_convert.s). |
extern Uint8 | syResourceExecuteTransferCodeSize [] | The size of syResourceExecuteTransfer (decompress_tagged_lz.s). |
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. |
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 stub table's prototypes, then
each group's inlines and macros in turn.
Macros in detail
SpriteAnimations
#define SpriteAnimations
SPR_ANIMATION) that fdSpriteAnimationAllocate takes from.
Referenced by fdSpriteAnimationAllocate().
Definition at line 207 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's and the battle's, and OAM_DEPTH_FRONT is in front of
everything.
Referenced by btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btPlaybackRun(), fdEffectUpdateSparkles(), fdMotesUpdate(), fdWeatherUpdateRain(), mnBattleCommandRowRun(), mnBattleDjinnMenuRun(), mnBattleDjinnMenuShowChangePreview(), mnBattleItemMenuRun(), mnBattleMenuUpdate(), mnBattlePsynergyMenuRun(), mnBattleStatusScreenRun(), mnBattleSummonMenuRun(), mnBattleTargetRunSelection(), mnIconMenuDrawIcons(), mnSelectionMenuDraw(), mnSelectionMenuDrawArrow(), mnStatusScreenHideStatusIcons(), mnStatusScreenRunEquipmentPage(), mnStatusScreenRunPsynergyPage(), mnStatusScreenShowMemberStatus() and mnStatusScreenShowStatusIcons().
Definition at line 281 of file system.h.
OAM_DEPTH_FRONT
#define OAM_DEPTH_FRONT 255
Referenced by mnArrowSetPos(), mnCommandIconCreate(), mnCursorCreate(), mnDjinnShowJoinedMessage(), mnGlyphDraw(), mnItemMenuRunList(), mnNameEntryEditMemberName(), mnPartyShowJoinedMessage(), mnPartyShowPairJoinedMessage(), mnPauseMenuChoose(), mnPsynergyMenuRunList(), mnSettingsMenuRun(), mnShopDrawCarriedItem(), mnShopDrawMemberItems(), mnShopDrawStock(), mnTitleCreate(), mnWindowSpriteCreate(), mnWindowSpriteCreateOverlaidIcon(), mnWindowSpritePulse(), scColossoDrawGauge(), scColossoUpdatePointer(), scHeatGaugeDraw(), scLemurianShipCloseCurtains() and scTitleUpdateSpriteReveal().
Definition at line 282 of file system.h.
syRandom16Below
#define syRandom16Below(count) ((syRandom() * (count)) >> 16)
A random whole number from 0 to count - 1, from syRandom.
Referenced by btAbilityReplaceDefeated(), btAIChooseRandomTarget(), btAIChooseTarget(), btAutoBattleBuildActions(), btBuildEnemyActions(), btEnemyCalculateCoinReward(), btEnemyCalculateExperienceReward(), btFleeCheckSuccess(), btFleePlayRun(), btFormationBuildEnemyList(), btFormationGetRandomMember(), btFormationSelectLevelMatchedCandidate(), btStagingRunFlee(), fdEffectUpdateMarsSpark(), fdEffectWanderAroundAnchor(), fdPsynergyRetreat(), fdRetreatUpdateSpark(), fdWeatherUpdateLightning(), gmUnitLevelUp(), mnAbilityApplyToTargets(), mnSanctumRunMemberIconBurst(), mnSanctumUpdateBurst() and mnWindowSpriteUpdateAll().
Definition at line 302 of file system.h.
PROJECTION_FAR_DEPTH_MAX
#define PROJECTION_FAR_DEPTH_MAX toFIXED(32767)
The far depth well past everything drawn, the largest whole 16.16 number: the battle's, Thor's and Lucky Dice's projections.
Referenced by btStagingDispatchAction().
Definition at line 316 of file system.h.
DMA_FILL16
#define DMA_FILL16(value, destination, size)
The dma group. DMA channel registers, and the DMA and CPU fills. Fills size
bytes at destination with the halfword value by DMA3, from a volatile
copy of it on the stack.
Referenced by mnMemoryFillHalfwordsDMA() and mnScanlineWindowFillSpans().
Definition at line 374 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 btBackgroundInit(), btEffectRunAnnihilation(), fdActorCreate(), fdActorRelease(), fdEffectInitSlots(), fdEffectInitSparkles(), fdEngineRun(), fdMapScreenInit(), fdMotesStart(), fdPaletteFadeInit(), fdParticleFree(), fdParticleInit(), fdPlaceTreasureSpots(), fdPsynergyLoadResources(), fdPsynergyStartMindReadWave(), fdScreenTransitionAllocateAndClearState(), fdScreenTransitionFillTilemapAndColorTile(), fdScreenTransitionStartDissolveHeld(), fdScreenTransitionStartHeldWindow(), fdSpriteAnimationClear(), fdSpriteDestroy(), fdTilesetAnimationStartAll(), fdWeatherStartLightning(), fdWeatherStartLightningFlash(), fdWeatherStartRain(), fdWorldMapInitPerspective(), fdWorldMapLoadGraphics(), mnFileListSelectFile(), mnIconMenuOpen(), mnInitState(), mnPauseMenuInit(), mnSettingsMenuInitState(), mnShopInitState(), mnTitlePaletteFadeInit(), scColossoShowItemIcon(), scInit(), scLemurianShipStartCurtains(), scLineScrollInitWave(), scMercuryLighthouseRestoreLights(), scSolSanctumStartFloatingLights(), syBupInitState(), syBupInvalidateSector(), syBupLoadFileSummaries(), syBupWritePart(), syHeapInit(), syInit(), syPrintClear() and sySerialInit().
Definition at line 384 of file system.h.
DMA_FILL32_CELL
#define DMA_FILL32_CELL(cell, value, destination, size)
DMA_FILL32 through the caller's own volatile word cell, so a function that
fills several blocks keeps one word for all of them and forms its address
once.
Referenced by btEffectRunJudgment(), btEffectRunStarfieldFall(), btEffectSetupBlendedDisplay(), btRun(), btTransitionRun(), fdActorSystemConfigure(), fdActorSystemInit(), fdEffectStartGroundMask(), fdSpriteViewerRun(), gmMainRoutineStateInitDefaults(), mnCreditsClearBuffer() and mnCreditsInitTextSprites().
Definition at line 396 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 406 of file system.h.
DMA0_STOP
#define DMA0_STOP()
Stops DMA 0, which a scene may have left repeating each HBlank for a line effect: drops its start timing and repeat, then its enable, and reads the control back.
Referenced by gmMainRoutineRun(), syInit() and syVBlankHandler().
Definition at line 417 of file system.h.
IO_WRITE16
#define IO_WRITE16(v, reg)
The io_write group. IO_WRITE8, IO_WRITE16 and IO_WRITE32, writes to a
register or memory. Writes a value to a 16-bit register or memory location.
Referenced by btBackgroundShowZoomedPage(), btClearBg0Vofs(), btDebugBattleViewMessages(), btElementGlowInitStarField(), btElementGlowPlay(), btHighlightSetModes(), btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btTransitionClearBg0Vofs(), fdEffectStartGroundMask(), fdMapGridLoadMap(), fdMapScreenShow(), fdMotesStart(), fdScreenTransitionStartWindowHBlankDMA(), fdStartEncounterTransition(), fdWeatherStartRain(), fdWorldMapEndStillImage(), fdWorldMapInitPerspective(), fdWorldMapPresentStillImage(), mnCreditsRun(), mnFileListUpdateGlow(), mnGraphicsInstallBg1VCountHandler(), scAltinPeakFlickerWaterOut(), scAltmillerCaveApplyFadeBlend(), scAltmillerCaveInitDarkness(), scAltmillerCaveRestoreBabiAndInviteParty(), scAltmillerCaveStartReveal(), scCottageRoomsBHurryToThePlaza(), scCrossboneIsleKeysInitStatues(), scInit(), scLamakanDesertBatheInOasis(), scLemurianShipRaiseTheShip(), scLemurianShipSetSail(), scLemurianShipUpdateGlowSwellAndSpray(), scLemurianShipWalkBackToShack(), scSolSanctumLunaSolRoomsArriveAfterWiseOnesRescue(), scSuhallaDesertPulseRevealPalette(), scSuhallaDesertRevealEnds(), scTolbiSpringDrainSpring(), syInit(), syInputHandleKeyInterrupt(), syInstallIWRAMAndIRQs(), syPrintClear(), sySerialCollectReceivedPayloads(), sySerialStartClocking(), sySoftReset(), sySynch() and syWindowLoadGraphics().
Definition at line 457 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(), mnBattleDjinnMenuShowChangePreview(), mnSaveBuildFileSummary() and sySoundTestRun().
Definition at line 466 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 sySerialResetTransferState().
Definition at line 470 of file system.h.
syIORead16
#define syIORead16(reg, variable) (*(variable) = *(reg))
Reads a 16-bit register or memory location into a variable. The variable is reached through its address, so a halfword one lives in the tick and is read back from there after each call. The Lost Age has the same macro.
Referenced by btTransitionRunMosaicFadeOut(), scInit() and scLemurianShipRaiseTheShip().
Definition at line 475 of file system.h.
IME_SAVE
#define IME_SAVE(ime, saved)
Saves the original IME value in saved.
Referenced by syIRQLock().
Definition at line 484 of file system.h.
IME_DISABLE
#define IME_DISABLE(ime)
Disables interrupts.
Referenced by syIRQLock().
Definition at line 491 of file system.h.
IME_RESTORE
#define IME_RESTORE(ime, saved)
Restores IME from saved.
Definition at line 498 of file system.h.
IRQ_LOCK
#define IRQ_LOCK(saved)
Disables interrupts and saves IME in saved; IRQ_UNLOCK restores it.
Referenced by btAppendLinkedActions(), scBattleArenaRestartLink(), syCloseEvent(), syFindEvent(), syIntFunction(), syResumeEvent(), syResumeOverlayEvents(), sySerialInit(), sySerialResetTransferState(), sySerialStartReceive(), sySerialStartSend(), sySetEvent(), sySetEventFlags(), sySuspendEvent() and sySuspendOverlayEvents().
Definition at line 505 of file system.h.
IRQ_UNLOCK
#define IRQ_UNLOCK(saved)
Restores the IME value saved by IRQ_LOCK.
Referenced by btAppendLinkedActions(), scBattleArenaRestartLink(), syCloseEvent(), syFindEvent(), syIntFunction(), syResumeEvent(), syResumeOverlayEvents(), sySerialInit(), sySerialResetTransferState(), sySerialStartReceive(), sySerialStartSend(), sySetEvent(), sySetEventFlags(), sySuspendEvent() and sySuspendOverlayEvents().
Definition at line 514 of file system.h.
IO_WRITE_QUEUE_PUSH
#define IO_WRITE_QUEUE_PUSH(address, value, control)
The io_write_queue group. The register write queue that VBlank carries out
after each finished tick. Disables interrupts to add one register write or
DMA to the queue; a write to a full queue is dropped. control is a width
(IO_WRITE_BYTE to IO_WRITE_WORD), with IO_WRITE_SET or IO_WRITE_CLEAR to
change bits; or a DMA control word.
Referenced by btBackgroundSetMode(), btEffectConfigureEffectDisplay(), btEffectEndCanvasLayer(), btEffectOpenCanvasLayer(), btEffectRunShatteringOpening(), btEffectRunTorch(), btEffectStartCanvasLayer(), btElementGlowPlay(), btTransitionRun(), fdMapScreenShow(), fdMapScreenUpdateMarkers(), fdPaletteFadeUpdate(), fdScreenTransitionStart(), fdScreenTransitionUpdateDissolve(), mnBattleCommandRowRun(), mnCreditsLoadBackground(), mnTitlePaletteFadeUpdate(), mnTitleShowTitleScreen(), scColossoFadeInWarrior(), scColossoUpdateLettering(), scFileScreenFadeInBlend(), scSuhallaDesertRaiseStorm(), scSuhallaDesertSetUpFirstMapStorms(), scSuhallaDesertSetUpSecondMapStorms(), scTitleRevealScreen() and scWorldMapPlayLighthouseTransition().
Definition at line 543 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 btEffectRunJudgment() and btElementGlowPlay().
Definition at line 563 of file system.h.
IWRAM_COPY_WORDS
#define IWRAM_COPY_WORDS(destination, source, size)
syWordsCopy as a statement of its own: how the link battle and the Battle
Arena copy the Djinn recovery table into the send buffer, as The Lost Age
writes it there and in its IWRAM_FILL_WORDS fills.
Referenced by btLinkBattleSendParty() and scBattleArenaSendPartyRecords().
Definition at line 657 of file system.h.
syMulFX
#define syMulFX(left, right)
(left * right) >> 16 with a 64-bit product: the 16.16 product of two 16.16 numbers.
Referenced by btCameraSetRange(), btEffectRunThor(), btElementGlowInitStarField(), btElementGlowUpdateStarField(), btMotionLeapBack(), btMotionProjectCursorPoint(), btMotionProjectPos(), btMotionProjectScaledPos(), btObjectSpawnObjectsForList(), btUnitProjectToScreen(), fdActorMoveOnWorldMap(), fdActorScriptWanderNearHome(), fdActorSetMoveTarget(), fdActorSystemPlaceSprites(), fdActorUpdateAllMotion(), fdActorUpdateAllOnField(), fdActorUpdatePlayerControl(), fdActorWander(), fdCameraFollowLeaderInBounds(), fdEffectCircleAnchor(), fdEffectHueChannelRamp(), fdEffectRunSparkEmitter(), fdEffectSwayParticle(), fdEffectWanderAroundAnchor(), fdEncounterCountStepsAndSelectFormation(), fdFixedPointRemainder(), fdLineScrollBuildPage(), fdMapGridLoadMap(), fdMapGridSetCameraCenter(), fdMapGridUpdateLayerScroll(), fdPaletteFadeBuild(), fdParticleDraw(), fdParticleUpdateMotion(), fdPsynergyWatchLeaderDistance(), fdRenderPlaceProjectedSprite(), fdScriptSpawnActorPlacements(), fdTryJumpForward(), fdUpdateWalking(), fdWorldMapBuildScanlineTable(), fdWorldMapStepZoom(), fdWorldMapUpdateView(), mnColorScaleComponents(), mnDjinnMenuRunPreview(), mnTitlePaletteFadeBuildColors(), mnWindowColorScaleTint(), scAltinPeakAdvanceCart(), scImilSwayAndSpark(), scInit(), scLemurianShipUpdateGlowSwellAndSpray(), scLemurianShipWaveOffset() and 11 more.
Definition at line 691 of file system.h.
RAM_CODE_LOAD
#define RAM_CODE_LOAD(to, code, bytes)
Allocates a heap copy; release it with syHeapRelease when finished.
Referenced by fdActorRunUpdateAllFromHeap(), fdTileMapConvertBuffer(), mnGlyphDraw(), mnMessageFind(), mnScanlineWindowFillSpans(), syOAMBuildBuffer() and syOverlayLoad().
Definition at line 743 of file system.h.
RAM_CODE_LOAD_SLOT
#define RAM_CODE_LOAD_SLOT(slot, code, bytes)
Allocates a heap-slot copy; release it with syHeapSlotRelease.
Referenced by btBackgroundLoad(), fdActorSystemConfigure(), fdActorSystemPlaceSprites(), fdActorSystemProjectSprites(), fdTileMapDrawRowsFromRam(), fdWorldMapInitPerspective(), mnCreditsLoadBackground(), mnIconDecode(), mnIconDecompress(), mnMessageDecode() and mnMessageDecodeRaw().
Definition at line 754 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 | ||
CARTRIDGE_LANGUAGE_GERMAN | ||
CARTRIDGE_LANGUAGE_FRENCH | ||
CARTRIDGE_LANGUAGE_SPANISH | ||
CARTRIDGE_LANGUAGE_ITALIAN |
Definition at line 253 of file system.h.
Functions in detail
syHeapCallAlternatePool
static __inline__ void *syHeapCallAlternatePool(void *(*allocate)(Sint32), Sint32 size)
The heap_release group. Releasing heap blocks, and the two pools' space.
Takes size bytes from another pool through its allocator, such as
syHeapAllocateEWRAM.
References Sint32.
Referenced by scColossoDrawGauge() and scLemurianShipStartCurtains().
Definition at line 24 of file system.h.
sySin
FIXED sySin(ANGLE angle)
The sine of angle, a whole turn being TRIG_TURN, in 16.16, read from
TrigSineTable, 256 entries for the first quarter turn.
Referenced by btEffectRunBind(), btEffectRunBolt(), btEffectRunBreak(), btEffectRunCastingImpact(), btEffectRunCondemn(), btEffectRunCybele(), btEffectRunDeathPlunge(), btEffectRunDjinnBeams(), btEffectRunDjinnHeal(), btEffectRunDjinniEntrance(), btEffectRunDragonCloud(), btEffectRunDragonFire(), btEffectRunElementBurst(), btEffectRunElementPillar(), btEffectRunFire(), btEffectRunFlare(), btEffectRunFrost(), btEffectRunGatheringLights(), btEffectRunGround(), btEffectRunHail(), btEffectRunHaunt(), btEffectRunHealingMotes(), btEffectRunHelmSplitter(), btEffectRunImpactBurst(), btEffectRunJudgment(), btEffectRunJupiter(), btEffectRunKirin(), btEffectRunMars(), btEffectRunMercury(), btEffectRunMoteFountain(), btEffectRunNeptune(), btEffectRunOrbitingSkulls(), btEffectRunPlanetDiver(), btEffectRunPlasma(), btEffectRunProcne(), btEffectRunProjectileVolley(), btEffectRunQuake(), btEffectRunRagnarok(), btEffectRunRamses(), btEffectRunRay(), btEffectRunShiningStar(), btEffectRunSparkGroups(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunStatReduction(), btEffectRunStreakVolley(), btEffectRunTargetBursts(), btEffectRunTargetMotes(), btEffectRunTargetStrike(), btEffectRunThor() and 72 more.
Definition at line 47 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 btEffectRunBind(), btEffectRunBolt(), btEffectRunBreak(), btEffectRunCastingImpact(), btEffectRunCondemn(), btEffectRunCybele(), btEffectRunDeathPlunge(), btEffectRunDjinnBeams(), btEffectRunDjinnHeal(), btEffectRunDjinniEntrance(), btEffectRunDragonCloud(), btEffectRunDragonFire(), btEffectRunElementBurst(), btEffectRunElementPillar(), btEffectRunFire(), btEffectRunFlare(), btEffectRunFrost(), btEffectRunGround(), btEffectRunHail(), btEffectRunHealingMotes(), btEffectRunHelmSplitter(), btEffectRunImpactBurst(), btEffectRunJudgment(), btEffectRunJupiter(), btEffectRunKirin(), btEffectRunMars(), btEffectRunMercury(), btEffectRunMoteFountain(), btEffectRunNeptune(), btEffectRunOrbitingSkulls(), btEffectRunPlanetDiver(), btEffectRunPlasma(), btEffectRunProcne(), btEffectRunProjectileVolley(), btEffectRunRagnarok(), btEffectRunRamses(), btEffectRunRay(), btEffectRunShiningStar(), btEffectRunSparkGroups(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunStatReduction(), btEffectRunTargetBursts(), btEffectRunTargetMotes(), btEffectRunTargetStrike(), btEffectRunThor(), btEffectRunTitanBlade(), btEffectRunUndeadSword(), btEffectRunUnusedOrbitingSpirals(), btEffectRunVenus() and 51 more.
Definition at line 50 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(), btBackgroundLoad(), btEffectEndElementStreaks(), btEffectRunAnnihilation(), btEffectRunBolt(), btEffectRunByIdRange(), btEffectRunCastingImpact(), btEffectRunElementBurst(), btEffectRunElementPillar(), btEffectRunFlare(), btEffectRunFlashingStrike(), btEffectRunFromTable(), btEffectRunGround(), btEffectRunJudgment(), btEffectRunProjectileVolley(), btEffectRunShatteringOpening(), btEffectRunSpiderWeb(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunSummon(), btEffectRunTargetMotes(), btEffectRunTargetStrike(), btEffectRunThor(), btEffectRunUndeadSword(), btElementGlowEnd(), btTransitionRun(), fdActorSystemPlaceSprites(), fdActorSystemProjectSprites(), fdEffectInitSparkles(), fdEffectReleaseSlots(), fdEffectStartGroundMask(), fdEngineRun(), fdItemDisplayShowItem(), fdItemDisplayShowItemInFront(), fdLuckyDiceRun(), fdLuckyWheelsRun(), fdMotesStart(), fdPaletteCycleStop(), fdPaletteFadeRelease(), fdPsynergyEnd(), fdPsynergyStopMindReadWave(), fdSpriteComposePicture(), fdTileMapDrawRowsFromRam(), fdWeatherStartRain(), fdWorldMapWriteLayerMetatileTile(), mnAbilityIconLoadIntoSlot(), mnBattleCollectPartyCommands(), mnBattleCommandRowLoadIconTiles(), mnCommandIconLoad(), mnCommandIconReloadSlot() and 51 more.
Definition at line 58 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(), btBuildPartyActions(), btEnemyAdjustLevel(), btFormationSelectLevelMatchedCandidate(), btLinkBattleReceiveParty(), btLinkBattleSendParty(), btUnitProcessActionEnd(), fdActorRunUpdateAllFromHeap(), fdMapGridLoadMap(), fdMapScreenInit(), fdSpriteComposePicture(), fdTileMapConvertBuffer(), fdWorldMapLoadGraphics(), gmUnitCalculate(), gmUnitLevelUp(), mnBattleCollectPartyCommands(), mnBattleCommandRowLoadIconTiles(), mnBattleCommandRowRun(), mnBattleDjinnMenuRun(), mnBattleDjinnMenuShowChangePreview(), mnBattleStatusScreenRun(), mnCommandIconLoadIntoSlot(), mnCreditsDrawLine(), mnDebugSelectShortcuts(), mnDjinnMenuDrawStatPreview(), mnDjinnMenuRun(), mnDjinnMenuRunPreview(), mnDjinnMenuShowMemberStatus(), mnGlyphDraw(), mnItemMenuConfirmEquip(), mnItemMenuDrawEquipPreview(), mnItemMenuRun(), mnItemMenuRunCommands(), mnMessageFind(), mnPsynergyMenuRun(), mnPsynergyMenuSelectMember(), mnSaveWriteLinkTallies(), mnScanlineWindowFillSpans(), mnStatusPanelDraw(), mnStatusScreenRun(), mnStatusScreenShowMemberProgressMessage(), mnTextDrawString(), mnTextDrawStringAsTiles(), mnTextDrawStringAtOffset(), mnTextDrawStringInWindow(), mnWindowCopyTilemapRegion(), scBattleArenaReceivePartyRecords(), scBattleArenaSendPartyRecords() and 11 more.
Definition at line 65 of file system.h.
syDecompressByteLZ
Sint32 syDecompressByteLZ(const void *src, void *dest)
Referenced by fdEffectInitSparkles(), fdMotesStart(), fdWeatherStartRain(), fdWorldMapLoadAreaGraphics(), fdWorldMapLoadGraphics(), fdWorldMapWriteLayerMetatileTile(), mnBattleCommandRowLoadIconTiles(), mnCommandIconLoad(), mnCommandIconLoadIntoSlot(), mnCommandIconReloadSlot(), mnSelectionMenuLoadLargeIcon(), mnTitleLoad(), mnTitleLoadIntroBackgrounds(), mnTitleShowTitleScreen() and scSolSanctumStatueInitScrollingSprites().
Definition at line 70 of file system.h.
syDecompressTaggedLZ
Sint32 syDecompressTaggedLZ(const void *src, void *dest)
Referenced by btEffectRunAstralBlast(), btEffectRunBind(), btEffectRunCondemn(), btEffectRunDjinnBeams(), btEffectRunDjinniEntrance(), btEffectRunDragonFire(), btEffectRunFroth(), btEffectRunGatheringLights(), btEffectRunHaunt(), btEffectRunHealingMotes(), btEffectRunLobbedShells(), btEffectRunMirroredWall(), btEffectRunNereid(), btEffectRunOrbitingSkulls(), btEffectRunPlanetDiver(), btEffectRunProcne(), btEffectRunShiningStar(), btEffectRunUnusedOrbitingSpirals(), btEffectRunUnusedTriangleStrike(), btEffectRunWhirlwind(), btElementGlowInitStarField(), btResourceLoadAndDecompress(), fdLuckyWheelsRun(), fdMapGridLoadMap(), fdMapScreenShow(), fdSpriteComposePicture(), fdSpritePictureCacheLoad(), fdWorldMapInitPerspective(), fdWorldMapLoadAreaGraphics(), fdWorldMapLoadDefaultMetatilesAndUpdateBlock(), fdWorldMapLoadGraphics(), mnTitleShowCamelotLogo(), mnTitleShowPublisherLogo(), mnWindowCopyTilemapRegion(), scFieldDecompressTaggedLZ() and syOverlayLoad().
Definition at line 71 of file system.h.
syScreenFadeToBlack
void syScreenFadeToBlack(Sint32 frames)
Referenced by btRun(), btTransitionRunMosaicFadeOut(), fdScreenTransitionFinish(), fdScreenTransitionStart(), mnTitleShowCamelotLogo(), mnTitleShowPublisherLogo(), scFileScreenLoadBackground(), scInit() and scTitleLoadBackground().
Definition at line 103 of file system.h.
syScreenFadeFromBlack
void syScreenFadeFromBlack(Sint32 frames)
Referenced by fdMapGridLoadMap(), fdScreenTransitionFinish(), fdScreenTransitionStart(), fdSpriteViewerRun(), fdWorldMapInitPerspective() and mnTitleShowPublisherLogo().
Definition at line 104 of file system.h.
syScreenFadeToWhite
void syScreenFadeToWhite(Sint32 frames)
Referenced by mnTitleShowTitleScreen().
Definition at line 105 of file system.h.
syScreenFadeFromWhite
void syScreenFadeFromWhite(Sint32 frames)
Referenced by mnTitleShowCamelotLogo() and mnTitleShowTitleScreen().
Definition at line 106 of file system.h.
syIOWriteQueueStore8
void syIOWriteQueueStore8(Uint32 addr, Uint32 value)
Queue one register write of a width (8, 16 or 32 bits): a store, or the
value's bits set or cleared (system/system_io_write_queue.c).
Definition at line 119 of file system.h.
syIOWriteQueueStore16
void syIOWriteQueueStore16(Uint32 addr, Uint32 value)
Referenced by btEffectHideBg1AndRestoreBackdrop(), btElementGlowPlay(), btHighlightSetModes(), btTransitionRun(), mnBattleCommandRowRun(), scVaultCaveRunRumble() and scWorldMapUpdateTransitionBlend().
Definition at line 120 of file system.h.
syIOWriteQueueStore32
void syIOWriteQueueStore32(Uint32 addr, Uint32 value)
Referenced by scHeatGaugeDraw().
Definition at line 121 of file system.h.
syIOWriteQueueSetBits8
void syIOWriteQueueSetBits8(Uint32 addr, Uint32 value)
Definition at line 122 of file system.h.
syIOWriteQueueSetBits16
void syIOWriteQueueSetBits16(Uint32 addr, Uint32 value)
Referenced by btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btPlaybackRun() and btTransitionRun().
Definition at line 123 of file system.h.
syIOWriteQueueSetBits32
void syIOWriteQueueSetBits32(Uint32 addr, Uint32 value)
Definition at line 124 of file system.h.
syIOWriteQueueClearBits8
void syIOWriteQueueClearBits8(Uint32 addr, Uint32 value)
Definition at line 125 of file system.h.
syIOWriteQueueClearBits16
void syIOWriteQueueClearBits16(Uint32 addr, Uint32 value)
Referenced by btMessageWaitForAdvance(), btMessageWaitForAdvanceAt(), btPlaybackRun() and btTransitionRun().
Definition at line 126 of file system.h.
syIOWriteQueueClearBits32
void syIOWriteQueueClearBits32(Uint32 addr, Uint32 value)
Definition at line 127 of file system.h.
sySerialWaitForSend
void sySerialWaitForSend(void)
Referenced by btLinkBattleSendParty().
Definition at line 135 of file system.h.
sySerialWaitForReceive
void sySerialWaitForReceive(void)
Referenced by btLinkBattleReceiveParty().
Definition at line 136 of file system.h.
BiosSoundBiasOff
void BiosSoundBiasOff(void)
The system library's own functions and globals: interrupts, BIOS sound bias, random numbers and sleep.
Referenced by sySynch().
Definition at line 146 of file system.h.
BiosSoundBiasOn
void BiosSoundBiasOn(void)
Referenced by sySynch().
Definition at line 147 of file system.h.
BiosHalt
static __inline__ void BiosHalt(void)
The BIOS's Halt (SWI 02h): halts the CPU until an interrupt.
Definition at line 154 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.
Referenced by sySynch().
Definition at line 162 of file system.h.
syResourceGetMetadataRecordStub
ANIMATION_METADATA *syResourceGetMetadataRecordStub(Uint32 descriptorId)
The sprite module's one stub call: a sprite's animation metadata.
Referenced by btObjectSpawnObjectsForList(), fdActorCreate(), fdActorGetScreenPos(), fdEffectCopyWatchedActorPos(), fdPsynergyUpdateMindReadWave(), fdSpriteAddAnimation(), fdSpriteAnimationAllocate(), fdSpriteAnimationReset(), fdSpriteAnimationStart(), fdSpriteAnimationSumCommandLengths(), fdSpriteCreate(), fdSpritePictureCacheLoad(), fdSpriteResetAnimations(), fdSpriteStartAnimation(), fdSpriteViewerRun(), fdSpriteViewerSetLayerSprite(), fdSpriteViewerStartStaggeredAnimations() and fdSpriteViewerStepSpriteId().
Definition at line 191 of file system.h.
syHalt
void syHalt(void)
Stops the console for good with the BIOS Stop call: in the German, French, Spanish and Italian editions, what pulling the Game Pak out does.
Referenced by syInit().
Definition at line 244 of file system.h.
MixerEnter
void MixerEnter(void)
Runs the sound for this VBlank, the music players and then the game's own
mixer in IWRAM; the last thing syVBlankHandler does.
Referenced by syVBlankHandler().
Definition at line 247 of file system.h.
syDecompressMoveToFrontLZ
Sint32 syDecompressMoveToFrontLZ(const void *src, void *dest)
Referenced by fdMapGridLoadMap().
Definition at line 271 of file system.h.
syColorBufferBrighten
void syColorBufferBrighten(Uint8 *buf, Uint32 amount, Uint8 *dest, Uint32 bytes)
Referenced by btEffectTransferCanvas().
Definition at line 319 of file system.h.
syColorBufferDarken
void syColorBufferDarken(Uint8 *buf, Uint32 amount, Uint8 *dest, Uint32 bytes)
Referenced by btEffectTransferCanvas() and btEffectTransferFullScreenImage().
Definition at line 323 of file system.h.
syColorBufferScaleThreeQuarters
void syColorBufferScaleThreeQuarters(Uint8 *buf, Uint8 *dest, Uint32 bytes)
Referenced by btEffectTransferCanvas(), btEffectTransferFullScreenImage() and btElementGlowUploadStarField().
Definition at line 324 of file system.h.
syColorBufferHalve
void syColorBufferHalve(Uint8 *buf, Uint8 *dest, Uint32 bytes)
Referenced by btEffectTransferCanvas() and btEffectTransferFullScreenImage().
Definition at line 325 of file system.h.
syColorBufferBrightenPartial
void syColorBufferBrightenPartial(Uint8 *buf, Uint32 amount, Uint8 *dest, Uint32 bytes)
Definition at line 326 of file system.h.
syColorBufferDarkenPartial
void syColorBufferDarkenPartial(Uint8 *buf, Uint32 amount, Uint8 *dest, Uint32 bytes)
Definition at line 330 of file system.h.
syColorBufferScaleNonzeroThreeQuarters
void syColorBufferScaleNonzeroThreeQuarters(Uint8 *buf, Uint8 *dest, Uint32 bytes)
Referenced by fdLuckyWheelsTransferCanvas().
Definition at line 334 of file system.h.
syColorBufferHalveNonzero
void syColorBufferHalveNonzero(Uint8 *buf, Uint8 *dest, Uint32 bytes)
Referenced by fdLuckyWheelsTransferCanvas().
Definition at line 337 of file system.h.
syDMAXCopy
static __inline__ void syDMAXCopy(const volatile void *src, volatile void *dest, Uint32 control, volatile Uint32 *channel)
Starts a DMA transfer: stores the source, destination and control words into
channel's registers with one stmia. 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(), btEffectArmBg2AffineHBlankDMA(), btEffectArmPaletteHBlankDMA(), btEffectArmWin0HBlankDMA(), btEffectBuildWindowEdgeTable(), btEffectRunTorch(), btElementGlowInitStarField(), btShiftVRAMTiles(), btTransitionRun(), btTransitionUploadTileVariant(), dbIncreaseItemAndLevelSelectAbility(), dbIncreaseItemAndLevelSelectItem(), dbMenuTestSelectItem(), fdActorRestore(), fdActorSnapshot(), fdBlendScriptStart(), fdLineScrollArmDMA(), fdLuckyDiceRun(), fdLuckyWheelsRun(), fdLuckyWheelsStepSparkColors(), fdLuckyWheelsTransferCanvas(), fdLuckyWheelsUpdate(), fdMapScreenShow(), fdMindReadStartRipple(), fdPaletteCycleAdd(), fdPaletteCycleStep(), fdPaletteFadeBuild(), fdPaletteFadeInit(), fdPsynergyFadeToCastColor(), fdScreenTransitionFillTilemapAndColorTile(), fdScreenTransitionStartWindowHBlankDMA(), fdSpriteComposePicture(), fdTilesetAnimationUpdate(), fdWeatherUpdateLightning(), fdWorldMapApplyAffinePage(), fdWorldMapEndStillImage(), fdWorldMapLoadAreaGraphics(), fdWorldMapLoadGraphics(), fdWorldMapPresentStillImage(), fdWorldMapStartStillImage(), fdWorldMapWriteLayerMetatileTile(), mnBattleCommandRowLoadIconTiles(), mnColossoMenuChoose(), mnCreditsUpdateTextSprites(), mnGlyphDraw() and 64 more.
Definition at line 431 of file system.h.
syDMAWait
static __inline__ void syDMAWait(DMA_REGISTERS volatile *channel)
Waits until channel's transfer is done: SGL's slDMAWait.
Referenced by gmMainRoutineStateInitDefaults(), scColossoLoadLettering(), scCrossboneIsleSteppingStonesMovePillar(), scCrossboneIsleSteppingStonesReadMapGridMetatile() and scCrossboneIsleSteppingStonesSortPillarActors().
Definition at line 448 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.
Referenced by btBackgroundSetPaletteLevel().
Definition at line 522 of file system.h.
syIRQUnlock
static inline void syIRQUnlock(volatile Uint32 *saved)
Restores the IME that syIRQLock kept.
Referenced by btBackgroundSetPaletteLevel().
Definition at line 531 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(), btStagingDispatchAction(), fdActorSetMoveTarget(), fdActorUpdateAllMotion(), fdActorUpdateAllOnField(), fdCameraFollowLeaderInBounds(), fdCameraResetViewDefaults(), fdEffectHueChannelRamp(), fdEncounterCountStepsAndSelectFormation(), fdFixedPointRemainder(), fdWorldMapBuildScanlineTable(), fdWorldMapInitPerspective(), fdWorldMapStartZoom(), fdWorldMapUpdateView(), mnWindowDrawZoomBorder(), scMercuryLighthouseFollowLeader() and syPerspective().
Definition at line 588 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 btBackgroundLoad(), btCastingImpactEndPrelude(), btClearSerialTransferPayload(), btEffectClearTintTimers(), btEffectEndCanvasLayer(), btEffectEndElementStreaks(), btEffectOpenCanvasLayer(), btEffectRunCastingImpact(), btEffectRunCriticalHit(), btEffectRunCybele(), btEffectRunDjinniEntrance(), btEffectRunImpactBurst(), btEffectRunShatteringOpening(), btEffectSetupCanvasTileMap(), btEffectStartCanvasLayer(), btElementGlowEnd(), btElementGlowInitStarField(), btElementGlowPlay(), btFormationBuildEnemyList(), btObjectSpawnObjectsForList(), btPlaybackRun(), btRun(), btShiftVRAMTiles(), fdLuckyWheelsRun(), fdMapGridLoadMap(), fdSpriteComposePicture(), gmBattleUnitSet(), mnTextDrawGlyphPair(), mnTextDrawStringAsTiles(), mnWindowSystemInitBattle(), scBattleArenaWatchOpponent() and syVRAMCacheLoad().
Definition at line 595 of file system.h.
syWordsFill
static inline Sint32 syWordsFill(void *dest, Sint32 size, Uint32 value)
As syWordsClear, filling with value.
References Sint32.
Referenced by btEffectRunBolt(), btEffectRunCastingImpact(), btEffectRunCondemn(), btEffectRunFlashingStrike(), btEffectRunFlurry(), btEffectRunJudgment(), btEffectRunPlasma(), btEffectRunRay(), btEffectRunShatteringOpening(), btEffectRunSparkGroups(), btEffectRunThor(), btEffectRunTitanBlade(), btEffectRunWhirlwind(), btEffectSetupCanvasTileMap(), btEffectTransferCanvas(), btEffectTransferFullScreenImage(), btTransitionBuildAffineTilemap(), btTransitionBuildFlatTilemap(), fdLuckyWheelsRun(), fdLuckyWheelsTransferCanvas(), mnBattleDjinnMenuRun(), mnBuildPatternTiles(), mnCreditsDrawLine(), mnDjinnMenuRunPreview(), mnDjinnMenuShowMemberStatus(), mnItemMenuRun(), mnOpenBackdropScreen(), mnPsynergyMenuRun(), mnRangeIconBuildTiles(), mnStatusScreenRun(), mnTextClearCanvas(), mnTextDrawStringAsTiles(), mnTextFillCanvasBackground(), mnTextScrollCanvasUp() and mnWindowDrawOpened().
Definition at line 601 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(), btEffectRunHelmSplitter(), btEffectRunProcne(), btEffectRunStatBoost(), btEffectRunTargetMotes(), btEffectRunTorch(), btEffectSetApproachMotion(), btMotionApproachTarget(), fdActorApproachWatchedActor(), fdActorFindNearestFacingTarget(), fdActorMoveTowardTarget(), fdActorSetMoveTarget(), fdActorUpdateAllMotion(), fdActorUpdateAllOnField(), fdCameraFollowLeaderInBounds(), fdFindNearbyPsynergyTarget(), fdFindNearbyTalkTarget(), fdLuckyDiceRun(), fdParticleUpdateMotion(), fdScreenTransitionUpdateScanlineTable(), fdWorldMapBuildScanlineTable(), scLamakanDesertPixelsToOasis(), scMercuryLighthouseFollowLeader(), scPosDistance(), scTolbiSpringUpdateTossSimulation(), scValeDistanceInPixels(), syMatrixBuildLookAt() and sySquartFX().
Definition at line 608 of file system.h.
syCalcPoint
static inline Sint32 syCalcPoint(const POINT vector, POINT result)
Transforms a vector of three 16.16 coordinates by CurrentMatrix into result.
References Sint32.
Referenced by btCameraSetCommandView(), btCameraSetDefaultView(), btCameraSetView(), btCameraSetViewAtDepth(), btCameraUpdate(), fdCameraResetViewDefaults(), fdWorldMapBuildScanlineTable(), fdWorldMapInitPerspective(), fdWorldMapUpdateView() and syConvert3Dto2D().
Definition at line 614 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, CurrentMatrix.
Referenced by btCameraApplyTransform(), fdActorSystemProjectSprites(), syLookAt(), syMatrixRotate(), syMatrixRotateTranslate(), syMatrixRotateTranslateScale(), syMatrixScaleVector(), syMatrixTranslateVector(), syRotX(), syRotY() and syRotZ().
Definition at line 621 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() and syOAMMatrixAllocateFromTransform().
Definition at line 627 of file system.h.
syIntegerDivideUnsigned
static inline Uint32 syIntegerDivideUnsigned(Uint32 dividend, Uint32 divisor)
The unsigned quotient, rounded down.
Referenced by syConvert3Dto2D() and syMatrixBuildLookAt().
Definition at line 633 of file system.h.
syDecompressSpritePicture
static inline void *syDecompressSpritePicture(const void *src, void *dest)
Unpacks a sprite's codec 3 picture straight into its pixels at destination, where a byte above 223 skips that many less 223 transparent pixels, and returns null. A picture whose two-byte packed size is 0 is stored unpacked: it returns the picture after that size, for the caller to draw.
Referenced by fdSpriteComposePicture().
Definition at line 642 of file system.h.
syWordsCopy
static inline void syWordsCopy(volatile void *dest, const volatile void *src, Sint32 size)
Copies size bytes, rounded down to whole words, from source to destination.
References Sint32.
Referenced by btAbilityApplyToTarget(), btActionOrderSort(), btAwardSpoils(), btEffectConvertBackgroundToBlueRamp(), btEffectRunAstralBlast(), btEffectRunAtalanta(), btEffectRunAttackSlash(), btEffectRunBind(), btEffectRunBreak(), btEffectRunBurstShower(), btEffectRunCondemn(), btEffectRunCriticalHit(), btEffectRunDjinnBeams(), btEffectRunDjinniEntrance(), btEffectRunDragonFire(), btEffectRunDrain(), btEffectRunElementBurst(), btEffectRunElementPillar(), btEffectRunEruption(), btEffectRunFlurry(), btEffectRunFroth(), btEffectRunGaia(), btEffectRunGatheringLights(), btEffectRunHaunt(), btEffectRunHealingMotes(), btEffectRunJudgment(), btEffectRunLobbedShells(), btEffectRunMars(), btEffectRunMirroredWall(), btEffectRunMoteFountain(), btEffectRunNereid(), btEffectRunOrbitingSkulls(), btEffectRunPlanetDiver(), btEffectRunPlasma(), btEffectRunProcne(), btEffectRunProjectileVolley(), btEffectRunQuake(), btEffectRunRushingStrike(), btEffectRunShatteringOpening(), btEffectRunShiningStar(), btEffectRunSparkGroups(), btEffectRunStarfieldFall(), btEffectRunStatBoost(), btEffectRunStatReduction(), btEffectRunStreakVolley(), btEffectRunSwirlSwipe(), btEffectRunTargetBursts(), btEffectRunTargetMotes(), btEffectRunTargetStrike(), btEffectRunThor() and 34 more.
Definition at line 648 of file system.h.
syMulFX
static inline Sint32 syMulFX(Sint32 left, Sint32 right)
(left * right) >> 16 with a 64-bit product: the 16.16 product of two 16.16 numbers.
References Sint32.
Referenced by btCameraSetRange(), btEffectRunThor(), btElementGlowInitStarField(), btElementGlowUpdateStarField(), btMotionLeapBack(), btMotionProjectCursorPoint(), btMotionProjectPos(), btMotionProjectScaledPos(), btObjectSpawnObjectsForList(), btUnitProjectToScreen(), fdActorMoveOnWorldMap(), fdActorScriptWanderNearHome(), fdActorSetMoveTarget(), fdActorSystemPlaceSprites(), fdActorUpdateAllMotion(), fdActorUpdateAllOnField(), fdActorUpdatePlayerControl(), fdActorWander(), fdCameraFollowLeaderInBounds(), fdEffectCircleAnchor(), fdEffectHueChannelRamp(), fdEffectRunSparkEmitter(), fdEffectSwayParticle(), fdEffectWanderAroundAnchor(), fdEncounterCountStepsAndSelectFormation(), fdFixedPointRemainder(), fdLineScrollBuildPage(), fdMapGridLoadMap(), fdMapGridSetCameraCenter(), fdMapGridUpdateLayerScroll(), fdPaletteFadeBuild(), fdParticleDraw(), fdParticleUpdateMotion(), fdPsynergyWatchLeaderDistance(), fdRenderPlaceProjectedSprite(), fdScriptSpawnActorPlacements(), fdTryJumpForward(), fdUpdateWalking(), fdWorldMapBuildScanlineTable(), fdWorldMapStepZoom(), fdWorldMapUpdateView(), mnColorScaleComponents(), mnDjinnMenuRunPreview(), mnTitlePaletteFadeBuildColors(), mnWindowColorScaleTint(), scAltinPeakAdvanceCart(), scImilSwayAndSpark(), scInit(), scLemurianShipUpdateGlowSwellAndSpray(), scLemurianShipWaveOffset() and 11 more.
Definition at line 665 of file system.h.
syCallReturnIp
static __inline__ Sint32 syCallReturnIp(Sint32 left, Sint32 right, void *routine)
Calls an IWRAM function that returns through ip instead of lr, with left and
right in r0 and r1, and returns its r0: how the Thumb C reaches SGL's
slMulFX, the multiply in IWRAM, keeping lr and r3. No procedure-call standard
returns through ip.
References Sint32.
Definition at line 674 of file system.h.
syUnitMatrix
static __inline__ void syUnitMatrix(MATRIX matrix)
The matrix group. The 3D transform and its stack. 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(), syMatrixScaleVector(), syMatrixTranslateVector(), syRotX(), syRotY() and syRotZ().
Definition at line 701 of file system.h.
syUnitMatrixCurrentInline
static __inline__ void syUnitMatrixCurrentInline(void)
Resets the current matrix to the unit matrix: syUnitMatrix's stores, with
CurrentMatrix's address in r3, which the stores then set to 0. syUnitMatrix
itself cannot be used here: with r3 on its list of what it destroys the
address goes to r5, which then needs saving.
References CurrentMatrix.
Referenced by syInitMatrix() and syUnitMatrixCurrent().
Definition at line 719 of file system.h.
sySerialAddErrorFlag
static __inline__ Sint32 sySerialAddErrorFlag(Sint32 status)
The serial group. The link cable's runtime: serial packets, registers and
transfer state. Adds LINK_STATUS_ERROR to a link status once a transfer has
failed.
References SerialStateWork and Sint32.
Referenced by sySerialGetLinkStatus().
Definition at line 768 of file system.h.
sySerialResetTransferState
static __inline__ void sySerialResetTransferState(void)
Abandons any send or receive and clears the block transfer's state, with interrupts held off: what a failed link battle or Battle Arena exchange does.
References SerialReceiveDestination, SerialReceivedSize, SerialSendSize, SerialSendSource, SerialTransfer and state.
Referenced by scBattleArenaExchangePartyRecords() and syLinkBattleResetTransferState().
Definition at line 777 of file system.h.
syVector3Coordinates
static __inline__ const Sint32 *syVector3Coordinates(const VECTOR3 *vector)
The vector3 group. Returns the vector's three coordinates as an array. UB:
transform functions index three coordinates from separate scalar members.
UBFIX gives those functions a real array while preserving named components.
References Sint32.
Referenced by btEffectRunAstralBlast(), btEffectRunBind(), btEffectRunProcne(), btEffectRunUnusedTriangleStrike() and scTolbiSpringUpdateTossSimulation().
Definition at line 801 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 169 of file system.h.
NumberBufferDecimalEnd
extern Uint8 NumberBufferDecimalEnd[]
NumberBuffer + 10, the decimal form's units digit (the form ends at + 11);
syPrintDecimal starts n characters before it, so it prints n + 1.
Referenced by syPrintDecimal().
Definition at line 173 of file system.h.
NumberBufferHexEnd
extern Uint8 NumberBufferHexEnd[]
The end of the hexadecimal form in NumberBuffer.
Referenced by syPrintHex().
Definition at line 175 of file system.h.
LinkTimeLabelString
extern const Uint8 LinkTimeLabelString[]
The link battle timer's heading: TIME; TMPO. in Spanish, TEMPS in
French.
Referenced by mnLinkCreateCountdownLabelWindow().
Definition at line 178 of file system.h.
ResourceDirectoryTable
extern void *ResourceDirectoryTable[]
Each resource's ROM address by resource id (syResourceGetTableEntry).
Referenced by syResourceGetTableEntry().
Definition at line 180 of file system.h.
SpriteAnimationMetadata
extern ANIMATION_METADATA SpriteAnimationMetadata[]
Every sprite animation's metadata, by number (graphics/sprite/sprites.s).
Referenced by syResourceGetMetadataRecord().
Definition at line 183 of file system.h.
syResourcePatchThumbBranchCodeSize
extern Uint8 syResourcePatchThumbBranchCodeSize[]
The size of syResourcePatchThumbBranch (decompress_tagged_lz.s).
Referenced by syOverlayLoad().
Definition at line 194 of file system.h.
WindowPalette
extern const Uint16 WindowPalette[]
The window font's 16 colours, loaded as BG palette 15 (syWindowLoadGraphics).
Referenced by syWindowLoadGraphics().
Definition at line 196 of file system.h.
IwramSoundReverbCode
extern Uint8 IwramSoundReverbCode[]
The 152 bytes of IWRAM-resident sound code (0x03000bd8, not the mixer at
0x03007000) that sySoundLoadReverbCode overwrites with a reverb code from
IwramSoundReverbCodes.
Referenced by sySoundLoadReverbCode().
Definition at line 203 of file system.h.
DebugTextCursor
extern Uint16 *DebugTextCursor
Where the debug text writes next on its 32 by 20 screen in BG0.
Referenced by syPrint(), syPrintBlanks() and syPrintClear().
Definition at line 210 of file system.h.
DebugTextEnabled
extern Uint8 DebugTextEnabled
Nonzero lets syPrint write; the power-on set-up and the credits clear it.
Referenced by mnCreditsRun(), syInit() and syPrint().
Definition at line 212 of file system.h.
BupBuffer
extern Uint8 BupBuffer[]
The buffer a save file is built in and written from, in two halves; its summary's 16-byte header lies just before it.
Referenced by mnSaveBuildFileSummary(), mnSaveChooseAndLoadFile(), mnSaveCopyFile(), mnSaveToChosenFile(), mnSaveWriteCurrentFile(), mnSaveWriteFile(), mnSaveWriteLinkTallies() and scInit().
Definition at line 215 of file system.h.
BupSlot
extern Sint16 BupSlot
The current save file, or -1 for none (a new game).
Referenced by gmMainRoutineStateInitDefaults(), mnSaveChooseAndLoadFile(), mnSaveToChosenFile(), mnSaveWriteCurrentFile() and mnSaveWriteLinkTallies().
Definition at line 217 of file system.h.
IwramSoundReverbCodes
extern Uint8 IwramSoundReverbCodes[]
The five reverb codes' mixer code, SOUND_REVERB_CODE_SIZE bytes each.
Referenced by sySoundLoadReverbCode().
Definition at line 219 of file system.h.
syOAMBuildBufferKernelCodeSize
extern Uint8 syOAMBuildBufferKernelCodeSize[]
The size of syOAMBuildBufferKernel (decompress_byte_lz.s).
Referenced by syOAMBuildBuffer().
Definition at line 221 of file system.h.
syOAMBuildBufferKernel
extern const Uint8 syOAMBuildBufferKernel[]
The ARM OAM list builder, run from a heap copy by syOAMBuildBuffer.
Referenced by syOAMBuildBuffer().
Definition at line 223 of file system.h.
syResourceExecuteTransfer
extern const Uint8 syResourceExecuteTransfer[]
The ARM register-write executor, run from a stack copy by
syIOWriteQueueFlushPending.
Referenced by syIOWriteQueueFlushPending().
Definition at line 226 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 229 of file system.h.
RomLanguageCode
extern const Uint8 RomLanguageCode
The game code's last letter in the cartridge header: J in Japanese, E,
D, F, S or I (syGetLanguage).
Referenced by syGetLanguage().
Definition at line 232 of file system.h.
BasicSpritePalettes
extern const Uint8 BasicSpritePalettes[]
The basic sprite palettes 0 to 13, 224 colours
(syPaletteLoadBasicSpriteColors).
Referenced by syPaletteGetBasicSpriteColors(), syPaletteLoadBasicSpriteColors() and syWindowLoadGraphics().
Definition at line 235 of file system.h.
fdTileCopyStrided
extern Uint8 fdTileCopyStrided[]
The sprite tile uploader, run from HEAP_SLOT_PICTURE_UPLOADER.
Referenced by fdActorSystemConfigure().
Definition at line 237 of file system.h.
fdTileCopyStridedCodeSize
extern Uint8 fdTileCopyStridedCodeSize[]
The size of fdTileCopyStrided (map_grid_convert.s).
Referenced by fdActorSystemConfigure().
Definition at line 239 of file system.h.
syResourceExecuteTransferCodeSize
extern Uint8 syResourceExecuteTransferCodeSize[]
The size of syResourceExecuteTransfer (decompress_tagged_lz.s).
Referenced by syIOWriteQueueFlushPending().
Definition at line 241 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() and syRandom().
Definition at line 367 of file system.h.