diff options
author | Martmists <martmists@gmail.com> | 2020-04-12 00:16:52 +0200 |
---|---|---|
committer | Martmists <martmists@gmail.com> | 2020-04-12 00:16:52 +0200 |
commit | ce65297980c88ab8acd2ac95df14d427ca734dbd (patch) | |
tree | b7d4c1bc091872bdc487e5fbeb9023dc1e651496 | |
parent | 01801ea04f2a03a1fb9e9a6e08bcd00fa22a73c0 (diff) |
Add *.nds to gitignore, start working on Nitro OS functions
-rw-r--r-- | .gitignore | 6 | ||||
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | main.c | 3 | ||||
-rw-r--r-- | nitro/nitro.h | 9 | ||||
-rw-r--r-- | nitro/os.c | 9 | ||||
-rw-r--r-- | nitro/os.h | 10 | ||||
-rw-r--r-- | nitro/os_asm.h | 12 | ||||
-rw-r--r-- | nitro/os_asm.s | 7 | ||||
-rw-r--r-- | nitro/types.h | 16 |
9 files changed, 68 insertions, 10 deletions
@@ -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 @@ -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 |