Alamorobotics wrote:
Looks like the Commodore 64 does not follow the ASCII code so I need to re-arrange the characters...
That's correct, the PET character set is really weird. One reason is that it's based on an earlier ASCII standard than we all know now. So some characters are in a different place in the character set. But also, the characters are in a different order in the character ROM; When you tell the kernal to print a character (or use CHR$ in BASIC), it changes the value to make up for this. So CHR$(65) pokes a 1 into the screen location at the cursor to show an "A".
There are two character sets in each PET: the graphics character set which has upper case characters and graphics, and the lower case set which has upper case, lower case and fewer graphics. Interestingly, when you switch between the two character sets, earlier ROMs will show upper case glyphs for the same character codes (so PRINT remains PRINT) but newer ROMs have the lower case glyphs in the lower case set where the upper case glyphs are in the graphics set (so PRINT becomes print).
I didn't make any attempt to fix the problem that the characters are all in the wrong places because I was planning on making a PET replica which would make up for that by itself. For testing (i.e. when I wanted to print a text on the screen from the Propeller code), I modified the character printing routine to change the character values the same way as the PET does.
Both of the character sets (graphics and lower case) are in my PETSCII modified vga-hires-text driver but one of them is commented out. The plan was to eventually put both character sets into the module, and make it possible to switch character sets at runtime (just like on the real PET) by modifying the pointer that points to the font table. I never finished that, though.
===Jac