horizontal scrolling in basic

777
Posts: 2
Joined: Tue Jun 06, 2017 3:00 pm

horizontal scrolling in basic

Post by 777 »

hi,

i want to know how to do horizontal scrolling in basic. i know it has something to do with the 'to' statement using the print statement, which i read somehwere. also i would like to know how to scroll whole screens, not just single lines. thank you.
User avatar
1024MAK
Posts: 5087
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: horizontal scrolling in basic

Post by 1024MAK »

Hello and Welcome to our forum :D

Is this a question intended for a ZX80, a ZX81 or a ZX Spectrum?

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.
777
Posts: 2
Joined: Tue Jun 06, 2017 3:00 pm

Re: horizontal scrolling in basic

Post by 777 »

zx spectrum
RWAP
Posts: 1348
Joined: Thu May 08, 2008 8:42 am
Location: Stoke-on-Trent, UK
Contact:

Re: horizontal scrolling in basic

Post by RWAP »

I have moved this to the Spectrum section
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: horizontal scrolling in basic

Post by Shaun_B »

Whole screen scrolling in BASIC? Err... it's possible but not quickly.

At a guess, you would need a variable to represent each line of the screen that you want to scroll, here's a simple example using three string variables for speed

Code: Select all

 1 LET a$="01234567890123456789012345678901": LET b$=a$(2 TO )+a$(1): LET c$=b$(2 TO )+b$(1)
 2 LET a$=a$(2 TO )+a$(1): LET b$=b$(2 TO )+b$(1): LET c$=c$(2 TO )+c$(1)
 3 PRINT AT 0,0;a$;b$;c$;b$;a$;b$;c$;b$;a$;b$;c$;b$;a$;b$;c$;b$;a$;b$;c$;b$;a$;
 4 GO TO 2
Now the more variables you represent by each line you want to scroll, the slower your BASIC listing will go.

Regards,

Shaun.
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: horizontal scrolling in basic

Post by Shaun_B »

As an aside to the above listing, I believe that it's only possible to get a limited number of redefined characters using pure Sinclair ZX Spectrum BASIC; the limit is around 26 I think. Everything else you scroll must therefore be within the pre-defined character set.

Regards,

Shaun.
User avatar
1024MAK
Posts: 5087
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: horizontal scrolling in basic

Post by 1024MAK »

Yes, but it is also possible to redirect (POKE) a system variable so it points to your own custom character set. Best to do this as the final stage of development, as it makes the listing rather hard to read if you redefine A-Z, a-z and 0 to 9 etc to graphic characters :lol:

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.
Shaun_B
Posts: 474
Joined: Wed Apr 22, 2009 10:22 am

Re: horizontal scrolling in basic

Post by Shaun_B »

1024MAK wrote: Sun Aug 13, 2017 11:25 pm Yes, but it is also possible to redirect (POKE) a system variable so it points to your own custom character set. Best to do this as the final stage of development, as it makes the listing rather hard to read if you redefine A-Z, a-z and 0 to 9 etc to graphic characters :lol:

Mark
Good point. So we're getting towards "achieve good results with assembly" type answer.

Unless the person asking the question is thinking of Speccy Next BASIC running at 28Mhz?

Is there a limit on the string var length on the Speccy, or is it a case of "keep going until there is no RAM left"?

Regards,

Shaun.
User avatar
1024MAK
Posts: 5087
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: horizontal scrolling in basic

Post by 1024MAK »

The string size for the ZX Spectrum BASIC is held as a two byte value. So string size is not a problem :P
Certainly if you want, you can hold all the text for a screen in a single string variable if you want.

Try this:
String test
String test
IMG_5126.JPG (251.62 KiB) Viewed 15471 times
How many times did you have to press Y to scroll?...

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.
User avatar
1024MAK
Posts: 5087
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: horizontal scrolling in basic

Post by 1024MAK »

Not that this has much practical value, as you have to keep writing to the display, but it's a bit of fun...
Bit of fun
Bit of fun
IMG_5129.JPG (158.46 KiB) Viewed 15460 times
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.
Post Reply