PDP-8 socket tty looses data #85
Comments
|
I don't see when you actually start the program:
The tcp session has to be established before you can expect the output can be delivered. Does "dep ttox time 1" get you better behavior without the lost bytes? |
|
After some more thought, I realize what is probably happening. Your program is pushing bytes out before the system notices that someone has established a connection to the serial port. One would argue that this race condition is a consequence of the program which immediately starts writing output and the fact that from the simulator's point of view, a wire hasn't been plugged into the serial port yet, and the program doesn't have a way to determine this. One could hack the ttox device to not generate output complete interrupts when a tcp connection isn't established, but this wouldn't reflect how real hardware behaves. Most output to real serial ports just falls on the floor if a wire isn't plugged into the port. |
|
The socket receiving program was started before I started the PDP-8 running. This was for testing my program for dumping and restoring images. The PDP-8 program sends a character when started telling the other end of the serial line to send the next block. With SIMH that first character gets lost without the change above. Works fine on a real PDP-8. The order was 6416 sends the character |
|
My analysis above is correct. The 'wire' hasn't been connected to the serial port yet and hence the initial output drops on the floor in the back of the computer. As you initially suggested, I have fixed this issue by explicitly scheduling the TTIX device immediately when the "attach ttix nnn" is done. Now, when the TTIX device is attached, an initial check will be done the first time simulation is started. This is sort of equivalent to your "first_time" flag, but specific to the issue it was created for. |
|
I reopened this issue since the problem was reported to still be happening; And testing confirmed that using the above recipe: The order was . |
|
Much digging revealed that the problem persisted due to the use of "RUN 200" to start simulator execution rather than "GO 200". The difference between the simh RUN and GO commands is that the RUN command resets all devices before starting execution. The GO command merely starts execution at the indicated start address (or the current PC value of no start address is supplied). The additional reset operation cancels the immediate pending poll for connection operation which is scheduled when the "attach ttix" command was issued. The first poll operation will now not happen until the first clock tick. The program therefore drops output characters until the connection is established. If there is some benefit to having devices reset, then the best way to achieve this would be:
|
If you run the following program
with these simh commands
att ttix 2222;notelnet
set ttox 8b
The first few characters get lost
$ nc localhost 2222 | od -to1
0000000 103 104 101 102 103 104 101 102 103 104 101 102 103 104 101 102
*
0167040 103 104 101 102 103
0167045
This part of the patch for issue 75 was to fix this problem. With more knowledge of the code there is probably a better solution.
The text was updated successfully, but these errors were encountered: