C64 character encoding
The commodore 64 has two character encoding schemes; Petscii and screencode. Petscii is what you use when you print using the standard $ffd2 charout print routine and screencodes is what you use when you poke the values directly to the screen.
In addition to this, you can toggle between upper/lower and upper/gfx by pressing Commodore + Shift
Printing $8e will take you to upper/gfx and printing $0e will take you to lower. You can block this by printing $08 and you can enable it again using $09.
Simple enough, and most of the times it is apparent if it’s done right as it will show up on the screen. However, one distinguishable difference is if you work with the drive. Filenames and disk commands must be in the proper format, or it won’t work. After AGAIN spending hours in a ghost chasing bug hunt, which was caused by setting a string to petscii upper/lower I got fed up and decided to have this blog post for my own reference. 🙂
Code:
*=$1000
.encoding "screencode_mixed" //default
smix: .text "abcdefgh"
.text "ABCDEFGH"
.encoding "screencode_upper"
supper: .text "abcdefgh"
.text "ABCDEFGH"
.encoding "petscii_mixed"
pmix: .text "abcdefgh"
.text "ABCDEFGH"
.encoding "petscii_upper"
pupper: .text "abcdefgh"
.text "ABCDEFGH"
/* Result:
>C:1000 01 02 03 04 05 06 07 08 ........
>C:1008 41 42 43 44 45 46 47 48 ABCDEFGH
>C:1010 61 62 63 64 65 66 67 68 abcdefgh
>C:1018 01 02 03 04 05 06 07 08 ........
>C:1020 41 42 43 44 45 46 47 48 ABCDEFGH
>C:1028 c1 c2 c3 c4 c5 c6 c7 c8 ........
>C:1030 61 62 63 64 65 66 67 68 abcdefgh
>C:1038 41 42 43 44 45 46 47 48 ABCDEFGH
If using Screencode_mixed, disk commands and filenames should be in UPPER CASE.
If using petscii_mixed, disk commands and filenames should be in lower case.
*/
Really not sure all of what you’re saying here.
When you say “mixed” do you mean when then upper/lower case is displayed?
Can you tell us what the value range is that that drives are expecting to represent the characters?
I give the hex output for the respective settings options in KickAssembler. That’s it