diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index 4ff388901..5adb22a24 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -806,41 +806,77 @@ void Base::commit_register(int reg, uint8_t value) { break; case 32: + Storage::command_context_.source_x = + (Storage::command_context_.source_x & ~0xff) | + value; + break; case 33: - LOG("TODO: Yamaha command source x; " << PADHEX(2) << +value); + Storage::command_context_.source_x = + (Storage::command_context_.source_x & ~0x100) | + ((value & 1) << 8); break; case 34: + Storage::command_context_.source_y = + (Storage::command_context_.source_y & ~0xff) | + value; + break; case 35: - LOG("TODO: Yamaha command source y; " << PADHEX(2) << +value); + Storage::command_context_.source_y = + (Storage::command_context_.source_y & ~0x300) | + ((value & 3) << 8); break; case 36: + Storage::command_context_.destination_x = + (Storage::command_context_.destination_x & ~0xff) | + value; + break; case 37: - LOG("TODO: Yamaha command destination x; " << PADHEX(2) << +value); + Storage::command_context_.destination_x = + (Storage::command_context_.destination_x & ~0x100) | + ((value & 1) << 8); break; case 38: + Storage::command_context_.destination_y = + (Storage::command_context_.destination_y & ~0xff) | + value; + break; case 39: - LOG("TODO: Yamaha command destination y; " << PADHEX(2) << +value); + Storage::command_context_.destination_y = + (Storage::command_context_.destination_y & ~0x300) | + ((value & 3) << 8); break; case 40: + Storage::command_context_.size_x = + (Storage::command_context_.size_x & ~0xff) | + value; + break; case 41: - LOG("TODO: Yamaha command size x; " << PADHEX(2) << +value); + Storage::command_context_.size_x = + (Storage::command_context_.size_x & ~0x100) | + ((value & 1) << 8); break; case 42: + Storage::command_context_.size_y = + (Storage::command_context_.size_y & ~0xff) | + value; + break; case 43: - LOG("TODO: Yamaha command size y; " << PADHEX(2) << +value); + Storage::command_context_.size_y = + (Storage::command_context_.size_y & ~0x300) | + ((value & 3) << 8); break; case 44: - LOG("TODO: Yamaha command colour; " << PADHEX(2) << +value); + Storage::command_context_.colour = value; break; case 45: - LOG("TODO: Yamaha VRAM bank selection addressing and command arguments; " << PADHEX(2) << +value); + Storage::command_context_.arguments = value; // b6: 0 = video RAM; 1 = expansion RAM. // b5: MXD (???) // b4: MXS diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 90ccb5ee5..b5b797501 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -15,7 +15,9 @@ #include "../../../Numeric/BitReverse.hpp" #include "../../../Outputs/CRT/CRT.hpp" +#include "AccessEnums.hpp" #include "PersonalityTraits.hpp" +#include "YamahaCommands.hpp" #include #include @@ -27,44 +29,6 @@ namespace TI { namespace TMS { -// The screen mode is a necessary predecessor to picking the line mode, -// which is the thing latched per line. -enum class ScreenMode { - // Original TMS modes. - Blank, - Text, - MultiColour, - ColouredText, - Graphics, - - // 8-bit Sega modes. - SMSMode4, - - // New Yamaha V9938 modes. - YamahaText80, - YamahaGraphics3, - YamahaGraphics4, - YamahaGraphics5, - YamahaGraphics6, - YamahaGraphics7, - - // Rebranded Yamaha V9938 modes. - YamahaGraphics1 = ColouredText, - YamahaGraphics2 = Graphics, -}; - -enum class LineMode { - Text, - Character, - Refresh, - SMS, - Yamaha, -}; - -enum class MemoryAccess { - Read, Write, None -}; - // Temporary buffers collect a representation of each line prior to pixel serialisation. // // TODO: either template on personality, to avoid having to be the union of all potential footprints, @@ -217,6 +181,10 @@ template struct Storage