I have an idea for an ABI which solves many of the character encoding problems while being sufficiently portable for output via LCD, CRT and UART. RegA contains one byte to send. RegX specifies how to handle the data in RegA. Specifically:
- RegX = 0: Set output channel.
- RegX = 2: Set tab spacing.
- RegX = 4: Set cursor X co-ordinate to value in RegA. May be ignored.
- RegX = 6: Set cursor Y co-ordinate to value in RegA. May be ignored.
- RegX = 8: Clear display. May be ignored.
- RegX = 10: Output raw character and increment cursor X co-ordinate.
- RegX = 12: Output raw ROT13 character and increment cursor X co-ordinate.
- RegX = 14: Output baked ASCII character where tab, new-line and carriage return work as expected.
- RegX = 16: Output akohlbecker's preferred encoding where $00-$1F are accented characters.
- RegX = 18: Output Sheep64's preferred encoding where $80-$BF is Greek and $C0-$FF is Cyrillic.
- RegX = 20: Output sburrow's preferred encoding of PS/2 key-codes.
The trick is that RegA is a fully populated 8 bit encoding and RegA/RegX is a partially populated 16 bit encoding. This satisfies everyone who wants a 256 characters for display because it resolves conflicting use of the same code-points. Furthermore, it can be easily implemented with two invocations of JMP (abs,X). Each branch may LDX zp to load channel number and perform a second JMP (abs,X). From here, for each output channel, a best effort can be made to output the appropriate symbol. To output strings, this ABI may be called within a loop. For conciseness, you might want to store strings backwards so that a loop may terminate with BEQ. This leads to an old joke:
Quote:
!11-PDP A NI DEPPART M'I !PLEH