Speed Demon
- Type
- Game
- Category
- Overhead car-racing game
- Author
- John Magdziarz
- Published in
- Antic, October 1982 (Vol. 1, No. 4); reprinted in The Best of Antic, Volume 1
- Year
- 1982
- Language
- Atari BASIC
- Requirements
- 16K RAM, Atari BASIC, joystick in port 1
About the program
Speed Demon! appeared in Antic's fourth issue (October 1982), the sound-and-music issue, and was reprinted in The Best of Antic. That reprint gave it the subtitle "A slick way to circumvent player/missile programming". There are no players or missiles in it at all. The car, the hay bales, the checkered flags and the oil slicks are all redefined text characters, moved by printing them on the screen.
You drive a high-powered stock car that leaks oil now and then. The aim is to finish three laps of a twisting course in as little time as possible. Hit a hay bale or one of your own oil slicks and the car spins out, and you can't steer again until it regains traction.
What you need
A 16K Atari with Atari BASIC and a joystick in port 1. The listing here also runs under the Altirra BASIC replacement used by many emulators (see Changes from the published listing).
Typing it in
Lines 480 and 490 contain {CLEAR}, the clear-screen character: inside the quotes press ESC, then SHIFT-CLEAR. Everything else is plain text. The vertical bars in lines 630–670 are the ordinary | key (SHIFT-=).
How to play
After the title screen the track is drawn and the scoreboard asks WHAT LEVEL?. Press 1 for beginner or 2 for pro. A pro's car has "a severe oil leak". A countdown from 5 runs, then you're off. Steer with the joystick (the car keeps going in its last direction, and diagonals are ignored). Each pass through the gate by the flags adds a lap. After three laps you get GAME OVER, and START gives a new race. START also restarts at any time.
How it works
- A custom character set. Lines 200–250 lower RAMTOP (location 106) by five pages and copy the 1,024-byte ROM font from 57344 into RAM. Lines 260–390 then redraw nine control characters: four car shapes (one per direction), the hay bale, the checkered flag, two halves of the gate and the oil slick.
- A four-colour text screen. Lines 410–440 rewrite the GRAPHICS 0 display list so that most rows use ANTIC mode 4, in which each character is four pixels wide in four colours. Rows 19–22 stay as ordinary text for the scoreboard. Lines 450–470 POKE the colours into 708–712.
- Drawing the track.
HOR$is a row of bale characters.VERT$alternates the bale with cursor-down and cursor-left codes, so printing it draws a vertical wall. The DATA in lines 550–620 gives the position and length of every wall. - Driving.
LOCATEreads the character in front of the car. A space means move. Anything else (a bale, or the slick code 17) starts the spin routine at line 1170. - Oil and time. After each move there's a 1-in-45 chance (beginner) or 1-in-10 (pro) of leaving a slick behind. The TIME column shows
PEEK(19), the middle byte of the system clock, which ticks about every 4.3 seconds.
Changes from the published listing
One change, so the program also runs under Altirra BASIC, the free replacement BASIC built into many emulators. Altirra BASIC adds a command called CP, so it rejected the published lines that use that word as the start of a variable name. The variable is renamed everywhere in the program. The new name is the same length, so the memory layout is unchanged and the program behaves exactly as published on genuine Atari BASIC. If you type it in from the magazine, the original names work fine on a real Atari.
| Published | Now | Lines |
|---|---|---|
CP |
KP |
210, 220, 400 |
Listing
80 REM ******** SPEED DEMON ********
90 REM BY JOHN MAGDZIARZ 1982
100 GRAPHICS 1+16
110 POSITION 7,8:? #6;"ANTIC"
120 POSITION 6,10:? #6;"presents"
130 POSITION 4,12:? #6;"speed demon!"
140 FOR LOOP=1 TO 1000:NEXT LOOP
150 POSITION 3,16:? #6;"please wait...":FOR T=1 TO 600:NEXT T
160 GOTO 180
170 FOR LOOP=1 TO 10:NEXT LOOP:RETURN
180 GRAPHICS 0:POKE 559,0:REM SHUT OFF SCREEN TEMPORARILY
190 OPEN #1,4,0,"K:":REM OPEN KEYBOARD FOR DIRECT
200 A=PEEK(106):POKE 106,A-5
210 KP=PEEK(106)+1:POKE 756,KP
220 CHAR=KP*256
230 FOR M=0 TO 1023
240 POKE CHAR+M,PEEK(57344+M):REM COPY CHAR SET FROM ROM TO RAM
250 NEXT M
260 FOR NC=1 TO 9:READ OLD
270 DIF=(OLD+4+64)*8
280 FOR M=0 TO 7:READ LINE:REM POKE DATA FOR ALTERED CHARACTERS SET
290 POKE CHAR+DIF+M,LINE:NEXT M
300 NEXT NC:REM DATA FOR NEW CHARACTERS
310 DATA 1,136,136,255,255,255,255,136,136
320 DATA 2,60,60,190,190,60,60,190,190
330 DATA 3,34,34,191,191,191,191,34,34
340 DATA 4,190,190,60,60,190,190,60,60
350 DATA 9,0,0,20,20,20,20,0,0
360 DATA 10,204,204,51,51,204,204,51,51
370 DATA 11,255,85,255,170,60,20,60,0
380 DATA 12,0,60,20,60,170,255,85,255
390 DATA 13,8,42,168,42,170,170,168,40
400 GRAPHICS 0:POKE 756,KP:POKE 559,0
410 DL=PEEK(560)+PEEK(561)*256:REM ALTER DISPLAY LIST
420 POKE DL+3,68
430 FOR I=6 TO 23:POKE DL+I,4:NEXT I
440 POKE DL+28,4
450 FOR I=0 TO 4:READ COL:REM SET SCREEN COLORS, REGISTERS 0-4
460 POKE 708+I,COL:NEXT I
470 DATA 26,0,198,72,5
480 ? "{CLEAR}":DIM HOR$(40),VERT$(30):DIM CR1$(4)
490 POKE 559,0:? "{CLEAR}":RESTORE 550:S1=7
500 FOR I2=1 TO 39:HOR$(I2,I2)=CHR$(13):NEXT I2
510 FOR I=1 TO 30 STEP 3:VERT$(I,I)=CHR$(13):VERT$(I+1,I+1)=CHR$(29):VERT$(I+2,I+2)=CHR$(30):NEXT I
520 POKE 82,0
530 REM DRAW PLAYFIELD
540 FOR LOOP=1 TO 8:READ I,J,K,L:POSITION I,J:? HOR$(K,L):NEXT LOOP
550 DATA 0,0,1,39,28,3,1,9,3,6,1,20,25,6,1,8,0,9,1,19,3,12,1,13,15,15,1,22,0,18,1,39
560 FOR LOOP=1 TO 27:READ I,J,K,L:POSITION I,J:? VERT$(K,L):NEXT LOOP
570 REM DATA FOR PLAYFIELD
580 DATA 0,0,1,30,0,10,1,22,3,1,1,1,3,3,1,12,6,3,1,9,9,1,1,9
590 DATA 13,3,1,9,17,1,1,12,21,3,1,9,25,1,1,28,25,11,1,6,29,9,1,18
600 DATA 32,7,1,18,36,4,1,6,35,6,1,21,36,13,1,6,38,1,1,30
610 DATA 38,11,1,24,19,10,1,6,15,13,1,6,12,14,1,12,9,13,1,9
620 DATA 6,14,1,12,3,13,1,9,22,7,1,6,21,9,1,12,22,13,1,6
630 POSITION 3,19:? "| DRIVER |TIME|LAP|"
640 POSITION 3,20:? " "
650 POSITION 3,21:? "|PLAYER #1| 0 | 0 |"
660 POSITION 3,22:? " "
670 POSITION 24,19:? CHR$(124);CHR$(29);CHR$(30);CHR$(124);CHR$(29);CHR$(30);CHR$(124);CHR$(29);CHR$(30);CHR$(124)
680 POSITION 26,20:? CHR$(14);" SPEED ";CHR$(14)
690 POSITION 26,21:? CHR$(2);" DEMON ";CHR$(22)
700 POSITION 24,15:? CHR$(15):POSITION 24,18:? CHR$(16)
710 FOR I=1 TO 4:CR1$(I,I)=CHR$(I+132):NEXT I:LAP1=-1:OK=0:AG=0:TIME1=0:LP=1
720 POSITION 23,16:? CR1$(1,1):X1=23:Y1=16
730 POKE 559,34:POKE 752,1:POKE 53279,0
740 SOUND 0,170,4,4
750 POSITION 26,19:? "WHAT LEVEL?";:GET #1,LEV
760 IF LEV=49 THEN SC=45:GOTO 790
770 SC=10
780 IF LEV<>1 AND LEV<>50 THEN 750
790 POSITION 26,19:? " "
800 REM
810 GOSUB 1280
820 FOR G=5 TO 1 STEP -1:POSITION 23,21:? G:SOUND 0,40,10,4:FOR T=1 TO 100:NEXT T:SOUND 0,0,0,0:GOSUB 170:NEXT G
830 POSITION 23,21:? " "
840 SOUND 0,85,6,5
850 POKE 20,0:POKE 19,0:REM RESET REAL TIME CLOCK
860 REM START OF GAME ROUTINE
870 POSITION 15,21:? PEEK(19):IF PEEK(19)>98 THEN 480
880 IF PEEK(53279)=6 THEN 490
890 IF OK1=1 THEN 870
900 IF AG=1 THEN 1200
910 S=STICK(0):IF S=15 OR S=10 OR S=6 OR S=5 OR S=9 THEN S=S1
920 S1=S
930 REM READ STICK
940 ON S-4 GOTO 960,970,980,0,990,1000,1010,0,1030,1040
950 GOTO 910
960 GOTO 870
970 GOTO 870
980 X1L=X1+1:Y1L=Y1:P1=1:GOTO 1070
990 GOTO 870
1000 GOTO 870
1010 X1L=X1-1:Y1L=Y1:P1=3:IF (X1=24 OR X1=25) AND (Y1=16 OR Y1=17) THEN 870
1020 GOTO 1070
1030 X1L=X1:Y1L=Y1+1:P1=4:GOTO 1050
1040 X1L=X1:Y1L=Y1-1:P1=2
1050 IF (S=14 OR S=13) AND (X1=24) AND (Y1=16 OR Y=17) THEN S=7:GOTO 940
1060 REM CHECK COLLISIONS
1070 LOCATE X1L,Y1L,Z1:POSITION X1L,Y1L:PUT #6,Z1:LX=X1:LY=Y1
1080 IF Z1=17 THEN POSITION X1,Y1:? " ":X1=X1L:Y1=Y1L
1090 IF Z1<>32 THEN 1170
1100 REM MOVE CAR
1110 POSITION X1,Y1:? " ":POSITION X1L,Y1L:? CR1$(P1,P1):IF P1<>LP THEN GOSUB 1350
1120 LO=P1:X1=X1L:Y1=Y1L
1130 IF X1=24 AND (Y1=16 OR Y1=17) THEN LAP1=LAP1+1:SOUND 2,50,12,10:GOSUB 170:POSITION 20,21:? LAP1
1140 SOUND 2,0,0,0
1150 IF LAP1=3 THEN POSITION X1,Y1:? " ":SOUND 0,0,0,0:GOSUB 1290:GOTO 640
1160 GOSUB 1230:GOTO 870
1170 K=INT(RND(0)*3+1)
1180 FOR I=14 TO 0 STEP -2:SOUND 1,100,0,I:GOSUB 170:NEXT I
1190 FOR G=1 TO K:FOR I=1 TO 4:POSITION X1,Y1:? CR1$(I,I):AG=1:GOTO 870
1200 NEXT I:NEXT G:AG=0:POSITION X1,Y1:? CR1$(P1,P1)
1210 GOTO 910
1220 REM OIL SLICK PLACEMENT ROUTINE
1230 I=INT(RND(0)*SC+1)
1240 IF I=7 THEN GOSUB 1260
1250 RETURN
1260 LOCATE LX,LY,Z:IF Z=32 THEN POSITION LX,LY:? CHR$(17):RETURN
1270 POSITION LX,LY:PUT #6,Z:RETURN
1280 RETURN
1290 POSITION 26,20:? "GAME OVER!":POSITION 25,21:? " "
1300 POKE 53279,0
1310 S2=PEEK(53279):IF S2<>6 THEN 1310
1320 GOTO 490
1330 RETURN
1340 REM CAR TURNING SOUND
1350 SOUND 2,5,0,8:SOUND 3,2,10,8:FOR X=1 TO 10:NEXT X:SOUND 2,0,0,0:SOUND 3,0,0,0
1360 RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: SPEED.BAS.
Credits
- Program listing: Speed Demon — program listing (Antic, October 1982 (Vol. 1, No. 4); reprinted in The Best of Antic, Volume 1) — John Magdziarz
- Picture: The car waits at the gate while the game asks for the skill level. — John Magdziarz (program); screenshot by the site
- The Best of Antic, Volume 1: Speed Demon (atarimagazines.com) — John Magdziarz
- Antic, October 1982 - Vol. 1 No. 4: scan of the printed magazine, article and listing — Internet Archive, 1982
- Antic disk, October 1982 - Vol. 1 No. 4: SPEED.BAS (detokenized listing) — AtariMagazines.com (Kevin Savetz), 1982
