1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-01 14:29:51 +00:00

Adds just enough to ensure that border state gets through.

This commit is contained in:
Thomas Harte 2021-04-25 14:16:35 -04:00
parent d80f03e369
commit 0ef2806970
2 changed files with 20 additions and 3 deletions

View File

@ -401,6 +401,8 @@ template <Timing timing> class Video {
uint8_t last_fetches_[4] = {0xff, 0xff, 0xff, 0xff};
uint8_t last_contended_access_ = 0xff;
friend struct State;
#define RGB(r, g, b) (r << 4) | (g << 2) | b
static constexpr uint8_t palette[] = {
RGB(0, 0, 0), RGB(0, 0, 2), RGB(2, 0, 0), RGB(2, 0, 2),
@ -412,13 +414,29 @@ template <Timing timing> class Video {
};
struct State: public Reflection::StructImpl<State> {
uint8_t border_colour;
uint8_t border_colour = 0;
int time_into_frame = 0;
bool flash = 0;
int flash_counter = 0;
bool is_alternate_line = false;
State() {
if(needs_declare()) {
DeclareField(border_colour);
DeclareField(time_into_frame);
DeclareField(flash);
DeclareField(flash_counter);
DeclareField(is_alternate_line);
}
}
template <typename Video> void apply(Video &target) {
target.set_border_colour(border_colour);
target.time_into_frame_ = time_into_frame;
target.flash_mask_ = flash ? 0xff : 0x00;
target.flash_counter_ = flash_counter;
target.is_alternate_line_ = is_alternate_line;
}
};
}

View File

@ -127,6 +127,7 @@ template<Model model> class ConcreteMachine:
if(target.state) {
const auto state = static_cast<State *>(target.state.get());
state->z80.apply(z80_);
state->video.apply(*video_.last_valid());
// If this is a 48k or 16k machine, remap source data from its original
// linear form to whatever the banks end up being; otherwise copy as is.
@ -138,8 +139,6 @@ template<Model model> class ConcreteMachine:
} else {
memcpy(ram_.data(), state->ram.data(), std::min(ram_.size(), state->ram.size()));
}
LOG("TODO: apply rest of state");
}
}