1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Retain logical operation, take colour combination outside the loop.

This commit is contained in:
Thomas Harte 2023-01-29 13:29:19 -05:00
parent 0576451102
commit 4cdcd3ac7d
2 changed files with 26 additions and 1 deletions

View File

@ -852,6 +852,8 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
case 44:
Storage<personality>::command_context_.colour = value;
Storage<personality>::command_context_.colour4pp = (value & 0xf) | (value << 4);
Storage<personality>::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<personality>::commit_register(int reg, uint8_t value) {
}
#undef Begin
Storage<personality>::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<personality>::command_) {

View File

@ -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 {