To allow you to easily check programs typed into your ZX80 from SYNTAX, we will print a Syntactic Sum™, a number unique to the exact program form, after each listing we publish. Using the following program, you can verify your typing immediately after entry.
To make a cassette containing the Syntactic Sum™ program, start with a blank tape. (See below if you have more than 1K memory.) Type Program 1 and save it on the tape. Allow the tape to record about 2 seconds of screen hiss after the program is saved. Now type NEW (NL) and type in Program 2. Run Program 2, and input the numbers from the Decimal Listing, hitting (NL) after each. When you have typed in the final number, error 9/5 will appear. Hit any key to display the listing, then delete lines 1-5. Save lines 6-9 on the tape just after Program 1.
If you have more than 1K RAM, change the number in line 6 in Programs 1 and 2 to the amount of memory you have (in bytes, where 1K = 1024 bytes). For example, if you have a 2K MicroAce, change it to 2048. To run Syntactic Sum™ use 16352+your RAM size as the address (PRINT USR(18400) (NL) for 2K).
To load Syntactic Sum™, rewind the tape and load Program 1. Run it immediately and the screen will clear. Type LOAD (NL) when the cassette reaches the silent leader of Program 2. (If you use our cassette eavesdropper, just let the cassette keep going as you run the first program and type LOAD (NL) when Program 2’s leader comes up.) After loading Program 2, stop the recorder and type GO TO 6 (NL). It is very important to type GO TO 6 and not RUN, because RUN will destroy array variable P. After the program has run, do not type NEW! If you do, you erase the Syntactic Sum™ program hidden in memory. Erase Program 2 by typing 6 (NL) 7 (NL) 8 (NL) 9(NL), or by loading a program from tape.
After Programs 1 and 2 have been run, enter any BASIC program. To find the Syntactic Sum™ of the BASIC program in memory, type PRINT USR(17376) (NL) (If you have more than 1K, use a different address). The number appearing on the display equals the published Syntactic Sum™ when both programs are identically typed. You can also write the Syntactic Sum™ of your own programs on the cassette labels to check for a good load.
Program 1 sets aside 32 bytes of ZX80 RAM for Syntactic Sum™ (Thanks to David Ornstein of Sinclair Research Ltd. for this technique). If you type NEW (NL) you will erase this memory, protected from your BASIC programs. Program 2 loads machine language code to calculate the Syntactic Sum™. If your BASIC program runs out of memory with Syntactic Sum™ loaded, then save the BASIC program on cassette, type NEW (NL) to erase Syntactic Sum™, and reload the BASIC. Most programs will fit, but if they are normally cramped for space, they will not execute.
PROGRAM 1.
6 LET M=1024
7 LET M=M+16351
10 POKE 17152,33
20 POKE 17153,M-(M/256)
30 POKE 17154,M/256
40 POKE 17155,195
50 POKE 17156,107
60 POKE 17157,2
70 LET X=USR(17152)
PROGRAM 2.
1 DIM P(31)
2 FOR L=1 TO 31
3 INPUT P(L)
4 NEXT L
5 STOP
6 LET M=1024
7 FOR L=M+16352 TO M+16382
8 POKE L,P(L-M-16351)
9 NEXT L
SYNTACTIC SUM–DECIMAL LISTING
33 40 64 237 91 8 64 221 33 0 0 124 186 32 8 125 187 32 4 221 229 225 201 78 6 0 221 9 35 24 236
SYNTACTIC SUM–ASSEMBLY LISTING
ORG 43E0H
RAMBOT EQU 4028H
VARS EQU 4008H
43E0 212840 START LD HL,RAMBOT ;WHERE TO START
43E3 ED5B0840 LD DE,(VARS) ;WHERE TO END
43E7 DD210000 LD IX,0000 ;PUT 0 IN IX
43EB 7C REPT LD A,H ;COMPARE HL TO DE
43EC BA CP D
43ED 2008 JR NZ,ADDIN ;IF B <> D
43EF 7D LD A,L
43F0 BB CP E
43F1 2004 JR NZ,ADDIN ;IF L <> E
43F3 DDE5 PUSH IX ;PUT ANSWER (IX)
43F5 E1 POP HL ;IN HL FOR BASIC
43F6 C9 RET ;RETURN TO BASIC
43F7 4E ADDIN LD C,(HL) ;GET ANOTHER BYTE
43F8 0600 LD B,0 ;ZERO THE HI BYTE
43FA DD09 ADD IX,BC ;ADD INTO THE SUM
43FC 23 INC HL ;GO TO NEXT BYTE
43FD 18EC JR REPT ;AND DO IT AGAIN
END START
Syntax, Inc. hereby grants everyone the right to use the Syntactic Sum™ program to generate Syntactic Sums™ and to publish them with programs. Republication of this program is strictly prohibited without our written consent.
Media
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.