Alchemy
Loading...
Searching...
No Matches

ramcode.h File Reference

Copying ARM routines to RAM to run them there. More...

Go to the source code of this file.

Macros

#define RamCode_Load(to, code, bytes)
 Allocates a heap copy; release it with MemFree when finished.
#define RamCode_LoadSlot(slot, code, bytes)
 Allocates a work-slot copy; release it with Runtime_ReleaseHeapBlock.

Detailed Description

Copying ARM routines to RAM to run them there.

Definition in file ramcode.h.

Macro Definition Documentation

◆ RamCode_Load

#define RamCode_Load ( to,
code,
bytes )
Value:
do { \
u32 size_; \
\
size_ = (u32)(bytes); \
\
(to) = MemAlloc(size_); \
Dma_Set((const void *)(code), (to), 0x84000000 | (size_ >> 2), REG_DMA3); \
} while (0)
void * MemAlloc(s32 size)
Allocates size bytes (rounded up to words) with no slot, from IWRAM when they fit and EWRAM otherwise...
Definition heap.c:115
#define REG_DMA3
Definition io_reg.h:153
unsigned int u32
Definition types.h:15

Allocates a heap copy; release it with MemFree when finished.

Definition at line 15 of file ramcode.h.

Referenced by Object_RunUpdateAllFromHeap(), Render_BuildOamList(), Resource_LoadCode(), Tilemap_ConvertBuffer(), UiText_DrawGlyph(), UiText_LookupMessage(), and UiWindow_FillFromScene().

◆ RamCode_LoadSlot

#define RamCode_LoadSlot ( slot,
code,
bytes )
Value:
do { \
u32 size_; \
\
size_ = (u32)(bytes); \
\
Dma_Set((const void *)(code), Runtime_AllocateHeapBlock((slot), size_), \
0x84000000 | (size_ >> 2), REG_DMA3); \
} while (0)
void * Runtime_AllocateHeapBlock(s32 kind, s32 size)
Returns heap slot kind's block, first allocating size bytes for it (rounded up to words),...
Definition heap.c:47

Allocates a work-slot copy; release it with Runtime_ReleaseHeapBlock.

Definition at line 26 of file ramcode.h.

Referenced by BattleBackground_Load(), Graphics_LoadCharacterBlockAndPalette(), Map_InitializePerspectiveScene(), ObjectSystem_Configure(), ObjectSystem_UpdateCamera(), ObjectSystem_UpdateCameraFixed(), TileMap_DrawRowsFromRam(), UiIcon_Decode(), UiIcon_Decompress(), and UiText_DecodeMessage().