Acorn Computers BBC Micro Model B w/8271 — Acorn BBC Micro Model B w/8271 User Guide Manual PDF (EN)

152 190 IF burn$=""THEN burnrate%=0 ELSE burnrate%=VAL(burn$)*30 200 PROCcalculate 210 PROCdashboard 220 IF Y%>oldY%+4 OR Y% 225 PROCburn 230 UNTIL height=0 240 IF speed>0.004 THEN PROCcrash ELSE PROCfanfare 245 *FX 12,0 247 *FX 15,1 250 END Notes: Although line 250 says END this is not the end of the program. What follows are the various procedures which have been called by the program as it exists so far. Before we give the procedures, some notes on the earlier lines. Line 120 PROClabels – sets up the titles Line 130 PROCmoon – draws moon’s surface. Line 140 PROCinitialise – sets all the variables to initial values. Lines 170 to 230 are the main part of the program – a REPEAT...UNTIL loop.

Line 180 – checks to see if any key has been pressed. Line 185 – clears the key buffer, otherwise the burn continues for a long time after the key is released. Line 190 – we use INKEY$ to check if anything has been pressed, but this returns a string. Line 190 converts it to a number. Line 200 PROCcalculate – does the maths. Line 210 PROCdashboard – prints up the results. Line 220 – prints the rocket if Y% (the variable used in MOVE X%,Y% ) has gone up or down by 4. In this MODE the rocket is printed in the same place unless the change is greater than 4. Line 225 PROCburn – draws the burning fuel. Line 240 – crash or good landing? – at less than 15 mph it’s good.

Line 247 – clears keyboard buffer again so you don’t get a string of numbers printed when the program stops. 700 DEF PROClabels 710 PRINT TAB(0,7)"secs" 720 PRINT TAB(0,9)"miles" 725 PRINT TAB(0,10)"feet" 730 PRINT TAB(0,12)"speed" 740 PRINT TAB(0,14)"fuel" 750 PRINT TAB(0,16)"burn?" 760 ENDPROC