Skip to content

Commit

Permalink
n64: emulate disk change status bit behavior correctly + fix 64dd res…
Browse files Browse the repository at this point in the history
…et + fix DD debugger IO output (#1283)
  • Loading branch information
LuigiBlood authored Nov 10, 2023
1 parent 87ae65a commit fa0f9a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion ares/n64/dd/dd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ auto DD::disconnect() -> void {
if(id.match("NDXJ")) dd.information.cic = "CIC-NUS-8401";
}

io.status.diskChanged = 0;
io.status.diskPresent = 0;

//Deal with cases when the disk is removed while in use
Expand Down Expand Up @@ -142,7 +141,9 @@ auto DD::power(bool reset) -> void {
state = {};

io.status.resetState = 1;
io.status.diskChanged = 1;
if(disk) io.status.diskPresent = 1;

io.id = 3;
if(dd.information.cic.match("CIC-NUS-8401")) io.id = 4;

Expand Down
9 changes: 5 additions & 4 deletions ares/n64/dd/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ auto DD::readHalf(u32 address) -> u16 {
if(address == 36) {
}

debugger.io(Read, address, data);
return data;
}

Expand Down Expand Up @@ -195,7 +194,7 @@ auto DD::writeHalf(u32 address, u16 data_) -> void {

//ASIC_HARD_RESET
if(address == 16) {
if((data >> 16) == 0xAAAA) {
if(data == 0xAAAA) {
power(true);
}
}
Expand Down Expand Up @@ -242,18 +241,20 @@ auto DD::writeHalf(u32 address, u16 data_) -> void {
//ASIC_TEST_PIN_SEL
if(address == 36) {
}

debugger.io(Write, address, data);
}

auto DD::readWord(u32 address) -> u32 {
address = (address & 0x7f);
n32 data;
data.bit(16,31) = readHalf(address + 0);
data.bit( 0,15) = readHalf(address + 2);
debugger.io(Read, address >> 2, data);
return (u32)data;
}

auto DD::writeWord(u32 address, u32 data) -> void {
address = (address & 0x7f);
writeHalf(address + 0, data >> 16);
writeHalf(address + 2, data & 0xffff);
debugger.io(Write, address >> 2, data);
}

0 comments on commit fa0f9a7

Please sign in to comment.