summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/gba/gba.h1
-rw-r--r--include/gba/io_reg.h3
-rw-r--r--include/gba/macro.h2
-rw-r--r--include/gba/multiboot.h55
-rw-r--r--include/gba/syscall.h16
-rw-r--r--include/gba/types.h21
-rw-r--r--include/multiboot.h21
7 files changed, 119 insertions, 0 deletions
diff --git a/include/gba/gba.h b/include/gba/gba.h
index 26342cf88..42ae3cdde 100644
--- a/include/gba/gba.h
+++ b/include/gba/gba.h
@@ -4,6 +4,7 @@
#include "gba/defines.h"
#include "gba/io_reg.h"
#include "gba/types.h"
+#include "gba/multiboot.h"
#include "gba/syscall.h"
#include "gba/macro.h"
diff --git a/include/gba/io_reg.h b/include/gba/io_reg.h
index 0be92fa60..5234e5b6c 100644
--- a/include/gba/io_reg.h
+++ b/include/gba/io_reg.h
@@ -577,6 +577,8 @@
#define TIMER_ENABLE 0x80
// serial
+#define SIO_ID 0x0030 // Communication ID
+
#define SIO_8BIT_MODE 0x0000 // Normal 8-bit communication mode
#define SIO_32BIT_MODE 0x1000 // Normal 32-bit communication mode
#define SIO_MULTI_MODE 0x2000 // Multi-player communication mode
@@ -589,6 +591,7 @@
#define SIO_MULTI_SI 0x0004 // Multi-player communication SI terminal
#define SIO_MULTI_SD 0x0008 // SD terminal
+#define SIO_MULTI_BUSY 0x0080
#define SIO_ERROR 0x0040 // Detect error
#define SIO_START 0x0080 // Start transfer
diff --git a/include/gba/macro.h b/include/gba/macro.h
index 62d3e73fa..230fb4383 100644
--- a/include/gba/macro.h
+++ b/include/gba/macro.h
@@ -25,6 +25,8 @@
CPU_FAST_SET_SRC_FIXED | ((size)/(32/8) & 0x1FFFFF)); \
}
+#define CpuFastFill16(value, dest, size) CpuFastFill(((value) << 16) | (value), (dest), (size))
+
#define CpuFastCopy(src, dest, size) CpuFastSet(src, dest, ((size)/(32/8) & 0x1FFFFF))
#define DmaSet(dmaNum, src, dest, control) \
diff --git a/include/gba/multiboot.h b/include/gba/multiboot.h
new file mode 100644
index 000000000..e88b43a19
--- /dev/null
+++ b/include/gba/multiboot.h
@@ -0,0 +1,55 @@
+#ifndef GUARD_GBA_MULTIBOOT_H
+#define GUARD_GBA_MULTIBOOT_H
+
+#define MULTIBOOT_NCHILD 3 // Maximum number of slaves
+#define MULTIBOOT_HEADER_SIZE 0xc0 // Header size
+#define MULTIBOOT_SEND_SIZE_MIN 0x100 // Minimum transmission size
+#define MULTIBOOT_SEND_SIZE_MAX 0x40000 // Maximum transmission size
+
+struct MultiBootParam
+{
+ u32 system_work[5];
+ u8 handshake_data;
+ u8 padding;
+ u16 handshake_timeout;
+ u8 probe_count;
+ u8 client_data[MULTIBOOT_NCHILD];
+ u8 palette_data;
+ u8 response_bit;
+ u8 client_bit;
+ u8 reserved1;
+ u8 *boot_srcp;
+ u8 *boot_endp;
+ u8 *masterp;
+ u8 *reserved2[MULTIBOOT_NCHILD];
+ u32 system_work2[4];
+ u8 sendflag;
+ u8 probe_target_bit;
+ u8 check_wait;
+ u8 server_type;
+};
+
+#define MULTIBOOT_ERROR_04 0x04
+#define MULTIBOOT_ERROR_08 0x08
+#define MULTIBOOT_ERROR_0c 0x0c
+#define MULTIBOOT_ERROR_40 0x40
+#define MULTIBOOT_ERROR_44 0x44
+#define MULTIBOOT_ERROR_48 0x48
+#define MULTIBOOT_ERROR_4c 0x4c
+#define MULTIBOOT_ERROR_80 0x80
+#define MULTIBOOT_ERROR_84 0x84
+#define MULTIBOOT_ERROR_88 0x88
+#define MULTIBOOT_ERROR_8c 0x8c
+#define MULTIBOOT_ERROR_NO_PROBE_TARGET 0x50
+#define MULTIBOOT_ERROR_NO_DLREADY 0x60
+#define MULTIBOOT_ERROR_BOOT_FAILURE 0x70
+#define MULTIBOOT_ERROR_HANDSHAKE_FAILURE 0x71
+
+#define MULTIBOOT_CONNECTION_CHECK_WAIT 15
+
+#define MULTIBOOT_SERVER_TYPE_NORMAL 0
+#define MULTIBOOT_SERVER_TYPE_QUICK 1
+
+#define MULTIBOOT_HANDSHAKE_TIMEOUT 400
+
+#endif // GUARD_GBA_MULTIBOOT_H
diff --git a/include/gba/syscall.h b/include/gba/syscall.h
index 3f41abba1..deddec5ba 100644
--- a/include/gba/syscall.h
+++ b/include/gba/syscall.h
@@ -17,6 +17,10 @@ void RegisterRamReset(u32 resetFlags);
void VBlankIntrWait(void);
+u16 Sqrt(u32 num);
+
+u16 ArcTan2(s16 x, s16 y);
+
#define CPU_SET_SRC_FIXED 0x01000000
#define CPU_SET_16BIT 0x00000000
#define CPU_SET_32BIT 0x04000000
@@ -27,6 +31,18 @@ void CpuSet(const void *src, void *dest, u32 control);
void CpuFastSet(const void *src, void *dest, u32 control);
+void BgAffineSet(struct BgAffineSrcData *src, struct BgAffineDstData *dest, s32 count);
+
void ObjAffineSet(struct ObjAffineSrcData *src, void *dest, s32 count, s32 offset);
+void LZ77UnCompWram(const void *src, void *dest);
+
+void LZ77UnCompVram(const void *src, void *dest);
+
+void RLUnCompWram(const void *src, void *dest);
+
+void RLUnCompVram(const void *src, void *dest);
+
+int MultiBoot(struct MultiBootParam *mp);
+
#endif // GUARD_GBA_SYSCALL_H
diff --git a/include/gba/types.h b/include/gba/types.h
index be7390d5a..fd8a20a4c 100644
--- a/include/gba/types.h
+++ b/include/gba/types.h
@@ -74,6 +74,27 @@ struct OamData
#define ST_OAM_H_RECTANGLE 1
#define ST_OAM_V_RECTANGLE 2
+struct BgAffineSrcData
+{
+ s32 texX;
+ s32 texY;
+ s16 scrX;
+ s16 scrY;
+ s16 sx;
+ s16 sy;
+ u16 alpha;
+};
+
+struct BgAffineDstData
+{
+ s16 pa;
+ s16 pb;
+ s16 pc;
+ s16 pd;
+ s32 dx;
+ s32 dy;
+};
+
struct ObjAffineSrcData
{
s16 xScale;
diff --git a/include/multiboot.h b/include/multiboot.h
new file mode 100644
index 000000000..950c853d0
--- /dev/null
+++ b/include/multiboot.h
@@ -0,0 +1,21 @@
+#ifndef GUARD_MULTIBOOT_H
+#define GUARD_MULTIBOOT_H
+
+#define MULTIBOOT_MASTER_INFO 0x62
+#define MULTIBOOT_CLIENT_INFO 0x72
+#define MULTIBOOT_MASTER_START_PROBE 0x61
+#define MULTIBOOT_MASTER_REQUEST_DLREADY 0x63
+#define MULTIBOOT_CLIENT_DLREADY 0x73
+#define MULTIBOOT_MASTER_START_DL 0x64
+#define MULTIBOOT_MASTER_REQUEST_CRC 0x65
+#define MULTIBOOT_CLIENT_CALC_CRC 0x74
+#define MULTIBOOT_CLIENT_CRCREADY 0x75
+#define MULTIBOOT_MASTER_VERIFY_CRC 0x66
+
+void MultiBootInit(struct MultiBootParam *mp);
+int MultiBootMain(struct MultiBootParam *mp);
+void MultiBootStartProbe(struct MultiBootParam *mp);
+void MultiBootStartMaster(struct MultiBootParam *mp, u8 *srcp, int length, u8 palette_color, s8 palette_speed);
+int MultiBootCheckComplete(struct MultiBootParam *mp);
+
+#endif // GUARD_MULTIBOOT_H