buggy <<<******************** BUGGY ******************** I Program reorganised and enhanced by Jim Grimwood 6Coding highlighted in green has been inserted by me ZLine numbers highlighted in green have had coding deleted  Line 8 %Sets up initial screen attributes 7:0:0 SET UP UDG'S Lines 14-22 Set up UDGs. This is different from usual method as 42 characters defined - twice as many as normal. These are addressed as two banks of 21 UDGs by changing system variable UDG(23675) 65199 "10 ,10 ;"PLEASE WAIT" a=6520065535 x:a,x:.001wn,*20 a  40( Lines 30-36 $Comprise data for two sets of UDGs 85U,170,85U,170,85U,170,85U,170,85U,170,84T,168,84T,168,64@,128,85U,170,85U,10 ,5,10 ,5,0,64@,128,64@,168,84T,168,85U,170,1,2,5,42*,21,170,85U,170,0,1,3,3,3,3,3,1,171,255,117u,37%,85U,116t,255,255,0,128,192,192,192,64@,192,128,3,7,15,30,24,568,40(,80P,85U,255,255,165,90Z,36$,36$,24,192,224,240,112p,24,28,20,10 ,0,0,64@,224,248,134,177,233,0,0,0,0 0,32 ,159,96`,213,127,255,224,79O,31,579,127,179,255,255,124|,41),187,131,199,24,252,254,15,230,240,60<,254,0,0,3,6,15,30,21,58:,0,0,192,224,112p,184,220,172,535,123{,119w,234,221,171,223,255,94^,174,126~,174,247,107k,255,255,207,0,0,0,0,0,0,0,194,199,143,154,181,234,213,127,64@,224,248,134,177,233,179,255,0,0,0,32 ,159,96`,24,252,255,224,207,223,217,25,31,15 "255,108l,579,171,187,131,131,1,254,15,231,247,546,524,240,224,128,192,192,224,240,252,254,255,1,3,3,7,15,63?,127,255,157,255,255,255,255,255,255,255,129,195,227,231,231,247,255,255,0,0,194,199,143,154,181,234,0,0,64@,224,248,134,177,233,0,0,0,0,0,32 ,159,96`,213,127,255,224,79O,31,579,127,179,255,255,124|,41),187,131,199,24,252,254,15,230,240,60<,254,0,0,3,6 $Q15,30,21,58:,0,0,192,224,112p,184,220,172,535,123{,119w,234,221,171,223,255,94^,174,126~,174,247,107k,255,255,207,0,0,0,0,0,0,0 (INSTRUCTIONS )Lines 44-64 *4Print instructions using black INK and black PAPER ,0:0:1: .10 ;"LUNAR BUGGY" 0*1;0,10 ;"___________" 2'"PROGRAM BY ROBERT STOCKTON" 4#"BUGGY UDG'S BY ANDRE TABRIZIFAR" 5%'"ENHANCEMENTS BY JIM GRIMWOOD" 6'"The object is to first land yourmoon lander and get to your moonbuggy.Then you have to get to the next moon lander in your lunar buggy." 8''"To do this use keys-" :"9-Left 0-Right" <"1-Thrust or Jump" >\"2-Fire(only the buggy has a gun)The buggy jumps higher the further forward you are." @""Good Luck. Press a key to play" BLines 68-72 CiRoutine draws white lines OVER whole screen - thus, instructions are made to materialise as if by magic Da=1750-1 F00,a:1;7;255,0 Ha JLines 76-77 KWait for a key to be pressed L=""76L M""77M PLines 84-88 RASet up initial variables and attributes for lander part of game Ts=0:buggy=4 Vlev=1 X&0:0:7:0: X LANDER YLines 7005-7040 ZHSet up lander screen details. Line 7005 selects first bank of UDG data ].23675{\,176:23676|\,254 bSET UP VARIABLES lx=4:y=14 vv=.1}L:h=0 fuel=99c SET UP SCREEN Lines 7310-7350 Draw screen. Lines 7335 and 7340 dimension a$ to size of screen minus top line (21*32=672). The screen is then filled with characters from element 311 onwards and, finally, a$ is printed 0:7:0  V0,0;2;"SCORE ";s;" LEVEL ";lev,0,22;"FUEL ";fuel a$(672) }a$(3117)=" X10X20 X30 " 1,0;a$ Lines 7355-7380 #Print number of moon landers left ,2;1,0;"LANDERS LEFT",, a=1buggy Q2;2,a*5-5;" ",3,a*5-5;" ", a LPRINT AND MOVE LANDER MLines 7510-7556 NVariables cx and cy are used to contain last position of lander. Keyboard is then read and note taken of change of xy position and velocity(v) V cx=x:cy=y `5fuel.5v=v-((="1"x>2)/10 ) e'v<.2~Lv=v+lev*2/100d j+h=h+((="0")/10 )-((="9")/10 ) ~y>0y<29y=y+h !y0y=1:h=0 #y29y=28:h=0 x=x+v "x<4x=4:v=.1}L Lines 7570-7575 ,Erase old lander and print in new position (x+.5)ɺ(cx+.5)ź(y+.5)ɺ(cy+.5)cx,cy;" ";cx+1,cy;" ";x,y;"";x+1,y;"" Nfuel=fuel-.5:fuel02;0,27;fuel;" " Lines 7580-7600 OCheck if there's been a crash, or whether you've managed to land successfully b$=a$(((x))*32 +(y+1)((x))*32 +(y+3))+a$((x+1)*32 +(y+1)̺(x+1)*32 +(y+3)) b$=" "7500L 'b$" "9200#:7000X Lines 7610-7870 hCalculate and print bonus details - this depends on landing position and how much fuel is left in tank y=1b=10 "y>8y<14b=20 y>17b=30 x BONUS x$="BONUS = "+fuel+" x "+b a=1̱x$ 5,5+a;x$(a) .01z# =,30 a s=s+(b*fuel) 0,6;2;s Lines 7875-8060 ²Lander has landed, so underneath of landing bay is printed up on-screen. This is done using a call to 3582 of ROM which scrolls screen and attributes up one whole screen line ..1}L,40(:23692\,255 a=1100d:a 621,0;" " 620,0;""  LANDED @a=111 J 3582 T621,0;" " Va Y 3582 Z621,0;" " ^a=16 hC21,0;" ";1;"" m 3582 ra |621,0;"" Line 8070 +Prints buggy from second bank of UDG data 23675{\,88X:23676|\,255:19,22;"";20,22;"":23675{\,176:23676|\,254 Lines 8090-8140 VCause lander to move down 18 lines of screen, one at a time, until it reaches bottom a=018 ib=10 a,1;" ";a+1,1;"";a+2,1;"";a+3,1;"" qb=20a,10 ;" ";a+1,10 ;" ";a+2,10 ;" ";a+3,10 ;"" qb=30a,18;" ";a+1,18;" ";a+2,18;" ";a+3,18;""  .1}L,a a Lines 8170-8270 CThis routine moves buggy across screen into position at line 8500 -23675{\,88X:23676|\,255 a=2015-1 a,31;" " .1}L,1 a &a=2128 0'19,a;" ";20,a;" " 5.01z# =,20 :a D !4SET UP LANDSCAPE !5Lines 8505-8585 !6vSet up landscape for buggy part of game. The second bank of UDGs is used via system variable 23675 (see lines 10-24) !9-23675{\,88X:23676|\,255 !>l$=" " !Hm$=" " !\c=1:d=0 !fx=17:y=5 ! f=0 !/lev=lev+1:.1}L,20:c=1 !o$=" " !SET UP SCREEN !Lines 8605-8800 !PDraw screen containing buggy part of game, inlcuding score, "buggys left", etc !$0:7:0:0 !?21,0;6;"" !E0,0;2;6;"SCORE ";s,"LEVEL ";lev,,,,,,, !21,0;2;"BUGGYS LEFT " "La=1buggy "VQ2;2,a*5-5;" ";3,a*5-5;" " "`a "PRINT & MOVE MAN & LAND "Lines 8910-8970 "Variables cx and cy store old buggy position. Lines 8915 and 8920 draw land which is level-dependent; it gets much harder after 2nd level. Lines 8930 and 8940 read keyboard and update variables x and y, which store buggy's position " cx=x:cy=y "Clev>218,0;1;8;o$(cc+31) "Y6;2;19,0;l$(cc+31);20,0;m$(cc+31) ".y=y+(="0"y<25)-(="9"y>1) "="1"d1d=-1 "#x17-(y/2)d=1 # x=x+d #(Line 9002 #)-Erases old buggy and prints in new position #*(x+.5)ɺ(cx+.5)ź(y+.5)ɺ(cy+.5)cx,cy;" ";cx+1,cy;" ";x,y;4;"";x+1,y;5;"" #2Lines 9012-9052 #3YPrint score. Line 9015 checks for buggy's gun being fired. Throughout routine, if you've reached level 3 or over, a check is made to see if you've managed to hit alien with laser blast; also to see if buggy has hit a hole in track. If level is a multiple of 4 then a larger bonus is awarded. The routine then GO TOs to line 8900 for next move #4&0,6;6;2;s #7="2"9060d# #218,0;1;8;o$(cc+31) #Px=17d=1d=0:(x+.5)ɺ(cx+.5)ź(y+.5)ɺ(cy+.5)cx,cy;" ";cx+1,cy;" ";x,y;4;"";x+1,y;5;"":.1}L,-40( #UHd=0l$(c+y)""l$(c+y+2)""9200#:8900" #WHx=17lev>2o$(y+c+2)=""9200#:8900" #YUx=15lev>2o$(c+y)=""o$(c+y+2)=""9200#:8900" #Zfc=c+1:c=l$-31:0,22;8;lev:lev/4=(lev/4)9500% #[c=l$-318582! #\ 8900" #_FIRE A SHOT #`Lines 9060-9110 #aMRoutine to fire a shot from buggy. This will only be of use after level 2 #da=y+430 #ix+1,a;" " #x.001wn,60<:o$(c+a)" "lev>2x=17s=s+10 :o$(c+ac+a+1)=" ":.1}L,-30:x+1,a;" ": #a #x+1,31;" " # #LOSE A LIFE #Lines 9210-9260 #This routine comes into play once you've lost a life. Line 9210 blows moon lander/buggy to smithereens, line 9240 checks you've still some lives in hand, line 9250 rubs out lander from score #1:a=240-2:a/4:.0005vn,a*2:y*8+a,(176-x*8)+8:0,-16:y*8,160-(x*8)+a:24,0:a:0:x,y;" ";x+1,y;" ":7 $ c=1 $buggy=buggy-1 $buggy=09970& $"J2;2,buggy*5;" ";3,buggy*5;" " $, %BLAST OFF %Lines 8510-8600 %-Routine to blast moon lander off into space %&.23675{\,176:23676|\,254 %0317,27;"";18,27;"" %X>10 ,10 ;2;"BONUS = 5000":1,30 %]s=s+5000 %^a=1502:a %ba=163-1 %lY8;8;a,27;"";a+1,27;"";a+2,27;" " %q.01z# =,2 %va %{ % 7000X &GAME OVER &Lines 6010-6060 &wEnd of the game routine. You'll be asked if you want to play again, and whether you want to see instructions for play &@10 ,11 ;2;"GAME OVER":1,-30 &1,-502 &11 ,6;"PRESS A KEY TO PLAY";13 ,4;"PRESS i FOR INSTRUCTIONS";15,7;"OR q TO QUIT" &=""9980& &="i"40( &E="q"0:7:5:0:0:0:: '""9984' ' 80P