From 9f69dbf31a7bb05f84f77088ddaa22a2221a9442 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 10 Oct 2018 21:59:08 -0400 Subject: [PATCH] Adds half-updating of RAM pointer. This emulator now passes the first screen of the SMS VDP test. --- Components/9918/9918.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Components/9918/9918.cpp b/Components/9918/9918.cpp index 99e05d402..445b1ff49 100644 --- a/Components/9918/9918.cpp +++ b/Components/9918/9918.cpp @@ -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(low_write_ | (value << 8)); + ram_pointer_ = (ram_pointer_ & 0x00ff) | static_cast(value << 8); write_phase_ = false; if(value & 0x80) {