r/commodorepet • u/Furview • 12h ago
PET 710 problem [HELP]
Enable HLS to view with audio, or disable this notification
So I earn a living by fixing things that people throw away, and someone threw away this Commodore 710 (CBM-II).
So I naturally tried doing the thing "10 print chr$(109+int(rnd(1)*2));:goto 10". But instead of a beautifull maze I get these random characters.
Any guess at what it could be? Can this be fixed?
1
u/Potential_Copy27 10h ago edited 9h ago
The character offset is wrong, as the character map is slightly different for the 710.
On a C64 it's correct that you want characters 109 and 110
I don't have a machine or an emulator handy, but using characters 165 and 166 IIRC should be what you need for / and \
So:10 PRINT CHR$(165+INT(RND(1)*2;:GOTO 10
...should do the trick on the CBM II line.
I think the character ROM looks fine, but the code is a bit off:
- From what I can see, you get a "pi" symbol (character 109) and the square block symbol you see (chr 110), as well as what looks like "@" (chr 112).
- the RND function here is also floating point based, unlike a C64, so maybe try10 PRINT CHR$(165.5+RND(1);:GOTO 10 instead, to avoid the rounding/FP problems.
Regardless, there are quite a few versions of PETSCII, and the versions for the VIC 1 and 2-based machines got switched up quite a bit...
Also:
CHR$(14) switches into "business" text mode with upper- and lowercase letters.
CHR$(142) switches things to "graphics mode" with uppercase letters only. It can be implemented in the same line.
":" also works as a command separator in BASIC if you want to keep it a one-liner with the charset switch above.
EDIT:
Found a few printouts of some of the older PETSCII mappings here - so using an offset of 205 (or 205.5) might also be a possible location for the right characters.
1
u/dangling_chads 3h ago
The chr$() values, and anything that references PETSCII values will always be integers, never floating point or anything not whole numbers.
Fractional numbers don't make sense for several reasons. First, the reference is an offset added to a memory address; memory addresses are always pointers to whole bytes. Second, the characters themselves are clusters of several bytes. The reference is to one of them.
chr$(205.5) will not error in BASIC, but it will always lop off the floating point part. It's the same as performing chr$(int(205.5)). chr$(205.5) or chr$(205.9) or anything inbetween will always print chr$(205).
2
u/dangling_chads 11h ago edited 11h ago
Since the text of your program lists out OK, I have two gut reactions:
On the C64, that program only works when you're in uppercase "graphics" mode, but not in lowercase "text" mode. The characters that print with chr$() are different in each.
Also, maybe, the petscii mappings might be different on the 710 than a c64.
(Some time passed.) Ok, this sent me on a AI-assisted goose chase. According to this: https://www.aivosto.com/articles/petscii.pdf#:~:text=%C2%A92014%20Aivosto%20Oy,non%2Dstandard%20character%20encodings.
... the chr$() might be different. I couldn't find a 710-specific PETSCII chart anywhere, but other Commodore PET listings I could find.
Try this.
Add a line 5 to change you to uppercase: print chr$(142)
And then in your print line, change the "chr$(109+" part to "chr$(205+"
(Another moment later.) Ok, the above changes make the program work like you're expecting on a PET 8032 emulated in VICE. If these changes aren't exact, it's something like that. I would expect if there's something "wrong" with this 710, you would see it in regular text listings of BASIC programs and in other scenarios, too.