diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index 5adb22a24..09d475f84 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -890,6 +890,32 @@ void Base::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::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::command_ = std::make_unique(Storage::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; } } diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index b5b797501..2516a08be 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -183,7 +183,7 @@ template struct Storage command_ = nullptr; Storage() noexcept { // Perform sanity checks on the event lists. diff --git a/Components/9918/Implementation/YamahaCommands.hpp b/Components/9918/Implementation/YamahaCommands.hpp index 692c411c0..2b469f878 100644 --- a/Components/9918/Implementation/YamahaCommands.hpp +++ b/Components/9918/Implementation/YamahaCommands.hpp @@ -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; + } +}; + +} } }