Alchemy
Loading...
Searching...
No Matches

iwram_call.h File Reference

The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address, and one typed inline per routine that every call goes through. More...

Go to the source code of this file.

Macros

#define Iwram_RatioMulQ14Entry   FIXED_ADDRESS((s32 (*)(s32 divisor, s32 value)), 0x0300013c, IwramRatioMulQ14)
#define Iwram_ClearWordsEntry
#define Iwram_FillWordsEntry
#define Iwram_SqrtEntry   FIXED_ADDRESS((s32 (*)(s32 value)), 0x030001d8, IwramSqrt)
#define Iwram_ExpandBitRuns
#define Iwram_TransformVectorEntry
 Reads all three word-aligned coordinates before writing the result.
#define Iwram_TransformMatrixEntry   FIXED_ADDRESS((void (*)(const s32 *matrix)), 0x030002c0, IwramTransformMatrix)
#define Iwram_SignedDivideEntry
#define Iwram_UnsignedDivideEntry
#define Iwram_DecompressEntry
#define Iwram_CopyWordsEntry
#define Iwram_MulQ16(left, right)
#define Iwram_CopyWordsOffset   FIXED_OFFSET(0x1388, IwramCopyWords, IwramIrqMain)
#define Iwram_RatioMulQ14Offset   FIXED_OFFSET(0x13c, IwramRatioMulQ14, IwramIrqMain)
#define Iwram_SqrtOffset   FIXED_OFFSET(0x1d8, IwramSqrt, IwramIrqMain)

Functions

static s32 Iwram_RatioMulQ14 (s32 divisor, s32 value)
 All calls go through this layer.
static s32 Iwram_ClearWords (void *destination, s32 size)
static s32 Iwram_FillWords (void *destination, s32 size, u32 value)
static s32 Iwram_Sqrt (s32 value)
static s32 Iwram_TransformVector (const void *vector, s32 *result)
static void Iwram_TransformMatrix (const s32 *matrix)
static s32 Iwram_SignedDivide (s32 dividend, s32 divisor)
static u32 Iwram_UnsignedDivide (u32 dividend, u32 divisor)
static void * Iwram_Decompress (const void *source, void *destination)
static s32 Iwram_CopyWords (volatile void *destination, const volatile void *source, s32 size)
static __inline__ s32 Iwram_Call2 (s32 left, s32 right, void *routine)

Variables

u8 IwramMulQ16ReturnIp []

Detailed Description

The IWRAM call layer: the routines the game keeps resident in IWRAM, each at its fixed address, and one typed inline per routine that every call goes through.

It is a habit of the whole game written once: a layer, not a compiler-steering device (AGENTS.md S2). Code writes Iwram_Sqrt(value) or Iwram_SignedDivide(dividend, divisor), and the inline calls the routine at its fixed address.

Definition in file iwram_call.h.

Macro Definition Documentation

◆ Iwram_RatioMulQ14Entry

#define Iwram_RatioMulQ14Entry   FIXED_ADDRESS((s32 (*)(s32 divisor, s32 value)), 0x0300013c, IwramRatioMulQ14)

Definition at line 17 of file iwram_call.h.

Referenced by Iwram_RatioMulQ14().

◆ Iwram_ClearWordsEntry

#define Iwram_ClearWordsEntry
Value:
FIXED_ADDRESS((s32 (*)(void *destination, s32 size)), 0x03000164, \
u8 IwramClearWords[]
signed int s32
Definition types.h:14
#define FIXED_ADDRESS(type, address, linked)
Definition types.h:43

Definition at line 19 of file iwram_call.h.

Referenced by Iwram_ClearWords().

◆ Iwram_FillWordsEntry

#define Iwram_FillWordsEntry
Value:
FIXED_ADDRESS((s32 (*)(void *destination, s32 size, u32 value)), 0x03000168, \
IwramFillWords)
unsigned int u32
Definition types.h:15

Definition at line 22 of file iwram_call.h.

Referenced by BattleFx_RunSparkGroups(), and Iwram_FillWords().

◆ Iwram_SqrtEntry

#define Iwram_SqrtEntry   FIXED_ADDRESS((s32 (*)(s32 value)), 0x030001d8, IwramSqrt)

Definition at line 25 of file iwram_call.h.

Referenced by Iwram_Sqrt().

◆ Iwram_ExpandBitRuns

#define Iwram_ExpandBitRuns
Value:
FIXED_ADDRESS((s32 (*)(const void *bits, void *destination, s32 value)), \
0x03000214, IwramExpandBitRuns)

Definition at line 27 of file iwram_call.h.

Referenced by UiText_RenderGlyphPair().

◆ Iwram_TransformVectorEntry

#define Iwram_TransformVectorEntry
Value:
FIXED_ADDRESS((s32 (*)(const void *vector, s32 *result)), 0x03000250, \
IwramTransformVector)

Reads all three word-aligned coordinates before writing the result.

Input may be an array or a record's coordinate prefix; output may overlap it.

Definition at line 32 of file iwram_call.h.

Referenced by Iwram_TransformVector().

◆ Iwram_TransformMatrixEntry

#define Iwram_TransformMatrixEntry   FIXED_ADDRESS((void (*)(const s32 *matrix)), 0x030002c0, IwramTransformMatrix)

Definition at line 35 of file iwram_call.h.

Referenced by Iwram_TransformMatrix().

◆ Iwram_SignedDivideEntry

#define Iwram_SignedDivideEntry
Value:
FIXED_ADDRESS((s32 (*)(s32 dividend, s32 divisor)), 0x03000380, \
IwramSignedDivide)

Definition at line 37 of file iwram_call.h.

Referenced by Iwram_SignedDivide().

◆ Iwram_UnsignedDivideEntry

#define Iwram_UnsignedDivideEntry
Value:
FIXED_ADDRESS((u32 (*)(u32 dividend, u32 divisor)), 0x030003f0, \
IwramUnsignedDivide)

Definition at line 40 of file iwram_call.h.

Referenced by Iwram_UnsignedDivide().

◆ Iwram_DecompressEntry

#define Iwram_DecompressEntry
Value:
FIXED_ADDRESS((void *(*)(const void *source, void *destination)), \
0x030005c0, IwramDecompress)

Definition at line 43 of file iwram_call.h.

Referenced by Iwram_Decompress().

◆ Iwram_CopyWordsEntry

#define Iwram_CopyWordsEntry
Value:
FIXED_ADDRESS((s32 (*)(void *destination, const void *source, s32 size)), \
0x03001388, IwramCopyWords)
u8 IwramCopyWords[]

Definition at line 46 of file iwram_call.h.

Referenced by Iwram_CopyWords(), and Map_LoadLayeredScene().

◆ Iwram_MulQ16

#define Iwram_MulQ16 ( left,
right )
Value:
static __inline__ s32 Iwram_Call2(s32 left, s32 right, void *routine)
Definition iwram_call.h:111
u8 IwramMulQ16ReturnIp[]

Definition at line 127 of file iwram_call.h.

Referenced by AltinPeak_AdvanceLog(), BattleActor_SpawnObjectsForList(), BattleCamera_SetRange(), BattleFx_BuildBuffer(), BattleFx_CircleAnchor(), BattleFx_DrawScaledObject(), BattleFx_HueChannelRamp(), BattleFx_InitializeStarField(), BattleFx_RunSparkEmitter(), BattleFx_RunThor(), BattleFx_SwayParticle(), BattleFx_UpdateStarField(), BattleFx_WanderAroundAnchor(), BattleMotion_InitializeObject(), BattleMotion_ProjectConditionalPosition(), BattleMotion_ProjectPosition(), BattleMotion_ProjectScaledPosition(), BattleUnit_ProjectToScreen(), Camera_FollowLeaderInBounds(), Color_ScaleComponents(), DisplayScroll_BuildAndSwapHBlankPage(), EffectSlot_UpdateMotion(), Encounter_SelectEnemyGroup(), Event_SpawnObjectTable(), Field_ProcessStep(), Field_TryJumpForward(), FieldEffect_WatchLeaderDistance(), FieldFx_StepRatioTransition(), FieldObject_UpdatePlayerControl(), Fixed_Remainder(), Imil_SwayAndSpark(), Map_LoadLayeredScene(), Map_SetCameraCenter(), Map_UpdateLayerScroll(), MercuryLighthouse_FollowLeader(), MercuryLighthouse_HopAcrossPool(), Object_MoveOnWorldMap(), Object_SetMoveTarget(), Object_UpdateAllMotion(), Object_UpdateAllThumb(), Object_Wander(), ObjectSystem_UpdateCamera(), OwnerAction_RunCompareLoop(), Palette_Transform(), Render_PlaceProjectedSprite(), Render_ProjectPoint(), SceneTransform_ApplyRotation(), SceneTransform_ApplyRotationTranslation(), SceneTransform_ApplyScaledRotation(), ScriptObject_WanderNearHome(), Ship_UpdateSwell(), SolSanctumEruption_StepEmbers(), SolSanctumEruption_ThrowEruptionRing(), Transform_BuildLookAt(), TretTreeInteriors_EnterRoom(), Vector_AddPolarOffset(), Wave_Offset(), WindowColor_ScaleTint(), WorldMap_BuildScanlineTable(), WorldMap_UpdateBobbingMarker(), and WorldMap_UpdateView().

◆ Iwram_CopyWordsOffset

#define Iwram_CopyWordsOffset   FIXED_OFFSET(0x1388, IwramCopyWords, IwramIrqMain)

Definition at line 130 of file iwram_call.h.

◆ Iwram_RatioMulQ14Offset

#define Iwram_RatioMulQ14Offset   FIXED_OFFSET(0x13c, IwramRatioMulQ14, IwramIrqMain)

Definition at line 131 of file iwram_call.h.

◆ Iwram_SqrtOffset

#define Iwram_SqrtOffset   FIXED_OFFSET(0x1d8, IwramSqrt, IwramIrqMain)

Definition at line 133 of file iwram_call.h.

Function Documentation

◆ Iwram_RatioMulQ14()

◆ Iwram_ClearWords()

◆ Iwram_FillWords()

◆ Iwram_Sqrt()

◆ Iwram_TransformVector()

◆ Iwram_TransformMatrix()

◆ Iwram_SignedDivide()

◆ Iwram_UnsignedDivide()

u32 Iwram_UnsignedDivide ( u32 dividend,
u32 divisor )
inlinestatic

Definition at line 77 of file iwram_call.h.

Referenced by Iwram_UnsignedDivide(), Render_ProjectPoint(), and Transform_BuildLookAt().

◆ Iwram_Decompress()

void * Iwram_Decompress ( const void * source,
void * destination )
inlinestatic

Definition at line 81 of file iwram_call.h.

Referenced by Iwram_Decompress(), and Sprite_ComposeAnimationFrame().

◆ Iwram_CopyWords()

s32 Iwram_CopyWords ( volatile void * destination,
const volatile void * source,
s32 size )
inlinestatic

Definition at line 85 of file iwram_call.h.

Referenced by Battle_AwardSpoils(), Battle_SelectAbility(), BattleEnemy_AdjustLevel(), BattleFx_FlushPendingGraphicsTransfer(), BattleFx_InitializeStarField(), BattleFx_ProcessPendingGraphicsTransfer(), BattleFx_RunAstralBlast(), BattleFx_RunAtalanta(), BattleFx_RunBeamSequence(), BattleFx_RunBind(), BattleFx_RunBreak(), BattleFx_RunBurstScene(), BattleFx_RunBurstShower(), BattleFx_RunCondemn(), BattleFx_RunDjinnBeams(), BattleFx_RunDjinniEntrance(), BattleFx_RunDrain(), BattleFx_RunElementBurst(), BattleFx_RunElementPillar(), BattleFx_RunEruption(), BattleFx_RunFroth(), BattleFx_RunGaia(), BattleFx_RunGatheringLights(), BattleFx_RunHaunt(), BattleFx_RunHealingMotes(), BattleFx_RunJudgment(), BattleFx_RunLobbedShells(), BattleFx_RunMars(), BattleFx_RunMirroredWall(), BattleFx_RunMoteFountain(), BattleFx_RunNereid(), BattleFx_RunOrbitingSkulls(), BattleFx_RunOrbitingSpirals(), BattleFx_RunPaletteParticles(), BattleFx_RunParticleStreams(), BattleFx_RunPlanetDiver(), BattleFx_RunPlasma(), BattleFx_RunProcne(), BattleFx_RunProjectileVolley(), BattleFx_RunQuake(), BattleFx_RunRingAndSparkScene(), BattleFx_RunRushingStrike(), BattleFx_RunShatteringOpening(), BattleFx_RunShiningStar(), BattleFx_RunSparkGroups(), BattleFx_RunStatBoost(), BattleFx_RunStatReduction(), BattleFx_RunStreakVolley(), BattleFx_RunSwirlSwipe(), BattleFx_RunTargetBursts(), BattleFx_RunTargetMotes(), BattleFx_RunTargetStrike(), BattleFx_RunThor(), BattleFx_RunTriangleStrike(), BattleFx_RunVolcano(), BattleFx_RunWhirlwind(), BattleFx_StartElementStreaks(), BattleFx_StepPaletteToResource(), BattlePalette_UpdateBlend(), BattleQueue_SortByPriority(), BattleTargetExec(), BattleUnit_ProcessTurnEnd(), DisplayScroll_DrawLine(), DjinnMenu_Run(), DjinnMenu_ShowChangePreview(), DjinnMenu_ShowOwnerStatus(), Graphics_ConvertBackgroundToBlueRamp(), Graphics_UpdatePhasePalette(), ItemMenu_ConfirmEquip(), ItemMenu_DrawEquipPreview(), ItemMenu_Run(), Iwram_CopyWords(), LinkBattle_SendParty(), LinkLobby_SendPartyRecords(), Menu_OpenBackdropScreen(), OwnerAction_RunCompareLoop(), PsynergyMenu_Run(), Resource_LoadAndDecompress(), SaveState_ProcessSelectedSlot(), StatusMenu_Run(), Tilemap_ConvertBuffer(), Ui_RunOwnerStatusScreen(), and Unit_Copy().

◆ Iwram_Call2()

__inline__ s32 Iwram_Call2 ( s32 left,
s32 right,
void * routine )
static

Definition at line 111 of file iwram_call.h.

Referenced by Iwram_Call2().

Variable Documentation

◆ IwramMulQ16ReturnIp

u8 IwramMulQ16ReturnIp[]
extern