Dale’s Atari 800 Games › Stan Ockers
By Stan Ockers, in the ACE newsletter of October 1986.
Play Trap the DragonThe object is to trap the dragon by moving block walls around. You surround him and keep pushing blocks in until you squeeze him to death. You can't get next to him though. Even one space diagonally and you've had it. Use a joystick in port 1 to move the walls. Pointing without the trigger pressed moves you (the blue square). Pressing the trigger while pointing the stick moves a block if you are next to it. You may find the easiest thing to do is to hold the stick in one direction and continually press and release the trigger. The higher the level of difficulty, the fewer the number of blocks you have to move. Happy dragon hunting!
—Stan Ockers

The listing, “TRAP THE DRAGON by Stan Ockers”, is on pages 8, 9 of the issue. Stan wrote it in Action!, the compiled language from Optimized Systems Software, and readers needed the Action! cartridge to type it in and compile it. There is no Action! compiler here, so the game page runs a hand translation of the listing into JavaScript: one function for each of Stan’s procedures, with his variable names, sizes and memory addresses, driving the same emulated Atari 800 (its screen, player-missile graphics, collisions and sound) that runs the BASIC games.
Where this copy came from: Written in Action!. The listing was transcribed by hand from the scan (pages 8-9; there is no typed-in or compiled copy). The game page runs a hand translation of the listing into JavaScript.
; ******************
; * TRAP THE DRAGON *
; * S.O. 9-86 *
; ******************
DEFINE Blk="4",Ds="5",You="134"
INT ARRAY Nbor=[41 40 39 1 1 39 40 41]
BYTE Cset,CONSOL=53279,RTCLOK=19
CARD Scrad=88
BYTE POINTER Sc
PROC Init()
BYTE ARRAY Newchar=[162 170 138 170
168 170 162 170 4 20 17 16 68 84 20
0 255 255 255 255 255 255 255 255]
CARD Dlist=$230,J
Cset=Peek(106)-4 Poke(106,Cset-1)
MoveBlock(Cset*256,$E000,1024)
MoveBlock(Cset*256+32,Newchar,24)
Nbor(4)=-1 Nbor(5)=-39 Nbor(6)=-40
Nbor(7)=-41
Graphics(0) Poke(712,42) Poke(710,
54)
Poke(709,34) Poke(708,212) Poke(71
1,134)
FOR J=Dlist+6 TO dlist+28 DO
Poke(J,4)
OD
Poke(752,1) Poke(756,Cset)
RETURN
PROC Bkgnd()
BYTE C,CH=764
CARD Offset,Nbrblk=[500],J
Put(125)
FOR Offset=0 TO 39 DO
Sc=Scrad+Offset+40 Sc^=Blk
OD
FOR Offset=79 TO 920 STEP 40 DO
Sc=Scrad+Offset Sc^=Blk Sc==+1
Sc^=Blk
OD
FOR Offset=920 TO 959 DO
Sc=Scrad+Offset Sc^=Blk
OD
DO
WHILE CH=255 DO
POSITION(8,0)
IF RTCLOK MOD 2 THEN
PRINT (" TRAP THE DRAGON ")
ELSE
PRINT ("SELECT DIFFICULTY [1-5]")
FI
OD
C=GetD(7) C==-48
UNTIL C>0 AND C<6
OD
POSITION(8,0)
PRINT(" DIFFICULTY LEVEL = ")
PRINTB(C)
Nbrblk=(5-C)*75+100
FOR J=1 TO Nbrblk DO
Offset=Rand(0)*3+40 Offset==+Rand(194)
Sc=Scrad+Offset Sc^=Blk
OD
RETURN
PROC Delay(BYTE D)
BYTE Cntclk=20,T
DO T=Cntclk+D UNTIL T<256 OD
DO UNTIL Cntclk=T OD
RETURN
CARD FUNC Move(CARD Scrloc, INT Offset
,BYTE Shape)
Sc=Scrloc Sc^=0 Sc==+Offset
IF Sc^=0 THEN Sc^=Shape RETURN(Sc)
ELSE Sc=Scrloc Sc^=Shape RETURN(Sc)
FI
PROC Bumpup(CARD Scrloc)
CARD Lastsc
Lastsc=Scrad+40 Sc=Scrloc-40
IF Sc<Lastsc THEN RETURN FI
IF Sc^<>Blk THEN RETURN FI
WHILE Sc^<>0 DO
Sc==-40
IF Sc<Lastsc THEN RETURN FI
OD
WHILE Sc<Scrloc-40 DO
Sc^=Blk Sc==+40
OD
Sc^=0
RETURN
PROC Bumpdn(CARD Scrloc)
CARD Lastsc
Lastsc=Scrad+920 Sc=Scrloc+40
IF Sc>Lastsc THEN RETURN FI
IF Sc^<>Blk THEN RETURN FI
WHILE Sc^<>0 DO
Sc==+40
IF Sc>Lastsc THEN RETURN FI
OD
WHILE Sc>Scrloc+40 DO
Sc^=Blk Sc==-40
OD
Sc^=0
RETURN
PROC Bumplt(CARD Scrloc)
CARD Lastsc
Sc=Scrloc-1
Lastsc=Scrad+((Scrloc-Scrad)/40)*40
IF Sc<Lastsc THEN RETURN FI
IF Sc^<>Blk THEN RETURN FI
WHILE Sc^<>0 DO
Sc==-1
IF Sc<Lastsc THEN RETURN FI
OD
WHILE Sc<Scrloc-1 DO
Sc^=Blk Sc==+1
OD
Sc^=0
RETURN
PROC Bumprt(CARD Scrloc)
CARD Lastsc
Sc=Scrloc+1
Lastsc=Scrad+((Scrloc-Scrad)/40)*40+39
IF Sc>Lastsc THEN RETURN FI
IF Sc^<>Blk THEN RETURN FI
WHILE Sc^<>0 DO
Sc==+1
IF Sc>Lastsc THEN RETURN FI
OD
WHILE Sc>Scrloc+1 DO
Sc^=Blk Sc==-1
OD
Sc^=0
RETURN
BYTE FUNC Surr(CARD Scrloc,BYTE Test)
BYTE J
FOR J=0 TO 7 DO
Sc=Scrloc+Nbor(J)
IF Sc^=Test THEN RETURN(1) FI
OD
RETURN(0)
CARD FUNC MoveU(CARD Uloc)
IF (Stick(0)&1)=0 THEN
IF STrig(0) THEN
Uloc=Move(Uloc,-40,You)
ELSE Bumpup(Uloc)
FI
FI
IF (Stick(0)&2)=0 THEN
IF STrig(0) THEN
Uloc=Move(Uloc,40,You)
ELSE Bumpdn(Uloc)
FI
FI
IF (Stick(0)&4)=0 THEN
IF STrig(0) THEN
Uloc=Move(Uloc,-1,You)
ELSE Bumplt(Uloc)
FI
FI
IF (Stick(0)&8)=0 THEN
IF STrig(0) THEN
Uloc=Move(Uloc,1,You)
ELSE Bumprt(Uloc)
FI
FI
RETURN(Uloc)
CARD FUNC Movedrag(CARD Scrloc,BYTE
Shape)
BYTE J
INT Frst
J=Rand(8) Sc=Scrloc Sc^=0
Frst=Nbor(J) Sc==+Frst
IF Sc^=0 THEN Sc^=Shape RETURN(Sc)
FI
DO
J==+1 IF J>7 THEN J=0 FI
Sc=Scrloc+Nbor(J)
IF Sc^=0 THEN Sc^=Shape RETURN(S
c) FI
UNTIL Nbor(J)=Frst
OD
Sc=Scrloc Sc^=Shape
RETURN(Sc)
PROC Lose()
BYTE T,J,V
FOR J=150 TO 230 STEP 4 DO
FOR V=2 TO 10 STEP 2 DO
Sound(0,J,10,12-V) Delay(1)
OD
OD
SNDRST()
DO Position(7,0)
IF RTCLOK MOD 2 THEN
Print(" Sorry... You Lose!
")
ELSE
Print(" Press {inv}START{/inv} to play agai
n")
FI
UNTIL CONSOL=6
OD
RETURN
PROC Win()
BYTE T,J,V
FOR J=100 TO 200 STEP 10 DO
FOR V=2 TO 10 STEP 2 DO
SOUND(0,230-J,10,12-V) DELAY(1
)
OD
OD
SNDRST()
DO Position(7,0)
IF RTCLOK MOD 2 THEN
Print("Congratulations! You win!
")
ELSE
Print(" Press {inv}START{/inv} to play agai
n")
FI
UNTIL CONSOL=6
OD
RETURN
PROC Main()
CARD Drag,J,Upos
Init()
WHILE 1=1 DO
Bkgnd()
DO
Drag=Scrad+Rand(255)+80
UNTIL Peek(Drag)=0
OD
DO
Upos=Scrad+400+Rand(255)
UNTIL Peek(Upos)=0
OD
Poke(Upos,You)
DO
Drag=Movedrag(Drag,Ds)
FOR J=1 TO 2000 DO OD
Upos=MoveU(Upos)
UNTIL
(Surr(Upos,Ds)=1) OR (Surr(Dra
g,0)=0)
OD
IF Surr(Upos,Ds)=1 THEN Lose()
ELSE Win()
FI
Poke(77,0)
OD
RETURN