This commit is contained in:
2024-09-29 17:27:23 +02:00
parent 5292b7bf9f
commit 6680c4d5a3
18 changed files with 167 additions and 173 deletions

View File

@@ -9,7 +9,7 @@ namespace JabyEngine {
static constexpr uintptr_t End = 0x7FFFF;
}
__declare_io_value(AD, uint16_t) {
__declare_io_struct(AD, uint16_t) {
static constexpr auto AttackMode = Bit(15);
static constexpr auto AttackShift = BitRange::from_to(10, 14);
static constexpr auto AttackStep = BitRange::from_to(8, 9);
@@ -21,7 +21,7 @@ namespace JabyEngine {
}
};
__declare_io_value(ControlRegister, uint16_t) {
__declare_io_struct(ControlRegister, uint16_t) {
enum RAMTransferMode {
Stop = 0,
ManualWrite = 1,
@@ -42,13 +42,13 @@ namespace JabyEngine {
static constexpr auto CDAudioEnable = Bit(0);
};
__declare_io_value(DataTransferControl, uint16_t) {
__declare_io_struct(DataTransferControl, uint16_t) {
static constexpr DataTransferControl NormalTransferMode() {
return DataTransferControl{0x0004};
}
};
__declare_io_value(Echo, uint32_t) {
__declare_io_struct(Echo, uint32_t) {
static constexpr auto EchoBits = BitRange::from_to(0, 23);
static constexpr Echo AllOff() {
@@ -56,7 +56,7 @@ namespace JabyEngine {
}
};
__declare_io_value(KeyOff, uint32_t) {
__declare_io_struct(KeyOff, uint32_t) {
static constexpr KeyOff for_specific(uint32_t id) {
return KeyOff{1u << id};
}
@@ -66,7 +66,7 @@ namespace JabyEngine {
}
};
__declare_io_value(KeyOn, uint32_t) {
__declare_io_struct(KeyOn, uint32_t) {
static constexpr KeyOn for_specific(uint32_t id) {
return KeyOn{1u << id};
}
@@ -76,10 +76,10 @@ namespace JabyEngine {
}
};
__declare_io_value(KeyStatus, uint32_t) {
__declare_io_struct(KeyStatus, uint32_t) {
};
__declare_io_value(Noise, uint16_t) {
__declare_io_struct(Noise, uint16_t) {
static constexpr auto NoiseBits = BitRange::from_to(0, 23);
static constexpr Noise AllOff() {
@@ -87,7 +87,7 @@ namespace JabyEngine {
}
};
__declare_io_value(PitchModulation, uint32_t) {
__declare_io_struct(PitchModulation, uint32_t) {
static constexpr auto EnableBits = BitRange::from_to(1, 23);
static constexpr PitchModulation AllOff() {
@@ -95,7 +95,7 @@ namespace JabyEngine {
}
};
__declare_io_value(SampleRate, uint16_t) {
__declare_io_struct(SampleRate, uint16_t) {
static constexpr SampleRate stop() {
return SampleRate{0};
}
@@ -112,7 +112,7 @@ namespace JabyEngine {
}
};
__declare_io_value(SimpleVolume, int16_t) {
__declare_io_struct(SimpleVolume, int16_t) {
static constexpr auto MaxVolume = I16_MAX;
static constexpr SimpleVolume mute() {
@@ -128,7 +128,7 @@ namespace JabyEngine {
return {static_cast<int16_t>(static_cast<long double>(SimpleVolume::MaxVolume)*fraction)};
}
__declare_io_value(SR, uint16_t) {
__declare_io_struct(SR, uint16_t) {
static constexpr auto SustainMode = Bit(31 - 16);
static constexpr auto SustainDirection = Bit(30 - 16);
static constexpr auto SustainShift = BitRange::from_to((24 - 16), (28 - 16));
@@ -141,7 +141,7 @@ namespace JabyEngine {
}
};
__declare_io_value(SRAMAdr, uint16_t) {
__declare_io_struct(SRAMAdr, uint16_t) {
static constexpr SRAMAdr null() {
return SRAMAdr{0x0};
}
@@ -151,7 +151,7 @@ namespace JabyEngine {
}
};
__declare_io_value(StatusRegister, uint16_t) {
__declare_io_struct(StatusRegister, uint16_t) {
enum CapureBufferHalf {
First = 0,
Second = 1
@@ -172,7 +172,7 @@ namespace JabyEngine {
static constexpr auto CDAudioEnable = Bit(0);
};
__declare_io_value(SweepVolume, int16_t) {
__declare_io_struct(SweepVolume, int16_t) {
struct VolumeMode {
static constexpr auto MaxVolume = (I16_MAX >> 1);
static constexpr auto EnableSweep = Bit(15);