|
This program runs the classic
"Lunar Lander"
game with customizations specific to the 9830.
The "user interface" is
the single-line LED display on the computer and a graphical
plot in real-time of the lander descent on an attached plotter.
A plug-in Plotter Control ROM gives the 9830 BASIC language additional
commands, including:
The RBYTE function returns one byte of data from the device specified (RBYTE1 is the keyboard), regardless of the data structure. This gets the next keypress from the keyboard without the terminator that an INPUT command requires.
50 REM: LUNAR LANDER (PLOTTER, REAL TIME) 75 REM: TRANSLATE FROM 9820 PROGRAM BY RICK SCHERER 100 RAD 200 SCALE -500,500,-200,1000 300 PLOT 500,0 400 PLOT -500,0,0 500 PEN 600 PLOT -35,10 700 PLOT -35,-10 800 PEN 900 PLOT 35,10 1000 PLOT 35,-10 1100 PEN 1200 PLOT -480,-100 1300 LABEL (*,5,1.2,0,2/3)"9830 LUNAR LANDER"; 1400 R1=R2=0 1500 R3=200 1600 X=-470 1700 Y=900 1800 R1=R1+SQR(2000/(Y+2000))*2 1900 A=RBYTE1 2000 X=X+R2 2100 Y=Y-R1 2200 PLOT X,Y 2300 IF R3>0 THEN 2600 2400 R3=A=0 2500 DISP "OUT OF FUEL" 2600 IF (A <= 5)*(A#1) THEN 2900 2700 R1=R1-(3+(1001-R3)/1000) 2800 R3=R3-3 2900 IF A#5 THEN 3300 3000 R1=R1-(3+(1000-R3)/1000) 3100 R2=R2=(1+(1001-R3)/2000) 3200 R3=R3-4 3300 IF A#4 THEN 3600 3400 R2=R2-(1+(1001-R3)/2000) 3500 R3=R3-1 3600 IF A#3 THEN 4000 3700 R1=R1-(3+(1001-R3)/1000) 3800 R2=R2+(1+(1001-R3)/2000) 3900 R3=R3-4 4000 IF A#2 THEN 4300 4100 R2=R2+(1+(1001-R3)/2000) 4200 R3=R3-1 4300 REM: CMD"?06" 4400 FORMAT F3.0,F10.2 4500 REM: OUTPUT(13,340) R3,SQR(R1*R1+R2*R2) 4600 IF (X>-500)*(X <= 500)*(Y <= 1000) THEN 4800 4700 DISP "OUT OF RANGE" 4800 IF (Y <= 0)*((X>-35)*(X <= 35))*(SQR(R1*R1+R2*R2) <= 5) THEN 5200 4900 IF (Y <= 0)*((X <= -35)+(X>35))*(SQR(R1*R1+R2*R2) <= 5) THEN 5900 5000 IF (Y <= 0)*(SQR(R1*R1+R2*R2)>5) THEN 6500 5100 GOTO 1800 5200 GOSUB 7500 5300 PLOT -200,900 5400 LABEL (*,3,1.5,0)"SUCCESSFUL LANDING" 5600 FIXED 0 5700 LABEL (*,3,1.5,0)"FUEL/VELOCITY "R3/SQR(R1*R1+R2*R2); 5800 GOTO 7200 5900 GOSUB 7500 6000 PLOT 0,900 6100 LABEL (*,3,1.5,0)"SOFT LANDING"; 6200 PLOT 0,850 6300 LABEL (*)"NOT ON TARGET"; 6400 GOTO 7200 6500 PLOT X-27,Y-27 6600 LABEL (*,3,1,0)"+" 6700 CPLOT -1,0 6800 LABEL (*)"X" 6900 FIXED 2 7000 PLOT -200,900 7100 LABEL (*,3,1.5,0)"CRASH VELOCITY";SQR(R1*R1+R2*R2); 7200 PLOT 500,1000 7300 PEN 7400 END 7500 PLOT X-3,Y-3 7600 LABEL (*,1,1,0,2/3)"0"; 7700 CPLOT -1,0 7800 LABEL (*,1,1,PI/2)"0"; 7900 RETURN |
Click here for the Home page.
Click here for the Wanted page.
Last updated January 6, 2010