mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-05 21:32:55 +00:00
Edge towards not assuming graphics mode. Much more to do here.
This commit is contained in:
parent
c6cda7c401
commit
975ead5d01
@ -584,10 +584,36 @@ template <Personality personality> struct Base: public Storage<personality> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: undo assumption of Graphics Mode 5, pervasively but starting here.
|
// Compute the affected address and pixel
|
||||||
const unsigned int address =
|
unsigned address;
|
||||||
|
uint8_t mask;
|
||||||
|
switch(this->screen_mode_) {
|
||||||
|
default:
|
||||||
|
case ScreenMode::YamahaGraphics4: // 256 pixels @ 4bpp
|
||||||
|
address =
|
||||||
|
(Storage<personality>::command_->location.v[0] >> 1) +
|
||||||
|
(Storage<personality>::command_->location.v[1] << 7);
|
||||||
|
mask = 0xf0 >> ((Storage<personality>::command_->location.v[0] & 1) << 2);
|
||||||
|
break;
|
||||||
|
case ScreenMode::YamahaGraphics5: // 512 pixels @ 2bpp
|
||||||
|
address =
|
||||||
(Storage<personality>::command_->location.v[0] >> 2) +
|
(Storage<personality>::command_->location.v[0] >> 2) +
|
||||||
(Storage<personality>::command_->location.v[1] << 7);
|
(Storage<personality>::command_->location.v[1] << 7);
|
||||||
|
mask = 0xc0 >> ((Storage<personality>::command_->location.v[0] & 3) << 1);
|
||||||
|
break;
|
||||||
|
case ScreenMode::YamahaGraphics6: // 512 pixels @ 4bpp
|
||||||
|
address =
|
||||||
|
(Storage<personality>::command_->location.v[0] >> 1) +
|
||||||
|
(Storage<personality>::command_->location.v[1] << 8);
|
||||||
|
mask = 0xf0 >> ((Storage<personality>::command_->location.v[0] & 1) << 2);
|
||||||
|
break;
|
||||||
|
case ScreenMode::YamahaGraphics7: // 256 pixels @ 8bpp
|
||||||
|
address =
|
||||||
|
(Storage<personality>::command_->location.v[0] >> 0) +
|
||||||
|
(Storage<personality>::command_->location.v[1] << 8);
|
||||||
|
mask = 0xff;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
switch(Storage<personality>::next_command_step_) {
|
switch(Storage<personality>::next_command_step_) {
|
||||||
// Duplicative, but keeps the compiler happy.
|
// Duplicative, but keeps the compiler happy.
|
||||||
@ -606,7 +632,6 @@ template <Personality personality> struct Base: public Storage<personality> {
|
|||||||
packed_colour |= packed_colour << 2;
|
packed_colour |= packed_colour << 2;
|
||||||
packed_colour |= packed_colour << 4;
|
packed_colour |= packed_colour << 4;
|
||||||
|
|
||||||
const uint8_t mask = 0xc0 >> ((Storage<personality>::command_->location.v[0] & 3) << 1);
|
|
||||||
Storage<personality>::command_latch_ &= ~mask;
|
Storage<personality>::command_latch_ &= ~mask;
|
||||||
Storage<personality>::command_latch_ |= packed_colour & mask;
|
Storage<personality>::command_latch_ |= packed_colour & mask;
|
||||||
ram_[address] = Storage<personality>::command_latch_;
|
ram_[address] = Storage<personality>::command_latch_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user