The Museum of HP Calculators

# Moon Landing Simulation for the 12C

This program is by Richard Beal and is used here by permission.

This program is supplied without representation or warranty of any kind. Richard Beal 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

This is adapted from the program in the library for the HP-25.

It needed quite a lot of changes because the tests x<0 and x<y do not exist on the HP-12C, so x<=y must be used instead.

An enhancement is that the remaining fuel is flashed on the display.

The existing documentation is otherwise correct except that in step 3 it should say just R/S not f PRGM R/S, and step 7 should be removed.

## Listing

```01	42 4	f 4		4 digit display
02	45 0	RCL 0
03	26	EEX
04	4	4
05	10	/		Divide X by 10000
06	45 1	RCL 1
07	0	0
08	43 34	g x<=y		If 0<=V?
09	43,33 14	g GTO 14	-->	V positive or zero
10	33	R dn		V negative
11	34	x<>y		Add V and -X
12	30	-
13	43,33 16	g GTO 16	-->
14	33	R dn		Add V and X
15	40	+
16	31	R/S		Display V.X and get burn
17	45 2	RCL 2		Fuel
18	34	x<>y
19	43 34	g x<=y		If Burn<=Fuel?
20	43,33 22	g GTO 22	-->	Yes, so OK
21	43,33 42	g GTO 42	-->	No, so prepare for crash
22	44,30 2	STO - 2		Subtract burn from fuel
23	5	5
24	30	-
25	44 3	STO 3		Acceleration is burn-5
26	2	2
27	10	/
28	45 0	RCL 0
29	40	+
30	45 1	RCL 1
31	40	+
32	44 0	STO 0		Altitude X=X+V+A/2
33	0	0
34	43 34	g x<=y		If 0<=Altitude?
35	43,33 37	g GTO 37	-->	Yes, so OK
36	43,33 53	g GTO 53	-->	No, so crash
37	45 3	RCL 3
38	44,40 1	STO + 1		V=V+A
39	45 2	RCL 2		Display fuel remaining
40	43 31	g PSE
42	45 1	RCL 1		Show crash
43	36	ENTER
44	20	*
45	45 0	RCL 0
46	1	1
47	0	0
48	20	*
49	40	+
50	43 21	g SQR		V=Sqrt(V*V+2gX)
51	16	CHS		Show crash as down
52	44 1	STO 1		V
53	45 1	RCL 1		Jump here if hit ground
54	42 0	f 0
55	43,33 0	g GTO 00	-->	Stop
```