ZX81 Programs


Read about, play, run, or list games, animations, and more. These are my programs from the ’80s to today.

ZX81 Program Listing

**ROAD HOG**SLR/1983*** (roadhog.p)


SYSTEM VARIABLES

PROG  : 16509
D-FILE: 18178
VARS  : 18971
E-LINE: 18972
STKBOT: 18972
STKEND: 18972


LEGEND

A means INVERSE A
A means GRAPHICS A
PRINT means treat as KEYWORD P


PROGRAM LISTING

   1 REM **ROAD HOG**SLR/1983***
   2 LET CARVAR=200
   3 LET CARPRI=300
   4 LET CHECK=400
   5 LET D=PEEK 16396+256*PEEK 1
6397
   7 LET DAY=0
   8 GOSUB 20
  10 LET SC=0
  15 GOTO 70
  20 LET X=10
  21 FAST
  22 LET DAY=DAY+1
  30 FOR H=6 TO 21
  40 FOR G=21-H TO H+10
  45 PRINT AT H,G;" "
  50 NEXT G
  60 NEXT H
  61 SLOW
  62 PRINT AT 0,0;"DAY:";DAY
  65 RETURN
  70 FOR S=0 TO 49
  80 GOSUB CARVAR
  90 GOSUB CARPRI
 100 PRINT AT 20,X;" FGF ";AT 21
,X;" HFH "
 110 LET I$=INKEY$
 120 IF I$="Z" AND X>1 THEN LET
X=X-1
 130 IF I$="." AND X<25 THEN
LET X=X+1
 140 GOSUB CHECK
 150 IF A<>20 THEN GOTO 90
 160 LET SC=SC+10
 161 PRINT AT 1,0;"SCORE:";SC
 162 PRINT AT 2,0;"CARS:";S;" "
 170 NEXT S
 180 LET SC=SC+1000
 190 GOSUB 20
 200 LET A=8
 205 LET R=INT (6*RND+1)
 210 LET Q=R+12
 220 RETURN
 300 IF A=8 THEN PRINT AT A,Q;"H
"
 310 IF A=10 THEN PRINT AT A,Q;"
HH"
 320 IF A=12 THEN PRINT AT A,Q;"
GHG";AT A+1,Q;"HFH"
 330 IF A=14 THEN PRINT AT A,Q;"
FGGF";AT A+1,Q;"HFFH"
 340 IF A=16 THEN PRINT AT A,Q;"
FGGF";AT A+1,Q;"HFFH"
 350 IF A=18 THEN PRINT AT A,Q;"
FG7GF";AT A+1,Q;"HFFFH"
 370 RAND
 390 RETURN
 400 IF A=18 THEN GOSUB 600
 410 IF A=8 THEN PRINT AT A,Q;" 
"
 420 IF A=10 THEN PRINT AT A,Q;"
  "
 430 IF A=12 THEN PRINT AT A,Q;"
   ";AT A+1,Q;"   "
 440 IF A=14 THEN PRINT AT A,Q;"
    ";AT A+1,Q;"    "
 450 IF A=16 THEN PRINT AT A,Q;"
    ";AT A+1,Q;"    "
 460 IF A=18 THEN PRINT AT A,Q;"
     ";AT A+1,Q;"     "
 470 LET A=A+2
 480 LET Q=Q-(2 AND R=1 OR R=2)-
(1 AND R=3)+(1 AND R=5 OR R=6)
 490 RETURN
 500 FAST
 501 GOSUB 30
 510 PRINT AT 1,0;"SCORE:";SC
 520 PRINT AT 21,X;"CRASH"
 530 LET O=SIN PI
 540 PRINT AT 21,X;"CRASH"
 550 LET O=SIN PI
 560 GOTO 520
 600 FOR C=X+1 TO X+3
 610 IF PEEK (D+C+A*33+1)<>CODE
" " THEN GOTO 500
 620 NEXT C
 630 RETURN
 700 SAVE "ROADHOG"
 710 RUN