summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore6
-rw-r--r--CMakeLists.txt6
-rw-r--r--main.c3
-rw-r--r--nitro/nitro.h9
-rw-r--r--nitro/os.c9
-rw-r--r--nitro/os.h10
-rw-r--r--nitro/os_asm.h12
-rw-r--r--nitro/os_asm.s7
-rw-r--r--nitro/types.h16
9 files changed, 68 insertions, 10 deletions
diff --git a/.gitignore b/.gitignore
index e1343672..5e79f191 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,6 @@
+# CLion folders
.idea/
-cmake-build-debug/ \ No newline at end of file
+cmake-build-debug/
+
+# ROM
+*.nds
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00b7c6fe..a3b6a82e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,4 +3,8 @@ project(PokeDiamond)
# TODO: Add commands
-add_executable(PokeDiamond main.c) \ No newline at end of file
+enable_language(ASM)
+
+file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "*.c")
+
+add_executable(PokeDiamond ${SOURCES}) \ No newline at end of file
diff --git a/main.c b/main.c
index b4ccce75..17e69b3d 100644
--- a/main.c
+++ b/main.c
@@ -1,6 +1,7 @@
// Just includes for now so CLion sees the files
#include "structs/structs.h"
+#include "nitro/nitro.h"
void main() {
- int x = NULL
+ int x = NULL;
}
diff --git a/nitro/nitro.h b/nitro/nitro.h
index ea87f994..70ad9a18 100644
--- a/nitro/nitro.h
+++ b/nitro/nitro.h
@@ -1,7 +1,16 @@
#ifndef POKEDIAMOND_NITRO_H
#define POKEDIAMOND_NITRO_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Include all nitro files
#include "types.h"
+#include "os.h"
+
+#ifdef __cplusplus
+};
+#endif
#endif //POKEDIAMOND_NITRO_H
diff --git a/nitro/os.c b/nitro/os.c
new file mode 100644
index 00000000..a531740d
--- /dev/null
+++ b/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/nitro/os.h b/nitro/os.h
new file mode 100644
index 00000000..8e4d4ed3
--- /dev/null
+++ b/nitro/os.h
@@ -0,0 +1,10 @@
+//
+// Created by mart on 4/12/20.
+//
+
+#ifndef POKEDIAMOND_OS_H
+#define POKEDIAMOND_OS_H
+
+#include "os_asm.h"
+
+#endif //POKEDIAMOND_OS_H
diff --git a/nitro/os_asm.h b/nitro/os_asm.h
new file mode 100644
index 00000000..43c93385
--- /dev/null
+++ b/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 "types.h"
+
+OSProcMode OS_GetProcMode();
+
+#endif //POKEDIAMOND_OS_ASM_H
diff --git a/nitro/os_asm.s b/nitro/os_asm.s
new file mode 100644
index 00000000..86d7603c
--- /dev/null
+++ b/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/nitro/types.h b/nitro/types.h
index 327dd01a..d702de23 100644
--- a/nitro/types.h
+++ b/nitro/types.h
@@ -1,10 +1,6 @@
#ifndef POKEDIAMOND_NITRO_TYPES_H
#define POKEDIAMOND_NITRO_TYPES_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef unsigned char u8;
typedef unsigned short int u16;
typedef unsigned long u32;
@@ -41,8 +37,14 @@ typedef int BOOL;
#endif // __cplusplus
#endif
-#ifdef __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