Long scrolly on an unexpanded machine

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Shaun_B
Posts: 312
Joined: Wed Apr 22, 2009 9:22 am

Re: Long scrolly on an unexpanded machine

Post by Shaun_B » Mon Aug 07, 2017 7:14 pm

Hi Andy,

I tried some REM techniques in my second attempt. I'll do more experimenting.

Thanks,

Shaun

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

Re: Long scrolly on an unexpanded machine

Post by Shaun_B » Mon Aug 07, 2017 7:30 pm

Latest version has 262 characters, attached. S5.P has 264 characters and better logic, S6.P is almost complete logic I think... nearly there.

Thanks Dr Beep!

Regards,

Shaun
Attachments
S6.P
Nearly there
(535 Bytes) Downloaded 10 times
S5.P
(532 Bytes) Downloaded 10 times
S4.P
262 chars
(516 Bytes) Downloaded 12 times
Last edited by Shaun_B on Mon Aug 07, 2017 8:44 pm, edited 2 times in total.

dr beep
Posts: 1045
Joined: Thu Jun 16, 2011 7:35 am
Location: Boxmeer

Re: Long scrolly on an unexpanded machine

Post by dr beep » Mon Aug 07, 2017 8:21 pm

Shaun_B wrote:
Mon Aug 07, 2017 7:30 pm
Latest version has 262 characters, attached.

Regards,

Shaun
SGN PI=1
NOT PI=0

and shorter than CODE " "

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

Re: Long scrolly on an unexpanded machine

Post by Shaun_B » Tue Aug 08, 2017 9:23 pm

306 characters, almost perfect scrolly routines. See attached!

Regards,

Shaun
Attachments
S7.p
306 characters
(632 Bytes) Downloaded 6 times

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

Re: Long scrolly on an unexpanded machine

Post by Shaun_B » Tue Aug 08, 2017 9:53 pm

My work here is done - 322 char scrolly, unexpanded ZX81, BASIC driven.

Here is the scroller routine:

Code: Select all

 1 LET X=SGN PI
 2 LET Y=CODE "3"
 3 LET Z=Y
 4 PRINT AT NOT PI,Z+NOT PI;A$(X TO(X+Y)-Z)
 5 LET Y=Y-(X+Y>=LEN A$)
 6 IF NOT Y THEN GOTO SGN PI
 7 LET X=X+(SGN PI*(Z<=NOT PI))
 8 LET Z=Z-(SGN PI*(Z>NOT PI))
 9 GOTO VAL "4"
 
Remember to enter the A$ string in direct mode to save bytes; type GOTO 1 to test and run. Because of a slight imperfection, leave at least two white spaces at the end of your message. Should easily allow for another half a Twitter of text above the 322 chars achieved if you're careful enough.

Regards,

Shaun.
Attachments
SF.p
322 chars
(644 Bytes) Downloaded 9 times

User avatar
SafePit
Posts: 12
Joined: Mon Feb 20, 2012 6:06 pm
Location: Boise, ID
Contact:

Re: Long scrolly on an unexpanded machine

Post by SafePit » Fri Aug 25, 2017 4:37 pm

Pretty cool. Runs well too. You can get a few more bytes (15 by my count) out of it. I dropped unneeded parens and removed +NOT PI on line 4. I found you don't need the SGN PI*() in lines 7 and 8. Flipping lines 5 and 6 lets you drop a space from A$ which gives you another byte. Allows you to add 16 more characters to A$.

Code: Select all

 1 LET X=SGN PI
 2 LET Y=CODE "3"
 3 LET Z=Y
 4 PRINT AT NOT PI,Z;A$(X TO X+Y-Z)
 5 IF NOT Y THEN GOTO SGN PI
 6 LET Y=Y-(X+Y>=LEN A$)
 7 LET X=X+(Z<=NOT PI)
 8 LET Z=Z-(Z>NOT PI)
 9 GOTO VAL "4"
 
Image
Image

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

Re: Long scrolly on an unexpanded machine

Post by Shaun_B » Fri Aug 25, 2017 7:51 pm

Cool, thanks for the improvements to the listing. Extra 13 characters potential is excellent.

Regards,

Shaun

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

Re: Long scrolly on an unexpanded machine

Post by Shaun_B » Fri Aug 25, 2017 7:54 pm

With some POKEing of the RAMs, could the GOTO SGN PI become CONT? I'll give it a go.

Regards,

Shaun.

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

Re: Long scrolly on an unexpanded machine

Post by Shaun_B » Fri Aug 25, 2017 8:47 pm

The CONT command can be used in the SAVE routine, like:

Code: Select all

10 SAVE "S"
11 CONT
As for replacing GOTO with CONT in place of GOTO SGN PI, not sure yet.

Thanks,

Shaun

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests