10 REM        *****************
20 REM        CASTLE STORMWRATH
30 REM        *****************
40 REM
50 MODE 0:LOCATE 5,12:PRINT "PLEASE WAIT.":GOSUB 1140
60 PP=P:CLS:PEN 1:BORDER INT(RND*27):M=M+L:IF M>600 THEN INK 1,24,1:LOCATE 6,10:PRINT "YOUR STRENGTH HAS FAILED YOU":GOTO 1050
70 PRINT:PRINT STRING$(40,"*")
80 PRINT "You are ";L$(P):IF L=1 THEN PRINT:PRINT:PRINT:GOTO 140
90 PRINT:PRINT "You can see ";
100 FOR T=1 TO 17:IF O(T,1)=P THEN PRINT TAB(13);O$(T)
110 NEXT
120 PRINT:PRINT:PRINT "Visible Exits are:";:FOR T=1 TO 6:IF L(P,T)>0 THEN PRINT MID$(K$,(T*3)-2,3);"-";
130 NEXT
140 IF O(8,1)=0 AND O(9,1)=0 AND P=23 AND O(15,1)<>23 THEN PRINT "You hear cheering noises":GOTO 1100
150 IF Q>-1 AND DV<>1 AND O(8,1)=0 THEN Q=Q-1
160 IF DV<>1 AND Q=-1 AND O(8,1)=0 THEN PRINT "The vase slips from your grasp and hits the floor...SMASH":SOUND 1,32,100,15:O(8,1)=999
170 IF O(13,1)=P OR O(12,1)=P OR O(15,1)=P THEN PRINT "You cannot move, the creature is about  to attack":FOR Y=1 TO 7:A(P,Y)=L(P,Y):L(P,Y)=0:NEXT
180 IF O(17,1)=P AND L<>1 AND O(17,2)=-2 THEN PRINT "The Guards see you and attack, all exitsare sealed, you must fight":FOR T=1 TO 7:A(P,T)=L(P,T):L(P,T)=0:NEXT
190 IF P=28 OR P=24 THEN 1050
200 PRINT:PRINT:LINE INPUT "What Next? ";A$:A$=UPPER$(A$):IF LEFT$(A$,2)="UP" AND L(P,5)>0 THEN P=L(P,5) ELSE IF LEFT$(A$,3)="DOWN" AND L(P,6)>0 THEN P=L(P,6) ELSE IF LEFT$(A$,2)="UP" AND P=L(P,5)<1 THEN 250
210 IF LEFT$(A$,3)="NOR" AND L(P,1)>0 THEN P=L(P,1) ELSE IF LEFT$(A$,3)="SOU" AND L(P,2)>0 THEN P=L(P,2) ELSE IF LEFT$(A$,3)="EAS" AND L(P,3)>0 THEN P=L(P,3) ELSE IF LEFT$(A$,4)="WES" AND L(P,4)>0 THEN P=L(P,4)
220 IF PP<>P THEN PRINT "Moving Now...":GOTO 340
230 IF LEN(A$)<3 THEN PRINT "Too Short":GOTO 200
240 IF L=1 AND O(17,1)=P THEN PRINT "You cannot do anything other than move":GOTO 340
250 IF L=2 AND P=5 AND LEFT$(A$,3)<>"FIG" AND LEFT$(A$,3)<>"HIT" AND LEFT$(A$,3)<>"KIL" THEN PRINT "You can only fight"lgoto 340
260 PRINT:PEN 3:V=0:FOR T=1 TO 21:IF C$(T)=LEFT$(A$,3) THEN V=T:T=21
270 NEXT:IF V=0 THEN PRINT "You cannot do that":GOTO 340
280 IF LEFT$(A$,3)="INV" OR LEFT$(A$,3)="LIS" OR LEFT$(A$,3)="SCO" OR LEFT$(A$,3)="QUI" OR LEFT$(A$,3)="JUM" THEN GOTO 330
290 Z=INSTR(A$," "):B$=MID$(A$,Z+1,3)
300 IF V>0 AND Z=0 THEN PRINT "This command must be followed by an     object":GOTO 340
310 N=0:FOR T=1 TO 18:IF D$(T)=LEFT$(B$,3) THEN N=T:T=18
320 NEXT:IF N=0 THEN PRINT "No such object":GOTO 340
330 ON V GOSUB 350,350,1020,430,430,480,480,510,560,600,600,600,710,760,780,800,850,890,980,980,980
340 PRINT #1,"PRESS A KEY":WHILE INKEY$="":WEND:CLS #1:SOUND 1,100+INT(RND*200):GOTO 60
350 REM TAKE/GET/PICK UP
360 IF O(N,1)=0 THEN PRINT "Fool, you already have it":RETURN
370 IF O(N,2)=-1 THEN PRINT "You cannot take that, it's far too large":RETURN
380 IF O(N,2)=-2 THEN PRINT "You cannot take a creature either alive or dead":RETURN
390 IF O(N,1)<>P THEN PRINT "It's not here to take":RETURN
400 IF DV=1 AND O(8,1)=P AND O(9,1)=P AND N=9 THEN PRINT "The vase is safely carried on the velvetcushion":O(8,1)=0:O(9,1)=0:RETURN
410 IF N=8 AND DV<>1 AND O(9,1)<>P THEN PRINT "You can only carry the vase for several moves":Q=2:O(8,1)=0:RETURN
420 O(N,1)=0:O(N,2)=0:PRINT "You have taken the object":RETURN
430 REM DROP/LEAVE
440 IF O(N,1)<>0 THEN PRINT "You don't have the object to drop it":RETURN
450 IF N=8 AND O(9,1)=P THEN PRINT "The vase safely drops on the cushion, tocarry them safely, just TAKE CUSHION":DV=1:O(8,1)=P:RETURN
460 IF N=8 AND O(9,1)<>P THEN PRINT "The vase smashes as it hits the floor":O(8,1)=999:RETURN
470 O(N,1)=P:PRINT "You drop the object":RETURN
480 REM LIST/INVENTORY
490 CLS:PRINT:PRINT TAB(12);"OBJECTS CARRIED":PEN 2:PRINT:PRINT:X=0:FOR T=1 TO 16:IF O(T,1)=0 THEN X=X+1:PRINT X;") ";O$(T)
500 NEXT:RETURN
510 REM EMPTY
520 IF N<>10 THEN PRINT "You cannot empty that":RETURN
530 IF O(10,1)<>0 THEN PRINT "You don't have the bottle, I'm afraid":RETURN
540 IF P<>27 THEN PRINT "The liquid burns a small hole in front  of you":O(3,1)=0:O(10,1)=999:RETURN
550 PRINT "The poison lands in the stream and will kill all those at the Castle.":O(10,1)=999:O(3,1)=0:O$(17)="a pile of dead GUARDS":O(17,2)=-1:RETURN
560 REM LIGHT
570 IF O(2,1)<>0 OR (N<>2 AND N<>18) THEN PRINT "You can only light the lamp which must  be with you":RETURN
580 IF N=18 THEN L=1:PRINT "The light is switched off":RETURN
590 PRINT "The lamp is on, you can see all around  you. To switch lamp off, enter LIGHT OFF":L=2:RETURN
600 REM FIGHT/KILL/HIT
610 IF LEFT$(A$,3)="HIT" AND N=16 AND P=22 THEN PRINT "The panel breaks revealing a secret     passageway, centuries old":L(22,3)=9:O$(16)="a smashed panel":RETURN
620 IF N<>12 AND N<>13 AND N<>15 AND N<>17 THEN PRINT "You violent person! For that, I'll make you start again":WHILE INKEY$="":WEND:RUN
630 IF O(N,1)<>P THEN PRINT "How can you fight something that isn't  here":RETURN
640 IF N=17 THEN PRINT "You stood no chance against that many":GOTO 1050
650 IF (N=13 OR N=12 OR N=15) AND O(1,1)<>0 THEN PRINT "Without any weapon, your fight was long and arduous":M=M+560:GOTO 690
660 IF N=12 THEN PRINT "You kill the snake easily":O(12,1)=999:M=M+40:GOTO 690
670 IF N=13 THEN PRINT "You kill the troll after a fierce battle":O(13,1)=999:M=M+200:GOTO 690
680 IF N=15 THEN PRINT "You only managed to wound him":M=M+200:O(15,1)=INT(RND*9)+10:GOTO 690
690 IF N=15 AND O(1,1)<>0 THEN 1050
700 FOR T=1 TO 7:L(P,T)=A(P,T):NEXT:RETURN
710 REM OPEN
720 IF N<>6 THEN PRINT "You can only open the chest":RETURN
730 IF P<>5 AND N=6 THEN PRINT "There is no chest here":RETURN
740 IF O(4,1)<>0 THEN PRINT "You are missing something":RETURN
750 PRINT "The chest opens to reveal a Vase":O(8,1)=5:RETURN
760 REM SCORE
770 PRINT:PRINT "MOVES TAKEN:";M:RETURN
780 REM QUIT
790 GOTO 1080
800 REM DRINK
810 IF N=3 THEN PRINT "There's nothing to drink, it's empty":RETURN
820 IF N<>10 THEN PRINT "You cannot drink that!":RETURN
830 IF N=10 AND O(10,1)<>0 AND O(10,1)<>P THEN PRINT "It's not here to drink":RETURN
840 PRINT "You drink the liquid in the bottle, you didn't know that it was a strong poison":GOTO 1050
850 REM EAT
860 IF N<>11 THEN PRINT "Are you mad? You cannot eat that!":RETURN
870 IF O(11,1)<>0 AND O(11,1)<>P THEN PRINT "It's not here to eat":RETURN
880 O(11,1)=999:PRINT "The apple makes you stronger":M=M-120:RETURN
890 REM EXAMINE
900 IF O(N,1)<>P AND O(N,1)<>0 THEN PRINT "The object must be here if you want to  examine it":RETURN
910 IF N<6 OR N>10 THEN PRINT "There is little more that can be said":RETURN
920 PRINT "Your examination reveals...":ON N-5 GOTO 930,940,950,960,970
930 PRINT "a keyhole in the beautifully-crafted    chest":RETURN
940 PRINT "a message on the inside cover, telling  you that you are to be rescued from the battlements":RETURN
950 PRINT "the Vase of Destiny, whoever owns it hassupreme magical powers":RETURN
960 PRINT "a finely-made velvet cushion with a     depression in its centre":RETURN
970 PRINT "a bottle of potent poison, one sip will kill":RETURN
980 REM CLEAN/DUST/POLISH
990 IF L(1,3)=2 THEN PRINT "The genie is too tired to help again":RETURN
1000 IF O(2,1)=0 AND N=2 AND P=1 THEN PRINT "With a loud explosion and much smoke theGenie Of The Lamp appears and opens the door for you":O(14,1)=P:L(1,3)=2:RETURN
1010 PRINT "Nothing Happens":RETURN
1020 REM JUMP
1030 IF L(P,7)<1 THEN PRINT "Nothing Happens":RETURN
1040 IF L(P,7)>0 THEN P=L(P,7):PRINT "You jump...":FOR T=220 TO 80 STEP -20:SOUND 1,T,10:NEXT:FOR T=100 TO 240 STEP 20:SOUND 1,T,10:NEXT:RETURN
1050 REM DEFEAT
1060 FOR T=1 TO 3000:NEXT:CLS:INK 0,6:INK 1,0:BORDER 0:PEN 1:LOCATE 1,10:PRINT "   YOU FAILED IN YOUR ATTEMPT TO BEAT      THE DARK FORCES. YOU DIED BRAVELY."
1070 FOR T=80 TO 410 STEP 30:SOUND 1,T:NEXT:FOR T=1 TO 1000:NEXT:PRINT:PRINT:PRINT
1080 PRINT:PRINT "Do you want to play again (Y/N)"
1090 A$=INKEY$:IF A$="Y" THEN RUN ELSE IF A$="N" THEN END ELSE GOTO 1090
1100 REM VICTORY
1110 FOR T=1 TO 2500:NEXT:CLS:PEN 1:LOCATE 1,10:PRINT "  YOU ARE RESCUED FROM THE BATTLEMENTS    AND TAKEN BACK TO YOUR COUNTRY WHERE    YOUR LORD GIVES YOU LANDS AND TITLES"
1120 FOR T=1 TO 26:BORDER T:INK 1,T:SOUND 1,340-(10*T):NEXT:FOR T=1 TO 2000:NEXT:PRINT:PRINT:END
1130 STOP
1140 REM INITIALISATION
1150 L=1:Z=0:DV=0:P=1:K$="NORSOUEASWESUP DOW":Q=0
1160 DIM L(30,7),O(20,4),L$(30),O$(20),C$(30),D$(20),A(30,7)
1170 FOR T=1 TO 30:READ L$(T):IF T>8 AND T<20 THEN RESTORE 1260
1180 NEXT:FOR X=1 TO 30:FOR Y=1 TO 7:READ L(X,Y):IF L(X,Y)=-1 THEN L(X,Y)=INT(RND*9)+9:IF RND>0.6 THEN L(X,Y)=0
1190 NEXT:NEXT
1200 FOR T=1 TO 18:READ O$(T),O(T,1),O(T,2):NEXT
1210 FOR T=1 TO 21:READ C$(T):NEXT:FOR T=1 TO 18:READ D$(T):NEXT
1220 MODE 1:INK 1,24:INK 0,1:CLS:WINDOW #1,15,26,25,25:PEN #1,3:PAPER #1,2
1230 RETURN
1240 DATA "in a dark, Dungeon deep in the          heart of Castle Stormwrath","by an enormous staircase carved         in jade"
1250 DATA "in the Great Hallway","in the State Bedroom","in the Throne Room","in the Baron's Gardens","in a store room","in a kitchen"
1260 DATA "stuck in a maze of twisting and         turning tunnels","in the library","in the Baron's Study","on the Castle Battlements","in the Shark-infested moat"
1270 DATA "in a forest close to the castle","in a clearing in the forest","by a stream which supplies the          castle with water","falling down a deep hole dug to         catch wild boar","DEAD!!!","at the top of the giant jade            Staircase"
1280 DATA 0,0,-2,0,0,0,0,0,24,0,1,30,0,0,5,0,21,0,0,0,0,8,0,5,0,0,0,0,0,3,30,4,0,0,0,25,20,23,0,0,0,0
1290 DATA 0,8,0,0,0,0,0,7,4,0,0,0,0,0,-1,-1,22,10,-1,-1,0,11,9,-1,-1,-1,-1,0,-1,-1,12,10,-1,-1,0,-1,-1,-1,-1,13,11,0
1300 DATA -1,-1,-1,-1,14,12,0,15,13,-1,-1,-1,-1,0,-1,-1,-1,-1,14,16,0,15,17,-1,-1,-1,-1,0,-1,-1,-1,-1,16,18,0,-1,-1,17,19,-1,-1,0,-1,-1,18,20,-1,-1,0,19,6,-1,-1,-1,-1,0
1310 DATA 0,22,0,3,0,0,0,21,0,0,0,0,0,0,0,16,0,6,0,0,24,0,0,0,0,0,0,0,28,6,28,0,0,0,26,0,25,0,0,0,0,27,0,0,0,28,0,0,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,2,0
1320 DATA "a KNIFE",8,0,"an old, dirty LAMP",0,0,"an empty BOTTLE",999,0,"an ancient rusty KEY",27,0,"a solid oak DOOR",1,-1
1330 DATA "a carved CHEST",5,-1,"a dusty BOOK",21,0,"a precious VASE",-5,0,"a velvet CUSHION",3,0,"a FULL BOTTLE",7,0
1340 DATA "a golden APPLE",6,0,"a venomous SNAKE",26,-2,"a greedy TROLL",7,-2,"a mysterious GENIE",-1,-1,"the evil BARON",23,-1
1350 DATA "a hollow PANEL",22,-1,"a troop of GUARDS",5,-2,"zzz",999,999
1360 DATA "TAK","GET","JUM","DRO","LEA","LIS","INV","EMP","LIG","FIG","KIL","HIT","OPE","SCO","QUI","DRI","EAT","EXA","CLE","RUB","POL"
1370 DATA "KNI","LAM","BOT","KEY","DOO","CHE","BOO","VAS","CUS","FUL","APP","SNA","TRO","GEN","BAR","PAN","GUA","OFF"
1380 DATA 9,3,22,10,2,9,11,4,10,12,6,11,13,6,12,14,2,13,15,5,14,16,1,15,17,5,16,18,3,17,19,3,18,20,1,19
1390 DATA 9,4,10,10,1,11,11,3,12,12,5,13,13,5,14,14,1,15,15,6,16,16,2,17,17,6,18,18,4,19,19,4,20,20,2,6