-
Notifications
You must be signed in to change notification settings - Fork 1
/
AsmExtra.h
65 lines (52 loc) · 1.81 KB
/
AsmExtra.h
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
62
63
64
65
#ifndef ASMEXTRA_HEADER
#define ASMEXTRA_HEADER
#ifdef __cplusplus
extern "C" {
#endif
/// The current FPS as calculated by the calculateFPS function.
extern char fpsText[8];
/// Reset Flashcart and reboot GBA.
void resetFlashCart(void);
/// Put the GBA to sleep, sets Start+Select as wakeup keys. Doesn't seem to work right now, maybe some kind of IRQ not enabled?
void suspend(void);
/**
* Can be used to overclock EWRAM speed, doesn't work on GBA Micro.
* @param overclock: true to overclock EWRAM.
*/
void setEWRAMSpeed(bool overclock);
/**
* Tries to read the Real Time Clock from the cartridge as implemented in Pokemon.
* @return The time as BCD encoded ??SSMMHH, r1=??DDMMYY.
*/
int getTime(void);
/**
* Converts a binary number to Binary Encoded Decimal format
* @param value: Value to convert.
* @return Input value converted to BCD.
*/
int bin2BCD(int number);
/**
* Generates a "random" number between 0 and maxValue.
* @param maxValue: How large the distribution of values are.
* @return A new "random" number.
*/
int getRandomNumber(int maxValue);
/// Calculates fps, needs to be called _every_ frame, eg. from the VBlank interrupt.
void calculateFPS(void);
/**
* Converts 24bit RGB palette to 15bit BGR palette, while running gamma conversion on it.
* @param *dest: Destination of result, needs to be aligned to 16bit.
* @param *source: Source of RGB data, 8bit aligned.
* @param length: How many colors to convert.
* @param gamma: Gamma value between 1 & 4.
*/
void convertPalette(u16 *dest, const u8 *source, int length, int gamma);
/**
* Outputs text to the console of an NDS/GBA emulator, this works at least in No$GBA.
* @param *text: The text to output, max 80 chars.
*/
void debugOutputToEmulator(const char *text);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // ASMEXTRA_HEADER