Skip to content

Commit

Permalink
AltairZ80: Additional checks for stop_cpu condition
Browse files Browse the repository at this point in the history
  • Loading branch information
psco authored and markpizz committed Apr 21, 2023
1 parent 55dd407 commit 8e5368a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions AltairZ80/altairz80_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,11 @@ static int32 sio0sCore(const int32 port, const int32 io, const int32 data) {
pollConnection();
if (io == 0) { /* IN */
if (sio_unit.u4) { /* attached to a file? */
ch = sim_poll_kbd(); /* yes, check for stop condition first */
if ((ch == SCPE_OK) && stop_cpu) {
sim_interval = 0; /* detect stop condition as soon as possible*/
return spi.sio_cannot_read | spi.sio_can_write; /* do not consume stop character */
}
if (sio_unit.u3) /* character available? */
return spi.sio_can_read | spi.sio_can_write;
ch = getc(sio_unit.fileref);
Expand All @@ -783,6 +788,11 @@ static int32 sio0sCore(const int32 port, const int32 io, const int32 data) {
}
}
if (sio_unit.flags & UNIT_ATT) { /* attached to a port? */
ch = sim_poll_kbd(); /* yes, check for stop condition first */
if ((ch == SCPE_OK) && stop_cpu) {
sim_interval = 0; /* detect stop condition as soon as possible*/
return spi.sio_cannot_read | spi.sio_can_write; /* do not consume stop character */
}
if (tmxr_rqln(&TerminalLines[spi.terminalLine]))
result = spi.sio_can_read;
else {
Expand All @@ -798,9 +808,9 @@ static int32 sio0sCore(const int32 port, const int32 io, const int32 data) {
return spi.sio_can_read | spi.sio_can_write;
ch = sim_poll_kbd(); /* no, try to get a character */
if ((ch == SCPE_OK) && stop_cpu) {
sim_interval = 0; /* detect stop condition as soon as possible*/
return spi.sio_cannot_read | spi.sio_can_write; /* do not consume stop character */
}
sim_interval = 0; /* detect stop condition as soon as possible*/
return spi.sio_cannot_read | spi.sio_can_write; /* do not consume stop character */
}
if (ch) { /* character available? */
sio_unit.u3 = TRUE; /* indicate character available */
sio_unit.buf = ch; /* store character in buffer */
Expand Down

0 comments on commit 8e5368a

Please sign in to comment.