Page 1 of 2

horizontal scrolling in basic

Posted: Tue Jun 06, 2017 3:03 pm
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.

Re: horizontal scrolling in basic

Posted: Tue Jun 06, 2017 4:23 pm
by 1024MAK
Hello and Welcome to our forum :D

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

Mark

Re: horizontal scrolling in basic

Posted: Tue Jun 06, 2017 4:46 pm
by 777
zx spectrum

Re: horizontal scrolling in basic

Posted: Tue Jun 06, 2017 5:18 pm
by RWAP
I have moved this to the Spectrum section

Re: horizontal scrolling in basic

Posted: Sun Aug 13, 2017 2:29 pm
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.

Re: horizontal scrolling in basic

Posted: Sun Aug 13, 2017 11:11 pm
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.

Re: horizontal scrolling in basic

Posted: Sun Aug 13, 2017 11:25 pm
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

Re: horizontal scrolling in basic

Posted: Mon Aug 14, 2017 8:24 am
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.

Re: horizontal scrolling in basic

Posted: Mon Aug 14, 2017 12:04 pm
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 15757 times
How many times did you have to press Y to scroll?...

Mark

Re: horizontal scrolling in basic

Posted: Mon Aug 14, 2017 4:01 pm
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 15746 times
Mark