Skip to content

Commit

Permalink
ps1: log and recover from premature device transmit
Browse files Browse the repository at this point in the history
Fixes input in most (all?) titles that don't currently work
Requires more research
  • Loading branch information
LukeUsher committed Aug 14, 2023
1 parent 631085f commit ef53e87
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ares/ps1/peripheral/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ auto Peripheral::receive() -> u8 {
auto Peripheral::transmit(u8 data) -> void {
if(!io.joyOutput) return;

if(io.ackCounter > 0) {
debug(unusual, "Peripheral::transmit: ackCounter > 0");
//HACK: Recover by deasserting /ack and /irq; we need to figure out why this happens
//TODO: Why is transmit happening too early? Does real hardware do this?
io.acknowledgeAsserted = 0;
io.interruptRequest = 0;
}

//Calculate the number of cycles required to transfer a byte at the current baud rate
//This is added to the /ACK delay to determine the total duration until /ACK is asserted
u8 factors[4] = {1, 1, 16, 64};
Expand Down

0 comments on commit ef53e87

Please sign in to comment.