mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-27 15:29:34 +00:00
Ensure proper in-memory ordering of the b72a2c70 ROM.
This commit is contained in:
parent
c5c56f9d05
commit
dfe4e49110
@ -180,29 +180,40 @@ void DiskII::set_state_machine(const std::vector<uint8_t> &state_machine) {
|
|||||||
if(state_machine[0] != 0x18) {
|
if(state_machine[0] != 0x18) {
|
||||||
for(size_t source_address = 0; source_address < 256; ++source_address) {
|
for(size_t source_address = 0; source_address < 256; ++source_address) {
|
||||||
// Remap into Beneath Apple Pro-DOS address form.
|
// Remap into Beneath Apple Pro-DOS address form.
|
||||||
size_t destination_address =
|
const size_t destination_address =
|
||||||
((source_address&0x80) ? 0x10 : 0x00) |
|
|
||||||
((source_address&0x01) ? 0x20 : 0x00) |
|
|
||||||
((source_address&0x40) ? 0x40 : 0x00) |
|
|
||||||
((source_address&0x20) ? 0x80 : 0x00) |
|
((source_address&0x20) ? 0x80 : 0x00) |
|
||||||
((source_address&0x10) ? 0x01 : 0x00) |
|
((source_address&0x40) ? 0x40 : 0x00) |
|
||||||
|
((source_address&0x01) ? 0x20 : 0x00) |
|
||||||
|
((source_address&0x80) ? 0x10 : 0x00) |
|
||||||
((source_address&0x08) ? 0x08 : 0x00) |
|
((source_address&0x08) ? 0x08 : 0x00) |
|
||||||
((source_address&0x04) ? 0x04 : 0x00) |
|
((source_address&0x04) ? 0x04 : 0x00) |
|
||||||
((source_address&0x02) ? 0x02 : 0x00);
|
((source_address&0x02) ? 0x02 : 0x00) |
|
||||||
uint8_t source_value = state_machine[source_address];
|
((source_address&0x10) ? 0x01 : 0x00);
|
||||||
|
|
||||||
source_value =
|
// Store.
|
||||||
|
const uint8_t source_value = state_machine[source_address];
|
||||||
|
state_machine_[destination_address] =
|
||||||
((source_value & 0x80) ? 0x10 : 0x0) |
|
((source_value & 0x80) ? 0x10 : 0x0) |
|
||||||
((source_value & 0x40) ? 0x20 : 0x0) |
|
((source_value & 0x40) ? 0x20 : 0x0) |
|
||||||
((source_value & 0x20) ? 0x40 : 0x0) |
|
((source_value & 0x20) ? 0x40 : 0x0) |
|
||||||
((source_value & 0x10) ? 0x80 : 0x0) |
|
((source_value & 0x10) ? 0x80 : 0x0) |
|
||||||
(source_value & 0x0f);
|
(source_value & 0x0f);
|
||||||
|
|
||||||
// Store.
|
|
||||||
state_machine_[destination_address] = source_value;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
memcpy(&state_machine_[0], &state_machine[0], 128);
|
for(size_t source_address = 0; source_address < 256; ++source_address) {
|
||||||
|
// Reshuffle ordering of bytes only, to retain indexing by the high nibble.
|
||||||
|
const size_t destination_address =
|
||||||
|
((source_address&0x80) ? 0x80 : 0x00) |
|
||||||
|
((source_address&0x40) ? 0x40 : 0x00) |
|
||||||
|
((source_address&0x01) ? 0x20 : 0x00) |
|
||||||
|
((source_address&0x20) ? 0x10 : 0x00) |
|
||||||
|
((source_address&0x08) ? 0x08 : 0x00) |
|
||||||
|
((source_address&0x04) ? 0x04 : 0x00) |
|
||||||
|
((source_address&0x02) ? 0x02 : 0x00) |
|
||||||
|
((source_address&0x10) ? 0x01 : 0x00);
|
||||||
|
|
||||||
|
state_machine_[destination_address] = state_machine[source_address];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user