Coming back to C64 programming after 35 years...

Chat about anything CX16 related that doesn't fit elsewhere
Post Reply
bjazmoore
Posts: 3
Joined: Sun Jun 23, 2024 4:31 pm

Coming back to C64 programming after 35 years...

Post by bjazmoore »

I feel like a total beginner. Well - I know how to program in many languages and I learned BASIC as my first language and when I owned a C64 (Why did I ever sell it?) I spent many long hours programming on it. Today I feel lost.

The thing about 8bit technology is that it is so tightly bound to the hardware. I don't have to tell you all that. You know it too.

I keep trying to do things and figure out things - I know I can do this, but the manuals are spread all over the place and a lot of knowledge is squirled away in the forum (and God help me if I can get a search that returns meaningful results - thanks google!) it is challenging to make much progress. Then I get something to work! A little victory. I feel elated. I am ready to try my next wide idea.

Right now I am just playing with BASIC. Man - some of you all are really good at this!

Today I am trying to figure out character sets. I know there is an X16 character set and a PET character set. It seems that right now I am using the Pet character set. Can I change it? Can I change it in code? Any insights would be great.

Thanks
User avatar
JimmyDansbo
Posts: 476
Joined: Sun Apr 26, 2020 8:10 pm
Location: Denmark
Contact:

Re: Coming back to C64 programming after 35 years...

Post by JimmyDansbo »

You can switch between ISO mode and PETSCII mode with:
CHR$($0F)
and
CHR$($8F)
When in PETSCII mode, you can switch between upper- and lowercase with:
CHR$($0E)
and
CHR$($8E)
You can find the documentation here:
https://github.com/X16Community/x16-doc ... d#iso-mode

Below table may also be of help:
https://cx16.dk/cx16-petscii/
Visit my Github repo
or my personal site with CX16/C64/6502 related information.
Feel free to contact me regarding any of my projects or even about meeting up somewhere near Denmark
voidstar
Posts: 492
Joined: Thu Apr 15, 2021 8:05 am

Re: Coming back to C64 programming after 35 years...

Post by voidstar »

Also you can press SHIFT+ALT at same time to swap between the two PETSCII modes (this is immediate and won't clear the screen, it just toggles the loaded font set), and ALT+O to enter ISO mode (this will clear the screen, as a reminder that you're enabling a quite different font set, at least in the extended >127 region).


To experiment, try the following simple BASIC:

Code: Select all

1 SCREEN 1

5  REM REGULAR PETSCII CHARS (OR ISO IF IN ISO-MODE)
10 FOR I = 33 TO 126  : REM AVOID 0 TO 32, THOSE ARE CONTROL CODES
20 PRINT CHR$(I);  : REM THE SEMICOLON IS IMPORTANT HERE
30 NEXT I

35 REM SCREEN CODES (OR DISPLAY CODES) VIA TILE KEYWORD
40 FOR I = 0 TO 60
50 TILE I,4,I
60 NEXT I

70 LOCATE 8,1
Then press SHIFT+ALT to see the difference in font-set.

The console/CMDR-DOS and keyboard use one mapping (PRINT uses that mapping), while the display character set uses yet another mapping (TILE uses that mapping). Often it is faster to work directly with screen codes (like if you want to draw a box in text-mode using PETSCII symbols). Other times you want to make use of PRINT, MID$, CHR$
Attachments
charset_screencode_sample.jpg
charset_screencode_sample.jpg (135.93 KiB) Viewed 860 times
Post Reply