mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-06 01:28:57 +00:00
Adds just enough to ensure that border state gets through.
This commit is contained in:
parent
d80f03e369
commit
0ef2806970
@ -401,6 +401,8 @@ template <Timing timing> class Video {
|
|||||||
uint8_t last_fetches_[4] = {0xff, 0xff, 0xff, 0xff};
|
uint8_t last_fetches_[4] = {0xff, 0xff, 0xff, 0xff};
|
||||||
uint8_t last_contended_access_ = 0xff;
|
uint8_t last_contended_access_ = 0xff;
|
||||||
|
|
||||||
|
friend struct State;
|
||||||
|
|
||||||
#define RGB(r, g, b) (r << 4) | (g << 2) | b
|
#define RGB(r, g, b) (r << 4) | (g << 2) | b
|
||||||
static constexpr uint8_t palette[] = {
|
static constexpr uint8_t palette[] = {
|
||||||
RGB(0, 0, 0), RGB(0, 0, 2), RGB(2, 0, 0), RGB(2, 0, 2),
|
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> {
|
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() {
|
State() {
|
||||||
if(needs_declare()) {
|
if(needs_declare()) {
|
||||||
DeclareField(border_colour);
|
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;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,6 +127,7 @@ template<Model model> class ConcreteMachine:
|
|||||||
if(target.state) {
|
if(target.state) {
|
||||||
const auto state = static_cast<State *>(target.state.get());
|
const auto state = static_cast<State *>(target.state.get());
|
||||||
state->z80.apply(z80_);
|
state->z80.apply(z80_);
|
||||||
|
state->video.apply(*video_.last_valid());
|
||||||
|
|
||||||
// If this is a 48k or 16k machine, remap source data from its original
|
// 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.
|
// linear form to whatever the banks end up being; otherwise copy as is.
|
||||||
@ -138,8 +139,6 @@ template<Model model> class ConcreteMachine:
|
|||||||
} else {
|
} else {
|
||||||
memcpy(ram_.data(), state->ram.data(), std::min(ram_.size(), state->ram.size()));
|
memcpy(ram_.data(), state->ram.data(), std::min(ram_.size(), state->ram.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("TODO: apply rest of state");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user