strange problem with IF/THEN (ROM problem?)
-
- Posts: 2
- Joined: Mon Mar 06, 2023 12:01 pm
strange problem with IF/THEN (ROM problem?)
Hi, I have just finished fixing my old ZX81 (that was my first computer in the late 80s). Changed the keyboard and added german s-video mod and it is now up and running. The main reason for fixing it was because my kids wanted to "program some games" and.... we have problem. It seems that there's something strange happening with IF/THEN statement, I always get an S (syntax error) after the first part of the IF statement. For instance, if I write IF INKEY$="W" THEN... I get an S on THEN. Actually I get an S after the first part no matter what i write. I tried putting first part in parenthesis, removing THEN part, nothing works. Basically, you can't even type in listings from official basic manual. What is going on? Do I have a hardware problem? ROM error? I'm desperate, please help
- 1024MAK
- Posts: 5103
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: strange problem with IF/THEN (ROM problem?)
Hello fuzzomanus and welcome to our forum
Mark
You are using key word entry for the IF, the INKEY$ and the THEN rather than typing them in character by character ?
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: strange problem with IF/THEN (ROM problem?)
-
- Posts: 2
- Joined: Mon Mar 06, 2023 12:01 pm
Re: strange problem with IF/THEN (ROM problem?)
Hello, and thank you - I am glad to be here (I've been lurking for some time now).
Well, I checked and... My whole childhood was a lie! What is this witchcraft?!?
I wanted to say yes, I used keyword/function entry, but it's not true. It seems that I used "hybrid" of two. When I used ALL keyword entries problem went away. I feel pretty dumb about this. It also pretty much explains why I had so much problems typing in programs when I was a kid.
So how does this work if you, for instance, type a program listing as a text file in windows, convert it to .p file, load it into TZXduino and then into ZX (I am mentioning TZXduino because I have a kit on my way)? Should I be expecting same problems?
- 1024MAK
- Posts: 5103
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: strange problem with IF/THEN (ROM problem?)
Hey, don’t feel bad. Honestly, you are far from the only person to get caught out by this.
And I’m not just saying that. Another poster was also having problems earlier this year and could not understand why they were getting a syntax error.
The Windows applications convert the ‘plain text’ to tokenised format. If you look at the back of the ZX81 Programming Manual, where it lists the character set, you will see all the keywords listed along with the code for their ‘tokens’. A token represents each keyword, and the ROM decodes the token into individual characters when listing or printing, also when editing a line but only for displaying - the cursor jumps over the whole keyword when you move the cursor to it when editing.
In memory (RAM) all keywords are stored as tokens, both to save space, and to enable the machine to more easily run the program.
P files also store the keywords as tokens.
I hope that helps.
Mark
PS here is a simple program and what it looks like in the RAM in the ZX81. Note all numbers are in hexadecimal. The first program line is outlined in red. The second program line in orange.
And I’m not just saying that. Another poster was also having problems earlier this year and could not understand why they were getting a syntax error.
The Windows applications convert the ‘plain text’ to tokenised format. If you look at the back of the ZX81 Programming Manual, where it lists the character set, you will see all the keywords listed along with the code for their ‘tokens’. A token represents each keyword, and the ROM decodes the token into individual characters when listing or printing, also when editing a line but only for displaying - the cursor jumps over the whole keyword when you move the cursor to it when editing.
In memory (RAM) all keywords are stored as tokens, both to save space, and to enable the machine to more easily run the program.
P files also store the keywords as tokens.
I hope that helps.
Mark
PS here is a simple program and what it looks like in the RAM in the ZX81. Note all numbers are in hexadecimal. The first program line is outlined in red. The second program line in orange.
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.