diff --git a/sim_tmxr.c b/sim_tmxr.c index 3a9900b2..609180da 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -1411,7 +1411,7 @@ if (lp->mp && lp->modem_control) { /* This API ONLY works on mo if (lp->serport) return sim_control_serial (lp->serport, bits_to_set, bits_to_clear, incoming_bits); if ((lp->sock) || (lp->connecting)) { - if (bits_to_clear&TMXR_MDM_DTR) { /* drop DTR? */ + if ((~before_modem_bits & bits_to_clear & TMXR_MDM_DTR) != 0) { /* drop DTR? */ if (lp->sock) tmxr_report_disconnection (lp); /* report closure */ tmxr_reset_ln (lp); @@ -1431,6 +1431,13 @@ if (lp->mp && lp->modem_control) { /* This API ONLY works on mo } return SCPE_OK; } +if ((lp->sock) || (lp->connecting)) { + if ((~before_modem_bits & bits_to_clear & TMXR_MDM_DTR) != 0) { /* drop DTR? */ + if (lp->sock) + tmxr_report_disconnection (lp); /* report closure */ + tmxr_reset_ln (lp); + } + } if ((lp->serport) && (!lp->loopback)) sim_control_serial (lp->serport, 0, 0, incoming_bits); return SCPE_IERR;