Is this a typo?

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
fitz301
Posts: 6
Joined: Wed Oct 10, 2018 4:30 am

Is this a typo?

Post by fitz301 »

I trying to enter this program from a book by Tim Hartnell, but have come across an interesting problem. As you can see there's 2 - line 2's?!

Is this a typo?
book_page.jpg
User avatar
XavSnap
Posts: 2193
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.
Contact:

Re: Is this a typo?

Post by XavSnap »

Xavier ...on the Facebook groupe : "Zx81 France"(fr)
fitz301
Posts: 6
Joined: Wed Oct 10, 2018 4:30 am

Re: Is this a typo?

Post by fitz301 »

So how do I go about entering this into my zx?

I know how to get the line 0, but how do I get the 2 line 2's?
User avatar
XavSnap
Posts: 2193
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.
Contact:

Re: Is this a typo?

Post by XavSnap »

Hi,
You can't enter lines without poking the line data index.

You had to renum the type-ins lines or move extra lines:

Code: Select all

1 REM BLACKJACK
2 GOSUB 7999
3 LET B$="..."

7999 LET BET=100
8000 ...

9998 SAVE "BLACKJACK"
9999 RUN
Then Line 2 is protected from the LIST/EDIT command.
"LIST 2" will point to the first LET line.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
XavSnap
Posts: 2193
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.
Contact:

Re: Is this a typo?

Post by XavSnap »

I dryed to type it...
A RUN save the program, but stop after the "LET BET=100" command. (0/2)!
The gosub line can't be deleted, edited or launched.

It's a bug? :ugeek: No...

Just move extra lines to the proper location, and the game will init the Variables.

The program can't launch the initialization routine.
TWOTWO.P
(978 Bytes) Downloaded 25 times
Before RUN, type "2 GOSUB 8000"
In fact, the GOSUB line is use to set all fixed variables (A$= card face) to set the VARS memory segment for the first launch.


RUN
BREAK (space)
DELETE 8000-9000
2 LET BET=100
GOTO 1 (to save the program and the variables memory room)

You had to delete all lines beatween 8000 to 9000 to free memory room.
But a RUN will clear the A$ values, and A$ will be lost.

The init process 8000 to 9000 is slow, and can be execute once.

This is why the author chose not to run this part of the program each time.
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
Post Reply