Add *.nds to gitignore, start working on Nitro OS functions

This commit is contained in:
Martmists 2020-04-12 00:16:52 +02:00
parent 01801ea04f
commit ce65297980
9 changed files with 68 additions and 10 deletions

6
.gitignore vendored
View File

@ -1,2 +1,6 @@
# CLion folders
.idea/
cmake-build-debug/
cmake-build-debug/
# ROM
*.nds

View File

@ -3,4 +3,8 @@ project(PokeDiamond)
# TODO: Add commands
add_executable(PokeDiamond main.c)
enable_language(ASM)
file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "*.c")
add_executable(PokeDiamond ${SOURCES})

3
main.c
View 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;
}

View File

@ -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

9
nitro/os.c Normal file
View File

@ -0,0 +1,9 @@
//
// Created by mart on 4/12/20.
//
#include "os.h"
asm void OS_GetProcMode() {
}

10
nitro/os.h Normal file
View File

@ -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

12
nitro/os_asm.h Normal file
View File

@ -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

7
nitro/os_asm.s Normal file
View File

@ -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

View File

@ -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