This repository has been archived by the owner on Nov 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathramfunc.c
61 lines (49 loc) · 1.89 KB
/
ramfunc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "armfunc.h"
#undef DrawGlyph
#undef DecodeString
#undef PutOamHi
#undef PutOamLo
#undef MapFloodCoreStep
#undef MapFloodCore
extern u8 RamFuncArea[];
extern void (* DrawGlyphRamFunc)(u16 const * cvtLut, void * chr, u32 const * glyph, int offset);
extern void (* DecodeStringRamFunc)(char const * src, char * dst);
extern void (* PutOamHiRamFunc)(int x, int y, u16 const * oam_list, int oam2);
extern void (* PutOamLoRamFunc)(int x, int y, u16 const * oam_list, int oam2);
extern void (* MapFloodCoreStepRamFunc)();
extern void (* MapFloodCoreRamFunc)(void);
void InitRamFuncs(void)
{
int size = ArmCodeEnd - ArmCodeStart;
CpuCopy16(ArmCodeStart, RamFuncArea, size);
DrawGlyphRamFunc = (void *) RamFuncArea + (((u8 *) (void *) DrawGlyph) - ArmCodeStart);
DecodeStringRamFunc = (void *) RamFuncArea + (((u8 *) (void *) DecodeString) - ArmCodeStart);
PutOamHiRamFunc = (void *) RamFuncArea + (((u8 *) (void *) PutOamHi) - ArmCodeStart);
PutOamLoRamFunc = (void *) RamFuncArea + (((u8 *) (void *) PutOamLo) - ArmCodeStart);
MapFloodCoreStepRamFunc = (void *) RamFuncArea + (((u8 *) (void *) MapFloodCoreStep) - ArmCodeStart);
MapFloodCoreRamFunc = (void *) RamFuncArea + (((u8 *) (void *) MapFloodCore) - ArmCodeStart);
}
void DrawGlyphRam(u16 const * cvtLut, void * chr, u32 const * glyph, int offset)
{
DrawGlyphRamFunc(cvtLut, chr, glyph, offset);
}
void DecodeStringRam(char const * src, char * dst)
{
DecodeStringRamFunc(src, dst);
}
void PutOamHiRam(int x, int y, u16 const * oam_list, int oam2)
{
PutOamHiRamFunc(x, y, oam_list, oam2);
}
void PutOamLoRam(int x, int y, u16 const * oam_list, int oam2)
{
PutOamLoRamFunc(x, y, oam_list, oam2);
}
void MapFloodCoreStepRam(int connect, int x, int y)
{
MapFloodCoreStepRamFunc(connect, x, y);
}
void MapFloodCoreRam(void)
{
MapFloodCoreRamFunc();
}