summaryrefslogtreecommitdiff
path: root/include/nitro
diff options
context:
space:
mode:
Diffstat (limited to 'include/nitro')
-rw-r--r--include/nitro/nitro.h16
-rw-r--r--include/nitro/os.c9
-rw-r--r--include/nitro/os.h10
-rw-r--r--include/nitro/os_asm.h12
-rw-r--r--include/nitro/os_asm.s7
-rw-r--r--include/nitro/types.h50
6 files changed, 104 insertions, 0 deletions
diff --git a/include/nitro/nitro.h b/include/nitro/nitro.h
new file mode 100644
index 00000000..017f3708
--- /dev/null
+++ b/include/nitro/nitro.h
@@ -0,0 +1,16 @@
+#ifndef POKEDIAMOND_NITRO_H
+#define POKEDIAMOND_NITRO_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Include all nitro files
+#include "nitro/types.h"
+#include "nitro/os.h"
+
+#ifdef __cplusplus
+};
+#endif
+
+#endif //POKEDIAMOND_NITRO_H
diff --git a/include/nitro/os.c b/include/nitro/os.c
new file mode 100644
index 00000000..a531740d
--- /dev/null
+++ b/include/nitro/os.c
@@ -0,0 +1,9 @@
+//
+// Created by mart on 4/12/20.
+//
+
+#include "os.h"
+
+asm void OS_GetProcMode() {
+
+} \ No newline at end of file
diff --git a/include/nitro/os.h b/include/nitro/os.h
new file mode 100644
index 00000000..c14b2891
--- /dev/null
+++ b/include/nitro/os.h
@@ -0,0 +1,10 @@
+//
+// Created by mart on 4/12/20.
+//
+
+#ifndef POKEDIAMOND_OS_H
+#define POKEDIAMOND_OS_H
+
+#include "nitro/os_asm.h"
+
+#endif //POKEDIAMOND_OS_H
diff --git a/include/nitro/os_asm.h b/include/nitro/os_asm.h
new file mode 100644
index 00000000..775955f1
--- /dev/null
+++ b/include/nitro/os_asm.h
@@ -0,0 +1,12 @@
+//
+// Created by mart on 4/12/20.
+//
+
+#ifndef POKEDIAMOND_OS_ASM_H
+#define POKEDIAMOND_OS_ASM_H
+
+#include "nitro/types.h"
+
+OSProcMode OS_GetProcMode();
+
+#endif //POKEDIAMOND_OS_ASM_H
diff --git a/include/nitro/os_asm.s b/include/nitro/os_asm.s
new file mode 100644
index 00000000..86d7603c
--- /dev/null
+++ b/include/nitro/os_asm.s
@@ -0,0 +1,7 @@
+
+# TODO: make this syntax look correct in CLion
+# Potentially switch to AT&T syntax?
+OS_GetProcMode:
+ mrs r0, cpsr
+ and r0, r0, #0x80
+ bx lr
diff --git a/include/nitro/types.h b/include/nitro/types.h
new file mode 100644
index 00000000..d702de23
--- /dev/null
+++ b/include/nitro/types.h
@@ -0,0 +1,50 @@
+#ifndef POKEDIAMOND_NITRO_TYPES_H
+#define POKEDIAMOND_NITRO_TYPES_H
+
+typedef unsigned char u8;
+typedef unsigned short int u16;
+typedef unsigned long u32;
+
+typedef signed char s8;
+typedef signed short int s16;
+typedef signed long s32;
+
+typedef unsigned long long int u64;
+typedef signed long long int s64;
+
+typedef volatile u8 vu8;
+typedef volatile u16 vu16;
+typedef volatile u32 vu32;
+typedef volatile u64 vu64;
+
+typedef volatile s8 vs8;
+typedef volatile s16 vs16;
+typedef volatile s32 vs32;
+typedef volatile s64 vs64;
+
+typedef float f32;
+typedef volatile f32 vf32;
+
+typedef int BOOL;
+#define TRUE 1
+#define FALSE 0
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else // __cplusplus
+#define NULL ((void *)0)
+#endif // __cplusplus
+#endif
+
+typedef enum {
+ OS_PROCMODE_USER=16,
+ OS_PROCMODE_FIQ=17,
+ OS_PROCMODE_IRQ=18,
+ OS_PROCMODE_SVC=19,
+ OS_PROCMODE_ABORT=23,
+ OS_PROCMODE_UNDEF=27,
+ OS_PROCMODE_SYS=31
+} OSProcMode;
+
+#endif //POKEDIAMOND_NITRO_TYPES_H