OPTi 49x scratch register writes no longer write out of the array's bounds.

This commit is contained in:
OBattler
2021-12-29 18:00:01 +01:00
parent 3bf359cbf9
commit abacd105b2
2 changed files with 4 additions and 4 deletions

View File

@@ -152,7 +152,7 @@ opti495_write(uint16_t addr, uint8_t val, void *priv)
case 0xe1: case 0xe1:
case 0xe2: case 0xe2:
dev->scratch[addr] = val; dev->scratch[~addr & 0x01] = val;
break; break;
} }
} }
@@ -176,7 +176,7 @@ opti495_read(uint16_t addr, void *priv)
break; break;
case 0xe1: case 0xe1:
case 0xe2: case 0xe2:
ret = dev->scratch[addr]; ret = dev->scratch[~addr & 0x01];
break; break;
} }

View File

@@ -162,7 +162,7 @@ opti499_write(uint16_t addr, uint8_t val, void *priv)
break; break;
case 0xe1: case 0xe2: case 0xe1: case 0xe2:
dev->scratch[addr] = val; dev->scratch[~addr & 0x01] = val;
break; break;
} }
} }
@@ -189,7 +189,7 @@ opti499_read(uint16_t addr, void *priv)
break; break;
case 0xe1: case 0xe1:
case 0xe2: case 0xe2:
ret = dev->scratch[addr]; ret = dev->scratch[~addr & 0x01];
break; break;
} }