* Fix #3173 by only calling bus.map() on initial power, not subsequent calls * yeah screw that, we'll just lock the bus to prevent map calls from going through * initialize peekable in reset with false, just for safety i guess
This commit is contained in:
parent
1c0f2a45ba
commit
3726cc6291
Binary file not shown.
|
@ -11,12 +11,16 @@ Bus::~Bus() {
|
|||
abort();
|
||||
}
|
||||
|
||||
auto Bus::lock() -> void {
|
||||
locked = true;
|
||||
}
|
||||
|
||||
auto Bus::reset() -> void {
|
||||
for(uint id : range(256)) {
|
||||
reader[id].reset();
|
||||
writer[id].reset();
|
||||
counter[id] = 0;
|
||||
peekable[id] = true;
|
||||
peekable[id] = false;
|
||||
}
|
||||
|
||||
//if(lookup) delete[] lookup;
|
||||
|
@ -37,6 +41,7 @@ auto Bus::map(
|
|||
const function<void (uint, uint8)>& write,
|
||||
const string& addr, bool isPeekable, uint size, uint base, uint mask
|
||||
) -> uint {
|
||||
if (locked) return 0;
|
||||
uint id = 1;
|
||||
while(counter[id]) {
|
||||
if(++id >= 256) return print("SFC error: bus map exhausted\n"), 0;
|
||||
|
@ -81,6 +86,7 @@ auto Bus::map(
|
|||
}
|
||||
|
||||
auto Bus::unmap(const string& addr) -> void {
|
||||
if (locked) return;
|
||||
auto p = addr.split(":", 1L);
|
||||
auto banks = p(0).split(",");
|
||||
auto addrs = p(1).split(",");
|
||||
|
|
|
@ -30,6 +30,7 @@ struct Bus {
|
|||
alwaysinline auto read(uint address, uint8 data = 0) -> uint8;
|
||||
alwaysinline auto write(uint address, uint8 data) -> void;
|
||||
|
||||
auto lock() -> void;
|
||||
auto reset() -> void;
|
||||
auto map(
|
||||
const function<uint8 (uint, uint8)>& read,
|
||||
|
@ -41,6 +42,7 @@ struct Bus {
|
|||
private:
|
||||
uint8* lookup = nullptr;
|
||||
uint32* target = nullptr;
|
||||
bool locked;
|
||||
|
||||
function<uint8 (uint, uint8)> reader[256];
|
||||
function<void (uint, uint8)> writer[256];
|
||||
|
|
|
@ -323,6 +323,7 @@ auto Program::load() -> void {
|
|||
}
|
||||
|
||||
emulator->power();
|
||||
bus.lock();
|
||||
}
|
||||
|
||||
auto Program::load(uint id, string name, string type, vector<string> options) -> Emulator::Platform::Load {
|
||||
|
|
Loading…
Reference in New Issue