Jump to content
IGNORED

Commodore PET - Peek Inquiry


evildead9000

Recommended Posts

Hello All!

 

I've recently purchased a Commodore Pet and it's awesome! I'm loving all the Petscii and text games!!

 

I've also decided to code my own Petscii game. I have some knowledge of basic, and I've been working to learn more.

However, I'm having a bit of difficultly with Peek, which brings me here.

 

I'm hoping someone could shed some light. Right now I'm just testing out things to see how things work.

 

Here's my issue: I have an A as the first character on screen. I can peek that location and print the character on-screen below it. It's a 1 according to the PETSCII character chart. However, when I change the A into an inverted/reverse A, the number 32 is printed on screen. All inverted characters are printing a 32, which is a space.

 

How can I peek a location to verify if a specific inverted/reverse character is there?

 

I hope I explained the issue correctly and please correct me if I am incorrect! Any guidance/info would be greatly appreciated.

 

Thank You!

 

Long live the Commodore! (all of them)

 

Link to comment
Share on other sites

If I understand the problem correctly …

 

PETSCII isn't used for screen display codes; I believe the PET will use a similar (same?) code set as the VIC-20 / C=64 / C=128, seen in http://sta.c64.org/cbm64scr.html — It's like PETSCII with the 3° group of 32 chars swapped into the 1° position. A in PETSCII = $41, A in screen codes = $01.

 

A reverse char is the same as its normal char & $80 (+128), so where A is $01, reverse A is $81; π is $5e, reverse π is $de.

 

To get the PETSCII for a non-reverse char, and/or a flag to indicate if a char is reversed,

REM screen address
AD% = (screen code base RAM address) + Y% * (screen width) + X%

REM is it reversed? 0 = false, 128 = true.
RV% = PEEK(AD%) AND 128

REM convert screen code to PETSCII
SC% = PEEK(AD%) AND 127
PC% = SC%:IF SC% < 32 THEN PC%=SC%+64

 

 

Edited by brfennpocock
  • Like 1
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   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.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...