evildead9000 Posted September 25, 2019 Share Posted September 25, 2019 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) Quote Link to comment Share on other sites More sharing options...
brfennpocock Posted September 25, 2019 Share Posted September 25, 2019 (edited) 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 September 25, 2019 by brfennpocock 1 Quote Link to comment Share on other sites More sharing options...
evildead9000 Posted September 25, 2019 Author Share Posted September 25, 2019 Thanks for the quick response! Your explanation clarifies some things. I should be good moving forward. Thanks much! Quote Link to comment Share on other sites More sharing options...
carlsson Posted September 26, 2019 Share Posted September 26, 2019 And for anyone wondering, the screen base address here is 32768. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.