Jump to content
  • 0
Sign in to follow this  
rje

Ask VERA: Why is the character set shifted?

Question

Posted (edited)

I first saw this in the 8 Bit Guy's video, but I'm encountering it now in person. So I'm curious as to why the character set "swaps" PETSCII $40-$5F and $20-$3F?   

 

 

Edited by rje

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Are you talking about screen codes (used with POKE) vs PETSCII codes (used with PRINT, CHR$, ASC)? 

Or are you talking about PETSCII vs ASCII?

The reason the character codes are different than the PETSCII order is reverse characters and control codes. If you look at PETSCII or ASCII, the first 32 values are used for control characters. This would be wasted space if Commodore didn't use those screen codes for something. So they chose to put the screen codes in a different order to make everything fit. 

I don't know why they put A-Z at the beginning of the character set, rather than using that space for graphic glyphs, however. If I'd been making that decision, I would have kept 32-127 the same and just moved the C= key symbols into 0-31. 

As to PETSCII vs ASCII... that goes back to the PET. The PET 2001 did not have lower case characters. Instead, Commodore put the line drawing glyphs in the space between 96 and 127. Later, this changed, when the character set was expanded to allow for lower case. But by then, the damage had already been done. BASIC relied on the PETSCII character set staying unchanged, and so that legacy lived on through all of the Commodore 8-bit computers. 

 

 

 

Share this post


Link to post
Share on other sites
  • 0

It occurs to me that you might also be asking about the difference between shifted PETSCII vs. unshifted PETSCII, but I don't know the answer to that...

Share this post


Link to post
Share on other sites
  • 0

Tom answered it.  Basically the control codes don’t make sense for VERA, right?  So $40-$5f were moved to $00-1f.  It’s jarring, but it is what it is.

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
23 hours ago, Michael Steil said:

The X16 supports all C64 control codes plus a few extra ones, some of them borrowed from the C128 and the C65: https://github.com/commanderx16/x16-docs/blob/master/Commander X16 Programmer's Reference Guide.md#new-control-characters

That's bueno -- I was wanting that FLASH/NO FLASH code.   

I was specifically grumbling about VERA, and that a VPOKE x,y,z shifts $40-$5f down to $00-$1f, etc.   I hadn't thought about it, but Tom already knew:

 

Quote

The reason the character codes are different than the PETSCII order is reverse characters and control codes. If you look at PETSCII or ASCII, the first 32 values are used for control characters. This would be wasted space if Commodore didn't use those screen codes for something. So they chose to put the screen codes in a different order to make everything fit. 

 

Edited by rje

Share this post


Link to post
Share on other sites
  • 0

It is not the vpoke that shifts it. It is that the screenram has another coding (not Petscii) . You either use CHROUT or convert Petscii to screencode yourself. I never understood why the did not simply ordered the chars in charrom as in Petscii directly. Anyhow that is what it is now. 
 

Petscii<>Screencodes

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

Please review our Terms of Use