home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 4 #3
/
Commodore_Disk_User_Vol.4_3_1991_-.d64
/
aw-modules
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
6KB
|
171 lines
10 rem *********************************
20 rem * *
30 rem * adventure writing series *
40 rem * (c) commodore disk user 1990 *
50 rem * *
60 rem * sample routines from demad *
70 rem * written by jason finch *
80 rem * *
90 rem *********************************
100 :
110 a=a+1
120 ifa=1thenload"aw-modules.mc",8,1: rem ## load machine code
130 ifa=2thenload"pic4",8,1: rem ## load initial picture
140 ifa=3thenload"aw-sample text",8,1:rem ## load some sample text
150 :
160 rem *******************************
170 rem * sys 49152: rasters on *
180 rem * sys 49155: rasters off *
190 rem * sys 49158: display picture *
200 rem * sys 49161,c:display text *
210 rem * sys 49164: scroll text up *
220 rem * sys 49167: clear bitmap *
230 rem * sys 49170: load picture *
240 rem *******************************
250 :
260 poke 53280,0:poke 53281,0: gosub 1180:rem ## set screen cols. and read data
270 print chr$(147);chr$(8):rem ## clear text screen
280 sys 49167:rem ## clear bitmap screen
290 sys 49158:rem ## "decompress" pic.
300 poke 49295,0: sys 49152:rem ## rasters on (with black bar)
310 :
320 :
330 rem *******************************
340 rem * routine to illuminate *
350 rem * bar slowly *
360 rem *******************************
370 :
380 poke 49295,11: for t=1 to 50:next
390 poke 49295,12: for t=1 to 50:next
400 poke 49295,15: for t=1 to 50:next
410 poke 49295,1: for t=1 to 50:next
420 poke 49295,7: for t=1 to 90:next
430 poke 49295,13
440 :
450 sys 49164: sys 49164: sys 49164:rem ## scroll text window
460 poke 2,170: sys 49161,13:rem ## display text - length 170 - colour l.green
470 :
480 rem *******************************
490 rem * this is the input routine - *
500 rem * used to handle the entering *
510 rem * of the text by the player *
520 rem * of your epic adventure. *
530 rem * *
540 rem * usually incorporate it as a *
550 rem * sub-routine and call with *
560 rem * 'gosub' to the right place. *
570 rem *******************************
580 :
590 sys 49164: gosub 1130:rem ## scroll text window
600 print"[158]> ";:c$="":rem ## display prompt
610 print" [157][146]";:rem ## cursor block
620 get z$: if z$="" then 620:rem ## wait for key
630 z=asc(z$): if (z<32 and z<>13 and z<>20) or z>90 then 620:rem ## validity?
640 l=len(c$): if l>35 then 700:rem ## length of input
650 if z$="*" and l=0 then print"[210][197][208][197][193][212] [204][193][211][212][160][195][207][205][205][193][206][196]";:c$=oc$:goto740
660 if z=13 or z=20 then 700:rem ## space or delete pressed
670 z=z-5*(z=34):rem ## alter input if quotes pressed
680 c$=c$+z$: z=z-128*(z>64):rem ## add letter to command
690 print chr$(z);: goto 610:rem ## print letter and go back
700 if z=13 and l>0 then print" ";:oc$=c$:goto740:rem ## end input
710 if z=20 and l>0 then print" [157][157] [157]";: c$=left$(c$,l-1):rem ## delete
720 goto610:rem ## go back for more
730 :
740 if c$>"1" and c$<"5" and l=1 then 870:rem ## if 2/3/4 load picture
750 :
760 sys 49164: gosub 1130:rem ## scroll text window
770 print"[154][207]k. [208]ress 2,3 or 4 to load picture.";
780 sys 49164: gosub 1130
790 print"[154][210]emember to insert correct disk though!";
800 sys 49164: goto 590:rem ## go back for some more text
810 :
820 rem *******************************
830 rem * routine to darken the *
840 rem * bar slowly *
850 rem *******************************
860 :
870 poke 49295,7: for t=1 to 90:next
880 poke 49295,1: for t=1 to 50:next
890 poke 49295,15: for t=1 to 50:next
900 poke 49295,12: for t=1 to 50:next
910 poke 49295,11: for t=1 to 50:next
920 poke 49295,0
930 sys 49167:rem ## clear bitmap screen
940 sys 49155:rem ## rasters off
950 print" "
960 print" "
970 open 15,8,15,"i0":open 2,8,0,"pic"+c$+",p,r": rem ## check disk for pic.
980 input#15,e: close 2: close 15
990 if e>0 then 1040:rem ## not found
1000 print"[212]emporary message: [204][207][193][196][201][206][199][160][208][201][195][212][213][210][197]"
1010 poke 49852,asc(c$):rem ## store pic no. in load routine
1020 sys 49170:rem ## load picture
1030 goto 290: rem ## return to start to display picture etc.
1040 print"[147][212]emporary message: [198][201][204][197] [206][207][212][160][198][207][213][206][196]"
1050 print"[208]ress any key":poke 198,0: wait 198,1: poke 198,0
1060 goto 290
1070 :
1080 rem *******************************
1090 rem * routine to position cursor *
1100 rem * on the bottom line *
1110 rem *******************************
1120 :
1130 poke 781,24:poke 782,0: poke 783,0:sys 65520: return
1140 rem *******************************
1150 rem * a bit of sample data for ya!*
1160 rem *******************************
1170 :
1180 nv=20: nn=20: nl=4: nr=11: rem ## set no. of verbs/nouns/links/rooms
1190 dim v$(nv),n$(nn),l$(nl),d$(nn),il%(nn),w%(nn),d%(nr,8)
1200 :
1210 for x=1 to nn
1220 read n$(x),d$(x),il%(x),w%(x): rem ## read noun/descrip/init loc/weight
1230 next
1240 :
1250 for x=1 to nv: read v$(x): next: rem ## read in verbs
1260 for x=1 to nl: read l$(x): next: rem ## read in linking words
1270 for x=1 to nr: for y=0 to 7
1280 read d%(x,y): rem ## read direction info
1290 next y,x
1300 return
1310 data knife,a sharp knife,-1,10
1320 data knife,a blood-stained knife,0,10
1330 data rat,a rat,9,15
1340 data rat,a dead rat,0,15
1350 data witch,a witch,5,500
1360 data cauldron,a bubbling cauldron,5,500
1370 data coin,a small coin,0,1
1380 data coin,a medium-sized coin,0,2
1390 data coin,a large coin,0,3
1400 data key,a wooden key,0,5
1410 data rocks,some large jagged rocks,1,500
1420 data tree,a tall tree,10,500
1430 data stump,a tree stump,4,500
1440 data grass,a clump of green grass,3,10
1450 data bridge,a bridge,8,500
1460 data plank,a long plank of wood,0,30
1470 data chair,a comfy armchair,6,500
1480 data fireplace,a brick fireplace,6,500
1490 data picture,a picture,6,500
1500 data chest,a large wooden chest,6,500
1510 :
1520 data north,northeast,east,southeast
1530 data south,southwest,west,northwest
1540 data get,drop,inventory,quit
1550 data open,close,kill,examine
1560 data offer,turn,repair,look
1570 :
1580 data small,medium,large,to
1590 :
1600 data 0,0,0,0,3,0,0,0
1610 data 0,0,0,5,4,0,0,0
1620 data 1,0,4,0,0,0,0,0
1630 data 2,0,0,0,8,0,3,0
1640 data 0,0,0,0,0,0,0,2
1650 data 0,0,6,0,0,0,0,0
1660 data 0,0,0,0,11,0,0,0
1670 data 4,0,0,0,0,0,0,0
1680 data 7,0,9,0,0,0,0,0
1690 data 8,0,10,0,0,11,0,0
1700 data 9,0,0,0,10,0,7,0