10

I am fiddling with C64 cartridges and have successfully created one with a 32k EEPROM (of which I only use the top 8k).

For the autoboot though, according to this source, I need to put the string CBM80 on address $8004. In the example, it puts bytes $C3, $C2 and $CD there (after the boot vectors):

 .word coldstart            ; coldstart vector
 .word warmstart            ; warmstart vector
 .byte $C3,$C2,$CD,$38,$30  ; "CBM8O". Autostart string

I checked all my character tables, but nowhere can I find that $C3 translates to C (or the other two characters). The 80 seems to be plain ASCII though.

So, how does $C3, $C2, $CD translate to CBM ?

10
  • 9
    Aren't they the ASCII values $43,$42,$4D with msb set? Commented Apr 1 at 10:33
  • @WeatherVane, yes it seems like it. But what does that mean? Commented Apr 1 at 10:38
  • 2
    Still, kudos to the linked source for correctly using 'the kernel', with 'Kernal' reserved for use as a proper noun.
    – Tommy
    Commented Apr 1 at 14:04
  • 1
    @user3840170 - numeral zero, not letter oh. Commented Apr 1 at 18:11
  • 2
    @Tommy oh I see: KERNAL is "Commodore's name for the ROM-resident operating system core in its 8-bit home computers." Commented Apr 1 at 19:49

2 Answers 2

23

The C64 used PETSCII, not ASCII, as its character set, and most Commodore 6502-based computers had a 'shift' between the normal layout, with uppercase letters at $41 through $5A and pseudographics at $61 through $7A and the 'shifted' layout (accessed by POKE 59468, 14; to return to the normal layout, POKE 59468,12) placed lowercase at $41 through $5A and replaced the graphics from $61 through $7A with uppercase. For some reason, in both modes, the ranges $C0 through $DF and $60 through $7F were duplicated; under some circumstances, while the appearance was the same, the semantics/interpretation differed. It can be surmised that the cartridge autoboot relied on the semantic/interpretational difference between the $60 range and the $C0 range for its "key".

5
  • 4
    The cartridge auto-boot didn't care about the semantics of the characters beyond whether their values matched a hard-coded sequence. I always thought of the characters not as being uppercase CBM, but rather as being CBM but with the high bit set, since one purpose of such a check would be to exercise all eight data bits. The characters B and M with high bit set, and 0 with high bit clear, ensure that each bit is high at least once and low at least once.
    – supercat
    Commented Apr 1 at 16:06
  • 1
    @supercat - Well, yes, all that the code would actually care about was bit patterns, but at the "meta" level, I was working with the Wikipedia explanation, and more-or-less matching that to the actual data that the querent provided. Commented Apr 1 at 17:14
  • 1
    If we were to apply any semantics, a set sign-bit usually indicates a string termination in Commodore ROM context. (Meaning, these are 3 separate characters.) However, I think, @supercat is right about a successful test also guaranteeing a sound cartridge connection. Notably $C3 | $C2 | $CD | $38 | $30 = $FF, all 8 lines must work at both logic levels in order for the check to succeed.
    – masswerk
    Commented Apr 1 at 17:29
  • 4
    And to amplify your point, ($C3 & C2 & $CD & $30) yields zero. The fourth character would vary depending upon where a ROM was meant to be loaded, but the upper nybble of the fifth byte would be $3, which is the opposite of $C, and the bottom nybble of the second byte, $02, is the opposite of the third byte's $0D). CBM might have been nice semantically, but also had nice bit patterns, sorta like the "AT" command set, chosen because "A" has a very long low period and "T" has the opposite parity from "A".
    – supercat
    Commented Apr 1 at 17:52
  • It's really a Commodore branded "the quick brown fox jumps over the lazy dog"… :-)
    – masswerk
    Commented Apr 2 at 14:37
4

8-Bit Commodore computers starting with the PET (released in '77) used the PETSCII set, which was based on the 1963 version of ASCII rather than the 1967 version used by most machines. PETSCII could only use lowercase OR uppercase characters at a time, as changing between the two required a POKE 59468, 14 (or POKE 59468, 12 to revert). PETSCII held characters at 0xC0 to 0XFF. You might appreciate this photo from Wikipedia describing the layout in the "shifted" vs. "unshifted" modes.

Table showing the PETSCII character set

In your case, the letter a (or A, depending on the mode), starts at 0xC1, thus c (the third letter) is 0xC3, b (the second letter) is 0xC2, and m (the 13th letter) is 0xCD (D being hexadecimal for 13).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .