durgadas311 / minimalCPM

Project to explore a minimal CP/M computer - console device only.
4 stars 1 forks source link

Console input request might timeout #2

Open durgadas311 opened 3 years ago

durgadas311 commented 3 years ago

The console input request/response sequence is the only CP/NET message that could delay indefinitely before the response is sent. It's not entirely clear exactly how this manifests in the code, but after leaving the system at the "A>" for a couple hours, and pressing the RETURN key, it would appear that things did timeout and it takes a little time to resync. After pressing RETURN at the "A>" prompt, we see "A>A>" - i.e. the RETURN and subsequent CR/LF output did not go exactly right.

It would be better to handle console input more like BDOS function 6 Direct Console I/O - in fact it might be better if all CP/NET console I/O used this function. Still, any changes to NDOS must be made carefully.

durgadas311 commented 3 years ago

One possible workaround for this might be to have the SNIOS snoop the FNC and wait forever for the response in the case of console input. However, the FNC is only know for SNDMSG and needs to be detected in RCVMSG, which are logically separate operations and technically shouldn't know anything about each other.

durgadas311 commented 3 years ago

Even with the timeout resolved, console input is significantly flawed in this implementation. Any request-response sequence that might span hours, let alone days, is at significant risk of being broken by either side experiencing a restart or any other event that results in loss of context. For example, resetting the client while in the middle of a console input leaves the server sleeping on an input character, and the client will not be able to re-establish contact. Also, the client will eventually get an unsolicited response message for the console input, when the user next presses a key.