Skip to content

Commit

Permalink
- Avoid unnecessary end read.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Mar 4, 2024
1 parent 5efa327 commit 600fa45
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions cube/patches/base/emulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,12 @@ static void exi_read(unsigned index, uint32_t *value)

switch (index % 5) {
case 0:
if (chan == *VAR_EXI_SLOT)
mask |= 0b01000000000000;
if (chan == EXI_CHANNEL_2)
mask |= 0b00000000000011;
if (chan == EXI_CHANNEL_0 && (dev & (1 << EXI_DEVICE_2)))
mask |= 0b00001111111100;
else if (chan == EXI_CHANNEL_2)
mask |= 0b00000000000011;
if (chan == *VAR_EXI_SLOT)
mask |= 0b01000000000000;

*value = exi.reg[chan].cpr | (EXI[chan][0] & ~mask);
break;
Expand Down Expand Up @@ -388,18 +388,17 @@ static void exi_write(unsigned index, uint32_t value)

dev2 = (exi.reg[chan].cpr >> 7) & 0b111;

if (chan == *VAR_EXI_SLOT) {
if (chan == EXI_CHANNEL_2)
mask |= 0b00000000000011;
if (chan == EXI_CHANNEL_0 && ((dev | dev2) & (1 << EXI_DEVICE_2))) {
mask |= 0b00001111111100;
} else if (chan == *VAR_EXI_SLOT) {
if ((dev | dev2) & (1 << EXI_DEVICE_0))
mask |= 0b00001110000000;
if (~dev & dev2)
end_read();
}

if (chan == EXI_CHANNEL_0 && ((dev | dev2) & (1 << EXI_DEVICE_2)))
mask |= 0b00001111111100;
else if (chan == EXI_CHANNEL_2)
mask |= 0b00000000000011;

EXI[chan][0] = (value & ~mask) | (EXI[chan][0] & mask2);

if (chan == EXI_CHANNEL_0) {
Expand Down Expand Up @@ -494,7 +493,6 @@ static void exi_write(unsigned index, uint32_t value)
mask |= 0b00001110000000;
end_read();
}

#ifdef BBA
if (chan == EXI_CHANNEL_0 && (dev2 & (1 << EXI_DEVICE_2)))
mask |= 0b00001110000000;
Expand Down

0 comments on commit 600fa45

Please sign in to comment.