Screen set 1 character 32 and 96 are both space.
Moderator: Moderators
Screen set 1 character 32 and 96 are both space.
Screen set 1 character 32 and 96 are both space.
This is probably not news for many of you, but for those rare stragglers out in the mud like me, it was an important realisation, after 25 years.
For an hour I wondered why my PEEKS for a space and inverted space somewhere on the screen came up empty.
Well, they weren't 96 or 224! They were 32 and 160!
I am amused to see someone at Commodore, long ago, made up all these funny symbols, but ran out of imagination just one short of a full set.
This is probably not news for many of you, but for those rare stragglers out in the mud like me, it was an important realisation, after 25 years.
For an hour I wondered why my PEEKS for a space and inverted space somewhere on the screen came up empty.
Well, they weren't 96 or 224! They were 32 and 160!
I am amused to see someone at Commodore, long ago, made up all these funny symbols, but ran out of imagination just one short of a full set.
Hmm, not quite getting your point on this - 32 is the standard ASCII code for a space, which is reflected accurately in PETSCII. 160 is a 'shifted' space (also known as an inverse space) and 224 is a 'Commodore' space (i.e. space pressed whilst holding the C= key). These two are PETSCII-specific.
I'm actually curious as to what code 96 or 224 looks like now.
What were you trying to do which necessitated PEEKing the screen for spaces? I'm desperately trying to recall anything where code 96 or 224 might have been used to good effect that you might need to test for. Do tell!
I'm actually curious as to what code 96 or 224 looks like now.

What were you trying to do which necessitated PEEKing the screen for spaces? I'm desperately trying to recall anything where code 96 or 224 might have been used to good effect that you might need to test for. Do tell!
- eslapion
- ultimate expander
- Posts: 5037
- Joined: Fri Jun 23, 2006 7:50 pm
- Location: Canada
- Occupation: 8bit addict
Re: Screen set 1 character 32 and 96 are both space.
Just for the fun of it I started VICE and poked these values to 7680 on an unexpanded config.Witzo wrote:Well, they weren't 96 or 224! They were 32 and 160!
32: blank space
160: reversed space
96: blank space
224: reversed space
However, pages 268 and 269 of the VIC-20's Programmer's reference guide does indicate both of these codes are spaces so I'm not exactly sure what is the big discovery here.
Be normal.
The discovery was just for me. And maybe others that hadn't noticed this either.
Only after 25 years I noticed that 'space' was mentioned twice in the screen poke list in the VIC user manual.
And I found out the hard way, looking for 96 in memory and then finding out eventually that it was stored as 32.
Only after 25 years I noticed that 'space' was mentioned twice in the screen poke list in the VIC user manual.
And I found out the hard way, looking for 96 in memory and then finding out eventually that it was stored as 32.
Are you saying that you store 96 into a screen RAM location, but when you read it back it's 32? This actually sounds like a memory chip fault.
What happens if you store 64 there? Do you get 64 back, or zero? And if you store 128, do you get that back or something else?
EDIT: oh wait - are you saying you were looking for a space using code 96 as the search code, but didn't find any because they were actually stored as 32? In which case, this all makes sense - you mis-apprehended what the standard ASCII code for a space was because the PETSCII set on the VIC has '4' values for a space (32, plus three more non-standard ones).
What happens if you store 64 there? Do you get 64 back, or zero? And if you store 128, do you get that back or something else?
EDIT: oh wait - are you saying you were looking for a space using code 96 as the search code, but didn't find any because they were actually stored as 32? In which case, this all makes sense - you mis-apprehended what the standard ASCII code for a space was because the PETSCII set on the VIC has '4' values for a space (32, plus three more non-standard ones).
Indeed it was as in your 'edit'. I first printed a hex grid to screen, and then went looking for spaces by peeking for 96, because that was the first 'space' entry in the manual that caught my eye.FD22 wrote:Are you saying that you store 96 into a screen RAM location, but when you read it back it's 32? This actually sounds like a memory chip fault.
What happens if you store 64 there? Do you get 64 back, or zero? And if you store 128, do you get that back or something else?
EDIT: oh wait - are you saying you were looking for a space using code 96 as the search code, but didn't find any because they were actually stored as 32? In which case, this all makes sense - you mis-apprehended what the standard ASCII code for a space was because the PETSCII set on the VIC has '4' values for a space (32, plus three more non-standard ones).
Of course it drew blanks, or more exactly, 32s, because that's what the VIC uses for a printed space.
In the mean time I read up in the ref guide, the 96 space is the shifted space.
Sorry to stir up so much; I was just being confusing to myself. And then to the forum...
- freshlamb
- Vic 20 Dabbler
- Posts: 76
- Joined: Sun Apr 04, 2004 5:38 pm
- Website: http://www.rufnoiz.com
- Location: Prince Albert SK Can
Not that it makes much difference but 96 is a Shifted space. If you clear the screen press shift and space and peek(7680) (for unexpanded) it should return a 96.
The only thing that I can think of, that makes this useful, is that in ML 96 is the number for the mnemonic RTS. Some games used this for copy protection by printing a shifted space to the screen and then later JMPing to it or SYSing to it.
OH NO I've said too much ...
The only thing that I can think of, that makes this useful, is that in ML 96 is the number for the mnemonic RTS. Some games used this for copy protection by printing a shifted space to the screen and then later JMPing to it or SYSing to it.
OH NO I've said too much ...
I really like the idea, although I can't spontaniously figure out, how to use it for copy protection purposes. How does the software decide to print (or not to print) a shift space to the screen (in order to JMP/JSR/SYS) there?freshlamb wrote:The only thing that I can think of, that makes this useful, is that in ML 96 is the number for the mnemonic RTS. Some games used this for copy protection by printing a shifted space to the screen and then later JMPing to it or SYSing to it.
I have used char 96 as a marker before. If I were randomly filling the screen with a certain character but didn't want parts of the screen to have that character, I would put 96's in that location. Then as the vic was choosing random locations, it would check if location had a 32 or a 96. The program would then get a new random location if a 96 was peeked.
Also works well with an invisible maze type situation. Use char 96 to draw maze walls.
Also works well with an invisible maze type situation. Use char 96 to draw maze walls.
Rob
- freshlamb
- Vic 20 Dabbler
- Posts: 76
- Joined: Sun Apr 04, 2004 5:38 pm
- Website: http://www.rufnoiz.com
- Location: Prince Albert SK Can
Here's an example:
A loader pokes all the graphics in, and loads the next program. It also prints a shifted space to say the first screen location. When the second program loads, the first thing it does is a SYS7680 (for unexpanded). If that shifted space is there it does a RTS and continues with the program. If it is something else, it will try to run it as an ML program, and nothing good will happen. Again for example if the screen has 3 spaces right at the top it will read it as JSR 8224 then try to run the ML @ 8224 (where there probably isn't any memory, we're unexpanded right?) read a zero and perform a BRK. The program not run properly until there is a 96 @ 7680 or you get rid of the SYS7680.
A loader pokes all the graphics in, and loads the next program. It also prints a shifted space to say the first screen location. When the second program loads, the first thing it does is a SYS7680 (for unexpanded). If that shifted space is there it does a RTS and continues with the program. If it is something else, it will try to run it as an ML program, and nothing good will happen. Again for example if the screen has 3 spaces right at the top it will read it as JSR 8224 then try to run the ML @ 8224 (where there probably isn't any memory, we're unexpanded right?) read a zero and perform a BRK. The program not run properly until there is a 96 @ 7680 or you get rid of the SYS7680.
The general idea is obvious, but when you copy both the main program and the loader, the 96 will still be there. Of course you can put any characters into the screen memory that build a valid ML program, the question (to me) is how to distinguish between a legal and an illegal copy.
The idea with the shift-space in the filename is a first step in my eyes, not very effective though, if I copy the whole tape or disk.
The idea with the shift-space in the filename is a first step in my eyes, not very effective though, if I copy the whole tape or disk.