appleramdac: Allow read from CLUT part 2.

This commit is contained in:
joevt 2024-02-18 04:47:01 -08:00 committed by dingusdev
parent 789114cc7d
commit ea46d08835

View File

@ -35,6 +35,8 @@ AppleRamdac::AppleRamdac(DacFlavour flavour) {
} }
uint16_t AppleRamdac::iodev_read(uint32_t address) { uint16_t AppleRamdac::iodev_read(uint32_t address) {
uint16_t result;
switch(address) { switch(address) {
case RamdacRegs::MULTI: case RamdacRegs::MULTI:
switch(this->dac_addr) { switch(this->dac_addr) {
@ -53,12 +55,13 @@ uint16_t AppleRamdac::iodev_read(uint32_t address) {
if (this->comp_index == 0) { if (this->comp_index == 0) {
this->get_clut_entry_cb(this->dac_addr, this->clut_color); this->get_clut_entry_cb(this->dac_addr, this->clut_color);
} }
result = this->clut_color[this->comp_index];
this->comp_index++; this->comp_index++;
if (this->comp_index >= 3) { if (this->comp_index >= 3) {
this->dac_addr++; // auto-increment CLUT address this->dac_addr++; // auto-increment CLUT address
this->comp_index = 0; this->comp_index = 0;
} }
break; return result;
default: default:
LOG_F(WARNING, "%s: read from unsupported register at 0x%X", LOG_F(WARNING, "%s: read from unsupported register at 0x%X",
this->name.c_str(), address); this->name.c_str(), address);