1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Adds half-updating of RAM pointer.

This emulator now passes the first screen of the SMS VDP test.
This commit is contained in:
Thomas Harte 2018-10-10 21:59:08 -04:00
parent 63fb3f03d1
commit 9f69dbf31a

View File

@ -412,12 +412,15 @@ void TMS9918::set_register(int address, uint8_t value) {
if(!write_phase_) {
low_write_ = value;
write_phase_ = true;
// The initial write should half update the access pointer.
ram_pointer_ = (ram_pointer_ & 0xff00) | low_write_;
return;
}
// The RAM pointer is always set on a second write, regardless of
// whether the caller is intending to enqueue a VDP operation.
ram_pointer_ = static_cast<uint16_t>(low_write_ | (value << 8));
ram_pointer_ = (ram_pointer_ & 0x00ff) | static_cast<uint16_t>(value << 8);
write_phase_ = false;
if(value & 0x80) {