Citadel

Type
Game
Category
Catch-the-bombs action game
Author
Heath Lawrence
Published in
Antic, June 1987 (Vol. 6, No. 2), Game of the Month
Year
1987
Language
Atari BASIC
Requirements
Any Atari 8-bit, any memory size, Atari BASIC, joystick in port 1
A starry black text screen with a rack of bombs across the top, a falling bomb, a small shield above a row of city buildings, and SCORE and IMPACTS counters

About the program

Commander Bardrudius, Antic's story goes, has failed to enslave the Earth, so now he is destroying it one city at a time. His shuttles tow racks of "pneumonium" bombs across the sky. One by one, each bomb's timer runs out and it falls, wobbling unpredictably, towards the Citadel below. You steer an energy shield along the rooftops to catch them. It's the Kaboom! idea, rebuilt in a redefined character set inside an ordinary GRAPHICS 0 text screen.

Heath Lawrence, from Port Elgin, Ontario, had been programming his Atari 800 for about five years. Citadel was his third Antic program, after Cliffhanger (November 1986) and Vectron (March 1987). It ran as the June 1987 Game of the Month and works on any 8-bit Atari with any amount of memory.

Typing it in

Lines 490–510 are the hard part. Line 490 is a machine-language memory-move routine stored in a string, and lines 500–510 hold the new character shapes as 136 bytes of string data. They're packed with inverse and control characters. In this site's notation, {inv}…{/inv} means type with the Atari (inverse) key on, {CTRL-E} means hold CTRL and press E, {CTRL-,} is CTRL-comma (character 0), and {BACK S}, {CTRL-TAB}, {INS CHAR}, {RIGHT} and the like are typed by pressing ESC first and then the key. The magazine offered a second listing that wrote these three lines to a LINES.LST file for you to ENTER over the main program. The disk version printed here has them merged in.

The shape data can't contain a quotation mark, so line 520 pokes CHR$(34) into the five places where one is needed. Everywhere else, the lower-case letters in PRINT statements ("hga", "lm", "kkk…") are not text. They're the redefined graphics characters, so type them in lower case exactly as shown.

How to play

Choose a skill level from 1 to 3 by pushing the joystick up or down, then press the button. A shuttle flies across the top of the screen and leaves a row of bombs. Move the shield left and right with the joystick. A caught bomb is worth 5 points, and clearing a whole rack earns a 25-point bonus and a little fanfare. Each bomb you miss blasts a hole in the city and adds one to IMPACTS. Five impacts and the Citadel is destroyed. Press START to play again, and CTRL-1 to pause.

At higher skill levels the bombs keep zig-zagging for longer before they drop straight. Level 1 is the easiest place to learn.

How it works

  • Character graphics. Line 540 copies the ROM character set to RAM just above a lowered RAMTOP (line 470 pokes location 106). Line 550 then copies the new shapes over characters 97–113, the lower-case letters a to q. The bombs, shield, shuttle, buildings and explosion frames are all just letters printed with PRINT and POSITION.
  • Collision by PEEK. The program works out the screen address of a bomb, SC+H+40*Y, from the screen pointer in 88/89. Line 140 PEEKs the cell it is about to enter. Internal code 101 (the letter "e") is the shield, so that's a catch. Reaching row 20 means the bomb has hit the city.
  • Random wobble. Each step, line 100 adds −1, 0 or +1 to the bomb's column, until the bomb passes row SK+14.
  • Speed tricks. The program uses ON condition GOTO in place of IF … THEN and boolean arithmetic such as SX=SX-1*(S=11)+1*(S=7), and it reads the joystick twice for every step of the bomb, so the shield stays responsive. POKE 77,0 stops the attract mode from kicking in, and POKE 16,112:POKE 53774,112 disables the BREAK key.

Variations to try

  • Make it harder: change the 2 in FOR Z=1 TO 2 (line 90) to 1, so the shield gets only one move per bomb step.
  • Change the 5-impact limit in line 220, or the scoring in lines 240 and 290.

Listing

10 REM CITADEL
20 REM BY HEATH LAWRENCE
30 REM (c) 1987, ANTIC PUBLISHING
40 GOSUB 470:GOSUB 360
50 GOSUB 400
60 BD=BD+1:ON BD=37 GOSUB 240
70 H=INT(RND(0)*36)+2:Y=1:ON BFLAG(H)=0 GOTO 70:BFLAG(H)=0:P=0
80 REM MOVE BOMB
90 FOR Z=1 TO 2:S=STICK(0):SX=SX-1*(S=11)+1*(S=7):SX=SX-1*(SX>35)+1*(SX<0):POSITION SX,19:? SHI$:NEXT Z:POKE 77,0
100 V=INT(RND(0)*3)-1:IF Y>(SK+14) THEN V=0
110 ON (Y=19 AND PEEK(SC+H+40*Y)=101) GOTO 120:POKE SC+H+40*Y,P
120 H=H+V:Y=Y+1:SOUND 1,Y+10,10,8:IF H<1 THEN H=1
130 IF H>37 THEN H=37
140 P=PEEK(SC+H+40*Y):ON P=101 GOTO 290:ON Y>19 GOTO 320:POKE SC+H+40*Y,97:GOTO 90
150 REM GAME OVER
160 POSITION 11,10:? "CITADEL DESTROYED!":POSITION SX+1,18:? "  "
170 FOR X=100 TO 200 STEP 8:SOUND 1,X,8,8:POSITION 0,20:? "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii"
180 POSITION 0,20:? "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk":NEXT X:SOUND 1,0,0,0:POSITION 0,20
190 ? "fffffffffffffffffffffffffffffffffffffff":POSITION 7,12:? "PRESS {inv}START{/inv} TO PLAY AGAIN"
200 ON PEEK(53279)<>6 GOTO 200:GOTO 50
210 REM UPDATE STATS
220 POSITION 2,0:? "SCORE:";SCO:POSITION 27,0:? "IMPACTS:";IMP:ON IMP=5 GOTO 160:RETURN
230 REM RACK CLEARED
240 POSITION 12,0:? "{inv}WAVE COMPLETE!{/inv}":SCO=SCO+25:GOSUB 220:FOR N=1 TO 9 STEP 2:SOUND 1,MA1(N),10,8
250 FOR D=1 TO MA1(N+1):NEXT D:NEXT N:FOR N=1 TO 9 STEP 2:SOUND 1,MA2(N),10,8:FOR D=1 TO MA2(N+1):NEXT D:NEXT N
260 FOR N=1 TO 9 STEP 2:SOUND 1,MA1(N),10,8:SOUND 2,MA2(N),10,8:FOR D=1 TO MA1(N+1):NEXT D:NEXT N:POSITION 12,0
270 ? "              ":SOUND 1,0,0,0:SOUND 2,0,0,0:GOSUB 440:RETURN
280 REM SHIELD HIT
290 SCO=SCO+5:POSITION H,Y:? " ":GOSUB 220:FOR X=30 TO 70:POSITION SX+1,19:? "pp":POSITION SX+1,19:? "qq"
300 SOUND 1,X,12,8:NEXT X:SOUND 1,0,0,0:POSITION SX+1,19:? "  ":GOTO 60
310 REM CITY HIT
320 IMP=IMP+1:GOSUB 220:FOR X=100 TO 200 STEP 8:SOUND 1,X,8,8:POKE 710,67:POSITION H,Y:? "k":POKE 710,67
330 POSITION H,Y:? "k":POKE 710,69:POSITION H,Y:? "i":POKE 710,65:POSITION H,Y:? "f":NEXT X:SOUND 1,0,0,0
340 POKE 710,0:GOTO 60
350 REM SELECT LEVEL
360 GRAPHICS 18:POKE 712,82:POSITION 2,5:? #6;"skill level{inv}->{/inv}":SK=1
370 S=STICK(0):SK=SK+1*(S=14)-1*(S=13):SK=SK+1*(SK<1)-1*(SK>3):POSITION 16,5:? #6;SK:FOR D=1 TO 35:NEXT D
380 ON STRIG(0)<>0 GOTO 370:RETURN
390 REM PLAYFIELD
400 GRAPHICS 0:POKE 559,0:POKE 756,ST/256:POKE 752,1:POKE 710,0:SC=PEEK(88)+256*PEEK(89):SCO=0:IMP=0:SX=17
410 FOR X=0 TO 38:POSITION X,21:? "b":POSITION X,22:? "b":NEXT X:POSITION 0,20
420 ? "dcd dc c cdd c dc dc ddc d cdc cdc dc":FOR X=1 TO 80:POSITION INT(RND(0)*39),INT(RND(0)*19):? "j":NEXT X
430 POSITION 10,9:? "lm{DOWN}{LEFT}{LEFT}no{DOWN}{RIGHT}{CTRL-T}":GOSUB 220:POKE 559,34:FOR X=35 TO 0 STEP -1
440 SOUND 1,10,4,8:POSITION X,1:? "hga":FOR D=1 TO 15:NEXT D:NEXT X:FOR I=2 TO 37:BFLAG(I)=1:NEXT I
450 POSITION 0,1:? "  ":BD=0:POKE 16,112:POKE 53774,112:RETURN
460 REM REDEFINE C-SET
470 DIM MA1(10),MA2(10),SHI$(10),BFLAG(37),Q$(2),A$(136):SHI$=" ee ":POKE 106,PEEK(740)-5
480 Q$(1,1)=CHR$(34):Q$(2,2)=Q$:GRAPHICS 17:POKE 712,66
490 MOV=ADR("hh{inv}{CTRL-E}q{/inv}h{inv}{CTRL-E}p{/inv}h{inv}{CTRL-E}U{/inv}h{inv}{CTRL-E}T{/inv}h{inv}{CTRL-E}o{/inv}h{inv}{CTRL-E}n {/inv}{CTRL-,}{inv}1p{CTRL-Q}TfTP{/inv}{CTRL-B}{inv}fUfpP{/inv}{CTRL-B}{inv}fqFnPjFo{/inv}{CTRL-P}{inv}f{/inv}{CTRL-.}")
500 A$(1,68)="{CTRL-,}:{inv}kkkk{/inv}:{CTRL-,}{inv}n{/inv}=m{inv}_{/inv}{CTRL-TAB}q{inv}g\{/inv}<{BACK S}{inv}g{/inv}{INS CHAR}B{BACK S}B{BACK S}{BACK S}<<{BACK S}B{BACK S}f{inv}C{/inv}UUU{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-P},jU{inv}+W{/inv}|{inv}{CTRL-D}{/inv}{CTRL-D}{DEL CHAR}{CTRL-A}{BELL}{CTRL-A}{DEL CHAR}{CTRL-,}{CTRL-,}{CTRL-A}{CTRL-G}{CTRL-J}{DEL CHAR}{inv}@{/inv}{BACK S}{CTRL-,}{CTRL-R}@{CTRL-D}"
510 A$(69,136)=" {CTRL-H}@{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-P}{CTRL-,}{CTRL-,}{CTRL-,}{CTRL-,}hA{CTRL-H} {inv}{CTRL-A}{/inv}${CTRL-,}#{CTRL-,}{CTRL-,}{CTRL-C}{CTRL-O}{RIGHT}???{CTRL-,}{CTRL-,}{inv}@px|||{/inv}???{RIGHT}{CTRL-O}{CTRL-C}{CTRL-,}{CTRL-,}{inv}|||xp@{/inv}{CTRL-,}{CTRL-,}##UU{inv}{CTRL-H}{CTRL-H}{/inv}{CTRL-,}{CTRL-,}{inv}{CTRL-H}{CTRL-H}{/inv}UU##{CTRL-,}{CTRL-,}"
520 A$(88,88)=Q$:A$(121,122)=Q$:A$(133,134)=Q$
530 POSITION 6,5:? #6;"CITADEL":POSITION 1,7:? #6;"{inv}BY HEATH LAWRENCE{/inv}":POSITION 2,9:? #6;"(c)1987, ANTIC"
540 ST=(PEEK(106)+1)*256:JNK=USR(MOV,57344,ST,1024):FOR X=1 TO 300:NEXT X
550 JNK=USR(MOV,ADR(A$),776+ST,136)
560 FOR X=1 TO 10:READ Z:MA1(X)=Z:NEXT X:FOR X=1 TO 10
570 READ Z:MA2(X)=Z:NEXT X:RETURN
580 REM TUNE DATA
590 DATA 50,30,46,30,42,30,46,30,50,50,70,30,66,30,62,30,66,30,70,75

Download

The original program from the Antic disk, to LOAD or ENTER instead of typing it: CITADEL.BAS.

Credits