mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-26 15:32:04 +00:00
Generate an appropriate instance for line drawing.
This commit is contained in:
parent
0c8815d6a0
commit
b12fd00145
@ -890,6 +890,32 @@ void Base<personality>::commit_register(int reg, uint8_t value) {
|
||||
LOG("TODO: Yamaha command; " << PADHEX(2) << +value);
|
||||
// b0–b3: LO0–LO3 (???)
|
||||
// b4–b7: CM0-CM3 (???)
|
||||
|
||||
switch(value >> 4) {
|
||||
// All codes not listed below are invalid; just abandon
|
||||
// whatever's going on, if anything.
|
||||
default: Storage<personality>::command_ = nullptr;
|
||||
|
||||
case 0b0000: break; // TODO: stop.
|
||||
case 0b0100: break; // TODO: point.
|
||||
case 0b0101: break; // TODO: pset.
|
||||
case 0b0110: break; // TODO: srch.
|
||||
case 0b0111:
|
||||
Storage<personality>::command_ = std::make_unique<Commands::Line>(Storage<personality>::command_context_);
|
||||
break;
|
||||
|
||||
case 0b1000: break; // TODO: lmmv.
|
||||
case 0b1001: break; // TODO: lmmm.
|
||||
case 0b1010: break; // TODO: lmcm.
|
||||
case 0b1011: break; // TODO: lmmc.
|
||||
|
||||
case 0b1100: break; // TODO: hmmv.
|
||||
case 0b1101: break; // TODO: hmmm.
|
||||
case 0b1110: break; // TODO: ymmm.
|
||||
case 0b1111: break; // TODO: hmmc.
|
||||
}
|
||||
|
||||
// TODO: record logical mode.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ template <Personality personality> struct Storage<personality, std::enable_if_t<
|
||||
|
||||
// Command engine state.
|
||||
CommandContext command_context_;
|
||||
Command *command_ = nullptr;
|
||||
std::unique_ptr<Command> command_ = nullptr;
|
||||
|
||||
Storage() noexcept {
|
||||
// Perform sanity checks on the event lists.
|
||||
|
@ -14,6 +14,8 @@
|
||||
namespace TI {
|
||||
namespace TMS {
|
||||
|
||||
// MARK: - Generics.
|
||||
|
||||
struct CommandContext {
|
||||
int source_x = 0, source_y = 0;
|
||||
int destination_x = 0, destination_y = 0;
|
||||
@ -32,14 +34,32 @@ struct Command {
|
||||
int cycles = 0;
|
||||
uint8_t value = 0;
|
||||
|
||||
// TODO: how best to describe access destination? Probably as (x, y) and logical/fast?
|
||||
|
||||
/// Current command parameters.
|
||||
CommandContext &context;
|
||||
Command(CommandContext &context) : context(context) {}
|
||||
|
||||
/// Request that the fields above are updated given the completed access.
|
||||
/// Request that the fields above are updated given that the previously-request access
|
||||
/// was completed.
|
||||
///
|
||||
/// @returns @c true if another access has been enqueued; @c false if this command is done.
|
||||
virtual bool next() = 0;
|
||||
};
|
||||
|
||||
// MARK: - Line drawing.
|
||||
|
||||
namespace Commands {
|
||||
|
||||
struct Line: public Command {
|
||||
using Command::Command;
|
||||
|
||||
bool next() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user