1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Fix memory handler, STOS.

This commit is contained in:
Thomas Harte 2023-10-20 21:49:34 -04:00
parent 93e90b09a0
commit 4efc181f07
2 changed files with 3 additions and 7 deletions

View File

@ -1440,11 +1440,7 @@ void stos(const InstructionT &instruction, AddressT &eCX, AddressT &eDI, IntT &e
return;
}
Source destination_segment = instruction.segment_override();
if(destination_segment == Source::None) destination_segment = Source::DS;
memory.template access<IntT>(destination_segment, eDI) = eAX;
memory.template access<IntT>(Source::ES, eDI) = eAX;
eDI += status.direction<AddressT>() * sizeof(IntT);
repeat<AddressT>(instruction, eCX, flow_controller);

View File

@ -156,7 +156,7 @@ struct Memory {
// to the start. So the 16-bit value will need to be a local cache.
if(address == 0xffff) {
write_back_address_ = (segment_base(segment) + address) & 0xf'ffff;
write_back_value_ = memory[write_back_address_] | (memory[write_back_address_ - 65535] << 8);
write_back_value_ = memory[write_back_address_] | (memory[(write_back_address_ - 65535) & 0xf'ffff] << 8);
return write_back_value_;
}
}
@ -168,7 +168,7 @@ struct Memory {
if constexpr (std::is_same_v<IntT, uint16_t>) {
if(write_back_address_) {
memory[write_back_address_] = write_back_value_ & 0xff;
memory[write_back_address_ - 65535] = write_back_value_ >> 8;
memory[(write_back_address_ - 65535) & 0xf'ffff] = write_back_value_ >> 8;
write_back_address_ = 0;
}
}