Curse of the Aztec Tomb

This file is part of and Timex Sinclair Public Domain Library Tape 1007. Download the collection to get this file.
Date: 198x
Type: Program
Platform(s): TS 1000

You are faced with the task of exploring a sacred mountain of the Aztecs, in which one of their great leaders is rumoured to be buried along with untold riches in ancient relics. The only clue you have is that you must seek out a key which closely resembles a dollar sign.


Program Analysis

“Curse of the Aztec Tomb” is a text-graphics adventure/action game in which the player guides a character (“O”) down a pyramid-shaped mountain, dodging a rolling boulder, navigating a drawbridge, evading a lowering ceiling trap, collecting a dollar-sign key, and ultimately reaching the inner tomb treasure. The pyramid is drawn using a staircase of “% %” character pairs and block graphics characters to represent cliffs and terrain features. Player movement is controlled by keys “1” (move forward/left) and “0” (jump), with the game polling INKEY$ directly in a tight loop rather than using PAUSE-based input. The scoring system awards and deducts points for various actions, with a maximum bonus of 2,500 points for finding the treasure, and multiple death endings each deducting 500 points before restarting. Several random events (snake bite, falling ceiling, drawbridge collapse) are triggered using INT(RND*N) comparisons scattered through the game loop.

Program Structure

The program is organised into distinct functional blocks, separated by line-number ranges:

  • Lines 45–90: Initialisation — jumps to the title/instructions at line 9500, then sets up all game variables.
  • Lines 100–500: Main game loop — draws the boulder (“O”), moves it diagonally down-right each iteration, checks for collision with the target position, and polls for keypresses.
  • Lines 2000–2020: Subroutine to reset the boulder’s starting position (row 3, column 13).
  • Lines 3000–3018: “Move forward” handler — moves the player target left and up; triggers the next phase at line 3500 when Y=2.
  • Lines 3200–3300: “Jump” handler — repositions the target and animates the boulder past a segment.
  • Lines 3500–3740: Cliff-top/drawbridge phase — the player crosses a ledge, with further key-based movement and random events.
  • Lines 4000–4140: Subroutine animating the player moving along the drawbridge approach.
  • Lines 4200–4260: Moat drowning sequence — animates the “+” falling into water, leading to the moat death ending at 9350.
  • Lines 4400–5100: Inner tomb section — random chance of a bat/creature appearing (flag V), scored movement, and key polling.
  • Lines 5300–5380: Creature departure animation, restoring the M (movement allowed) flag.
  • Lines 5500–5790: Cliff-dive sequence — player jumps and falls; detects landing on the creature (V=1) vs. falling off the cliff.
  • Lines 6000–6110: Underground river/tunnel navigation with random drawbridge collapse event.
  • Lines 6300–6330: Move right in tunnel.
  • Lines 6700–6810: Drawbridge collapse animation.
  • Lines 6850–6890: Drawbridge death ending.
  • Lines 6900–6970: Jump up in tunnel.
  • Lines 7200–7295: Lowering ceiling trap animation (flickering inverse characters).
  • Lines 7350–7480: Ceiling death ending.
  • Lines 7800–7999: Key/treasure room — snake encounter, treasure found ending, cobra death.
  • Lines 9000–9200: Subroutine drawing the pyramid graphic using “% %” pairs and block-graphic characters.
  • Lines 9300–9410: Boulder squash, moat, and other death endings.
  • Lines 9500–9720: Title screen with inverse-video banner and instructions.
  • Lines 9730–9750: Save block.

Main Game Loop

The core loop runs from approximately line 270 (referenced by GOTO 270 at line 500, though line 270 is absent — the interpreter falls through to line 280). Each iteration erases the boulder’s previous position with a space at AT A-1,C-1, resets the boulder to the top if it reaches row 21 (GOSUB 2000), draws it at AT A,C;"O", decrements the score by 25, then increments both A (row) and C (column) to move the boulder diagonally. A collision check at line 333 tests whether the boulder has caught the player marker “+” at position (Y,X).

Notable Techniques

  • Absent target line as fall-through: GOTO 270 and GOTO 240 target non-existent lines; the interpreter advances to the next higher-numbered line (280 and 280 respectively), which is a deliberate ZX BASIC technique to skip ahead cleanly.
  • Block graphic pyramid: The pyramid subroutine at 9000–9200 builds a staircase shape by printing progressively wider rows of % % pairs (each % being a space character in context, producing a pattern), with \: block graphics (▌) used for the cliff face indentation at lines 9060–9080.
  • State flags: V tracks whether the creature is visible/present; M controls whether the player can move; M1 records whether the player has previously entered the inner tomb; G flags that the drawbridge has collapsed.
  • Ceiling flicker animation: Lines 7200–7295 alternate between inverse \~~ and inverse \@@ characters with a null REM/RETURN subroutine at 7300–7310 acting as a minimal delay loop.
  • Treasure flash loop: Lines 7970–7980 form an infinite loop alternating **, inverse %*%*, and block graphic \@@\@@ characters to animate a glittering treasure effect — the game never exits this loop normally.
  • Score as difficulty metric: The score is simultaneously a progress reward and a time penalty; the main loop deducts 25 points per iteration, encouraging the player to act quickly.

Key Variables

VariableRole
ABoulder row position
CBoulder column position
XPlayer target column
YPlayer target row
SScore (starts at 1000)
VCreature present flag (0/1)
MMovement permitted flag (0/1)
M1Inner tomb visited flag
GDrawbridge collapsed flag
DSnake strike counter (0–6)

Bugs and Anomalies

  • Typographical error: Line 9303 prints "YPU HAVE BEEN SQUASHED" — “YPU” should be “YOU”.
  • Typographical error: Line 7400 prints "UNSUSPECTING EXLOPLORERS" — “EXLOPLORERS” should be “EXPLORERS”.
  • Typographical error: Line 9305 prints "YOUR CERTAINLY NOT" — “YOUR” should be “YOU’RE”.
  • Dead subroutine code: Line 7320 (LET S=S-300) is unreachable — execution flows from the RETURN at 7310 back to the caller, so 7320 is never executed.
  • Line 9060 block graphics: \: produces a half-block character (▌) used for the cliff indentation, giving an irregular left edge to the pyramid — this appears intentional for visual effect.
  • Potentially infinite jump-death sub-loop: Line 5678 deducts 750 points, prints a cliff-base graphic, then (if G=0) CLSs and restarts from line 50, but if G=1 it goes to 6850 for the drawbridge death — this interaction is logically consistent.
  • Line 3595 out-of-range guard: IF X>12 THEN LET X=12 prevents the player marker from going off the right of the drawbridge section, but the earlier movement code at 3710 already decrements X, so this guard is a defensive check for edge cases.

Content

Appears On

Assembled by Tim Ward from many sources. Contains programs 10294-10335.

Related Products

Related Articles

Related Content

Image Gallery

Source Code

  45 GOTO 9500
  50 LET X=28
  55 LET M=1
  60 LET Y=18
  65 LET G=0
  70 LET S=1000
  75 LET M1=0
  80 LET V=0
  90 GOSUB 9000
 100 GOSUB 2000
 280 PRINT AT A-1,C-1;" "
 285 IF A=21 THEN GOSUB 2000
 290 PRINT AT A,C;"O"
 300 LET S=S-25
 303 LET A=A+1
 305 LET C=C+1
 333 IF A=Y AND C=X THEN GOTO 9300
 350 PRINT AT Y,X;"+"
 360 IF INKEY$="1" THEN GOSUB 3000
 370 IF INKEY$="0" THEN GOTO 3200
 500 GOTO 270
 2000 LET A=3
 2010 LET C=13
 2020 RETURN 
 3000 LET X=X-1
 3005 LET S=S+100
 3010 LET Y=Y-1
 3015 PRINT AT Y+1,X+1;" "
 3017 IF Y=2 THEN GOTO 3500
 3018 RETURN 
 3200 PRINT AT Y,X;" "
 3210 LET S=S-200
 3220 LET Y=Y-2
 3230 PRINT AT Y,X;"+"
 3235 IF C=X-1 THEN GOTO 3240
 3236 PRINT AT Y,X;" "
 3237 LET Y=Y+2
 3238 GOTO 240
 3240 PRINT AT A-1,C-1;" "
 3245 FOR Q=1 TO 3
 3250 PRINT AT A,C;" "
 3260 LET A=A+1
 3270 LET C=C+1
 3280 PRINT AT A,C;"O"
 3290 NEXT Q
 3295 PRINT AT A,C;" "
 3300 GOTO 3236
 3500 LET X=12
 3510 LET Y=2
 3520 LET S=S+300
 3530 PRINT AT Y,X;"+"
 3550 IF X=4 THEN GOTO 3560
 3555 IF INKEY$="0" THEN GOSUB 4000
 3560 IF INKEY$="1" THEN GOTO 3700
 3570 IF X=10 AND Y=2 THEN GOTO 4200
 3580 IF X=7 AND Y=2 THEN GOTO 4200
 3585 LET S=S-25
 3590 IF X=5 AND Y=2 THEN GOTO 4200
 3595 IF X>12 THEN LET X=12
 3600 IF X=3 THEN GOTO 4400
 3620 GOTO 3530
 3700 PRINT AT Y,X;" "
 3710 LET X=X-1
 3720 LET S=S+100
 3730 PRINT AT Y,X;"+"
 3735 IF X=9 THEN GOTO 3560
 3740 GOTO 3570
 4000 LET Y=Y-1
 4010 PRINT AT Y+1,X;" "
 4020 PRINT AT Y,X;"+"
 4030 LET Y=Y-1
 4040 LET X=X-1
 4050 PRINT AT Y+1,X+1;" "
 4060 PRINT AT Y,X;"+"
 4070 LET Y=Y+1
 4080 LET X=X-1
 4090 PRINT AT Y-1,X+1;" "
 4100 LET Y=Y+1
 4110 PRINT AT Y-1,X;" "
 4120 PRINT AT Y,X;"+"
 4130 LET S=S-75
 4140 GOTO 3570
 4200 FOR Z=1 TO 9
 4210 PRINT AT Y,X;" "
 4220 LET Y=Y+1
 4230 PRINT AT Y,X;"+"
 4240 NEXT Z
 4250 PRINT AT Y,X;"@@"
 4260 GOTO 9350
 4400 LET S=S+300
 4500 LET S=S-10
 4507 IF INT (RND*10)=1 THEN GOTO 5000
 4510 IF INT (RND*10)=2 THEN GOTO 5300
 4520 IF INKEY$="0" THEN GOTO 5500
 5000 IF V=1 THEN GOTO 4500
 5010 LET V=1
 5015 LET M=0
 5020 PRINT AT 9,3;" ";AT 10,3;" ";AT 11,3;" "
 5021 PRINT AT 9,1;" .";AT 10,1;"'.";AT 11,2;"'."
 5024 PRINT AT 9,1;" ";AT 10,1;" ";AT 11,2;" "
 5050 PRINT AT 9,0;" .";AT 10,1;"'.";AT 11,2;"'."
 5075 PRINT AT 9,0;" ";AT 10,1;" ";AT 11,2;" "
 5080 PRINT AT 10,0;" .";AT 11,1;"''.."
 5085 PRINT AT 10,0;" ";AT 11,1;"  "
 5090 PRINT AT 12,0;"''''''"
 5100 GOTO 4500
 5300 IF V=0 THEN GOTO 4500
 5310 LET V=0
 5315 LET M=1
 5320 PRINT AT 12,0;"   "
 5325 PRINT AT 10,0;" .";AT 11,1;"''.."
 5327 PRINT AT 10,0;" ";AT 11,1;"  "
 5330 PRINT AT 9,0;" .";AT 10,1;"'.";AT 11,2;"'."
 5340 PRINT AT 9,0;" ";AT 10,1;" ";AT 11,2;" "
 5350 PRINT AT 9,1;" .";AT 10,1;"'.";AT 11,2;"'."
 5355 PRINT AT 9,1;" ";AT 10,1;" ";AT 11,2;" "
 5360 PRINT AT 9,0;" ";AT 10,1;" ";AT 11,2;" "
 5370 PRINT AT 9,3;": ";AT 10,3;": ";AT 11,3;": "
 5375 IF M=1 AND M1=1 THEN GOTO 5540
 5380 GOTO 4500
 5500 LET M1=1
 5505 PRINT AT Y,X;" "
 5510 LET S=S+100
 5520 LET Y=Y-1
 5530 PRINT AT Y,X;"+"
 5531 IF M=1 THEN GOTO 5540
 5532 IF INT (RND*3)=1 THEN GOTO 8000
 5540 LET Y=Y-1
 5550 LET X=X-1
 5560 PRINT AT Y+1,X+1;" "
 5570 PRINT AT Y,X;"+"
 5580 LET Y=Y+1
 5590 LET X=X-1
 5600 PRINT AT Y-1,X+1;" "
 5610 PRINT AT Y,X;"+"
 5620 FOR K=1 TO 10
 5630 PRINT AT Y,X;" "
 5640 LET Y=Y+1
 5650 PRINT AT Y,X;"+"
 5660 IF Y=11 AND V=1 THEN GOTO 6000
 5670 NEXT K
 5678 LET S=S-750
 5680 PRINT AT 18,0;".:. "
 5685 PRINT AT 19,0;" :"
 5690 FOR J=1 TO 50
 5695 NEXT J
 5696 IF G=1 THEN GOTO 6850
 5697 CLS 
 5700 PRINT "   GOOD GRIEF, WHO DO YOU THINK"
 5710 PRINT "YOU ARE, SUPERMAN. FANCY DOING"
 5720 PRINT "A SWAN DIVE OFF THE TOP OF A"
 5730 PRINT "CLIFF. WHAT SOME PEOPLE WILL DO"
 5740 PRINT "FOR A BIT OF AZTEC TREASURE."
 5750 PRINT 
 5760 PRINT "YOU SCORED ";S
 5770 PRINT "PRESS N/L TO RE-START"
 5780 IF INKEY$="" THEN GOTO 5780
 5785 CLS 
 5790 GOTO 50
 6000 IF INT (RND*3)=2 THEN GOTO 6700
 6030 LET S=S-15
 6050 IF X>8 THEN LET X=8
 6055 IF X=4 AND INT (RND*5)=2 THEN GOTO 7200
 6057 IF X=8 THEN GOTO 7800
 6060 IF INKEY$="1" THEN GOTO 6300
 6070 IF INKEY$="0" THEN GOTO 6900
 6110 GOTO 6050
 6300 LET X=X+1
 6310 PRINT AT Y,X-1;" "
 6320 PRINT AT Y,X;"+"
 6325 LET S=S+100
 6330 GOTO 6050
 6700 LET Y1=12
 6710 LET X1=0
 6720 PRINT AT Y1-1,X1;"   "
 6730 PRINT AT Y1,X1;"'./.'"
 6740 LET Y1=Y1+1
 6750 PRINT AT Y1,X1;"-/-";AT Y1,X1;"'  .>"
 6760 IF Y1=19 THEN GOTO 6800
 6770 PRINT AT Y1,X1;"   "
 6780 GOTO 6740
 6800 LET G=1
 6810 GOTO 5680
 6850 CLS 
 6851 LET S=S-500
 6853 PRINT "   HARD LUCK. THE DRAWBRIDGE HAS"
 6855 PRINT "COLLAPSED AND YOU HAVE FALLEN TO"
 6860 PRINT "YOUR DEATH."
 6865 PRINT 
 6870 PRINT "YOU SCORED ";S
 6875 PRINT 
 6880 PRINT "PRESS N/L TO RE-START"
 6885 IF INKEY$="" THEN GOTO 6885
 6887 CLS 
 6890 GOTO 50
 6900 LET Y=Y-2
 6910 PRINT AT Y+2,X;" "
 6920 PRINT AT Y,X;"+"
 6930 IF X=9 THEN GOTO 7000
 6940 LET Y=Y+2
 6950 PRINT AT Y-2,X;" "
 6960 PRINT AT Y,X;"+"
 6970 GOTO 6050
 7200 PRINT AT 9,3;"~~~~~~"
 7210 GOSUB 7300
 7220 PRINT AT 9,3;"@@@@@@"
 7230 GOSUB 7300
 7240 PRINT AT 10,3;"~~~~~~"
 7250 GOSUB 7300
 7260 PRINT AT 10,3;"@@@@@@"
 7270 GOSUB 7300
 7280 PRINT AT 11,3;"~~~~~~"
 7290 GOSUB 7300
 7295 PRINT AT 11,3;"@@@@@@"
 7297 GOTO 7350
 7300 REM 
 7310 RETURN 
 7320 LET S=S-300
 7350 CLS 
 7360 PRINT "   AN INTERESTING FEATURE OF "
 7370 PRINT "AZTEC ARCHITECTURE IS THE CLEVER"
 7380 PRINT "LITTLE CEILINGS THAT LOWER "
 7390 PRINT "THEMSELVES DOWN ON TOP OF"
 7400 PRINT "UNSUSPECTING EXLOPLORERS"
 7410 PRINT "ESPECIALLY WHEN THEY ARE ONLY"
 7420 PRINT "YARDS AWAY FROM THE FABULOUS"
 7430 PRINT "TREASURES OF THE INNER TOMB."
 7440 PRINT 
 7450 PRINT "YOU SCORED ";S
 7455 PRINT 
 7460 PRINT "PRESS N/L TO RE-START"
 7470 IF INKEY$="" THEN GOTO 7470
 7475 CLS 
 7480 GOTO 50
 7800 PRINT AT 9,8;"$"
 7805 LET D=0
 7810 IF D=6 THEN GOTO 7985
 7815 IF INKEY$="0" THEN GOTO 7850
 7820 GOTO 7810
 7850 IF INT (RND*8)=4 THEN GOTO 7900
 7855 LET D=D+1
 7857 LET S=S-50
 7860 LET Y=Y-1
 7865 PRINT AT Y+1,X;" ";AT Y,X;"+"
 7870 LET Y=Y+1
 7875 PRINT AT Y-1,X;" ";AT Y,X;"+"
 7880 GOTO 7810
 7900 LET Y=Y-2
 7910 PRINT AT Y+2,X;" ";AT Y,X;"+"
 7920 LET Y=Y+2
 7930 PRINT AT Y-2,X;" ";AT Y,X;"+$"
 7935 PRINT AT 0,0;"CONGRATULATIONS, YOU HAVE FOUND"
 7940 PRINT "THE AZTEC TREASURE AND SCORED "
 7944 LET S=S+2500
 7945 PRINT S
 7950 PRINT AT 11,10;" "
 7955 PRINT AT 9,11;"    "
 7960 PRINT AT 10,11;"    "
 7965 PRINT AT 11,11;"    "
 7970 PRINT AT 11,12;"**";AT 11,12;"%*%*";AT 11,12;"@@@@"
 7975 PRINT AT 10,12;"**";AT 10,12;"%*%*";AT 10,12;"@@@@"
 7980 GOTO 7970
 7985 FOR J=1 TO 30
 7986 NEXT J
 7987 CLS 
 7990 PRINT "   YOU HAVE BEEN BITTEN BY A"
 7992 PRINT "DEADLY KING COBRA. NOT A LOT YOU"
 7994 PRINT "CAN DO ABOUT THAT, YOU FORGOT TO"
 7996 PRINT "BRING SOMEONE TO SUCK OUT THE"
 7997 PRINT "POISON."
 7998 LET S=S-250
 7999 GOTO 9315
 8000 LET M=1
 8010 GOTO 5300
 9000 PRINT AT 3,0;"   % %  %  % %  % % "
 9010 PRINT "   % %  %  % %  % % % "
 9020 PRINT "   % %  %  % %  % % % % "
 9030 PRINT "   % % % % % % % % % % % % % "
 9040 PRINT "   % % % % % % % % % % % % % % "
 9050 PRINT "   % % % % % % % % % % % % % % % "
 9060 PRINT "   :   :    % % % % % % % % % "
 9070 PRINT "   :       % % % % % % % % % % "
 9080 PRINT "   :       % % % % % % % % % % % "
 9090 PRINT "   % % % % % % % % % % % % % % % % % % % "
 9100 PRINT "   % % % % % % % % % % % % % % % % % % % % "
 9110 PRINT "   % % % % % % % % % % % % % % % % % % % % % "
 9120 PRINT "   % % % % % % % % % % % % % % % % % % % % % % "
 9130 PRINT "   % % % % % % % % % % % % % % % % % % % % % % % "
 9140 PRINT "   % % % % % % % % % % % % % % % % % % % % % % % % "
 9150 PRINT "   % % % % % % % % % % % % % % % % % % % % % % % % % "
 9160 PRINT "   % % % % % % % % % % % % % % % % % % % % % % % % % % "
 9170 PRINT "% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % "
 9180 PRINT "% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % "
 9200 RETURN 
 9300 FOR J=1 TO 50
 9301 NEXT J
 9302 CLS 
 9303 PRINT "   YPU HAVE BEEN SQUASHED BY A"
 9305 PRINT "BOULDER. YOUR CERTAINLY NOT THE"
 9310 PRINT "ATHLETIC TYPE ARE YOU ?"
 9315 PRINT 
 9317 LET S=S-500
 9320 PRINT "YOU SCORED ";S
 9325 PRINT 
 9330 PRINT "PRESS N/L TO RE-START"
 9335 IF INKEY$="" THEN GOTO 9335
 9338 CLS 
 9340 GOTO 50
 9350 FOR J=1 TO 50
 9352 NEXT J
 9353 LET S=S-500
 9354 CLS 
 9355 PRINT "   YOU HAVE DROWNED IN THE MOAT."
 9360 PRINT "ISNT IT ABOUT TIME YOU LEARNT TO"
 9365 PRINT "TO SWIM ? I SUPPOSE ITS A BIT "
 9370 PRINT "LATE THOUGH NOW."
 9375 PRINT 
 9380 PRINT "YOU SCORED ";S
 9385 PRINT 
 9390 PRINT "PRESS N/L TO RE-START"
 9395 IF INKEY$="" THEN GOTO 9395
 9400 CLS 
 9410 GOTO 50
 9500 PRINT AT 2,4;"%C%U%R%S%E% %O%F% %T%H%E% %A%Z%T%E%C% %T%O%M%B"
 9510 PRINT AT 6,0;"   YOU ARE FACED WITH THE TASK"
 9520 PRINT "OF EXPLORING A SACRED MOUNTAIN"
 9530 PRINT "OF THE AZTECS, IN WHICH ONE OF"
 9540 PRINT "THEIR GREAT LEADERS IS RUMOURED"
 9550 PRINT "TO BE BURIED ALONG WITH UNTOLD"
 9560 PRINT "RICHES IN ANCIENT RELICS."
 9570 PRINT "   THE ONLY CLUE YOU HAVE IS "
 9580 PRINT "THAT YOU MUST SEEK OUT A KEY "
 9590 PRINT "WHICH CLOSELY RESEMBLES A DOLLAR"
 9600 PRINT "SIGN."
 9610 PRINT "BEWARE OF THE CURSE. THERE ARE"
 9620 PRINT "MANY DANGERS TO FACE ON YOUR WAY"
 9630 PRINT "TO THE TREASURE. GOOD LUCK."
 9640 PRINT "   KEY 1 ALLOWS YOU TO MOVE"
 9650 PRINT "FORWARD AND KEY 0 ALLOWS YOU TO"
 9660 PRINT "JUMP. PRESS N/L TO START"
 9670 PRINT AT 0,0;"%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*"
 9680 PRINT AT 4,0;"%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*%*"
 9690 PRINT AT 1,0;"%*";AT 2,0;"%*";AT 3,0;"%*"
 9700 PRINT AT 1,31;"%*";AT 2,31;"%*";AT 3,31;"%*"
 9710 IF INKEY$="" THEN GOTO 9710
 9715 CLS 
 9720 GOTO 50
 9730 CLEAR 
 9740 SAVE "1032%0"
 9750 RUN 

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.

People

No people associated with this content.

Scroll to Top