Hi Everyone,
I am new to Spectrum. Just got my Speccy +3.
When ever I get a new computer I like to look at the characters in ROM. So I wrote a program that works on every computer I have except my new +3.
Can anyone please tell me why this program doesn't work?
10 FOR X=0 to 255
20 PRINT CHR$(X);
30 NEXT X
Thanks!
Bill
Spectrum +3 basic
-
- Drutt
- Posts: 15
- Joined: Fri Sep 13, 2019 7:58 pm
- Location: Chicago, IL USA
Re: Spectrum +3 basic
Hi Bill.
It does actually "work" but codes lower than 32 are 'control codes' mainly legacy things for printers and also control things like ink/paper colours. Codes above 127 are tokens and will on the Speccy represent keywords like BORDER / PRINT etc as well as some for user defined graphics too. So attempting to print things below 32 will sometimes cause errors as some are unused too.
If you change your program to 'start' at 32 and 'end' at 127 it will work. 32 you won't really 'see' as its the space character and 127 is the copyright Ⓒ character.
You could leave the end alone too:
Regarding control codes, for instance you can type
or
That gives the same effect as 16 is 'ink'
There is a list in the Manual at the back under 'character set' , generally speaking ( ! ) the common ones I sometimes use are:
8 = Backspace
13 = Newline
16 = INK
17 = PAPER
18 = FLASH
19 = BRIGHT
20 = INVERSE
21 = OVER
22 = AT
23 = TAB
They have to be followed by a valid value, see my '16+4' line above. AT has to have an x,y so you would for instance use:
That's the same as typing:
Hope that helps a bit. It is usually best to not try to 'print/display' control codes out unless you are sure what you're doing. The effects might vary a bit on model (48/128) too possibly.
It does actually "work" but codes lower than 32 are 'control codes' mainly legacy things for printers and also control things like ink/paper colours. Codes above 127 are tokens and will on the Speccy represent keywords like BORDER / PRINT etc as well as some for user defined graphics too. So attempting to print things below 32 will sometimes cause errors as some are unused too.
If you change your program to 'start' at 32 and 'end' at 127 it will work. 32 you won't really 'see' as its the space character and 127 is the copyright Ⓒ character.
Code: Select all
10 FOR X=32 to 127
Code: Select all
10 FOR X=32 to 255
Code: Select all
10 PRINT INK 4; " cats and dogs "
Code: Select all
10 PRINT CHR$ 16 + CHR$ 4 + " cats and dogs "
There is a list in the Manual at the back under 'character set' , generally speaking ( ! ) the common ones I sometimes use are:
8 = Backspace
13 = Newline
16 = INK
17 = PAPER
18 = FLASH
19 = BRIGHT
20 = INVERSE
21 = OVER
22 = AT
23 = TAB
They have to be followed by a valid value, see my '16+4' line above. AT has to have an x,y so you would for instance use:
Code: Select all
10 PRINT CHR$ 22 + CHR$ 12 + CHR$ 12 + " testing "
Code: Select all
10 PRINT AT 12 , 12 ; " testing "
-
- Drutt
- Posts: 15
- Joined: Fri Sep 13, 2019 7:58 pm
- Location: Chicago, IL USA
Re: Spectrum +3 basic
Thanks Andy!
Everything works great!
Thanks for taking the time to explain it to me!
Bill
Everything works great!
Thanks for taking the time to explain it to me!
Bill
Re: Spectrum +3 basic
Excellent.
You're very welcome. Enjoy!retro_collector wrote: ↑Mon Sep 16, 2019 8:17 pm Thanks for taking the time to explain it to me!
Bill