horizontal scrolling in basic

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

horizontal scrolling in basic

Post by 777 » Tue Jun 06, 2017 2:03 pm

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: 1799
Joined: Mon Sep 26, 2011 9:56 am
Location: Looking forward to summer in Somerset, UK...

Re: horizontal scrolling in basic

Post by 1024MAK » Tue Jun 06, 2017 3:23 pm

Hello and Welcome to our forum :D

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

Mark

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

Re: horizontal scrolling in basic

Post by 777 » Tue Jun 06, 2017 3:46 pm

zx spectrum

RWAP
Site Admin
Posts: 1235
Joined: Thu May 08, 2008 7:42 am
Location: Stoke-on-Trent, UK
Contact:

Re: horizontal scrolling in basic

Post by RWAP » Tue Jun 06, 2017 4:18 pm

I have moved this to the Spectrum section

Shaun_B
Posts: 329
Joined: Wed Apr 22, 2009 9:22 am

Re: horizontal scrolling in basic

Post by Shaun_B » Sun Aug 13, 2017 1:29 pm

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: 329
Joined: Wed Apr 22, 2009 9:22 am

Re: horizontal scrolling in basic

Post by Shaun_B » Sun Aug 13, 2017 10:11 pm

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: 1799
Joined: Mon Sep 26, 2011 9:56 am
Location: Looking forward to summer in Somerset, UK...

Re: horizontal scrolling in basic

Post by 1024MAK » Sun Aug 13, 2017 10: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

Shaun_B
Posts: 329
Joined: Wed Apr 22, 2009 9:22 am

Re: horizontal scrolling in basic

Post by Shaun_B » Mon Aug 14, 2017 7:24 am

1024MAK wrote:
Sun Aug 13, 2017 10: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: 1799
Joined: Mon Sep 26, 2011 9:56 am
Location: Looking forward to summer in Somerset, UK...

Re: horizontal scrolling in basic

Post by 1024MAK » Mon Aug 14, 2017 11:04 am

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:
IMG_5126.JPG
String test
IMG_5126.JPG (251.62 KiB) Viewed 252 times
How many times did you have to press Y to scroll?...

Mark

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

Re: horizontal scrolling in basic

Post by 1024MAK » Mon Aug 14, 2017 3:01 pm

Not that this has much practical value, as you have to keep writing to the display, but it's a bit of fun...
IMG_5129.JPG
Bit of fun
IMG_5129.JPG (158.46 KiB) Viewed 241 times
Mark

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest