The Museum of HP Calculators


Moon Landing Simulator for the HP 9810a

This program was adapted by Johnny Nestor from Dave Hicks' HP 9100 adaptation from the "HP-25 Applications Programs" book Copyright © 1975 by Hewlett-Packard and is used here by permission.

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Overview

Imagine for a moment the difficulties involved in landing a rocket on the moon with a strictly limited fuel supply. You're coming down tail-first, free-falling toward a hard rock surface. You'll have to ignite your rockets to slow your descent; but if you burn too much too soon, you'll run out of fuel 100 feet up, and then you'll have nothing to look forward to but cold eternal moon dust coming faster every second. The object, clearly, is to space your burns just right so that you will alight on the moon's surface with no downward velocity.

The game starts off with the rocket descending at a velocity of 50 feet/sec from a height of 500 feet. The velocity, height and fuel are shown in the HP-9100's three line display as

-50      (Velocity 50 ft/sec downward)
500      (Altitude 500 feet)
120      (Fuel left: 120 units - this line changes to 0 after 1 second.)

The velocity is shown with a negative sign to indicate downward motion. The Fuel is displayed for just a second and then changes to zero. This lets you perform a 0 fuel burn by simply pressing the CONTINUE button (CONT on the HP-9100B.) (Otherwise the default burn would be all your fuel which is usually not what you want.)

A perfect landing shows as three zeros. A display like:

-velocity
0
-999999 

means you have landed (or crashed) with non-zero velocity. In real life, you'd probably survive if the velocity is around -1 but at say -10, you wouldn't be coming back.

You will start the game with 120 units of fuel. You may burn as much or as little of your available fuel as you wish at each step of your descent; burns of zero are quite common. A burn of 5 units will just cancel gravity and hold your speed constant. Any burn over 5 will act to change your speed in an upward direction. You must take care, however, not to burn more fuel than you have; for if you do, no burn at all will take place, and you will free-fall to your doom! The final velocity shown will be your impact velocity (generally rather high). If the fuel flashes by and you forget it, you may recall it by pressing f.

Equations:

We don't want to get too specific, because that would spoil the fun of the game; but rest assured that the program is solidly based on some old friends from Newtonian physics:

x = x0+v0t + (1/2)at2
v=v0 + at
v2 = v02 + 2ax
where x, v, a, and t are distance, velocity, acceleration, and time.

Notes:

1. If you crash before running out of fuel, the crash velocity shown will be the velocity before the burn, rather than the impact velocity.

2. Unlike the handheld versions, it's OK to burn fractional units of fuel. This is because this program doesn't have to combine the multiple numbers into a one line display.

Instructions

Step

Instructions

Input Data/Units

Keys

Output Data/Units

1

Enter program

     

2

Initialize

END CONTINUE

-50/500/120

3

Key in burn, compute new speed and distance. (For burn of zero, just press CONTINUE.)

Burn
(if non-zero)

CONTINUE

new Vel/Alt/Fuel

5

Perform step 3 till you land or crash

 

 

 

6

To see remaining fuel after it has been cleared.

 

a

Vel/Alt/Fuel

To Start a new game goto step 2

 

 

 

Example

The following outputs are shown with the decimal wheel set to zero but that's not a requirement of the program

END CONTINUE           -50/500/120    (the fuel units will change to zero
CONTINUE               -55/488/120     after a second)
5 CONTINUE             -55/393/115
30 CONTINUE            -30/350/85
CONTINUE               -35/318/85
CONTINUE               -40/280/85
CONTINUE               -45/238/85
CONTINUE               -50/190/85
10 CONTINUE            -45/143/75
CONTINUE               -50/95/75
10 CONTINUE            -45/48/65
25 CONTINUE            -25/13/40      Looking dangerous!
20 CONTINUE            -25/0/-999999  Crash!!!

The Program

LINE  CODE  KEY         COMMENTS
 000    05   5           Initialize
 001    00   0
 002    32   CHG SIGN
 003    23   x->()
 004    14   b           initial velocity
 005    05   5
 006    00   0
 007    00   0
 008    23   x->()
 009    00   0
 010    00   0
 011    00   0           initial altitude
 012    01   1
 013    02   2
 014    00   0
 015    23   x->()
 016    13   a           initial fuel
 017    51   LABEL
 018    00   0           Label 0
 019    14   b           Set up the display...velocity
 020    27   UP (ENTER^)
 021    23   x->()
 022    00   0
 023    00   0
 024    00   0           ...altitude
 025    27   UP (ENTER^)
 026    13   a           ...fuel
 027    57   PAUSE       Display the Vel/Altitude/Fuel for 1 sec
 028    57   PAUSE
 029    57   PAUSE
 030    57   PAUSE
 031    57   PAUSE
 032    57   PAUSE
 033    57   PAUSE
 034    57   PAUSE
 035    00   0           Replace fuel with zero
 036    41   STOP        Allow input (default is a zero burn)
 037    27   UP (ENTER^) Move requested burn into y
 038    13   a           Fuel into x
 039    52   IF x<y   Attempting to burn more fuel than available?
 040    44   GO TO       
 041    51   LABEL
 042    01   1           Prepare to crash! 
 043    47   CONTINUE    (conditional 4-step placeholder)
 044    30   x<>y  fuel in y, burn in x
 045    34   -           fuel left after burn
 046    40   y->()
 047    00   0
 048    00   0
 049    00   0           save fuel left
 050    27   UP (ENTER^) burn -> y
 051    05   5
 052    34   -           y = burn - 5 (subtract gravity effect from burn)
 053    40   y->()
 054    00   0
 055    00   0
 056    01   1           acceleration = burn - 5
 057    02   2           compute new altitude
 058    35   /           y = acc/2
 059    67   x<-()
 060    00   0
 061    00   0
 062    00   0           x = alt, y = acc/2
 063    33   +           y = alt + acc/2
 064    14   b           velocity -> x, y = alt + acc/2
 065    33   +           y = alt + vel + acc/2
 066    40   y->()
 067    00   0
 068    00   0
 069    00   0           save new altitude
 070    00   0
 071    53   IF x>y   Are we now below ground?
 072    44   GO TO
 073    51   LABEL
 074    02   2           If yes, go to crash display!
 075    47   CONTINUE    (conditional 4-step placeholder)
 076    67   x<-()
 077    00   0
 078    00   0
 079    01   1           x=acc, y=alt
 080    27   UP (ENTER^) x=acc, y=acc, z=alt
 081    14   b           x=vel, y=acc, z=alt
 082    33   +           x=vel, y=acc+vel, z=alt
 083    40   y->()
 084    14   b           New velocity = acceleration + velocity 
 085    44   GO TO
 086    51   LABEL
 087    00   0           Loop Around for another display
 088    14   b           x=vel; Fuel gone show crash velocity as
 089    12   x^2         x=vel^2;             sqrt(v^2 + 2 g alt)
 090    27   UP (ENTER^) x=vel^2, y=vel^2
 091    67   x<-()
 092    00   0
 093    00   0
 094    00   0           x=alt, y=vel^2
 095    27   UP (ENTER^) x=alt, y=alt, z=vel^2
 096    01   1
 097    00   0           x=2g  (g=5)
 098    36   X           y=2 g alt, z=vel^2
 099    25   DOWN
 100    33   +           y=vel^2 + 2 g alt
 101    25   DOWN        y->x, z-&>;y
 102    76   sqrt        y=sqrt(vel^2 + 2 g alt)
 103    32   CHS
 104    23   x->()
 105    14   b           Store crash velocity
 106    51   LABEL
 107    02   2           Hard land/Crash
 108    14   b           Generate a hard land/crash display
 109    27   UP (ENTER^) ;                  vel/0/-999999
 110    00   0           Show 0 for crash altitude because 
 111    27   UP (ENTER^) ; it's too much work to compute
 112    11   9           ; the crator depth
 113    11   9
 114    11   9
 115    11   9
 116    11   9
 117    11   9
 118    32   CHS         Fuel at -999999 indicates a crash    
 119    46   END                                                               

Register Use

a    Fuel
b    Velocity
000  Altitude
001  Acceleration

Go back to the software library
Go back to the main exhibit hall