tebl/RC6502-Apple-1-Replica

pia_communicator map_to_ascii() seems partly nonsensical

Opened this issue · 0 comments

0cjs commented

The map_to_ascii() function in pia_communicator seems to be at least partly nonsensical. It's passed the output of Serial.read(), which returns a byte read from the serial port. An examination of the standard AVR source code indicates that it will always return a value between 0 and 255 (if a character is available) and as far as I'm aware the AVR serial ports read values no larger than 8 bits. So:

  1. The "Ctrl A-Z" code checks for values larger than 255, which can never be returned, and thus does nothing. If there is some sort of case (linking to a different library?) where the values this checks can be returned, this should be documented, otherwise the code should be removed.

  2. The "Convert ESC key" code checking for a value of 203 doesn't make sense to me; it would be unusual for a terminal program with correct communications settings to set the high bit on ASCII characters, and if it did why would it do so only for ESC and not for any other characters? Again, remove or document.