diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index 7ffa65dc6..f610ccf94 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -727,9 +727,8 @@ void Base::write_register(uint8_t value) { break; case 17: - LOG("TODO: Yamaha indirect addressing; " << PADHEX(2) << +low_write_); - // b7: 1 = disable autoincrementing; 0 = enable. - // b5–b0: register number + Storage::increment_indirect_register_ = low_write_ & 0x80; + Storage::indirect_register_ = low_write_ & 0x3f; break; case 18: @@ -829,9 +828,14 @@ void Base::write_palette(uint8_t value) { } template -void Base::write_register_indirect(uint8_t value) { - LOG("Register indirect write TODO"); - (void)value; +void Base::write_register_indirect([[maybe_unused]] uint8_t value) { + if constexpr (is_yamaha_vdp(personality)) { + LOG("TODO: indirect write of " << PADHEX(2) << +value << " to " << PADHEX(2) << Storage::indirect_register_); + + if(Storage::increment_indirect_register_) { + Storage::indirect_register_ = (Storage::indirect_register_ + 1) & 0x3f; + } + } } template diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index 261106dea..a12e3b0f6 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -128,6 +128,9 @@ template <> struct Storage { // Yamaha-specific storage. template struct Storage> { int selected_status_ = 0; + + int indirect_register_ = 0; + bool increment_indirect_register_ = false; }; // Master System-specific storage.