Based on this tread, I've started a design spec for an external UART interface. It would rely on a PIC or Arduino to convert the parallel data to serial, as well as provide buffering.
Key points:
PARALLEL interface. This will use 8 VIA data lines to carry a full byte in one clock cycle
8 bits for data
1 wire for clock (this is triggered once per byte, to let the UART know there is data waiting)
1 wire for direction. Raising and lowering this line tells the UART whether the computer wants to read a byte or transmit a byte.
Buffering and Flow Control
256 byte buffer per direction per channel. (So 1 channel uses 512 bytes. 2 channels use 1024 bytes, etc.)
2 lines for buffer status: one line signals receive buffer has data. Another line signals transmit buffer is empty.
Command/Data interface:
Channel select (Selects serial ports, network port, file I/O, or external display)
a dedicated wire selects command mode, which is used for controlling the UART.
Baud Rate, data length, stop bits, parity
IP address (for TCP/UDP channels)
Directory and File selection (for file I/O)
https://docs.google.com/document/d/1HwHCv2txDu91l3uozRH8hwBrq6Fw06lmrQl3kidKQ1c/
@BruceMcF and @Andre , you've had the most to say, so if you could review the doc and provide your input here, I'll refine the specification based on your suggestions.
My goal is to test this on a WDC 6502 development board, and once we have 6502 and Arduino code working, provide a PR to @Michael Steil with a KERNAL routine for direct access.
We'll probably provide 5 KERNAL routines:
Clear To Send: Returns 0 if send buffer is full. >1 if buffer is not full. (Returned value is bytes available.)
Write Byte (returns 1 if successful, 0 if buffer is full)
Data Waiting: returns 0-buffer size bytes.
Read Byte: returns first byte in buffer, 0 if buffer is empty. (You should always check Data Waiting before a read for binary data. Reading a null is fine for ASCII data.)
Set Address: Sets address register for read/write. Used to set baud rate, port number, or directly read modem pins.
Ideally, I'd like to see this implemented as device #2, using secondary address 10-13 for data and 14 for control.
For example:
OPEN 2,2,2: Opens the bit-banged serial port
OPEN 2,2,10, "9600" (Opens the first serial port at 9600 baud.)
I'm currently re-writing the spec to take your suggestions into account, as well as extend the design to allow for more flexibility.
** update: For the first prototype, I've selected the Raspberry Pi zero. I'm currently using two Pis, connected together, as my test harness. More updates at the end of the thread.
** Update 2: Pi works, but is slow. I simply can’t sense the GPIO fast enough to do more than about 5-10KB/sec. I may be able to speed this up a little with an additional handshaking pin… stay tuned.