Escape by Nick Shcherbyna
About
+----------------- PUR-80 BASIC GAME for Mattel Aquarius -----------
| (c) 2021 Nick Shcherbyna (Lviv, UA) [email protected] |
+-------------------------------------------------------------------
| Instructions / |
| You are an alien imprisoned in the underground concentration camp known
| as HANGAR-18. There are five levels with six floors each, patrolled by
| bots. You have to avoid sentinels, otherwise mission will restart from
| scratch. Fortunately bots are a bit dumb. Run as fast as possible and
| climb up on the ladders using [O]-left, [P]-right, [A]-up and [Z]-down.
|
| Use real hardware or VirtualAquarius emulator:
| https://www.zophar.net/download_file/32834
|
| Use either Util->Paste to copy the BASIC source from file, or CLOAD the
| tape image using File->Play Cassette File... Then RUN the game program.
|
+----------------------------------------------------------------
| Source Code Explained /
|-----------------------
|
| Variables:
| (X, Y) - Alien coordinates
| Z - Alien address in VRAM
| B - Saved character in place of alien
| C - Character below of alien
| (U, V) - Sentinel coordinates
| W - Sentinel address in VRAM
| D - Saved character in place of sentinel
| E - Character below of sentinel
| H - Ladder character code
| M - Floor character code
| S - Current level minus 1
| K - Shifted keycode
| R - Random value
| A$ - Beep character
|
| Lines:
| 0 Init VRAM address (bottom right), randomize if (re)start, iterate all
| screen characters.
| 1 Init variables for procedural generation: L for ladder, F for floor.
| 2 Calculate character and display it. Init alien and bot coordinates.
| 3 Calculate bot VRAM addr. Check for game over condition and restart.
| 4 Calculate alien VRAM addr. Put alien sprite, poll keyboard.
| 5 Determine new alien position. Check whether level is completed.
| 6 finalize new alien position. Start dealing with sentinel.
| 7 Put sentinel sprite, determine new vertical position.
| 8 Determine new horizontal position. Delay, restore characters in place
| of sprites.
| 9 Display message, end game if all levels completed.
|
+-----------------------------------------------------------------
| Source Code Listing /
|---------------------
| Note: Microsoft BASIC in Mattel Aquarius limits line of code to just 72
| characters, so the program below is effectively PUR-72 ;-)
| 111111111122222222223333333333444444444455555555556666666666777
|123456789012345678901234567890123456789012345678901234567890123456789012
| | | | | | | |
|0A=13248:FORY=0TO24:FORX=1TO38:Z=YAND3:R=RND(2*(S=0)+X+Y):L=PEEK(A+X+40)
|1H=172:M=134:L=Z=1ANDL=MANDC<>HANDR<.2ORZ<>1ANDL=H:F=Z=LAND(C=32ORR<.98)
|2C=32-102*(Y=0ORF)-140*L:POKEA+X,C:NEXTX:A=A-40:NEXTY:U=38:V=4:X=1:Y=6*V
|3W=A+40*V+U:A$=CHR$(7):IFX=UANDY=VTHENPOKEW,209:?A$;A$;A$;CHR$(11);:RUN!
|4Z=A+40*Y+X:B=PEEK(Z):C=PEEK(Z+40):POKEZ,146+(X+YAND1):K=PEEK(14346)-111
|5X=X+(X>1ANDK=0ANDC>32)-(X<38ANDK=1ANDC>32):Y=Y+(B=HANDK=-14):IFY=0THEN9
|6Y=Y-(C=32ORC=HANDK=11)::D=PEEK(W)::E=PEEK(W+40)::F=14+5*(U+VAND-(E>32))
|7POKEW,F-11*(E=32):L=(V<YANDE<>MORE=32)-(V>YANDD=H):REM(c)NickShcherbyna
|8U=U+(L=0)*SGN(U-X):V=V-L:FORI=5*STO50:NEXT:POKEZ,B:POKEW,D:GOTO3ESCAPE!
|9S=S+1:?CHR$(11);"CONGRATS! Level";S;"/5 completed!";A$;A$;A$:IFS<5THEN0
|
+----------------------------------------------------------------