mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-21 21:33:54 +00:00
Attempts to get in-SNA software to start.
This commit is contained in:
parent
0ebd900e40
commit
a5098a60ec
@ -18,10 +18,12 @@ namespace ZXSpectrum {
|
||||
|
||||
struct State: public Reflection::StructImpl<State> {
|
||||
CPU::Z80::State z80;
|
||||
std::vector<uint8_t> ram;
|
||||
|
||||
State() {
|
||||
if(needs_declare()) {
|
||||
DeclareField(z80);
|
||||
DeclareField(ram);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -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_);
|
||||
memcpy(ram_.data(), state->ram.data(), std::min(ram_.size(), state->ram.size()));
|
||||
|
||||
LOG("TODO: apply rest of state");
|
||||
}
|
||||
|
@ -63,9 +63,19 @@ std::unique_ptr<Analyser::Static::Target> SNA::load(const std::string &file_name
|
||||
state->z80.registers.stack_pointer = file.get16le();
|
||||
state->z80.registers.interrupt_mode = file.get8();
|
||||
|
||||
// TODO: border colour, RAM contents, then pop the program counter.
|
||||
// 1A border colour
|
||||
const uint8_t border_colour = file.get8();
|
||||
(void)border_colour; // TODO.
|
||||
|
||||
// 1B– 48kb RAM contents
|
||||
state->ram = file.read(48*1024);
|
||||
|
||||
// Establish program counter.
|
||||
state->z80.registers.program_counter = state->ram[state->z80.registers.stack_pointer];
|
||||
state->ram[state->z80.registers.stack_pointer] = 0;
|
||||
state->z80.registers.program_counter |= state->ram[state->z80.registers.stack_pointer+1] << 8;
|
||||
state->ram[state->z80.registers.stack_pointer+1] = 0;
|
||||
state->z80.registers.stack_pointer += 2;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user