10 REM >ADVENTURE2
20 REM THE LOST AMULET II - a text adventure
30 REM for the BBC Microcomputer Model B
35 REM By Claude AI 01/08/2026 for 8BS by CJR
40 REM 20 room edition
50 MODE 7
60 PROCsetup
70 PROCtitle
80 REPEAT
90 PROCturn
100 UNTIL FINISHED%=1
110 PRINT
120 PRINT "Thanks for playing!"
130 END
200 DEF PROCsetup
210 DIM RM$(20),EXN(20),EXS(20),EXE(20),EXW(20)
220 DIM OBJ$(5),OBJLOC(5)
230 FOR I%=1 TO 20
240 READ RM$(I%)
250 NEXT I%
260 FOR I%=1 TO 20
270 READ EXN(I%),EXS(I%),EXE(I%),EXW(I%)
280 NEXT I%
290 FOR I%=1 TO 5
300 READ OBJ$(I%),OBJLOC(I%)
310 NEXT I%
320 ROOM%=1
330 DOORLOCKED%=1
340 FINISHED%=0
350 MOV%=0
360 ENDPROC
400 DEF PROCtitle
410 CLS
420 PRINT "*** THE LOST AMULET II ***"
430 PRINT
440 PRINT "A larger cave adventure for the BBC"
442 PRINT "Microcomputer"
450 PRINT
460 PRINT "Find the Golden Amulet hidden deep in"
462 PRINT "the caves and bring it safely back out"
464 PRINT "into the daylight."
470 PRINT
480 PRINT "Type HELP at any time for a list of"
482 PRINT "commands."
490 PRINT
500 ENDPROC
600 DEF PROCturn
610 PROClook
620 REPEAT
630 INPUT "> "A$
640 UNTIL A$<>""
650 SP%=INSTR(A$," ")
660 IF SP%=0 THEN VERB$=A$ ELSE VERB$=LEFT$(A$,SP%-1)
670 IF SP%=0 THEN NOUN$="" ELSE NOUN$=MID$(A$,SP%+1,LEN(A$)-SP%)
680 PROCupper(VERB$)
690 PROCupper(NOUN$)
700 IF VERB$="N" OR VERB$="NORTH" THEN PROCmove("N"):ENDPROC
705 IF VERB$="S" OR VERB$="SOUTH" THEN PROCmove("S"):ENDPROC
710 IF VERB$="E" OR VERB$="EAST" THEN PROCmove("E"):ENDPROC
715 IF VERB$="W" OR VERB$="WEST" THEN PROCmove("W"):ENDPROC
720 IF VERB$="LOOK" OR VERB$="L" THEN ENDPROC
725 IF VERB$="GET" OR VERB$="TAKE" THEN PROCget(NOUN$):ENDPROC
730 IF VERB$="DROP" THEN PROCdrop(NOUN$):ENDPROC
735 IF VERB$="INV" OR VERB$="INVENTORY" OR VERB$="I" THEN PROCinv:ENDPROC
740 IF VERB$="HELP" OR VERB$="?" THEN PROChelp:ENDPROC
742 IF VERB$="OUT" THEN PROCtryexit:ENDPROC
744 IF VERB$="QUIT" THEN PRINT "You abandon your quest and leave the":PRINT "cave forever.":FINISHED%=1:ENDPROC
746 PRINT "I don't understand that."
748 PRINT "Type HELP for a list of commands."
750 ENDPROC
800 DEF PROCmove(D$)
805 LOCAL T%
810 IF D$="N" THEN T%=EXN(ROOM%)
815 IF D$="S" THEN T%=EXS(ROOM%)
820 IF D$="E" THEN T%=EXE(ROOM%)
825 IF D$="W" THEN T%=EXW(ROOM%)
830 IF T%=0 THEN PRINT "You can't go that way.":ENDPROC
835 IF T%=16 AND DOORLOCKED%=1 THEN PROCtrygate:ENDPROC
840 IF T%>=17 AND OBJLOC(2)<>0 THEN PRINT "It's pitch dark that way - you need a":PRINT "light source.":ENDPROC
845 ROOM%=T%
850 MOV%=MOV%+1
855 ENDPROC
900 DEF PROCtrygate
905 IF OBJLOC(1)<>0 THEN PRINT "The gate is locked fast. Perhaps a key":PRINT "would help.":ENDPROC
910 PRINT "You unlock the gate with the rusty key"
912 PRINT "and step through."
915 DOORLOCKED%=0
920 ROOM%=16
925 MOV%=MOV%+1
930 ENDPROC
1000 DEF PROClook
1010 PRINT
1020 PROCprintwrapped(RM$(ROOM%))
1030 PROClistobjects
1040 ENDPROC
1050 DEF PROClistobjects
1060 LOCAL I%,N%
1070 N%=0
1080 FOR I%=1 TO 5
1090 IF OBJLOC(I%)=ROOM% THEN N%=N%+1
1100 NEXT I%
1110 IF N%=0 THEN ENDPROC
1120 PRINT "You can see: ";
1130 FOR I%=1 TO 5
1140 IF OBJLOC(I%)=ROOM% THEN PRINT OBJ$(I%);" ";
1150 NEXT I%
1160 PRINT
1170 ENDPROC
1200 DEF PROCget(N$)
1210 LOCAL I%,F%
1220 IF N$="" THEN PRINT "Get what?":ENDPROC
1230 F%=0
1240 FOR I%=1 TO 5
1250 IF OBJ$(I%)=N$ AND OBJLOC(I%)=ROOM% THEN F%=I%
1260 NEXT I%
1270 IF F%=0 THEN PRINT "I don't see that here.":ENDPROC
1280 IF FNcarried>=4 THEN PRINT "You are carrying as much as you can":PRINT "manage.":ENDPROC
1290 OBJLOC(F%)=0
1300 PRINT "You pick up the ";OBJ$(F%);"."
1310 ENDPROC
1400 DEF FNcarried
1410 LOCAL I%,C%
1420 C%=0
1430 FOR I%=1 TO 5
1440 IF OBJLOC(I%)=0 THEN C%=C%+1
1450 NEXT I%
1460 =C%
1500 DEF PROCdrop(N$)
1510 LOCAL I%,F%
1520 IF N$="" THEN PRINT "Drop what?":ENDPROC
1530 F%=0
1540 FOR I%=1 TO 5
1550 IF OBJ$(I%)=N$ AND OBJLOC(I%)=0 THEN F%=I%
1560 NEXT I%
1570 IF F%=0 THEN PRINT "You are not carrying that.":ENDPROC
1580 OBJLOC(F%)=ROOM%
1590 PRINT "You drop the ";OBJ$(F%);"."
1600 ENDPROC
1700 DEF PROCinv
1710 LOCAL I%,N%
1720 N%=0
1730 PRINT "You are carrying: ";
1740 FOR I%=1 TO 5
1750 IF OBJLOC(I%)=0 THEN PRINT OBJ$(I%);" ";:N%=N%+1
1760 NEXT I%
1770 IF N%=0 THEN PRINT "nothing";
1780 PRINT
1790 ENDPROC
1800 DEF PROChelp
1810 PRINT "Commands understood:"
1820 PRINT "N S E W     - move that direction"
1822 PRINT "LOOK        - look around again"
1824 PRINT "GET <item>  - pick up an item"
1826 PRINT "DROP <item> - put down an item"
1828 PRINT "INV         - list what you carry"
1830 PRINT "OUT         - leave cave (at cave mouth)"
1832 PRINT "QUIT        - give up, end the game"
1840 ENDPROC
1900 DEF PROCtryexit
1910 IF ROOM%<>1 THEN PRINT "You must return to the cave mouth before":PRINT "you can leave.":ENDPROC
1920 IF OBJLOC(3)<>0 THEN PRINT "You step outside, but without the Amulet":PRINT "your quest is unfinished.":FINISHED%=1:ENDPROC
1930 PRINT
1940 PRINT "You step out into the sunlight, the"
1942 PRINT "Golden Amulet held high!"
1944 PRINT "*** YOU HAVE WON! ***"
1946 PRINT "You escaped the caves in ";MOV%;" moves."
1950 FINISHED%=1
1960 ENDPROC
2000 DEF PROCupper(S$)
2010 LOCAL I%,C%,B$
2020 B$=""
2030 FOR I%=1 TO LEN(S$)
2040 C%=ASC(MID$(S$,I%,1))
2050 IF C%>=97 AND C%<=122 THEN C%=C%-32
2060 B$=B$+CHR$(C%)
2070 NEXT I%
2080 S$=B$
2090 ENDPROC
2100 DEF PROCprintwrapped(S$)
2110 LOCAL P%,SEG$
2120 REPEAT
2130 P%=INSTR(S$,"|")
2140 IF P%=0 THEN PRINT S$:S$="" ELSE SEG$=LEFT$(S$,P%-1):PRINT SEG$:S$=MID$(S$,P%+1)
2150 UNTIL S$=""
2160 ENDPROC
9000 DATA "You stand at the mouth of a dark cave.|Daylight glows behind you. A passage|leads north into the gloom."
9010 DATA "You are in a narrow tunnel of damp|rock. Passages continue in several|directions."
9020 DATA "A small alcove holds a glint of metal|among the rubble."
9030 DATA "The passage ends at a rockfall here,|but a way leads south."
9040 DATA "You are in a wide chamber with a low|ceiling. Water drips somewhere close."
9050 DATA "A dusty ledge holds an old, unlit|torch."
9060 DATA "The tunnel forks here, echoing softly|in every direction."
9070 DATA "A crack in the wall lets a thin draft|through, but there is no way onward|except south."
9080 DATA "You are in a cold, damp corridor deep|underground."
9090 DATA "An old sword lies half-buried in the|dust of this passage."
9100 DATA "The path bends sharply here, the rock|walls close and rough."
9110 DATA "A sturdy iron gate blocks the way|south, rusted shut."
9120 DATA "This chamber is silent except for the|drip of unseen water."
9130 DATA "A torn old map lies discarded on the|ground."
9140 DATA "The tunnel narrows sharply, forcing you|to stoop as you pass."
9150 DATA "Beyond the gate the passage continues,|the air growing colder."
9160 DATA "Your torch lights a rough passage,|carved with faint scratches on the|walls."
9170 DATA "Torchlight flickers over a chamber of|wet, black stone."
9180 DATA "The passage narrows here, torchlight|glinting off veins of quartz in the|rock."
9190 DATA "Your torch reveals a small treasure|chamber. Ancient gold glints all|around, and a Golden Amulet rests atop|a stone plinth."
9200 DATA 0,5,2,0
9210 DATA 0,6,3,1
9220 DATA 0,7,4,2
9230 DATA 0,8,0,3
9240 DATA 1,9,6,0
9250 DATA 2,10,7,5
9260 DATA 3,11,8,6
9270 DATA 4,12,0,7
9280 DATA 5,13,10,0
9290 DATA 6,14,11,9
9300 DATA 7,15,12,10
9310 DATA 8,16,0,11
9320 DATA 9,17,14,0
9330 DATA 10,18,15,13
9340 DATA 11,19,16,14
9350 DATA 12,20,0,15
9360 DATA 13,0,18,0
9370 DATA 14,0,19,17
9380 DATA 15,0,20,18
9390 DATA 16,0,0,19
9400 DATA "KEY",3
9410 DATA "TORCH",6
9420 DATA "AMULET",20
9430 DATA "SWORD",10
9440 DATA "MAP",14
