The Museum of HP Calculators


Moon Rocket Lander for the HP-19C/HP-29C

This program is Copyright © 1977 by Hewlett-Packard and is used here by permission. This program was originally published in "HP-19C/HP-29C Applications Book", pages 49 through 51. This program was transcribed by Mark Lynch

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 rocks 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/second from a height of 500 feet. The velocity and altitude are shown in a combined display as -50.0500, the altitude appearing to the right of the decimal point and the velocity to the left, with a negative sign on the velocity to indicate downward motion. Then the remaining fuel is displayed and the rocket fire count-down begins: "3", "2", "1", "0",. Exactly at zero you may key in a fuel burn. You only have one second, so be ready. A zero burn, which is very common, is accomplished by doing nothing. After a burn the sequence is repeated unless:

1. You have successfully landed - flashing zeros.

2. You have smashed into the lunar surface - flashing crash velocity.

You must take care, however, not to burn more fuel than you have; for if you do, you will free-fall to your doom! The final velocity shown will be your impact velocity (generally rather high). You have 60 units of fuel initially.

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 + 2a (x - x0)
where x, V, a, and t are distance, velocity, acceleration, and time.

Remarks:

Only integer values for fuel burn are allowed. R/S can be used to stop Moon Rocket Lander at any time.

Instructions

Step Instructions Input Data/Units Keys Output Data/Units
1 Key in the program.      
2 Assume manual control.   GSB 1 "V.ALT"
        "FUEL"
        "3"
        "2"
        "1"
        "0"
3 Key in burn upon "0" display:      
  Press and hold R/S until      
  blinking stops.   R/S  
  Enter burn BURN R/S "V.ALT"
        "FUEL"
        "3"
        "2"
        "1"
        "0"
4 Go to step 3 until you land      
  (flashing zeros) or crash      
  (flashing impact velocity).      
5 If you survived last landing      
  attempt, go to step 2 for another      
  try.      

The Program

       19C        29C
LINE   CODE       CODE      KEYS        COMMENTS
 00
 01  25 14 01   15 13 01   g LBL 1
 02        05         05   5
 03        00         00   0            Store initial conditions
 04        00         00   0
 05     45 06      23 06   STO 6
 06        05         05   5
 07        00         00   0
 08        22         32   CHS
 09     45 07      23 07   STO 7
 10        06         06   6
 11        00         00   0
 12     45 08      23 08   STO 8
 13  25 14 00   15 13 00   g LBL 0      -------------------------
 14     55 06      24 06   RCL 6
 15  16 13 04   14 11 04   f FIX 4
 16        23         33   EEX          Divide height by 10000
 17        04         04   4            for proper display
 18        61         71   ÷            -------------------------
 19     55 07      24 07   RCL 7
 20     25 54      15 64   g ABS        Build VV.Ohhh display,
 21        41         51   +            taking negative values
 22     55 07      24 07   RCL 7        into account
 23     25 41      15 51   g x>0
 24     13 04      12 04   GSB 4
 25        11         21   x⇔y
 26        22         32   CHS          -------------------------
 27     16 64      14 74   f PSE        Display VV.Ohhhh
 28     16 64      14 74   f PSE        -------------------------
 29  16 13 00   14 11 00   f FIX 0
 30     55 08      24 08   RCL 8
 31     16 64      14 74   f PSE
 32        03         03   3            Count down for burn
 33     16 64      14 74   f PSE
 34        02         02   2
 35     16 64      14 74   f PSE
 36        01         01   1
 37     16 64      14 74   f PSE
 38        00         00   0
 39     16 64      14 74   f PSE        -------------------------
 40  25 14 09   15 13 09   g LBL 9      Accept input
 41     55 08      24 08   RCL 8        -------------------------
 42        11         21   x⇔y          If fuel is gone calculate
 43     16 41      14 51   f x>y        crash velocity
 44     14 06      13 06   GTO 6        -------------------------
 45  45 31 08   23 41 08   STO - 8
 46        02         02   2
 47        51         61   x            Determine velocity and
 48        05         05   5            height
 49        31         41   -
 50     45 09      23 09   STO 9
 51        02         02   2
 52        61         71   ÷
 53     55 06      24 06   RCL 6
 54        41         51   +
 55     55 07      24 07   RCL 7
 56        41         51   +
 57     55 09      24 09   RCL 9
 58  45 41 07   23 51 07   STO + 7
 59        12         22   R↓
 60     45 06      23 06   STO 6
 61     16 52      14 62   f INT        -------------------------
 62     25 41      15 51   g x>0        If no impact go for
 63     14 00      13 00   GTO 0        another burn
 64     55 07      24 07   RCL 7        -------------------------
 65  25 14 07   15 13 07   g LBL 7
 66     16 64      14 74   f PSE        Flash crash velocity
 67     14 07      13 07   GTO 7
 68  25 14 06   15 13 06   g LBL 6      -------------------------
 69     55 08      24 08   RCL 8        Fuel exhausted:
 70        02         02   2            call free-fall crash
 71        63         73   .            velocity
 72        05         05   5
 73        31         41   -
 74  45 41 06   23 51 06   STO + 6
 75        02         02   2
 76        51         61   x
 77  45 41 07   23 51 07   STO + 7
 78     55 06      24 06   RCL 6
 79        01         01   1
 80        00         00   0
 81        51         61   x
 82     55 07      24 07   RCL 7
 83     25 53      15 63   g x2
 84        41         51   +
 85     16 53      14 63   f √x
 86        22         32   CHS
 87     14 07      13 07   GTO 7
 88  25 14 04   15 13 04   g LBL 4
 89        11         21   x⇔y
 90        22         32   CHS
 91        11         21   x⇔y
 92     25 13      15 12   g RTN

Register Use

R6  x
R7  V
R8  Fuel
R9  Acceleration

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