Page 1 of 1
SIO board input/output buffers
Posted: July 8th, 2018, 1:42 pm
by Jethro82
First does anybody know how the check(and clear) the keyboard buffer on the default settings for main board(the one the monitor is set to work with).
Second does anybody know how to check if the output buffer is clear. I have programs that work fine in single step mode but skip a bunch of characters during regular operation.
Re: SIO board input/output buffers
Posted: July 9th, 2018, 11:08 am
by AltairClone
Is the console serial port configured as a "2SIO" (88-2SIO, typically the default) or as an "SIO" (88-SIO) as mentioned in the thread title?
Mike
Re: SIO board input/output buffers
Posted: July 9th, 2018, 1:24 pm
by TomXP411
The SIO port has a single data register, so it can only hold one byte at a time. You need to query the status register to determine whether there's a byte waiting to be read or if the byte in the output buffer has been written. And since the buffer only holds one byte, you need to handle input at least as fast as it's coming in.
IIRC, when bit 0 is set, you need to read the data register. When bit 1 is set, you can write to the output register.
Re: SIO board input/output buffers
Posted: July 9th, 2018, 8:41 pm
by AltairClone
If using a 2SIO port, then check bit 0 of the status register for 1 to indicate a new character is present in the input data register. Check bit 1 of the status register for 1 to indicate the data register can accept a character for output.
If using an SIO port, then check bit 0 of the status register for 0 to indicate a new character is present in the input data register. Check bit 7 of the status register for 0 to indicate the data register can accept a character for output.
Mike
Re: SIO board input/output buffers
Posted: July 11th, 2018, 12:50 pm
by TomXP411
AltairClone wrote:If using a 2SIO port, then check bit 0 of the status register for 1 to indicate a new character is present in the input data register. Check bit 1 of the status register for 1 to indicate the data register can accept a character for output.
If using an SIO port, then check bit 0 of the status register for 0 to indicate a new character is present in the input data register. Check bit 7 of the status register for 0 to indicate the data register can accept a character for output.
Mike
Ooh, I hadn't realized there was a functional difference between the two. That explains the discrepancy between what I actually observed while testing the ports and what the documentation I found actually said.
Thanks, Mike.