Re-arranged files

This commit is contained in:
Jaby 2022-08-31 20:01:39 +02:00
parent c63bdb8e3a
commit c58520c26b
9 changed files with 69 additions and 61 deletions

View File

@ -23,8 +23,10 @@
}
template<typename T>
static constexpr void io_class__volatile_assign(volatile T& dst, const T& src) {
dst.raw_value = src.raw_value;
static constexpr __always_inline void io_class__volatile_assign(T& dst, const T& src) {
typedef decltype(dst.raw_value) DST_VALUE;
const_cast<volatile DST_VALUE&>(dst.raw_value) = src.raw_value;
}
#endif //!__JABYENGINE_IO_CLASS_HELPER_HPP__

View File

@ -1,7 +1,7 @@
#ifndef __JABYENGINE_SPU_PORTS_HPP__
#define __JABYENGINE_SPU_PORTS_HPP__
#include "../Auxiliary/io_class_helper.hpp"
#include "../../limits.h"
#ifndef __JABYENGINE_SPU_IO_HPP__
#define __JABYENGINE_SPU_IO_HPP__
#include "../../Auxiliary/io_class_helper.hpp"
#include <limits.h>
namespace SPU {
enum Mode {
@ -46,17 +46,13 @@ namespace SPU {
return *this;
}
//A value between 0 and 1000
constexpr auto& set_volume_step(VolumeStep volume_step) {
volume_step *= SingleVolumeStep;
this->raw_value = bit::value::set_normalized(this->raw_value, volume_step, __start_end_bit2_start_length(0, 14));
constexpr auto& set_volume(int16_t volume) {
this->raw_value = bit::value::set_normalized(this->raw_value, static_cast<int16_t>((volume >> 1)), __start_end_bit2_start_length(0, 14));
return *this;
}
//A value between 0 and 1000
constexpr VolumeStep get_volume_step() const {
return (bit::value::get_normalized(this->raw_value, __start_end_bit2_start_length(0, 14))/SingleVolumeStep);
constexpr int16_t get_volume_step() const {
return bit::value::get_normalized(this->raw_value, __start_end_bit2_start_length(0, 14));
}
io_class__2option_map(volume_mode, sweep_mode, 15);
@ -109,4 +105,4 @@ namespace SPU {
};
}
#endif //!__JABYENGINE_SPU_PORTS_HPP__
#endif //!__JABYENGINE_SPU_IO_HPP__

View File

@ -68,16 +68,16 @@ SECTIONS {
{
.planschi
{
*libJabyEngine.a:start.o(.text.startup._GLOBAL__*)
*libJabyEngine.a:start.o(.ctors)
*libJabyEngine.a:boot_*.o(.text.startup._GLOBAL__*)
*libJabyEngine.a:boot_*.o(.ctors)
*libJabyEngine.a:start.o(.text.*)
*libJabyEngine.a:start.o(.rodata*)
*libJabyEngine.a:start.o(.sdata*)
*libJabyEngine.a:start.o(.data*)
*libJabyEngine.a:start.o(.sbss*)
*libJabyEngine.a:start.o(.bss*)
*libJabyEngine.a:start.o(*)
*libJabyEngine.a:boot_*.o(.text.*)
*libJabyEngine.a:boot_*.o(.rodata*)
*libJabyEngine.a:boot_*.o(.sdata*)
*libJabyEngine.a::boot_*.o(.data*)
*libJabyEngine.a::boot_*.o(.sbss*)
*libJabyEngine.a::boot_*.o(.bss*)
*libJabyEngine.a::boot_*.o(*)
}
}
__boot_loader_end = .;

View File

@ -55,6 +55,7 @@
},
"settings": {
"C_Cpp.default.includePath": [
"include",
"../../include"
],
"C_Cpp.default.compilerPath": "",

View File

@ -1,7 +1,7 @@
ARTIFACT = libJabyEngine
BUILD_DIR = bin
CCFLAGS += -I../../include
CCFLAGS += -Iinclude -I../../include
CCFLAGS += -save-temps=obj
include ../../lib/Wildcard.mk

View File

@ -0,0 +1,8 @@
#ifndef BOOT_LOADER_HPP
#define BOOT_LOADER_HPP
namespace SPU {
void setup();
}
#endif //!BOOT_LOADER_HPP

View File

@ -0,0 +1,26 @@
#include <PSX/System/IOPorts/SPU_IO.hpp>
namespace SPU {
static void clear_voice(Voice& voice) {
io_class__volatile_assign(voice.volumeLeft, SweepVolume());
io_class__volatile_assign(voice.volumeRight, SweepVolume());
io_class__volatile_assign(voice.sampleRate, SampleRate::from_HZ(0.0));
io_class__volatile_assign(voice.adsr, ADSR());
io_class__volatile_assign(voice.currentVolume, SweepVolume());
voice.adr = 0x200;
voice.repeatAdr = 0x200;
}
void setup() {
static constexpr auto StartVol = SweepVolume().set_volume_mode().set_volume_percent(50.0);
io_class__volatile_assign(MainVolume::Left, StartVol);
io_class__volatile_assign(MainVolume::Right, StartVol);
for(auto& voice : Voice::Channel) {
clear_voice(voice);
}
}
}

View File

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

View File

@ -1,36 +0,0 @@
#include <PSX/SPU/SPU_Ports.hpp>
#include <stdio.h>
namespace JabyEngine {
namespace SPU {
static void clear_voice(::SPU::Voice& voice) {
io_class__volatile_assign(voice.volumeLeft, ::SPU::SweepVolume());
io_class__volatile_assign(voice.volumeRight, ::SPU::SweepVolume());
io_class__volatile_assign(voice.sampleRate, ::SPU::SampleRate::from_HZ(0.0));
io_class__volatile_assign(voice.adsr, ::SPU::ADSR());
io_class__volatile_assign(voice.currentVolume, ::SPU::SweepVolume());
voice.adr = 0x200;
voice.repeatAdr = 0x200;
}
static void setup() {
static constexpr auto StartVol = ::SPU::SweepVolume().set_volume_mode().set_volume_percent(50.0);
io_class__volatile_assign(::SPU::MainVolume::Left, StartVol);
io_class__volatile_assign(::SPU::MainVolume::Right, StartVol);
for(auto& voice : ::SPU::Voice::Channel) {
clear_voice(voice);
}
}
}
void start() {
printf("Hello Planschbecken\n");
SPU::setup();
printf("Setup done!\n");
}
}