Discussion about ZX80 / ZX81 Software
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"As You Like It"

Contributor : Antipontifex.

Code: Select all

``````10 DIM A\$(10)
20 INPUT A\$
30 FOR J=1 TO 640
40 LET X=INT(RND*10)+1
50 PRINT A\$(X);
60 NEXT J``````
AYLI.P
Last edited by XavSnap on Wed Nov 25, 2020 11:43 am, edited 1 time in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"Undercut"

/Basic Game/

Contributor : Xavsnap.

Code: Select all

``````1 LET S = PI-PI
2 LET T = S
3 LET V = S
4 CLS
5 PRINT "YOUR TOTAL =";S,"ZX81 TOTAL = ";T; AT 2,16*(NOT V);"*"
6 PRINT,," YOU CHOOSE ";
7 IF INKEY\$ = "" THEN GOTO VAL"7"
8 LET A = VAL INKEY\$
9 IF A > VAL "5" + V OR A < PI/PI + V THEN GOTO VAL"7"
10 LET C = RND*CODE "PI"
11 LET B = PI/PI+V*((C>10)+(C>36)+(C>49)+(C > 62.8))+(NOT V)*(PI/PI +(C>32)+(C>44)+(C >63)+(C>65))
12 PRINT A,"ZX81 CHOSE ";B
13 LET C = A*(A - B <> PI/PI) + B*(B - A = PI/PI)
14 LET D = A*(A - B = PI/PI) + B*(B - A <> PI/PI)
15 LET T = T + D
16 LET S = S + C
17 LET U = VAL"100"
18 IF S = U OR T >= U THEN GOTO CODE "2"
19 IF S > U THEN LET S = U + U - S
20 LET V = (NOT V)
21 GOTO VAL"4"
30 PRINT,,,,S;"-";T;" YOU WIN" AND S > T; "ZX81 RULES" AND T > S; "THAT WAS CLOSE" AND S = T;W
``````
UNDERCUT.P
Last edited by XavSnap on Wed Nov 25, 2020 11:46 am, edited 2 times in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"Screen flash"

/ASM TOOL/

Contributor : Xavsnap.

Code: Select all

``````1 REM [HEX: \
01,00,06,80,2A,0C,40,23,C5,0E,18,\
06,20,7E,3C,CB,77,28,04,CB,B7,EE,\
80,77,23,10,F2,23,0D,20,EC,C1,2A,\
82,40,2B,7C,B5,20,FA,10,DA,C9 ]
5 PRINT AT 10,8;"HELLO WORLD"
10 RAND USR 16516
``````
FLASHSCREEN.P
Last edited by XavSnap on Wed Nov 25, 2020 11:46 am, edited 2 times in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"Small Enterprise"

/Basic text Game/

Contributor : Xavsnap.

(@42=PI character)

Code: Select all

``````2 LET P =SGN PI
5 DIM A ( CODE "\. ")
6 FOR T =P TO SQR EXP PI
10 LET A(T) =INT ( RND*EXP PI) +P
20 NEXT T
21 LET E =VAL "3E3"
22 LET K =CODE ":"
24 IF E < SGN PI THEN GOTO PEEK PI
30 IF P=A(SGN PI) OR P=A(CODE "\ '") OR P=A(PI) THEN GOSUB PEEK SIN PI
34 IF P=A(CODE "\. ") THEN GOSUB PEEK PEEK PI
35 PRINT "SECTOR=";P,,"COMMAND?"
40 INPUT C
45 LET E=E-CODE "W"/C
50 CLS
60 GOTO C*PI*PI+CODE "W"
70 PRINT "TO WHERE?"
71 INPUT M
72 LET C=ABS(M-P)*(M OR M)
74 IF C=SGN PI OR C=CODE"\: " THEN LET P=M
75 GOTO EXP PI
80 PRINT "ENERGY ="; E,"KLINGONS=";K;":";A(PI) ,"MISSILES=";T
85 GOTO EXP PI
90 LET A(SGN C+ (A(CODE "\ '")=P)+(A(C)=P)*CODE "\ '"-(A(CODE "\ '"=A(C)))=INT (RND*EXP PI+SGN C)*(K>PI OR A(CODE "\ '")=P)
100 PRINT "BOOM"
105 GOTO EXP PI
155 PRINT "DOCKED"
160 LET E=E-CODE "@42"
165 IF T<PI THEN LET T=T+INT PI
170 RETURN
220 PRINT "KLINGON MISSILE"
225 IF K THEN LET K=K-(T>SGN PI )
230 LET T=T-(T>SIN PI)
235 IF RND>VAL ".1" THEN RETURN
255 PRINT "RATING=";CODE "\:'"-K
``````
SMALLENTERPRISE.P
Last edited by XavSnap on Wed Nov 25, 2020 11:44 am, edited 2 times in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"Standard deviation"

/Basic tool/

Contributor : Xavsnap.

Code: Select all

``````1 REM L COOPER
10 LET N=0
11 LET FX=0
12 LET F=0
13 LET D2=0
14 LET D=0
100 PRINT "NOW MANY VALUES OF X ?"
110 INPUT NX
120 DIM X(NX)
130 DIM F(NX)
140 PRINT "FIRST X=?"
150 INPUT FX
160 PRINT "LAST  X=?"
170 INPUT LX
180 PRINT "INTERVAL=?"
190 INPUT IN
200 FOR Z=FX TO LX STEP IN
210 PRINT "FOR X=";Z;"  INPUT F(X)"
215 INPUT F
220 LET X(Z)=Z
230 LET F(Z)=F
240 PRINT "X=";X(Z),"F(X)=";F(Z);"             CORRECT (Y/N) "
250 INPUT A\$
260 IF A\$="N" THEN GOTO 210
270 CLS
280 NEXT Z
300 PRINT "ALL VALVES OF X AND F(X) ENTERED"
400 FOR Z=FX TO LX STEP IN
410 LET N=N+F(Z)
420 LET FX=FX+X(Z)*F(Z)
430 LET F=F+F(Z)
440 NEXT Z
450 PRINT "MEAN OF X=";FX/F
460 PRINT "SAMPLE SIZE=";NX
470 LET MEAN= FX/F
490 FOR Z=FX TO LX STEP IN
500 LET D=MEAN-X(Z)
505 IF D<0 THEN LET D=0-D
510 LET D2=D2+(D*F(Z))**2
520 LET N=N+F(Z)
530 NEXT Z
540 LET SD=SQR (D2/N)
550 PRINT "STANDARD DEVIATION=";SD
560 PRINT "VARIANCE=";SD**2
570 PRINT ,,"ONE STANDARD DEVIATION=         ";MEAN-SD;" TO ";MEAN+SD
580 PRINT ,,"TWO STANDARD DEVIATIONS=        ";MEAN-SD*2;" TO ";MEAN+SD*2
590 PRINT ,,"THREE STANDARD DEVIATIONS=      ";MEAN-SD*3;" TO ";HEAN+SD*3
600 PRINT " CONT ?"
610 IF INKEY\$="" THEN GOTO 610
615 CLS
620 PRINT "X=","F(X)="
630 FOR Z=FX TO LX STEP IN
640 PRINT X(Z),F(Z)
650 NEXT Z
``````
DEVIATION.P
Last edited by XavSnap on Wed Nov 25, 2020 11:44 am, edited 3 times in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"Swap"

/ASM TOOL/

(You had to move the RamTop before using this program)

Contributor : Xavsnap.

Code: Select all

``````1 REM [HEX: \
11,00,7F,01,00,01,21,8E,\
40,ED,B0,C9,CD,ED,02,11,\
00,60,21,00,40,01,00,19,\
C9,CD,00,7F,18,04,CD,00,\
7F,EB,ED,B0,C3,07,02,CD,\
00,7F,1A,ED,A0,2B,77,23,\
E2,07,02,18,F5 ]
2 SAVE "SWAP"
3 RAND USR 16514
``````
SWAP.P
Last edited by XavSnap on Wed Nov 25, 2020 11:45 am, edited 2 times in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

/ASM Game/
Keys: R-W-0

Contributor : Xavsnap.

Code: Select all

``````0 REM [HEX: \
00,06,86,00,06,86,00,06,\
86,00,06,86,00,06,86,00,\
06,86,00,06,86,00,06,86,\
FF,38,28,34,37,2A,FF,31,\
2E,3B,2A,38,FF,00,87,80,\
04,00,FF,0E,00,00,14,01,\
00,01,01,00,CD,F5,08,21,\
9B,40,CD,3B,41,01,17,00,\
CD,F5,08,21,A1,40,CD,3B,\
41,01,00,01,CD,F5,08,06,\
20,CD,35,41,01,00,15,CD,\
F5,08,06,20,CD,35,41,01,\
01,04,C5,CD,\
\
F5,08,21,82,40,CD,3B,41,\
C1,04,04,3E,0E,B8,20,EE,\
01,00,12,C5,CD,F5,08,06,\
03,CD,35,41,3E,07,C1,81,\
FE,23,4F,20,EE,ED,4B,AF,\
40,CD,F5,08,21,A7,40,CD,\
3B,41,01,1D,00,CD,F5,08,\
3A,B1,40,4F,06,00,CD,98,\
0A,01,07,00,CD,F5,08,ED,\
03,D7,10,FD,C9,7E,FE,FF,\
C8,D7,23,18,F8,CD,BB,02,\
CB,55,20,2F,\
\
ED,4B,AF,40,CB,54,20,0A,\
0D,79,FE,FF,20,04,ED,4B,\
AF,40,CB,64,20,0A,0C,79,\
FE,1C,20,04,ED,4B,AF,40,\
ED,43,AF,40,E5,CD,F5,08,\
21,A7,40,CD,3B,41,E1,CB,\
65,20,0D,ED,4B,AF,40,05,\
0C,0C,CD,F5,08,3E,17,D7,\
C9,2A,0C,40,01,D6,02,C5,\
E5,E1,C1,3E,17,ED,B1,20,\
43,C5,E5,2B,36,00,11,21,\
00,ED,52,7E,FE,00,20,04,\
36,17,18,E5,\
\
FE,1B,20,04,36,00,18,DD,\
FE,03,20,02,18,D7,CB,BF,\
FE,06,2B,06,03,36,00,23,\
01,07,00,CD,F5,08,C1,ED,\
01,D6,02,C5,E5,E1,C1,3E,\
1B,ED,B9,C0,C5,E5,23,36,\
00,11,21,00,19,7E,FE,00,\
20,04,36,1B,18,E7,FE,17,\
20,04,36,00,18,DF,FE,03,\
28,DB,E6,7F,FE,06,28,D5,\
ED,4B,AF,40,\
\
CD,F5,08,06,05,3E,08,D7,\
10,FD,3A,B1,40,3D,FE,00,\
28,35,32,B1,40,4F,06,00,\
C5,01,1D,00,CD,F5,08,C1,\
CD,98,0A,06,FF,10,FE,ED,\
4B,AF,40,CD,F5,08,06,05,\
3E,00,D7,10,FD,01,0D,14,\
ED,43,AF,40,CD,F5,08,21,\
A7,40,CD,3B,41,18,8A,C1,\
C1,C1,01,0B,0B,CD,F5,08,\
21,69,42,CD,3B,41,C9,AC,\
A6,B2,AA,80,B4,BB,AA,B7,\
FF,3A,B2,40,\
\
CB,67,20,64,2A,0C,40,11,\
D6,02,19,E5,D5,C1,E1,3E,\
86,ED,B9,20,0D,E5,C5,23,\
54,5D,13,01,03,00,ED,B8,\
18,EB,01,1E,00,CD,F5,08,\
2A,0E,40,11,21,00,3E,86,\
06,15,BE,28,04,19,10,FA,\
C9,01,00,10,CD,F5,08,2A,\
0E,40,01,21,00,3E,06,ED,\
B1,CA,5B,42,3A,B2,40,CB,\
E7,32,B2,40,2A,0C,40,01,\
31,02,09,54,5D,01,21,00,\
ED,42,01,CE,\
\
01,ED,B8,C9,2A,0C,40,01,\
D6,02,C5,E5,E1,C1,3E,06,\
ED,B1,20,0D,C5,E5,2B,54,\
5D,1B,01,03,00,ED,B0,18,\
EB,2A,0C,40,23,23,11,21,\
00,06,15,3E,06,BE,28,04,\
19,10,FA,C9,3A,B2,40,CB,\
A7,32,B2,40,C9,3E,03,F5,\
CD,44,43,E6,1F,06,11,4F,\
CD,F5,08,2A,0E,40,11,21,\
00,06,0F,7E,E6,7F,FE,06,\
28,0B,ED,52,10,F5,F1,3D,\
FE,00,20,DB,\
\
C9,19,36,1B,F1,C9,2A,32,\
40,54,5D,29,29,19,29,29,\
29,19,22,32,40,7C,C9,3E,\
C9,3E,03,32,B1,40,21,00,\
AF,40,CD,B3,40,CD,8B,41,\
CD,43,41,CD,55,43,CD,8B,\
41,CD,73,42,2A,0C,40,01,\
D6,02,3E,06,ED,B1,28,03,\
CD,B3,40,CD,44,43,E6,03,\
3C,47,C5,CD,17,43,C1,10,\
F9,18,D2,EA,\
\
1D,1E,1F,20,21,22,23,24,25,1C,76 ]

10 RAND USR 17247
``````
SPACE.P
Last edited by XavSnap on Wed Nov 25, 2020 11:45 am, edited 3 times in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"BubbleSort"

/ASM TOOL/

Asm checked, but give a 2/x error, The listing is of very poor quality.

Contributor : Antipontifex.

Code: Select all

``````4082            76        HALT
4083            76        HALT
4084  NAME      00
4085  1STDIM    00
4086  2NDDIM    00
4087  FLAGS     00
4088  STRST     0000
408A  STEMPIX   0000
408C  TEMPIV    0000
408E            0000
4090  BEGIN     CD230F    CALL 0F23,FAST
4096            23        INC  HL
4097            23        INC  HL
4098            7E        LD   A,(HL)
4099            F6C0      OR   C0H
409B            CBAF      RES  5,A
409D            328440    LD   (NAME),A
40A0            2A1040    LD   HL,(VARS)
40A3  NEWNAME   7E        LD   A,(HL)
40A4            FE80      CP   80H
40A8            CD2B0F    CALL 0F28,SLOW
40AB            CF        RST  08H
40AC            01        DEFB 01H
40AE            3A8440    LD   A,(NAME)
40B1            BA        CP   D
40B2            2806      JR   Z,408A,INITIATE
40B4  NOTFOUND  CDF209    CALL 09F2
40B7            EB        EX   DE,HL
40B8            18E9      JR   40A3,NEWNAME
40BA  INITIATE  23        INC  HL
40B8            23        INC  HL
40BC            23        INC  HL
40BD            3E02      LD   A,02H
40BF            BE        CP   (HL)
40C0            2805      JR   Z,40C7,DIM
40C2  ERROR     CD2B0F    CALL 0F28,SLOW
40C5            CF        RST  08H
40C6            0D        DEFB 0D
40C7  DIM       23        INC  HL
40C8            7E        LD   A,(HL)
40C9            328540    LD   (1STDIM),A
40CC            23        INC  HL
40CD            7E        LD   A,(HL)
40CE            A7        AND  A
40CF            20F1      JR   NZ,40C2,ERROR
40D1            23        INC  HL
40D2            7E        LD   A,(HL)
40D3            328640    LD   (2NDDIM),A
40D6            23        INC  HL
40D7            7E        LD   A,(HL)
40D8            A7        AND  A
40D9            20E7      JR   NZ,40C2,ERROR
40DB            23        INC  HL
40DC            228840    LD   (STRST),HL
40DF  SORT      DDE5      PUSH IX
40E1            FDE5      PUSH IV
40E3  START     0602      LD   B,02H
40E5            DD2A8848  LD   IX,(STRST)
40E9            DDE5      PUSH IX
40EB            ED5B8640  LD   DE,(2NDDIM)
40EF            1600      LD   D,08H
40F3            DDE5      PUSH IX
40F5            FDE1      POP  IY
40F7            DDE1      POP  IX
40F9            7A        LD   A,D
40FA            218740    LD   HL,4087H,FLAGS
40FD            77        LD   (HL),A
40FE  CHAR1     0E01      LD   C,01H
4100  GETCHAR   FD7E00    LD   A,(IY+0)
4103            DDBE00    CP   (IX+0)
4106            3842      JR   C,414A,EXCHANGE
4108            2017      JR   NZ,4121,NEXTSTR
410A  EQUAL     3A8640    LD   A,(2NDDIM)
410D            B9        CP   C
410E            2811      JR   Z,4121,NEXTSTR
4110            CB4E      BIT  1,(HL)
4112            2806      JR   NZ,411A,CONT
4114            CBCE      SET  1,(HL)
4116            DDE5      PUSH IX
4118            FDE5      PUSH IY
411A  CONT      0C        INC  C
411B            DD23      INC  IX
411D            FD23      INC  IY
411F            18DF      JR   4100,GETCHAR
4121  NEXTSTR   CB4E      BIT  I,(HL)
4123            2806      JR   Z,412B,TESTLAST
4125            CB8E      RES  1,(HL)
4127            FDE1      POP  IY
4129            DDE1      POP  IX
412B  TESTLAST  3A8540    LD   A,(1STDIM)
412E            B8        CP   B
412F            280D      JR   Z,413E,LAST
4131  NOTLAST   3A8640    LD   A,(2NDDIM)
4136            FD23      INC  IY
4138            3D        DEC  A
413B            04        INC  B
413C            18C0      JR   40FE,CHAR1
413E  LAST      CB46      BIT  0,(HL)
4140            20A1      JR   NZ,40E3,START
4142  FINISH    FDE1      POP  IV
4144            DDE1      POP  IX
4146            CD2B0F    CALL 0F2B,SLOW
4149            C9        RET
414A  EXCHANGE  DD228A40  LD   (TEMPIX),IX
414E            FD228C40  LD   (TEMPIX),IY
4152            CB4E      BIT  1,(HL)
4154            2808      JR   Z,415E,CONT2
4156            FDE1      POP  IY
4158            DDE1      POP  IX
415A            DDE5      PUSH IX
415C            FDE5      PUSH IY
415E  CONT2     ED5B8640  LD   DE,(2NDDIM)
4162  EXCH      DD7E00    LD   A,(IX+0)
4165            F5        PUSH AF
4166            FD7E00    LD   A,(IY+0)
4169            DD7700    LD   (IX+0),A
416C            F1        POP  AF
416D            FD7700    LD   (IY+0),A
4170            DD23      INC  IX
4172            FD23      INC  IY
4174            1D        DEC  E
4175            20EB      JR   NZ,4162,EXCH
4177            DD2A8A40  LD   IX,(TEMPIX)
417B            FD2A8C40  LD   IY,(TEMPIY)
417F            CBC6      SET  0,(HL)
4181            189E      JR   4121,NEXTSTR``````

Code: Select all

``````0 REM [HEX:\
76,76,00,00,00,00,00,00,\
00,00,00,00,00,00,CD,23,\
0F,2A,16,40,23,23,7E,F6,\
C0,CB,AF,32,84,40,2A,10,\
40,7E,FE,80,20,05,CD,2B,\
0F,CF,01,57,3A,84,40,BA,\
28,06,CD,F2,09,EB,18,E9,\
23,23,23,3E,02,BE,28,05,\
CD,2B,0F,CF,0D,23,7E,32,\
85,40,23,7E,A7,20,F1,23,\
7E,32,86,40,23,7E,A7,20,\
E7,23,22,88,40,DD,E5,FD,\
E5,06,02,DD,2A,88,40,DD,\
E5,ED,5B,86,40,16,00,DD,\
19,DD,E5,FD,E1,DD,E1,7A,\
21,87,40,77,0E,01,FD,7E,\
00,DD,BE,00,38,42,20,17,\
3A,86,40,B9,28,11,CB,4E,\
28,06,CB,CE,DD,E5,FD,E5,\
0C,DD,23,FD,23,18,DF,CB,\
4E,28,06,CB,8E,FD,E1,DD,\
E1,3A,85,40,B8,28,0D,3A,\
86,40,DD,23,FD,23,3D,20,\
F9,04,18,C0,CB,46,20,A1,\
FD,E1,DD,E1,CD,2B,0F,C9,\
DD,22,8A,40,FD,22,8C,40,\
CB,4E,28,08,FD,E1,DD,E1,\
DD,E5,FD,E5,ED,5B,86,40,\
DD,7E,00,F5,FD,7E,00,DD,\
77,00,F1,FD,77,00,DD,23,\
FD,23,1D,20,EB,DD,2A,8A,\
40,FD,2A,8C,40,CB,C6,18,\
9E ]
100 CLS
110 PRINT "HOW MANY STRINGS REQUIRED:";
120 INPUT I
130 PRINT I
140 PRINT "LENGTH OF EACH STRING:";
150 INPUT J
160 PRINT J
170 DIM A\$(I,J)
180 PRINT "HOW MANY DIFFERENT LETTERS","REQUIRED:";
190 INPUT D
200 IF D>256 THEN GOTO 190
210 PRINT D
220 FAST
230 FOR N=1 TO I
240 FOR L=1 TO J
250 LET A\$(N,L)=CHR\$ INT(D*RND+38)
260 NEXT L
270 NEXT N
280 SLOW
290 STOP
300 RAND USR 16528+LEN A\$(I)
310 FOR N=1 TO I
320 IF PEEK 16442<=2 THEN SCROLL
330 PRINT A\$(N)
340 NEXT N``````
SORT.P
Last edited by XavSnap on Wed Nov 25, 2020 11:45 am, edited 2 times in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"Cypher Breaker"

/Basic TOOL/

Contributor : XavSnap.

Code: Select all

``````10 CLS
15 PRINT "CODE NO.?"
20 INPUT X
25 CLS
30 PRINT AT 0,0;X
35 DIM C\$(32)
40 INPUT A\$
45 IF A\$="0" THEN GOTO 10
50 IF A\$="00" THEN STOP
55 FOR N=1 TO LEN A\$
60 IF A\$(N)<>" " THEN LET C\$(N)=CHR\$ (CODE A\$(N)+X)
65 IF A\$(N)=" " OR A\$(N)="?" OR A\$(N)="," OR A\$(N)="." THEN LET C\$(N)=A\$(N)
70 NEXT N
75 PRINT
80 PRINT C\$
85 GOTO 40``````
CYPHER.P
Last edited by XavSnap on Wed Nov 25, 2020 11:45 am, edited 3 times in total.
Xavier
XavSnap
Posts: 1106
Joined: Sat May 10, 2008 4:23 pm

"Speed Screen"

/ASM TOOL/

Contributor : XavSnap.

Code: Select all

``````1 REM [DEC:\
253,203,59,246,205,7,2,221,\
33,142,64,201,237,95,1,1,\
25,62,245,205,181,2,205,\
146,2,205,32,2,221,33,\
165,64,195,64,2,211,253,\
58,40,64,198,194,50,40,\
64,205,146,2,205,32,2,\
221,33,142,64,195,164,2 ]
10 RAND USR 16514``````
SPEEDSCREEN.P