diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index d1f0ec979..2e3d2de70 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -852,6 +852,8 @@ void Base::commit_register(int reg, uint8_t value) { case 44: Storage::command_context_.colour = value; + Storage::command_context_.colour4pp = (value & 0xf) | (value << 4); + Storage::command_context_.colour2pp = (value & 0x3) | ((value & 0x3) << 2) | ((value & 0x3) << 4) | ((value & 0x3) << 6); // Check whether a command was blocked on this. if( @@ -909,6 +911,8 @@ void Base::commit_register(int reg, uint8_t value) { } #undef Begin + Storage::pixel_operation = CommandContext::LogicalOperation(value & 0xf); + // Kill the command immediately if it's done in zero operations // (e.g. a line of length 0). if(!Storage::command_) { diff --git a/Components/9918/Implementation/YamahaCommands.hpp b/Components/9918/Implementation/YamahaCommands.hpp index 1e7d14d00..5b144e521 100644 --- a/Components/9918/Implementation/YamahaCommands.hpp +++ b/Components/9918/Implementation/YamahaCommands.hpp @@ -46,8 +46,29 @@ struct CommandContext { Vector source; Vector destination; Vector size; - uint8_t colour = 0; + uint8_t arguments = 0; + /// Colour as written by the CPU. + uint8_t colour = 0; + /// The low four bits of the CPU-written colour, repeated twice. + uint8_t colour4pp = 0; + /// The low two bits of the CPU-written colour, repeated four times. + uint8_t colour2pp = 0; + + enum class LogicalOperation { + Copy = 0b0000, + And = 0b0001, + Or = 0b0010, + Xor = 0b0011, + Not = 0b0100, + + ConditionalCopy = 0b1000, + ConditionalAnd = 0b1001, + ConditionalOr = 0b1010, + ConditionalXor = 0b1011, + ConditionalNot = 0b1100, + }; + LogicalOperation pixel_operation; }; struct Command {