Page 3 of 3

Re: Tricks in BASIC

Posted: Sat Jul 01, 2017 1:55 am
by archmageirvine
I have an article describing a lot of these memory saving techniques and their history.

See: https://mega.nz/#!ioVzgDLa!Vmb4uS9c4Ivz ... wETip0tSp8

Re: Tricks in BASIC

Posted: Sat Jul 01, 2017 8:28 am
by RWAP
archmageirvine wrote:
Sat Jul 01, 2017 1:55 am
I have an article describing a lot of these memory saving techniques and their history.

See: https://mega.nz/#!ioVzgDLa!Vmb4uS9c4Ivz ... wETip0tSp8
Welcome to the forums - that is quite an interesting short article - I have uploaded it here to make it easier to accesss

Re: Tricks in BASIC

Posted: Tue Aug 08, 2017 4:28 pm
by Shaun_B
Type this:

Code: Select all

LET A$="DONKEYSOFT"
in direct mode, and then:

Code: Select all

10 PRINT A$;" ";
20 GOTO 10
9998 SAVE "D"
9999 GOTO 10
Do not try RUNning the listing, instead type:

Code: Select all

GOTO 9998
As you will see, the file will save everything including the variable stack. So that means - if you are careful - you may type in your variables in direct mode and use them in your program. It also means that if someone breaks your program to hack it, and types RUN, the var stack will be wiped.

Regards,

Shaun

Re: Tricks in BASIC

Posted: Sat Sep 02, 2017 1:20 pm
by Shaun_B
I haven't thought of a practical use for it yet, but this is possible:

Code: Select all

  10 LET I=CODE "4"
  20 FOR I=I/I TO I
  30 PRINT I,;
  40 NEXT I
So you're re-using I in place of the start and end of the loop counter, and declaring I as the scalar value for the FOR/NEXT loop.

Regards,

Shaun.

Re: Tricks in BASIC

Posted: Wed Feb 07, 2018 12:00 am
by JJH
Hi

I've not programmed anything in 30 years and am really struggling with many things.
This caught my eye while I was reading a few threads earlier this evening and I wonder if anyone could post an explanation of line 20.
The rest is simple enough to follow and I think I kind of somewhat get it, but not totally, so please assume I know nothing.

10 LET A$=" HELLO USER. THIS IS THE BEST COMPUTER IN THE WORLD. THE SINCLAIR ZX81 "
20 LET A$=A$(2 TO )+A$(1)
30 PRINT AT 10,1;A$(1 TO 30)
40 GOTO 20

Also, if this is covered in the SINCLAIR BASIC manual and anyone knows what page it's on, please let me know that too.

Thanks in advance to anyone that might respond.

Re: Tricks in BASIC

Posted: Wed Feb 07, 2018 1:23 am
by JJH
Must have been extra dozey earlier. I get it now.
@The little basic program is a nice way to achieve a simple text crawl:)

Re: Tricks in BASIC

Posted: Wed Feb 07, 2018 6:25 am
by Paul
Hi jjh
Well you did not give us much time to respond. ;)
Glad you sorted it out.
Sinclair Basic is a little different to others because of the usage of the keyword TO and the omitted parameters.
Kind regards Paul

Re: Tricks in BASIC

Posted: Wed Feb 07, 2018 11:45 pm
by JJH
Hi Paul
Thanks for checking it out.
Think I was just super tired last night after work.
It's a great forum/resource going on here that I only stumbled upon just over a week ago.
Lot's of really friendly, passionate it seems like and quick too offer help too.
Cheers!