Prepare save spot for booting

This commit is contained in:
jaby 2022-12-16 03:20:08 +01:00
parent 723864fcaa
commit c7e651f2e7
5 changed files with 44 additions and 9 deletions

23
include/PSX/jabyengine.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef __JABYENGINE__H__
#define __JABYENGINE__H__
#include "../stdint.h"
namespace JabyEngine {
struct NextRoutine {
typedef NextRoutine (*ExecutionFunction)();
uintptr_t value;
static NextRoutine null() {
return {.value = 0};
}
static NextRoutine from(ExecutionFunction function) {
return {.value = reinterpret_cast<uintptr_t>(function)};
}
};
typedef NextRoutine::ExecutionFunction ExecutionFunction;
}
#endif //!__JABYENGINE__H__

View File

@ -1,5 +1,5 @@
#ifndef __JABYENGINE_DEFINES__H
#define __JABYENGINE_DEFINES__H
#ifndef __JABYENGINE_DEFINES__H__
#define __JABYENGINE_DEFINES__H__
#include "../stddef.h"
#define __keep __attribute__((used))
@ -13,4 +13,4 @@
#else
#define __constexpr
#endif
#endif //!__JABYENGINE_DEFINES__H
#endif //!__JABYENGINE_DEFINES__H__

View File

@ -1,5 +1,6 @@
#ifndef BOOT_LOADER_HPP
#define BOOT_LOADER_HPP
#include <PSX/jabyengine.h>
namespace GPU {
void display_logo();
@ -11,4 +12,8 @@ namespace SPU {
void setup();
}
namespace Setup {
JabyEngine::NextRoutine start();
}
#endif //!BOOT_LOADER_HPP

View File

@ -2,15 +2,12 @@
#include <PSX/System/IOPorts/dMa_io.hpp>
#include <stdio.h>
extern int main();
namespace JabyEngine {
namespace Setup {
static void enable_DMA() {
DMA::DPCR.write(DMA::DPCR.read() | DMA::DMAControlRegister::SPUEnable | DMA::DMAControlRegister::GPUEnable);
}
void start() {
printf("Starting Planschbecken\n");
JabyEngine::NextRoutine start() {
enable_DMA();
SPU::stop_voices();
@ -20,6 +17,6 @@ namespace JabyEngine {
//Pause??
SPU::setup();
printf("Setup done!\n");
return JabyEngine::NextRoutine::null();
}
}

View File

@ -0,0 +1,10 @@
#include "../include/BootLoader/boot_loader.hpp"
#include <stdio.h>
namespace JabyEngine {
void start() {
printf("Starting Planschbecken\n");
Setup::start();
printf("Stop!\n");
}
}