Actually, the VIC-20 User Guide already contains the two tables of PETSCII and screen codes in its appendices.Robbie wrote:[...] I decided to check out the reference to Compute's Programming the Vic [...]
There is one easily overlooked detail though: there are duplicates of the PETSCII codes, and when you enter them as 'plain text', with the screen editor, into a string (for PRINT or as variable), you only get one of the possible codes. Also, the pi symbol is special cased. Here is the correspondence table I use:
Code: Select all
with X=0..31:
PETSCII screen code
32+X <-> 32+X
64+X <-> X
160+X <-> 96+X
192+X <-> 64+X (_except_ X=30!)
255 <-> 94
(Also @wimoos): reverse characters outside quotes do not have separate PETSCII codes. You need to 'bracket' them with {RVS ON} and {RVS OFF}. You should also take into account, that a quote toggles quote mode, so if you want to print quotes in a programs, I recommend to define a helper string like Q$=CHR$(34)+CHR$(20)+CHR$(34) and use it like this:
PRINT Q$+"THIS IS QUOTED."+Q$
The first CHR$(34) already does a quote, but it also activates quote mode - CHR$(20) deletes that quote, moving the cursor back one position and then the second CHR$(34) reprints the quote, but also switches off quote mode! I.e. you can also print a reverse quote like thus:
PRINT "{RVS ON}"+Q$+"{RVS OFF} <- A REVERSE QUOTE."
... and {RVS OFF} works as intended. With just "Q$=CHR$(34)", you unintentionally print {RVS OFF} as quoted control character and the remainder of the print string still appears reverse.