Skip to content

Commit

Permalink
Fix TUBE_ULA_R3 use
Browse files Browse the repository at this point in the history
Fixes #410, thanks CoPilot for finding the bug!
  • Loading branch information
mattgodbolt committed Aug 4, 2024
1 parent 5fdab64 commit a42a952
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tube.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,14 @@ export class Tube {
if (this.parasiteStatus[TUBE_ULA_R3] & TUBE_ULA_FLAG_DATA_REGISTER_NOT_FULL) {
if (this.internalStatusRegister & TUBE_ULA_FLAG_STATUS_ENABLE_2_BYTE_R3_DATA) {
if (this.parasiteToHostFifoByteCount3 < 2) {
this.parasiteToHostData[this.parasiteToHostFifoByteCount3++] = value;
this.parasiteToHostData[TUBE_ULA_R3][this.parasiteToHostFifoByteCount3++] = value;
}
if (this.parasiteToHostFifoByteCount3 === 2) {
this.hostStatus[TUBE_ULA_R3] |= TUBE_ULA_FLAG_DATA_AVAILABLE;
this.parasiteStatus[TUBE_ULA_R3] &= ~TUBE_ULA_FLAG_DATA_REGISTER_NOT_FULL;
}
} else {
this.parasiteToHostData[0] = value;
this.parasiteToHostData[TUBE_ULA_R3][0] = value;
this.parasiteToHostFifoByteCount3 = 1;
this.hostStatus[TUBE_ULA_R3] |= TUBE_ULA_FLAG_DATA_AVAILABLE;
this.parasiteStatus[TUBE_ULA_R3] &= ~TUBE_ULA_FLAG_DATA_REGISTER_NOT_FULL;
Expand Down

0 comments on commit a42a952

Please sign in to comment.