Use new IO Port related types and further improvements of readability #1
Loading…
Reference in New Issue
No description provided.
Delete Branch "Overlay-The-Beginning_CDDrive_EndOfIO"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Before this PR the access to the IOPorts of the Playstation were handled via
ComplexBitMap
andVolatilePOD
. Both types in combination were supposed to create a construct that allows:However this lead to strange and hard to understand constructs to please the compiler. For new types it would often be very unclear which cast is expected by the type.
The new IOPort types are based on macros and garantee to be POD for the cost of being more difficult to find errors inside the macro. However thanks to more macros the creation and extension of these values should be easy and intuitive now.
The
ComplexBitMap
type was removed complete because it really does not has any benefit over directly using theBit
andBitRange
types@ -23,3 +23,3 @@
static void enable() {
GPU_IO::GP1.write(GPU_IO::Command::GP1::SetDisplayState(GPU_IO::DisplayState::On));
GPU_IO::GP1 = GPU_IO::Command::SetDisplayState(GPU_IO::DisplayState::On);
This is definitely way nicer looking to me vs using a write method!
@ -59,0 +39,4 @@
static constexpr auto HasResponseFifoData = Bit(5);
static constexpr auto HasDataFifoData = Bit(6);
static constexpr auto IsTransmissionBusy = Bit(7);
);
Very good readability with this style of types and instantiation
@ -125,3 +120,1 @@
static constexpr Info Pause{0x09, Interrupt::Type::Complete};
static constexpr Info Init{0x0A, Interrupt::Type::Complete};
static constexpr Info SetMode{0x0E, Interrupt::Type::Acknowledge};
static constexpr Desc GetStat{0x01, Interrupt::Type::Acknowledge};
what is Desc?
It's the description of a CD command. I wanted to keep
Command
as the parent so developers can typeCommand::GetStat
but then needed a sub type for the pair of the Command ID and the IRQ that indicates completion.Better names are very welcome!
Oh ok that totally makes sense as is. I just didn't understand why there would be a Description here at first.