{{htmlmetatags>metatag-robots=() metatag-title=( | ugBASIC User Manual) metatag-keywords=(ugBASIC,Commodore 64,Commodore PLUS/4,ZX Spectrum) metatag-description=(An isomorphic language for retrocomputers) metatag-media-og:image=(:ugbasic:logo-ugbasic-fb.png) metatag-og:title=( | ugBASIC User Manual) metatag-og:description=(An isomorphic language for retrocomputers) }} ====== ugBASIC User Manual ====== ===== ===== ==== PURPOSE ==== ==== SOURCE CODE ==== 1 CLEAR5635 12 GOSUB40000 15 x=2:y=2:lo=1:d1=1 20 DIMbba(3) 21 DIM w$(18) 25 DIMma$(12),ms(12),n1(12),l$(10),kl$(10) 27 FORi=1TO12 28 READma$(i),ms(i),n1(i) 29 NEXTi 30 FORi=1TO18 31 READw$(i) 32 NEXTi 33 FORi=1TO9 34 READl$(i) 35 NEXTi 36 FORi=1TO 10 37 READ kl$(i) 38 NEXTi 39 FOR i=1 TO RND(5) 40 READ be,bf,bg 41 NEXT i 55 GOTO80 60 IF se=1 THEN80 65 CLS7 70 PRINT@195,"MAP COMES WITH EXPERIENCE"; 75 FORn=1TO 3000:NEXTn:GOTO1000 80 PMODE#1,#1:SCREEN#1,#0:PCLS:COLOR#2,#1 90 bb$="BM6,2;D1F1D1L3ND2R2D3G1ND5E1R1NU2R1F1ND5H1U3R2ND2L3U1E1U1L1" 95 DRAW"S8"+bb$ 96 GET(2,2)-(16,20),bba,G 100 IF se=0 THEN1000 105 LINE(0,0)-(254,190),PSET,B 110 aa$="BM0,48;E7R4E3U4E3R3E4U4R4D4G6L3G2D5G2L1G2L4G8U4" 120 DRAW"S8"+aa$ 130 DRAW"BM71,80;R4E4R1E3R2E1R2F1R2F7R2L2BL8L10E3R3F2" 150 DRAW"BM152,45;E8U4E5R5F2D1F3D4G2D1F4D1G5L4G2L12H1L2H1L1H3U1E2R4BR5E5R5D3F2G3L5U1H3" 170 DRAW"BM96,132;U6R6U6R6U6R6U6R6U6R6D3L3D6L6D6L6D6L6D6L6D3L2" 190 DRAW"BM80,40;E10F8H4E8F6G3E5F4" 210 DRAW"BM74,65;E8H3G3E4F2E7F10H5G5F5H8G2" 230 DRAW"BM174,156;U12L3E2U2R3D2R3U2R3D2R3U2R3D2F2L3D6R3D2R3U2R3D2R3U2R3D2R3U2R3U23L3E2U2R3D2R3U2R1BD34L31U4H3L1G3D4L2NR10L6G3D1R49BU3" 250 DRAW"BM52,148;U22R10D4BL3H1L2G1D1F1R2E1BR3D17L9" 280 DRAW"BM76,165;U4L1E3F3L1D4L3" 290 DRAW"BM90,170;U4L1E3F3L1D4L3" 300 DRAW"BM80,178;U4L1E3F3L1D4L3" 310 DRAW"BM64,184;U4L1E3F3L1D4L3" 330 DRAW"BM92,186;U4L1E3F3L1D4L3" 350 DRAW"BM10,78;U7NG3NF3U3NG3NF3U1" 360 DRAW"BM10,108;U7NG3NF3U3NG3NF3U1" 370 DRAW"BM32,68;U7NG3NF3U3NG3NF3U1" 380 DRAW"BM32,96;U7NG3NF3U3NG3NF3U1" 400 DRAW"BM50,72;U7NG3NF3U3NG3NF3U1" 410 DRAW"BM68,24;U7NG3NF3U3NG3NF3U1" 420 DRAW"BM68,50;U7NG3NF3U3NG3NF3U1" 460 PAINT(2,48),3,2 470 PAINT(152,56),3,2 480 PAINT(98,130),4,2 490 PAINT(180,136),,2 500 PAINT(188,150),4,2 510 PAINT(180,160),3,2 530 PAINT(78,163),4,2 540 PAINT(92,169),4,2 550 PAINT(82,177),4,2 560 PAINT(66,183),4,2 570 PAINT(94,180),4,2 580 PAINT(62,118),,2 590 PAINT(62,114),4,2 600 PAINT(96,78),4,2 610 DRAW"S8C1"+bb$ 620 PUT(x,y)-(x+14,y+18),bba,PSET 650 FORn=1TO2000:NEXTn 1000 CLS5 1010 PRINT@0,"WHAT NOW, PENDRAGON?";:PRINT@64,"1.PROCEED";:PRINT@128,"2.REST";:PRINT@192,"3.STATUS";:PRINT@256,"4.MAP"; 1015 PRINT@384,"ENTER:1/2/3/4" 1020 c$=INKEY$ 1030 IF c$="1" THEN2000 1040 IF c$="2" THEN 3000 1050 IF c$="3" THEN 10000 1060 IF c$="4" THEN 60 1080 GOTO1020 2000 CLS3:GOTO9000 2002 PRINT@12,"proceed:";:PRINT@77,"NORTH ";:PRINT@104,"WEST";:PRINT@116,"EAST";:PRINT@141,"SOUTH ";:PRINT@238,"HALT"; 2003 a$=INKEY$ 2004 IF a$="N" THEN2020 2005 IF a$="S" THEN2030 2006 IF a$="W" THEN2050 2007 IF a$="E" THEN2040 2008 IF a$="H" THEN1000 2009 GOTO2003 2010 INPUTa$ 2020 y=y-16:lo=lo-16:IF y<2 THEN: y=2:lo=lo+16:ENDIF 2025 GOTO2065 2030 y=y+16:lo=lo+16:IFy>164THEN:y=164:lo=lo-16:ENDIF 2035 GOTO2065 2040 x=x+16:lo=lo+1:IFx>252THEN:x=252:lo=lo-1:ENDIF 2045 GOTO2065 2050 x=x-16:lo=lo-1:IFx<2THEN:x=2:lo=lo+1:ENDIF 2065 lx=0 2066 m=m+1:bf=bf-1:bd=bd+2 2071 GOTO2900 2075 IF lo=3ORlo=18ORlo=33ORlo=34THEN:lx=1:IFlx=1THEN30000:ENDIF 2076 IFlo=5ORlo=21ORlo=37ORlo=49ORlo=50ORlo=51ORlo=52ORlo=65ORlo=66ORlo=67ORlo=81ORlo=82ORlo=83ORlo=97THEN:lx=2:IFlx=2THEN30000:ENDIF 2077 IFlo=8ORlo=22ORlo=23ORlo=24ORlo=25ORlo=38ORlo=39ORlo=40ORlo=54ORlo=55THEN:lx=3:IFlx=3THEN30000:ENDIF 2078 IFlo=70ORlo=71THEN:lx=4:IFlx=4THEN30000:ENDIF 2079 IFlo=12ORlo=27ORlo=28ORlo=29ORlo=41ORlo=41ORlo=43ORlo=44ORlo=45ORlo=57ORlo=58ORlo=59ORlo=60THEN:lx=5:IFlx=5THEN30000:ENDIF 2080 IFlo=75ORlo=90ORlo=91ORlo=104ORlo=105ORlo=106ORlo=119ORlo=120THEN:lx=9:IFlx=9THEN30000:ENDIF 2081 IFlo=100ORlo=101ORlo=116ORlo=117ORlo=132ORlo=133THEN:lx=6:IFlx=6THEN30000:ENDIF 2082 IFlo=148ORlo=149ORlo=150ORlo=165ORlo=166ORlo=167THEN:lx=7:IFlx=7THEN30000:ENDIF 2083 IFlo=123ORlo=124ORlo=125ORlo=139ORlo=140ORlo=141ORlo=142ORlo=143ORlo=144ORlo=155ORlo=156ORlo=157ORlo=158ORlo=159ORlo=160THEN:lx=8:IFlx=8THEN30000:ENDIF 2086 IF lx>0 THEN30000 2100 GOTO2000 2900 ' rf=RND(TI) DIM rf AS FLOAT RANDOMIZE TIMER rf=RND(100)/100 2910 IF rf>0.75 THEN: GOTO 24999:ENDIF 2920 IF rf<0.45 THEN: GOTO 20000:ENDIF 2930 PRINT@361,"NOTHING.CONTINUE"; 2940 FORn=1TO1000:NEXTn 2950 GOTO2075 3000 GOTO9200 3002 GOTO3100 3004 re=0 3005 CLS0 3006 FORn=1TO25 3007 PRINT@(RND(500)),CHR$(122); : 'INT(RND(TI)*500) 3008 NEXTn 3010 be=be+RND(10) 3030 bf=bf+RND(10) bh=bh-RND(10):IF bh<=0 THEN: bh=0 : ENDIF 3045 IF be>=75 THEN: be=75 : ENDIF 3050 IF bf>=75 THEN: bf=75 : ENDIF 3055 du=du+re/2:dv=dv+re : 'INT(re/2) 3060 FORn=90TO250STEP20:SOUND155,4 3070 NEXTn 3080 CLS 3090 GOTO1000 3100 re=RND(100): 're=INT(RND(TI)*100) 3110 IF re>40THEN3150 3120 GOTO3004 3150 CLS0 3159 zy$=CHR$(128) 3160 PRINT@160,"the";zy$;"forces";zy$;"of";zy$;"evil";zy$;"are";zy$;"too";zy$;"close";:PRINT@233,"no";zy$;"time";zy$;"to";zy$;"rest"; 3170 FORn=1TO2000:NEXTn 3180 GOTO1000 4000 CLS0 4010 PRINT@174,"at"; 4020 PRINT@(224+(15-(LEN(l$(lx))/2))),l$(lx); 4200 PRINT@492,"press";zy$;"p"; 4202 GOSUB20700 4210 GOTO2000 6000 CLS8 6010 PRINT@73,"YOU HAVE BEEN";:PRINT@140,"ATTACKED"; 6020 ' IF n1>=1 AND RND(TI)<0.5 THEN 6030 zb=zb-2:IF zb<=0 THEN 25480 6040 rf=RND(10)+1 : ' rf=INT(RND(TI)*10+1) 6050 ON rf GOTO6060,6070,6080,6090,6100,6110,6120,6130 6060 PRINT@230,"IT SWINGS AND MISSES";:GOTO6190 6070 PRINT@229,"YOU DEFLECT THE BLOW";:GOTO6190 6080 PRINT@234,"BUT HESITATES";:GOTO6190 6090 PRINT@235,"A BODY BLOW";:dx=5:GOTO6190 6100 PRINT@233,"A HEAD WOUND";:dx=8:GOTO6190 6110 PRINT@233,"A CHEST WOUND";:dx=6:GOTO6190 6120 PRINT@234,"A BLOW TO ARM";:dx=4:GOTO6190 6130 PRINT@235,"A BODY BLOW";:dx=3:GOTO6190 6140 PRINT@236,"LEGS HIT"; 6150 IF RND(100)<50 THEN6180 : ' IF RND(TI)<0.5 THEN6180 6160 dx=5 6180 PRINT@232,"SAVED BY ARMOUR!"; 6190 be=be-dx:bf=bf-(dx/2): ' be=be-dx:bf=bf-INT(dx/2) 6195 IF be<=0 THEN7000 6196 IF bf<=0 THEN7000 6198 FORn=1TO2000:NEXTn 6200 GOTO25210 7000 CLS3 7020 IF di=1 THEN8600 7030 PRINT@32,"*LIFE HAS FLED YOUR MORTAL BODY*";:PRINT@102,"SUCH AN INCOMPETENT";:PRINT@169,"WAS NOT WORTHY";:PRINT@234,"OF THE NAME";:PRINT@299,"pendragon"; 7040 PLAY"O1V31T2L4GGL8GGL4B-AAGGF+G" 7045 FORN=1TO8 7050 PRINT@480," " 7055 NEXTN 7060 PRINT@489,"HOW YOU RATED":PRINT@480," ":PRINT@490,"EXPERIENCE:";bd:PRINT@40," ":PRINT@493,"GOLD:";bh: 7065 FORN=1TO6 7070 PRINT@480," " 7075 NEXTN 7080 RA=INT(((bd*(bh+1))+(di*5)+(DG*8)+(DD*10))/(m/10)) 7085 PRINT@298,"YOUR RATING:";RA: 7090 FORN=1TO2000:NEXTN 7100 PRINT@356,"IF YOU HAD THE CHANCE OF";:PRINT@393,"REINCARNATION";:PRINT@418,"WOULD YOU LIKE TO TRY AGAIN";:PRINT@459,"YES OR NO"; 7102 FORN=1TO3 7103 PRINT@480," " 7104 NEXTN 7110 a$=INKEY$ 7120 IF a$="y" THEN7140 7130 GOTO7110 7140 RUN 8000 IF WA=1 THEN2000 8010 CLS8:OM=0 8030 IF DD=1 THEN8070 8040 PRINT@39,"YOU WILL NEED THE";:PRINT@104,"NECROMANCERS MAP"; 8050 FORN=1TO2000:NEXTN 8060 GOTO2000 8070 IF DG=1 THEN8105 8080 PRINT@39,"YOU WILL NEED THE";:PRINT@105,"RING OF POWER"; 8090 FORN=1TO2000:NEXTN 8100 GOTO2000 8105 OM=INT(RND(TI)*20) 8110 PRINT@195,"THE WATER OF LIFE AWAITS";:PRINT@229,"WHAT IS THE MAGIC WORD"; 8120 GOSUB51000 8130 IF SP=1 THEN8190 8140 CLS7 8145 PRINT@235,"YOU FAILED"; 8150 FORN=1TO1000:NEXTN 8160 GOTO2000 8190 CLS0:WA=1 8200 R$=CHR$(128) 8210 PRINT@108,"YOU";R$;"HAVE";:PRINT@168,"THE";R$;"WATER";R$;"OF";R$;"LIFE"; 8220 FORN=1TO2000:NEXTN 8230 GOTO2000 8300 IF DG=1 THEN2000 8305 CLS8 8310 PRINT@41,"AT CAVE OF DOOM";:PRINT@70,"DO YOU WISH TO ENTER";:PRINT@108,"YES/NO?"; 8312 a$=INKEY$ 8313 IF a$="y" THEN8317 8314 IF a$="N" THEN30420 8315 GOTO8312 8317 IF CB=1 THEN 8320 8318 PRINT@292,"NO USE. YOU HAVE NO LAMP"; 8319 GOTO30420 8320 rf=RND(3) 8330 ON rf GOTO8340,8360,8360 8340 CLS8 8350 GOTO20500 8360 PRINT@294,"SOMETHING EVIL HERE";:PRINT@323,"DRAINING YOUR MAGIC POWERS"; 8370 BG=BG-INT(BG/10) 8380 GOTO30420 8400 CLS8 8405 IF di=1 THEN2000 8410 PRINT@44,"AT LAKE";:PRINT@70,"DO YOU WISH TO CROSS";:PRINT@105,"TO THE ISLAND?";:PRINT@140,"YES/NO?"; 8415 a$=INKEY$ 8420 IF a$="y" THEN8435 8425 IF a$="N" THEN30520 8430 GOTO8415 8435 IF CL=1 THEN 8450 8440 PRINT@292,"NO USE. YOU HAVE NO BOAT"; 8445 GOTO30520 8450 rf=RND(3) 8455 ON rf GOTO 8460,8470,8470 8460 CLS8 8465 GOTO20475 8470 GOTO8360 8500 IF DD=1 THEN2000 8505 CLS8 8510 PRINT@38,"AT TOWER OF THE EYE ";:PRINT@70,"DO YOU WISH TO ENTER";:PRINT@108,"YES/NO?"; 8515 a$=INKEY$ 8520 IF a$="y" THEN8535 8525 IF a$="N" THEN30665 8530 GOTO8515 8535 IF CM=1 OR CA=1 THEN 8550 8540 PRINT@294,"NO USE. YOU HAVE NO";:PRINT@334,"ROPE"; 8545 GOTO30665 8550 rf=RND(3) 8555 ON rf GOTO8560,8570,8570 8560 CLS8 8565 GOTO20525 8570 GOTO8360 8600 FORN=1TO8 8610 CLSN 8615 FORM=1TO20 8620 OO$="O3L2GBO4CDL4CO3BAG" 8621 NEXTM 8625 PLAY"T255V10"+OO$:PLAY"T255V20"+OO$:PLAY"T255V30"+OO$ 8630 NEXTN 8640 PRINT@8,"THE SHIELD OF LIFE";:PRINT@43,"SAVED YOU"; 8645 PRINT@162,"MAGIC ALL GONE AND VERY WEAK"; 8650 be=20:bf=20:BG=0:di=0 8655 FORN=1TO4000:NEXTN 8660 GOTO2000 9000 IF be<=0 THEN 7000 9010 IF bf<=0 THEN9100 9015 IF WA=1 AND lo=1 THEN9300 9016 IF WA=1 AND lo=2 THEN9300 9017 IF WA=1 AND lo=17 THEN9300 9030 IF bd>10 THEN SE=1 9040 GOTO2002 9100 CLS3 9110 PRINT@231,"YOU ARE TOO WEAK";:PRINT@262,"REST AND RECUPERATE"; 9120 FORN=1TO2000:NEXTN 9130 GOTO1000 9200 CLS5 9202 IF bh<=0 THEN 9230 9204 GOTO3002 9230 PRINT@232,"NO GOLD-NO REST"; 9240 FORN=1TO2000:NEXTN 9260 IF bf<=0 THEN7000 9270 GOTO1000 9280 RETURN 9300 CLS4 9310 FORN=1TO100 9320 PLAY"T255AC" 9330 NEXTN 9340 PRINT@66,"YOU ARE PENDRAGON THE MIGHTY"; 9350 PRINT@138,"YOU HAVE WON"; 9360 PRINT@224," EXPERIENCE:";bd:PRINT@245,"GOLD:";bh; 9370 RA=INT(((bd*(bh+1))+(di*5)+(DG*8)+(DD*10)+(WA*500))/(m/10)) 9380 PRINT@360,"YOUR RATING:"RA; 9390 GOTO9390 10000 CLS0 10050 IF be<0 THEN be=0 10055 IF bf<0 THEN bf=0 10100 PRINT@10,"";:PRINT@74,"POWER STATUS";: 10110 PRINT@128,"EXPERIENCE: ";bd:PRINT@160,"HEALTH : ";be:PRINT@192,"STRENGTH : ";bf:PRINT@224,"MAGIC ":PRINT@256,"POWERS : ";BG: 10120 PRINT@288,"GOLD : ";bh 10130 PRINT@421,"SEE INVENTORY?YES/NO?"; 10145 C$=INKEY$ 10150 IFC$="N"THEN1000 10160 IFC$="y"THEN10170 10165 GOTO10145 10170 CLS 10175 IF BG<=0 THEN DH=0 10180 PRINT@10,"POSSESSIONS:"; 10190 PRINT@69,"ROPE :";CA;:PRINT@101,"LAMP :";CB;:PRINT@133,"BOAT :";CL;:PRINT@261,"CLOAK OF INVISIBILITY:";DF; 10191 PRINT@293,"PRECIOUS STONES :";GP;:PRINT@325,"NECROMANCERS MAP :";DD;:PRINT@357,"RING OF POWER :";DG;:PRINT@389,"SHIELD OF LIFE :";di;:PRINT@421,"POWER STONES :";DH;:PRINT@490,"PRESS ENTER"; 10192 SCREEN0,1 10200 a$=INKEY$ 10202 IF a$=CHR$(13) THEN1000 10210 GOTO10200 20000 TX=0 20030 rf=INT(RND(TI)*13+1) 20040 CLS7 20050 PRINT@9,"SOMETHING HERE";:PRINT@73,"DO YOU SEARCH?";:PRINT@141,"YES/NO"; 20060 a$=INKEY$ 20070 IF a$="y" THEN 20090 20080 IF a$="N" THEN 2075 20085 GOTO20060 20090 CLS5 20100 ON rf GOTO20300,20110,20130,20150,20180,20210,20285,20300,20320,20340,20360,20455,20375 20110 PRINT@203,"WATER HERE";:PRINT@262,"YOU DRINK YOUR FILL"; 20120 DE=RND(15):be=be+DE:IF be>75 THEN be=75 20122 GOSUB20750 20125 GOTO21050 20130 PRINT@205,"FOOD";:PRINT@329,"EAT YOUR FILL"; 20140 OD=RND(15):bf=bf+OD:IF bf>75 THEN bf=75 20142 GOSUB20750 20145 GOTO21050 20150 PRINT@109,"A ROPE"; 20160 GOSUB21000 20165 IF NO=1THEN2075 20170 CA=CA+TX:IF CA>1 THEN CA=1 20175 GOTO21050 20180 PRINT@109,"A LAMP"; 20190 GOSUB21000 20195 IF NO=1THEN2075 20200 CB=CB+TX:IF CB>1 THEN CB=1 20205 GOTO20150 20210 PRINT@109,"A BOAT"; 20215 GOSUB21000 20217 IF NO=1THEN2075 20220 CL=CL+TX:IF CL>1 THEN CL=1 20225 GOTO21050 20285 G=INT(RND(TI)*20)+1 20287 PRINT@102,G;"PRECIOUS STONES"; 20290 GOSUB21000 20291 IF NO=1THEN2075 20292 GP=GP+(G*TX) 20295 GOTO21050 20300 LD=INT(RND(TI)*30)+2 20305 PRINT@100,"A CACHE OF";LD;"GOLD PIECES"; 20310 GOSUB21000 20311 IF NO=1THEN2075 20315 bh=bh+(LD*TX):GOTO21050 20320 dv=INT(RND(TI)*7+3) 20325 PRINT@104,dv;" POWER STONES"; 20330 GOSUB21000 20331 IF NO=1THEN2075 20335 DH=DH+(dv*TX):BG=BG+((dv*TX)*RND(5)):GOTO21050 20340 PRINT@101,"A PLACE OF EVIL POWER"; 20345 BG=BG-RND(10):IF BG<=0 THEN BG=0 20347 GOSUB20750 20350 GOTO21050 20360 PRINT@108,"A TRAP";:PRINT@195,"ESCAPING HAS WEAKENED YOU!"; 20365 bf=bf-RND(7):IF bf<=0 THEN bf=0 20367 GOSUB20750 20370 GOTO21050 20375 PRINT@106,"AN AMBUSH!";:PRINT@163,"YOU HAVE LOST SOME OF YOUR";:PRINT@226,"POSSESSIONS WHILST FIGHTING";:PRINT@298,"YOUR WAY OUT"; 20380 DH=DH-RND(7):IF DH<=0 THEN DH=0 20381 bh=bh-RND(20):IF bh<=0 THEN bh=0 20382 UW=RND(4):IF UW<2 THEN CA=0 AND CL=0 20383 UX=RND(4):IF UX<2THEN CJ=0 AND CB=0 20384 GOSUB20750 20385 GOTO21050 20455 IF DF=1 THEN20000 20460 PRINT@99,"THE CLOAK OF INVISIBILITY"; 20465 GOSUB21000 20466 IF NO=1THEN2075 20470 DF=1:GOTO21050 20475 IF lx<>5 THEN 20000 20480 IF di=1 THEN20000 20485 PRINT@102,"THE SHIELD OF LIFE"; 20490 GOSUB21000 20491 IF NO=1THEN2075 20495 di=1:GOTO21050 20500 IF lx<>4 THEN20000 20505 IF DG=1 THEN 20000 20510 PRINT@102,"THE RING OF POWER"; 20515 GOSUB21000 20516 IF NO=1THEN2075 20520 DG=1:GOTO21050 20525 IF lx<>6 THEN20000 20530 IF DD=1 THEN 20000 20535 PRINT@102,"THE NECROMANCERS MAP"; 20540 GOSUB21000 20541 IF NO=1THEN2075 20545 DD=1:GOTO21050 20600 NO=0:a$=INKEY$ 20610 IF a$="y" THEN21045 20620 IF a$="N" THEN NO=1:GOTO21046 20630 GOTO20600 20700 a$=INKEY$ 20710 IF a$="P" THEN RETURN 20720 GOTO20700 20750 FORN=1TO1500:NEXTN 20755 RETURN 21000 PRINT@297,"DO YOU TAKE IT";:PRINT@333,"YES/NO"; 21010 GOTO20600 21045 TX=1:bf=bf-3 21046 RETURN 21050 GOTO2075 24014 NEXTJ 24999 PRINT@390,"BEWARE!YOU HAVE MET"; 25010 rf=INT((RND(TI)*12)+1) 25080 XC$=RIGHT$(ma$(rf),LEN(ma$(rf))-1) 25090 PRINT@(448+(32-LEN(XC$))/2),XC$; 25100 FORN=1TO2000:NEXTN 25110 PRINT@384," ":PRINT@416," ":PRINT@448," " 25120 zb=INT(MS(rf)*D1) 25125 ZA=INT(bf*((bd*2)/100)) 25126 XP=INT((zb+1)/(ZA+1))*2 25200 IFRND(TI)<0.6ORDF=1THEN25210:ELSE25375 25205 DZ=0 25210 CLS4 25211 IF be<=0 THEN 7000 25212 IF bf<=0 THEN be=be-be 25215 DZ=DZ+INT((bd*(bf*.5))/100):IF DZ>25 THEN DZ=25 25220 T=0:dx=0:IF zb<=0 THEN 25480 25221 CLS4 25222 PRINT@133,"ATTACK OR CAST A SPELL"; 25223 KL=RND(10)-1 25224 PRINT@RND(127),KL; 25225 a$=INKEY$ 25230 IF a$=KL$(KL+1) THEN 25300 25240 IF a$="S" THEN29350 25250 T=T+1:IF T>100 THEN25265 25260 GOTO25225 25265 CLS4 25270 dx=5:PRINT@204,"TOO SLOW";:PRINT@296,"YOU ARE WOUNDED"; 25280 GOSUB25450 25281 IF be<=0THEN7000 25282 IF bf<=0THEN9100 25283 IF ZA<=0THEN25510 25290 GOTO6000 25300 CLS4 25310 IF T<25 THEN rf=1 25311 IF T>24 AND T<28 THEN rf=2 25312 IF T>27 AND T<35 THEN rf=3 25313 IF T>34 THEN25265 25320 ON rf GOTO25325,25340,25355 25325 DZ=INT((DZ+10)/(MS(rf)/10)):dx=0:PRINT@201,"A MIGHTY BLOW";:GOSUB25450 25326 IF be<=0THEN7000 25327 IF bf<=0THEN9100 25328 IF ZA<=0THEN25510 25335 GOTO25210 25340 DZ=INT((DZ+8)/(MS(rf)/10)):dx=1:PRINT@201,"A SWIFT STRIKE"; 25345 GOSUB25450 25346 IF be<=0THEN7000 25347 IF bf<=0THEN9100 25348 IF ZA<=0THEN25510 25350 GOTO25210 25355 DZ=INT((DZ+6)/(MS(rf)/10)):dx=2:PRINT@201,"HALF REPELLED";:GOSUB25450 25356 IF be<=0THEN7000 25357 IF bf<=0THEN9100 25358 IF ZA<=0THEN25510 25360 GOTO25210 25375 CLS4 25380 PRINT@133,"SURPRISE ON YOUR SIDE";:dx=10: 25385 PRINT@201,"ATTACK OR RUN!";:PRINT@232,"OR CAST A SPELL"; 25390 a$=INKEY$ 25395 IF a$="A" THEN25300 25398 IF a$="S" THEN29350 25400 IF a$="R" THEN25420 25405 T=T+1:IF T>50 THEN 25265 25410 GOTO25390 25420 RU=RND(TI):IF TI<0.5 THEN 25210 25425 CLS 25430 PRINT@205,"LUCKY";:PRINT@233,"YOU ESCAPED!";:PRINT@300,"YOU COWARD"; 25433 FORN=1TO1000:NEXTN 25435 bd=bd-3 25440 GOTO2950 25450 zb=zb-DZ: 25460 be=be-dx:bf=bf-INT(dx/2) 25470 FORN=1TO2500:NEXTN 25475 RETURN 25480 CLS4 25482 bd=bd+2+XP 25485 PRINT@137,"WE SALUTE YOU";:PRINT@203,"pendragon";:PRINT@265,"MIGHTY WARRIOR"; 25495 FORN=1TO1000:NEXTN 25500 GOTO2950 25510 CLS4 25520 PRINT@199,"BATTLE INDECISIVE!"; 25525 FORN=1TO1000:NEXTN:GOTO2950 25530 FORN=1TO750:NEXTN:GOTO1000 25550 PRINT@203,"pendragon";:PRINT@229,"ON YOUR WAY VICTORIOUS"; 25560 bf=bf+(ZX-ZA): 25570 FORN=1TO750:NEXTN:RETURN 28000 CLS8 28010 PRINT@231,"TOO WEAK TO ATTACK"; 28020 FORN=1TO750:NEXTN 28030 PRINT@296,"YOU ARE KILLED!!"; 28040 FORN=1TO750:NEXTN 28050 RUN 29350 CLS0 29360 IFBG>10THEN29600 29370 PRINT@233,"POWER TOO WEAK"; 29380 FORN=1TO750:NEXTN:MS=MS+10 29390 GOTO25270 29500 FORN=1TO8 29510 CLSN:GOSUB29550 29520 NEXTN 29530 RETURN 29550 FORX=1TO10 29560 X3=INT(RND(TI)*63):Y3=INT(RND(TI)*31) 29570 SET(X3,Y3,N-1) 29580 NEXTX 29590 RETURN 29600 CLS6 29605 L1$="ALL HAIL PENDRAGON" 29610 PRINT@10,"*CAST SPELL*"; 29620 GOSUB51000 29630 IF SP<1 THEN29992 29640 CLS6 29645 BG=INT(BG*0.9)-T:IF BG<=0 THEN BG=0 29646 bd=bd+INT(n1/5) 29650 PRINT@326,L1$; 29660 FORN=1TO25:SOUND225,1 29670 NEXTN 29680 GOTO2000 29992 CLS6 29995 BG=INT(BG*0.75)-T:IF BG<=0 THEN BG=0 29997 GOTO25210 30000 PMODE1,3:SCREEN1,0:PCLS 30010 P1$="BM0,154;E3F2E2F2E2F2E2F2E2F2R2H3U39G2L3G1L3G1L3G1L3G1L2R2E1R3E1R3E1R3E1R3E3R3E2R3E4R2E4R2E3U2H1U2H1U4H1U2H1U3H1U3" 30020 P2$="BM88,36;E4R2E6F2E6F3R2F5NG5E3R2E2R1F6NG8R1E2R1E2R4E1R3F1R1F2NG3E2R1E2R2E1R4F4NG4E1R2F1R1E1" 30023 P4$="BM182,172;R3D3L3NU2D4BR6U7R3D3L3F4BR2U7NR3D3NR2D4R3BR2R3U4L3U3R3BR2R3L3D3R3D4NL3BR6U7R3D3L2" 30025 LINE(0,0)-(254,190),PSET,B 30030 ON lx GOTO 30100,30200,30300,30400,30500,30600,30700,30800,30900 30100 DRAWP1$ 30110 DRAWP2$ 30120 DRAW"BM72,54;F4R2F2R2F1R1F1R1F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R2F1R1" 30130 DRAW"BM40,86;R1F3R2F4R2F5R2F5R3F3R2F5R2F4R2F4R2F3D1F6D1F8" 30140 PAINT(12,100),4,4 30145 PAINT(120,4),3,4 30150 PAINT(140,100),3,4 30155 PAINT(4,180),2,4 30156 DRAW"C2"+P4$ 30160 GOSUB20700 30165 D1=2 30170 GOTO4000 30200 DRAWP1$ 30220 DRAW"BM84,48;F3R2F1R2F2R3F1R2F1R2F1R2F1R2F1R2F1R2E1R2E1R2E1R2E1R2E1R2E1R2E1R2E4R1E1R1E2R1E2R1E2U3H1U2H2U3H2U3H2" 30230 DRAW"BM118,64;F3D1F1D1F1D37G4R3E3F3E3F3E3F3E4F4R3H4U39E1U2E1U1E1GD1F2R3F1R3F1R3E1R3E1R3U1R4" 30240 DRAW"BM192,72;F4D12G2R2E2F1R1E1F2R2H2U12E1U1E2U1R3F1R1F1D3F3D3F2D36G4R3E3F4" 30250 DRAW"BM202,48;F3R1F2R1F2R1F2R1F2R1F2R1F3R2F1R1" 30260 PAINT(16,100),4,4 30270 PAINT(152,100),4,4 30275 PAINT(206,80),4,4 30280 PAINT(252,112),4,4 30282 PAINT(100,180),2,4 30283 DRAW"C3"+P4$ 30285 GOSUB20700 30290 GOTO4000 30300 DRAW"BM0,48;E13R2E2F2E5F5D2F1D2F3D3F3NG3E6R2E1R2E5F8R2F1R1F4R3F4NG6E14R1E7F8R2F1R2F1R2E1R2E11" 30310 DRAW"BM0,158;E1U2E6U1E3U1E1U1E1H2U2E4R1E2R3E1R3E2R1E2R1E2R1E1R1E1R2E5R1E1R1E1R1E5R1F1R2F1R3F1R2F1R2F4R1F1R1F1R1F4R1F1R1F1R1F1R1F1NG10E3R2E1R2E1R2E4R2E1R1E2R1F7NG5E3R2E1R2E2" 30320 DRAW"BM76,86;G10L1G2L1G2L4G2F3D2G1D2G1D2G2D3G1D2F5R2F1R2F1R2F2R2F3R2F4D1" 30330 DRAW"BM80,114;R8F3NL7D6L4U3L2D3NR1L2U6H3D6F2" 30350 PAINT(4,4),3,4 30360 PAINT(20,172),2,4 30365 PAINT(88,118),2,4 30370 PAINT(88,122),2,4 30375 PAINT(82,122),2,4 30376 DRAW"C3"+P4$ 30380 GOSUB20700 30390 GOTO4000 30400 GOTO8300 30420 FORN=1TO1500:NEXTN:GOTO4000 30500 GOTO8400 30520 FORN=1TO1500:NEXTN:GOTO4000 30600 DRAW"BM0,52;E1R2E2R2E4R2F7NG8E2R2E1R2E2R2E3R1E2R2E1R2E1R2E4F12NG5E5R3E4R3E6F4" 30605 DRAW"BM0,72;F3R2F3R2F3R2F3" 30610 DRAW"BM0,90;F4R2F3R2F3R1F1H1L1H2R3F1R1F1R4F1R3F3R2F1R2F1R2F1R2F3G3D1G3D1G4F2D2F1R1F3R1F5R3F1R3F4" 30615 DRAW"BM16,102;R9F1R4F1R3F1R3F1R3F1R2F1R2F2R1F1R1F6D1G2F2R6F1R4F1R3F1R3F2R39F3R3F1R2F1R3F1R2" 30620 DRAW"BM218,40;F2NF4D1ND52L3G1L3G1L4G1L3G1L2H1L3H1L4H1L3H1L3ND52L1NG3E19F16E2R2E3R2E4R2E3" 30625 DRAW"BM170,72;E2R2E1R6F1R2F2G2L2G1L6H1L2H1" 30630 PAINT(12,12),3,4 30635 PAINT(120,160),2,4 30640 PAINT(180,100),2,4 30642 PAINT(192,44),2,4 30645 PAINT(184,72),4,4 30646 DRAW"C3"+P4$ 30650 GOSUB20700 30660 GOTO8500 30665 FORN=1TO1500:NEXTN:GOTO4000 30700 DRAWP1$ 30710 DRAW"BM40,94;R21H5U13NR6D13L3NU12H5NU5F5R9NU12R4BU7U6R8D5L8BD7D1R14U11NR5U11NL14H8NL10F8D22L19F5R19D6L18F17R4H3U49E16NR45F16NR29G15NH16NR44D16BR15R22D17L21U17BL15L1D35NR44H3U35H11D35F11L4F14BL22L1H42L4" 30720 PAINT(20,100),4,4 30725 PAINT(72,100),2,4 30730 PAINT(120,4),3,4 30735 PAINT(100,46),2,4 30740 PAINT(78,64),4,4 30745 PAINT(100,62),3,4 30750 PAINT(200,12),2,4 30755 PAINT(164,24),2,4 30760 PAINT(220,44),2,4 30765 PAINT(140,56),2,4 30770 PAINT(200,80),2,4 30775 PAINT(144,100),4,4 30780 PAINT(216,116),3,4 30784 DRAW"C3"+P4$ 30785 GOSUB20700 30790 GOTO4000 30800 DRAW"BM0,66;F7NG3E4F6E2F3" 30810 DRAW"BM200,0;G4R7D41L7D3L7U3L7D3L7U3L7D3L7U3L7U15R7H5U4L7D3L7U3L7D3L7U3L7D4G5R7D38R5NG27NR20U12E5R11F5D12NF27R78" 30820 DRAW"BM44,118;G18R14" 30830 DRAW"BM118,154;R69" 30840 DRAW"BM118,88;E14F8NG3E14F1E4F2" 30850 PAINT(4,4),3,4 30855 PAINT(72,72),2,4 30860 PAINT(34,140),3,4 30865 PAINT(76,120),4,4 30870 PAINT(160,144),3,4 30875 PAINT(76,160),2,4 30876 DRAW"C2"+P4$ 30880 GOSUB20700 30890 GOTO8000 30900 GOTO4000 40000 CLS0 40010 R$=CHR$(128) 40020 PRINT@33,CHR$(238);:PRINT@62,CHR$(237);:PRINT@449,CHR$(235);:PRINT@478,CHR$(231); 40040 PRINT@139,"pendragon";:PRINT@233,"water";R$;"of";R$;"life"; 40045 PRINT@335,"by";:PRINT@393,"david";R$;"jenkins"; 40046 SCREEN0,1 40047 FORN=1TO2000:NEXTN 40050 FORN=1TO50 40051 PLAY"V20T255O3CFC" 40055 NEXTN 40060 RETURN 50010 DATA "BGIANT SPIDER",20,0,"HLIVING DEAD",25,10,"GHUNTER",35,0 50020 DATA "GMERCENARY",40,0,"ATROLL",40,5,"EDARK BIRDS",30,15,"AGOBLIN",30,17 50030 DATA "ADWARFS OF THE PIT",35,15,"ESOLDIERS OF THE MISTS",50,0,"CWRAITH",30,35 50040 DATA "ERIDER OF THE NIGHT",50,40,"DWARLOCKS OF THE EYE",50,50 51000 SP=0:A4=0 51002 IF BG<25 THEN A4=18 51003 IF BG>24 AND BG<35 THEN A4=13 51004 IF BG>34 AND BG<45 THEN A4=8 51005 IF BG>44 THEN A4=4 51010 re=INT(RND(TI)*A4) 51100 A2=LEN(W$(re)) 51110 A3=0 51140 FORY1=1 TO LEN(W$(re)) 51150 PRINT@(32*9)+(Y1*2),"-";" " 51160 NEXTY1 51170 T2=0 51175 IF n1(rf)>BG THEN T2=2 51180 PRINT@(32*10),"SPELL!" 51190 PRINT@(32*11)," " 51200 F=0 51210 INPUTL$ 51220 T2=T2+1 51230 IF T2=8 THEN51500 51350 IF l$=W$(re) THEN51550 51360 FOR A=1 TO LEN(W$(re)) 51370 IF l$=MID$(W$(re),A,1) THENGOSUB51440 51380 NEXTA 51381 IF A3=A2 THEN51550 51390 IF F=1 THEN51180 51400 PRINT@(32*11),"WRONG" 51410 FORN=1TO500:NEXTN 51420 PRINT@(32*11)," " 51430 GOTO51180 51440 PRINT@(32*8)+(A*2),l$; 51441 A3=A3+1 51450 F=1 51460 RETURN 51470 DATA"SAUCER","LINGER","COLONY","BECKON","SAUNTER","LINTLE","COLOUR","BECOME","SAUSAGE","LINCTUS" 51475 DATA"COLUMN","BECALM","FAVOUR","LINSEED","COLLIDE","BEAVER","COLONEL","BEAUTY" 51500 CLS4 51505 PRINT@234,"MAGIC FAILS!"; 51510 FORN=1TO1500:NEXTN 51520 RETURN 51550 SP=1 51555 CLS0 51556 PRINT@236,"SUCCESS!"; 51557 FORN=1TO1500:NEXTN 51560 RETURN 52000 DATA"river","forest","mountains","cave","lake","tower","village","castle","greatwall" 52050 DATA"0","1","2","3","4","5","6","7","8","9" 52100 DATA 40,40,15,45,45,20,50,50,10,60,60,25,70,70,15 ==== SOURCE FILE ==== * ''[[https://github.com/spotlessmind1975/ugbasic/tree/main/examples/the_water_of_life_dragon_32_64_basic.bas|the_water_of_life_dragon_32_64_basic.bas]]'' ==== HOW TO COMPILE AND RUN ==== The instructions here refer to compiling the example from the command line. For Microsoft Windows users we suggest using **[[https://spotlessmind1975.itch.io/ugbasic-ide|UGBASIC-IDE]]**, which allows you to compile the example with just one click.=== ATARI 400/800 family === In order to compile and run the example, you need to have the Altirra emulator, and in particular that the ''altirra'' executable is accessible. Then, type this command on the command line: # Linux ugbc.atari the_water_of_life_dragon_32_64_basic.bas -o example.xex altirra example.xex # Windows ugbc.atari.exe the_water_of_life_dragon_32_64_basic.bas -o example.xex altirra example.xex === ATARI 600XL/800XL/1200XL/XG(SE) family === In order to compile and run the example, you need to have the Altirra emulator, and in particular that the ''altirra'' executable is accessible. Then, type this command on the command line: # Linux ugbc.atarixl the_water_of_life_dragon_32_64_basic.bas -o example.xex altirra example.xex # Windows ugbc.atarixl.exe the_water_of_life_dragon_32_64_basic.bas -o example.xex altirra example.xex === Commodore 64 === In order to compile and run the example, you need to have the VICE emulator, and in particular that the ''x64sc'' executable is accessible. Then, type this command on the command line: # Linux ugbc.c64 the_water_of_life_dragon_32_64_basic.bas -o example.prg x64sc example.prg # Windows ugbc.c64.exe the_water_of_life_dragon_32_64_basic.bas -o example.prg x64sc example.prg === Commodore PLUS/4 === == Using YAPE == In order to run the example, you need to have the YAPE emulator. In particular that the ''yape'' executable is accessible. Then, type this command on the command line: # Linux ugbc.plus4 the_water_of_life_dragon_32_64_basic.bas -o example.prg yape example.prg # Windows ugbc.plus4.exe the_water_of_life_dragon_32_64_basic.bas -o example.prg yape example.prg == Using VICE == In order to run the example, you need to have the VICE emulator. In particular that the ''xplus4'' executable is accessible. Then, type this command on the command line: # Linux ugbc.plus4 the_water_of_life_dragon_32_64_basic.bas -o example.prg xplus4 example.prg # Windows ugbc.plus4.exe the_water_of_life_dragon_32_64_basic.bas -o example.prg xplus4 example.prg === Dragon 32 === In order to compile and run the example, you need to have the XROAR emulator, and in particular that the ''xroar'' executable is accessible. Then, type this command on the command line: # Linux ugbc.d32 the_water_of_life_dragon_32_64_basic.bas -o example.bin xroar -rompath (your rom path) example.bin # Windows ugbc.d32.exe the_water_of_life_dragon_32_64_basic.bas -o example.bin xroar.exe -rompath (your rom path) example.bin === Dragon 64 === In order to compile and run the example, you need to have the XROAR emulator, and in particular that the ''xroar'' executable is accessible. Then, type this command on the command line: # Linux ugbc.d64 the_water_of_life_dragon_32_64_basic.bas -o example.bin xroar -rompath (your rom path) example.bin # Windows ugbc.d64.exe the_water_of_life_dragon_32_64_basic.bas -o example.bin xroar.exe -rompath (your rom path) example.bin === PC128 Olivetti Prodest === In order to compile and run the example, you need to have the DCMOTO emulator, and in particular that the ''dcmoto'' executable is accessible. Then, type this command on the command line and on the emulator: # Linux ugbc.pc128op the_water_of_life_dragon_32_64_basic.bas -o example.k7 dcmoto (choose BASIC 128) CLEAR,&H2FFF: LOADM"CASS:",R: EXEC # Windows ugbc.pc128op.exe the_water_of_life_dragon_32_64_basic.bas -o example.k7 dcmoto (choose example.k7) (choose BASIC 128) CLEAR,&H2FFF: LOADM"CASS:",R: EXEC === Thomson MO5 === In order to compile and run the example, you need to have the DCMOTO emulator, and in particular that the ''dcmoto'' executable is accessible. Then, type this command on the command line and on the emulator: # Linux ugbc.pc128op the_water_of_life_dragon_32_64_basic.bas -o example.k7 dcmoto (choose BASIC 128) CLEAR,&H2FFF: LOADM"CASS:",R: EXEC # Windows ugbc.pc128op.exe the_water_of_life_dragon_32_64_basic.bas -o example.k7 dcmoto (choose example.k7) (choose BASIC 128) CLEAR,&H2FFF: LOADM"CASS:",R: EXEC === Commodore VIC-20 === In order to compile and run the example, you need to have the VICE emulator, and in particular that the ''xvic'' executable is accessible. Then, type this command on the command line: # Linux ugbc.vic20 the_water_of_life_dragon_32_64_basic.bas -o example.prg xvic --memory 24k example.prg # Windows ugbc.vic20.exe the_water_of_life_dragon_32_64_basic.bas -o example.prg xvic --memory 24k example.prg === ZX Spectrum === In order to compile and run the example, you need to have the Speccy emulator, and in particular that the ''speccy'' executable is accessible. Then, type this command on the command line: # Linux ugbc.zx the_water_of_life_dragon_32_64_basic.bas -o example.tap Speccy example.tap # Windows ugbc.zx.exe the_water_of_life_dragon_32_64_basic.bas -o example.tap Speccy example.tap === MSX === In order to compile and run the example, you need to have the openMsx or the BlueMSX emulator, and in particular that its executable is accessible. Then, type this command on the command line: == openMSX == # Linux ugbc.msx1 the_water_of_life_dragon_32_64_basic.bas -o example.rom openmsx -cart example.rom # Windows ugbc.msx1.exe the_water_of_life_dragon_32_64_basic.bas -o example.rom openmsx -cart example.rom == blueMSX == # Linux ugbc.msx1 the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx example.rom # Windows ugbc.msx1.exe the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx example.rom === ColecoVision === In order to compile and run the example, you need to have the openMsx or the BlueMSX emulator, and in particular that its executable is accessible. Then, type this command on the command line: == openMSX == # Linux ugbc.coleco the_water_of_life_dragon_32_64_basic.bas -o example.rom openmsx -machine \"COL - ColecoVision\" -cart example.rom # Windows ugbc.coleco.exe the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx -machine \"COL - ColecoVision\" example.rom == blueMSX == # Linux ugbc.coleco the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx /machine \"COL - ColecoVision\" /rom1 example.rom # Windows ugbc.coleco.exe the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx /machine \"COL - ColecoVision\" /rom1 example.rom === SEGA SC-3000 === In order to compile and run the example, you need to have the BlueMSX emulator, and in particular that its executable is accessible. Then, type this command on the command line: # Linux ugbc.sc3000 the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx /machine \"SEGA - SC-3000\" /rom1 example.rom # Windows ugbc.sc3000.exe the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx /machine \"SEGA - SC-3000\" /rom1 example.rom === SEGA SG-1000 === In order to compile and run the example, you need to have the BlueMSX emulator, and in particular that its executable is accessible. Then, type this command on the command line: # Linux ugbc.sg1000 the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx /machine \"SEGA - SG-1000\" /rom1 example.rom # Windows ugbc.sg1000.exe the_water_of_life_dragon_32_64_basic.bas -o example.rom bluemsx /machine \"SEGA - SG-1000\" /rom1 example.rom ==== ANY PROBLEM? ==== If you have found a problem trying to run this example, if you think there is a bug or, more simply, you would like it to be improved, [[https://github.com/spotlessmind1975/ugbasic/issues/new?title=IMPROVE |open an issue]] for this example on GitHub. Thank you!===== POWERED BY ===== [[:ugbasic:user:examples|{{ :ugbasic:user:logo-ugbasic.png?nolink&600 |}}]]