From fda99d9c5fbd9a53972ad3f3b6236593a08a2867 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 10 Oct 2019 23:29:46 -0400 Subject: [PATCH] Ensures all 16 data lines reach the video. --- Machines/AtariST/AtariST.cpp | 4 ++-- Machines/AtariST/Video.cpp | 10 ++++++---- Machines/AtariST/Video.hpp | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Machines/AtariST/AtariST.cpp b/Machines/AtariST/AtariST.cpp index 4485366a4..e550d4ac4 100644 --- a/Machines/AtariST/AtariST.cpp +++ b/Machines/AtariST/AtariST.cpp @@ -263,9 +263,9 @@ class ConcreteMachine: } } else { if(cycle.operation & Microcycle::SelectByte) { - video_->write(int(address), cycle.value->halves.low); + video_->write(int(address), uint16_t(cycle.value->halves.low << cycle.byte_shift())); } else { - video_->write(int(address), cycle.value->halves.high); + video_->write(int(address), cycle.value->full); } } break; diff --git a/Machines/AtariST/Video.cpp b/Machines/AtariST/Video.cpp index aea6f8cd4..09dab4b8a 100644 --- a/Machines/AtariST/Video.cpp +++ b/Machines/AtariST/Video.cpp @@ -233,7 +233,7 @@ uint8_t Video::read(int address) { return 0xff; } -void Video::write(int address, uint8_t value) { +void Video::write(int address, uint16_t value) { LOG("[Video] write " << PADHEX(2) << int(value) << " to " << PADHEX(2) << (address & 0x3f)); address &= 0x3f; switch(address) { @@ -247,8 +247,10 @@ void Video::write(int address, uint8_t value) { case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29: case 0x2a: case 0x2b: - case 0x2c: case 0x2d: case 0x2e: case 0x2f: - palette_[address - 0x20] = uint16_t((value & 0x777) << 5); - break; + case 0x2c: case 0x2d: case 0x2e: case 0x2f: { + uint8_t *const entry = reinterpret_cast(&palette_[address - 0x20]); + entry[0] = uint8_t((value & 0x700) >> 7); + entry[1] = uint8_t((value & 0x77) << 1); + } break; } } diff --git a/Machines/AtariST/Video.hpp b/Machines/AtariST/Video.hpp index feecc1ff3..7eb4f8be6 100644 --- a/Machines/AtariST/Video.hpp +++ b/Machines/AtariST/Video.hpp @@ -42,7 +42,7 @@ class Video { void set_ram(uint16_t *); uint8_t read(int address); - void write(int address, uint8_t value); + void write(int address, uint16_t value); private: Outputs::CRT::CRT crt_;