23-line character scroll.

SYS 64738
User avatar
Shaun_B
Member
Member
Posts: 179
Joined: Tue May 06, 2014 12:12 pm
Location: UK
Contact:

23-line character scroll.

Post by Shaun_B » Sat May 31, 2014 10:01 pm

I was curious about whether you could do a full-screen character scroll in BASIC with the SuperCPU (without pixel scroll for now), so I came up with this (cleaned) listing:

Code: Select all

0 print"{clear}";
1 r=22
2 dim a$(r)
3 b=160
4 w=39
5 sc=1024
6 i=0
7 l=960
8 for i=sc to sc+w
9 poke i,b
10 poke i+l,b
11 next
12 y$="{home}{down}"
13 z=0
14 y=2
15 w=w+1
16 gosub 63995
17 x=1
18 o=x
19 c=255
20 print y$;:for i=z to r:print mid$(a$(i),x+o,w);:next:if x+w<c then x=x+o:goto 20
21 poke 198,0
22 wait 198,1
23 get a$
24 end
63995 for b=0 to r
63996 for i=0 to 254
63997 a$(b)=a$(b)+chr$(65+rnd(.)*26)
63998 next i,b
63999 return
It takes a while to set up the test data in lines from 63995 through to 63999; the scroll logic is in line 20. The obvious limitation with BASIC strings is that a string can only be up to 255 characters in length. The scroller actually works faster than I expected, so could probably add in pixel scrolling in there, and sort out the screen tearing. By using some sort of compression in the strings I could probably do some sort of tiling system or something. Don't try this at 1mhz :-)

Regards,

Shaun.


BASIC Programming - making the mistakes so that you don't have to.
Circles and Squares.
Nothing I post here will stand up in a court of law.

User avatar
Shaun_B
Member
Member
Posts: 179
Joined: Tue May 06, 2014 12:12 pm
Location: UK
Contact:

Re: 23-line character scroll.

Post by Shaun_B » Sun Jun 01, 2014 10:00 am

Here's the same thing but should be adding pixel scrolling on the x axis by manipulating the value at 53270:

Code: Select all

0 poke 53374,0:poke 53366,0:poke 53375,0:poke 53265,peek(53265) and 239:poke 53280,6:poke 53281,6:print"{clear}";:
1 r=22
2 dim a$(r)
3 b=160
4 w=39
5 sc=1024:co=55296
6 i=0
7 h=53270
8 s=7:s1=s
9 a=248
10 poke h,(peek(h)and a)+s
11 y$="{home}{down}"
12 z=0
13 y=2
14 w=w+1
15 gosub 63995
16 x=1
17 o=x
18 c=255:poke 53265,peek(53265) or 16
19 d=-1:p=53266:p1=248
20 print y$;:wait p,p1:for i=z to r:print mid$(a$(i),x+o,w);:next:for s=s1 to z step d:poke h,(peek(h)and a)+s:next:if x+w<c then x=x+o:goto 20
21 poke 198,0
22 wait 198,1
23 get a$
24 end
63995 for b=0 to r
63996 for i=0 to 254
63997 a$(b)=a$(b)+chr$(65+rnd(.)*26)
63998 next i,b
63999 return
Line 0 sets the SuperCPU optimisation mode to the default BASIC VIC-II set up, switches off the screen (so that the initialisation is slightly quicker, ie, declaring vars and building the test data) - it also clears the screen and sets the border and screen colour.

The variable h is used for the pixel scrolling - which is (peek(53270)and 248)+pixel position from 7 to zero counting down. wait p,p1 is waiting for the raster to be at approximately the bottom line of the screen at location 1984; the idea is that the test data is outputted from this point at the screen redraw to prevent tearing in the scroll. Not 100% as this is BASIC, but close enough.

Now... for a tiling system ;-)

Regards,

Shaun.
BASIC Programming - making the mistakes so that you don't have to.
Circles and Squares.
Nothing I post here will stand up in a court of law.

Post Reply Previous topicNext topic