That thing with the bottom two lines

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

That thing with the bottom two lines

Post by equinox »

Was it a good design idea for Spectrum BASIC to separate the upper and lower screen, and treat the "bottom two lines" differently?

Down sides:
• Writing to those lines is a special case. You can't PRINT AT y in a loop from y=0 to 23, for example.
• The lower screen has its own attributes, so INK 2: PRINT #0;"blah" does not honour the choice of red.
• It has no obvious default attributes either, so I can't get around the problem by doing INK #0;2
• I would imagine that it complicates redirection. For example, if I want to spool all output to a disk file, or the printer, I can redirect #2, but what will happen with PRINT #0 and #1? (I've actually never tried using the redirection features...)
• Er, why does #1 accept output anyway? I thought it was an input stream, for INPUT and INKEY$.

Up sides:
• Presumably made it easier for them to implement BASIC editor features, like "pull down a line for editing" in 48 mode, and the "Screen" function on the 128 context menu.
• Handy for "status line" displays, like the score in a game.
• ...?
AndyC
Dynamite Dan
Posts: 1409
Joined: Mon Nov 13, 2017 5:12 am

Re: That thing with the bottom two lines

Post by AndyC »

Not really. I can see why they did it to make BASIC line entry easier, but it's just very messy as an implementation. They really would've been better off with a full screen editor experience like the 128 had, it certainly would have made coding easier IMO. Or made more use of the streams functionality to enable separate text output windows on screen (like on the CPC) and then just had BASIC reset stream #1 for line editing purposes whenever a program ends (or not and let the user define their own weird layout I guess)
User avatar
Bedazzle
Manic Miner
Posts: 305
Joined: Sun Mar 24, 2019 9:03 am

Re: That thing with the bottom two lines

Post by Bedazzle »

Do you tried to POKE 23659,0 and then print?
Be careful, your program must not return/break! In that case it will hang.
User avatar
1024MAK
Bugaboo
Posts: 3123
Joined: Wed Nov 15, 2017 2:52 pm
Location: Sunny Somerset in the U.K. in Europe

Re: That thing with the bottom two lines

Post by 1024MAK »

It's a hang over from the ZX80 (which only had a 4K byte ROM). The ZX81 ROM built on the ZX80 ROM (now 8K bytes in size). Then the ZX Spectrum ROM is a development of the ZX81 ROM...

Sinclair wanted maximum features for lowest cost (read keep something that worked, and make everything fit in only 16K bytes of ROM).

Mark
:!: Standby alert :!:
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :dance
Looking forward to summer later in the year.
Ralf
Rick Dangerous
Posts: 2289
Joined: Mon Nov 13, 2017 11:59 am
Location: Poland

Re: That thing with the bottom two lines

Post by Ralf »

Well, I'm really accustomed to it, like many of us here I guess. It was my first contact with a computer and for some time I couldn't imagine that it could work in another way.

But it isn't the most comfortable way. Full screen editor is simply better. Practically all modern programming environments use full screen editor today, right?

But when Spectrum was created it wasn't a norm. Many 8 bit computers had in their Basic similar solutions to Spectrum - you don't edit whole code but first choose a line and then you edit this line.

It was a way of dealing with limited memory. And it was some historical thing - most very early computers had some limited buffer where you could process your input data in.

So it just a typical solution for 1982 which aged a bit badly.
AndyC
Dynamite Dan
Posts: 1409
Joined: Mon Nov 13, 2017 5:12 am

Re: That thing with the bottom two lines

Post by AndyC »

Yeah, line editors were reasonably common. It's more the weird quirk where running programs can't easily use the full screen for PRINT or PLOT that I find particularly odd. Though it never bothered me that much back in the day I guess.
User avatar
WhatHoSnorkers
Manic Miner
Posts: 254
Joined: Tue Dec 10, 2019 3:22 pm

Re: That thing with the bottom two lines

Post by WhatHoSnorkers »

You're right in that INK 2 on its own doesnt' work, but you just need to put the INK in the PRINT statement itself. Same with the PAPER. I believe it gets the default PAPER from the BORDER so you'll need to pad as necessary.

Drawing and plotting in there isn't possible. When I needed nice lines there for a full screen grid, I drew on most of the screen, then copied bytes from screen memory down there. That worked OK.
I have a little YouTube channel of nonsense
https://www.youtube.com/c/JamesOGradyWhatHoSnorkers
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: That thing with the bottom two lines

Post by equinox »

WhatHoSnorkers wrote: Tue Feb 13, 2024 6:34 am You're right in that INK 2 on its own doesnt' work, but you just need to put the INK in the PRINT statement itself.
This presupposes that I conveniently know what the current colour is, without peeking. Maybe it was set with VAL, or by a previous program, or manually by the user!
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: That thing with the bottom two lines

Post by equinox »

Ralf wrote: Mon Feb 12, 2024 10:34 pm But it isn't the most comfortable way. Full screen editor is simply better. Practically all modern programming environments use full screen editor today, right?
Yep, I think one of the fairly rare areas where the Speccy scores over the BBC Micro is the BASIC editor, even the 48k one, when you want to edit an existing line. On the Beeb you have that strange double-cursor mechanism where you have to LIST the desired line, cursor your way up there, and then hold down a special Copy key to re-enter it (or just the parts you want to keep). The Amstrad CPC (as far as I recall) involves entering EDIT 100 and then line 100 pops up for editing.

On the other hand, it's annoying that you can only cursor left and right in the 48k editor, as it takes an age to reach the end of a long line (especially since it gets slower as you go along: must be some O(n^2) thing :D ). I saw a utility called $KIPPER that allows you to use the up and down cursors too.
RST#08
Drutt
Posts: 30
Joined: Sun Jul 24, 2022 6:29 pm

Re: That thing with the bottom two lines

Post by RST#08 »

equinox wrote: Tue Feb 13, 2024 8:08 am Yep, I think one of the fairly rare areas where the Speccy scores over the BBC Micro is the BASIC editor, even the 48k one, when you want to edit an existing line (...) On the other hand, it's annoying that you can only cursor left and right in the 48k editor, as it takes an age to reach the end of a long line (especially since it gets slower as you go along (...)
^Yes, this. I quite like the 'current line' approach and the re-building of the screen, although I do agree that the implementation could have been a bit neater. But overall I like the approach and, as others have said, it's what you get used to.
Timmy
Manic Miner
Posts: 230
Joined: Sat Apr 23, 2022 7:13 pm
Location: The Netherlands

Re: That thing with the bottom two lines

Post by Timmy »

It's also not really just the bottom two lines. Especially when you're editing BASIC, that could be 6 to 8 lines too, depending on how long your lines are.

I do really like that it really focus you on the line you're editing. It's very useful there.
User avatar
spider
Dynamite Dan
Posts: 1099
Joined: Wed May 01, 2019 10:59 am
Location: Derby, UK
Contact:

Re: That thing with the bottom two lines

Post by spider »

Without going to check, I don't think there's any reason why the plot/draw routines could not take advantage and draw on the lower two lines...

Its dead easy to set a colour here anyway , 23624 , x , I sometimes set the 'main' screen area with this too using 23693 , x , followed by a CLS or a call to its routine (iirc) , just a bit easier to type in than setting all the permutations manually aka bright/flash etc
RST#08
Drutt
Posts: 30
Joined: Sun Jul 24, 2022 6:29 pm

Re: That thing with the bottom two lines

Post by RST#08 »

spider wrote: Tue Feb 13, 2024 10:54 am Without going to check, I don't think there's any reason why the plot/draw routines could not take advantage and draw on the lower two lines
Alas the ROM routine PLOT-SUB routine calls PIXEL-ADD which checks the upper y-coordinate limit (175d). So you'd need a bespoke routine, see p.19-22 of: this book for an example that allows plotting to lower screen (note coordinate system is changed).
Patrik Rak
Microbot
Posts: 117
Joined: Mon Apr 13, 2020 3:07 pm

Re: That thing with the bottom two lines

Post by Patrik Rak »

BTW, I always found it interesting that many of the early loading screens didn't use those lines, as apparently the tools used to create them couldn't draw there either.

It took several years before programs like The Artist or Art Studio appeared and full-screen loading screens became the norm. What an interesting setback.

Patrik
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: That thing with the bottom two lines

Post by equinox »

Patrik Rak wrote: Wed Feb 21, 2024 11:27 am BTW, I always found it interesting that many of the early loading screens didn't use those lines, as apparently the tools used to create them couldn't draw there either.
It took several years before programs like The Artist or Art Studio appeared and full-screen loading screens became the norm. What an interesting setback.
Yes, Art Studio required a bit of scrolling, purely because of menu layout. They could have chosen (Speccy-style) to keep the menus in the bottom two lines, but in fact they are in (off the top of my head) I think the top THREE lines.
User avatar
TMD2003
Rick Dangerous
Posts: 2045
Joined: Fri Apr 10, 2020 9:23 am
Location: Airstrip One
Contact:

Re: That thing with the bottom two lines

Post by TMD2003 »

equinox wrote: Tue Feb 13, 2024 8:08 am Yep, I think one of the fairly rare areas where the Speccy scores over the BBC Micro is the BASIC editor, even the 48k one, when you want to edit an existing line. On the Beeb you have that strange double-cursor mechanism where you have to LIST the desired line, cursor your way up there, and then hold down a special Copy key to re-enter it (or just the parts you want to keep). The Amstrad CPC (as far as I recall) involves entering EDIT 100 and then line 100 pops up for editing.
I see your BBC Micro line editor, and I raise you the Dragon 32. It was quicker to re-type the line every time.
Spectribution: Dr. Jim's Sinclair computing pages.
Features my own programs, modified type-ins, RZXs, character sets & UDGs, and QL type-ins... so far!
AndyC
Dynamite Dan
Posts: 1409
Joined: Mon Nov 13, 2017 5:12 am

Re: That thing with the bottom two lines

Post by AndyC »

equinox wrote: Tue Feb 13, 2024 8:08 am On the Beeb you have that strange double-cursor mechanism where you have to LIST the desired line, cursor your way up there, and then hold down a special Copy key to re-enter it (or just the parts you want to keep). The Amstrad CPC (as far as I recall) involves entering EDIT 100 and then line 100 pops up for editing.
The CPC does it both ways. You can use EDIT to just call up a line for editing, but you can also use the Copy Cursor to copy all, or part, of a line from elsewhere on screen.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: That thing with the bottom two lines

Post by equinox »

Patrik Rak wrote: Wed Feb 21, 2024 11:27 am BTW, I always found it interesting that many of the early loading screens didn't use those lines, as apparently the tools used to create them couldn't draw there either.
It took several years before programs like The Artist or Art Studio appeared and full-screen loading screens became the norm. What an interesting setback.
Let's try to ignore Icon Graphix ...
AndyC
Dynamite Dan
Posts: 1409
Joined: Mon Nov 13, 2017 5:12 am

Re: That thing with the bottom two lines

Post by AndyC »

equinox wrote: Tue Mar 05, 2024 4:12 am Let's try to ignore Icon Graphix ...
Wait. Was that the one they gave away on an SU covertape at some point? The one where you had to play a music tape in the tape deck while you were using it or the keyboard routines didn't work correctly?

Aside from that glaring bug, I seem to recall it wasn't actually that bad.
equinox
Dynamite Dan
Posts: 1052
Joined: Mon Oct 08, 2018 1:57 am
Location: SE England

Re: That thing with the bottom two lines

Post by equinox »

AndyC wrote: Tue Mar 05, 2024 7:55 am Wait. Was that the one they gave away on an SU covertape at some point? The one where you had to play a music tape in the tape deck while you were using it or the keyboard routines didn't work correctly?

Aside from that glaring bug, I seem to recall it wasn't actually that bad.
It was very buggy and would crash from time to time. There was also the "difficult to draw in the icon menu space" thing -- umm, I think there may have been a way to get around this but it's too long ago to remember. At least it was much less good than Art Studio which politely let you push the menu aside and scroll 2 lines. Spectrum owners are used to ignoring 2 lines (PRINT #0).
Post Reply