HP41 PROGRAM INFORMATION

Programs listed:
ALTRE		star height refraction correction
CJD		Calendar Date to Julian day no.
CSF		boat capsize screening formula
DEV		compass deviation calculator
DDR		dead reckoning program 
FV		course change and vmg
JD		Julian day
JMOON		Jupiter moon position program
MPASS 		meridian passage to lat & long
MSTAR		3 body fix
NAV		navitaion program menu
SADL		sail area displacement - displacement length 
SAJ		sail area and %J
SPEED		Auto speedometer checker
TALM		Timer alarm program
TMC		true - magnetic - compass heading conversion
TWP		Too Way Point 
TRP		trip computer (auto)
TW		true wind bearing and speed from apparant
UT, *UT, PRDT,	time/date utilities
 DTd, dDT, dA	
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	
Date:		
Subject:	
Size:		

REQUIREMENTS
MODULES:	
SUBS:		
HARDWARE: 	

Comments

DATA STRUCTURE
REG	DATA

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	ALTRE
Date:		12/15/90
Subject:	Navigation
size:		

Comments
Calculates a stars observed height. Program promts for sextant height (Hs) in D.Mt, index error (sind), height of eye in meters. Program calculates and displays observed height in d.mm. If flag 2 is set program will prompt for non-STP conditions of temp in deg C and preasure in MB. Program may be used as a sub routine by XEQ *ALRE. HO is returned to the X register.
DATA STRUCTURE
REG	DATA
01	HS	Sextant Height
02	SIND	Sextant Index Error
03	HE	Height of Eye
04	DIP	Dip to horizon
05	H  	Apparant Altitude (=HS+I-D)
06	Ro	Refraction at STP
07	T	in degrees Kelvin
08	P	mB*0.28
09	f	refraction correction for non STP conditions
10	fRo	
11	Ho	Observed Height

FLAGS	SET		CLEAR
02	STP		Prompt for non
			STP temp/pres

07	Prompt for 	Run as sub
	data input	routine

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Program Name:	CJD
Date:		12/10/94
Subject:	Time/Date
Size:		

REQUIREMENTS
MODULES:	Time
SUBS:		
HARDWARE: 	

Comments
Converts a calendar date (in R30) and time (in R34) to a julian date. This program does is simmilar to JD but is more compact because it uses time module functions. The memory usage is designed to be compatible with the HP NAV 1B rom.
DATA STRUCTURE
REG	DATA
30	Date
34	Time

PROGRAM LISTING

LBL "CJD" 
1.012 RCL 30 DDAYS 
RCL 34 24 / + 2451544.5 
+ END

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Program Name:	CSF  (CAPSIZE SCREENING FORMULA)
Date:		5/97		
Subject:	BOATS/SAILING	
Size:		

REQUIREMENTS
MODULES:	
SUBS:		
HARDWARE: 	

Comments
Calculates the capsize screening factor for a sail boat. Input the boats maximum beam in Y and displacement in X, the CSF is returned in X. All calculations are done in the stack.

Formulas used IN CSF

CSF=(disp/64)^(1/3)/beam

PROGRAM LISTING
LBL CSF
64
/
3
1/X
Y^X
/
END
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	DEV
Date:		12/94
Subject:	Navigation
SIZE:		354 bytes

REQUIREMENTS
MODULES:	none
SUBS:		none
HARDWARE: 	none

Comments
DEV takes a true or compass heading value in X and returns the compass deviation for that heading from a database internal to the program. the database has deviation values every 10 degrees and an interpolation is performed for intermediate values. The database is only good for one particular boat and must be re-created for each boat it is to be used with. The program itself is fairly short and all processing is done in the stack. The 00 register is used to store the label for the sub routine needed for the heading in X. The deviation is retuned to X and flag 5 (set for a compass heading input before execution) is cleared by the program.
DATA STRUCTURE
REG	DATA
00	scratch space

FLAGS	S E T		C L E A R
05*	compass		True heading	*Flag is cleared
	heading input	input		 on each run.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	DDR
Date:		12/94
Subject:	Navigation
size:		516 bytes

REQUIREMENTS
MODULES:	NAV-1B, TIME (or CX)
SUBS:		*UT
HARDWARE: 	


Comments
DDR is a dead reckoning navigation program. Given a known starting location (l & lo), coarse and speed the program can calculate the locations of successive positions. The time interval between DR position calculations can be any length but coarse and speed must me constant for each leg. Set and drift can be calculated with a position fix and used in subsequent DR position calculations.
DATA STRUCTURE
REG	DATA
01	D	Miles
02	ET	Elapsed Time
06	H	Heading
07	L1	Last Lat
08	Lo1	Last Long
09	L2	New DR Lat
10	Lo2	New DR Long
20	DD	Departure Date
24	DT	Departure Time
25	S	Speed (Knots)
26	"DR"	Alpha data
30	D	Date (M.DDYYYY)
34	T	Time (decimal hours)

FLAGS	SET		CLEAR
01	Use system	Prompt for 
	time for 	time 
	current DR

02	Do not print 	Print last
	last DR info	DR info

03	Do not prompt	Prompt for 
	for last DR	last DR info
	info

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	FV  (Falloff VMG)
Date:		6/96  revised 6/97
Subject:	sailing
Size:		63 bytes

REQUIREMENTS
MODULES:	
SUBS:		
HARDWARE: 	

Comments
FV calculates the required boatspeed needed to maintain the same VMG to a mark on a new heading.
S = speed
A = course angle to mark
Fa= Course change (+for falling off, - for heading up)
S2= New speed to maintain VMG
VMG= Velocuty Made Good towards the mark

Formulas used IN FV

S2=S*cos(A) / cos(A+Fa)
VMG=S*cos(A)

Program results are displayed on two alpha lines:
DISPLAY1 >> |S A+Fa S2   |
DISPLAY2 >> |VMG=nn      |

DATA STRUCTURE
REG	DATA
01	S
02	A
03	Fa
04	VMG

Program Listing 6/02/97
........................
LBL FV  
STO 03  RDN  STO 02  RDN 
STO 01  RCL 02  COS  * 
STO 04  RCL 02  RCL 03  
+  COS  /  FIX 1  CLA  
ARCL 01  "| "  FIX 0  
CF 29  SF 21  ARCL 02 0 
RCL 03 X>Y? "|+"  
ARCL X  "| "  FIX 1  
ARCL Z  AVIEW  "VMG="  
ARCL 04  AVIEW  END
........................
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	JD	
Date:		8/90	
Subject:	Calandar	
Size:		

REQUIREMENTS
MODULES:	
SUBS:		
HARDWARE: 	

Comments
Converts a date in x (M.DDYYYY) and a time in R34 (decimal hours) to a julian day number. The memory usage is designed to be compatible with the HP NAV 1B rom.
DATA STRUCTURE
REG	DATA
30	date
31	frac part of date
32
34	time (decimal hours)

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	JMOON
Date:		3/23/91
Subject:	Astronomy
Size:		208 bytes

REQUIREMENTS
MODULES:	Time, NAV 1B
SUBS:		UT
HARDWARE: 	

Comments
Calculates the relative positions of the Galelean satelites of Jupiter. Time and date are taken from the internal clock if flag 01 is set. The relative positions are displayed it terms of Jupiter diameters.
DATA STRUCTURE
REG	DATA
01	Io position
02	Europa position
03	Ganymede position
04	Callisto position
05	scratch

FLAGS	SET		CLEAR
  01	system		prompt for
	date & time	date & time

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Program Name:	MPASS
Date:		6/90
Subject:	Navigation
Size:		

REQUIREMENTS
MODULES:	NAV-1B(SUN, MOON, DSPL, DSPLO, D+T)
SUBS:		*UT, *ALRE
HARDWARE:

Comments:
Finds latitude and longitude from meridian passage of sun or moon. Prompts for date and time (set flag 01 for system date & time). Next prompts are for sextant data in *ALRE sub routine. Program then displays a series of menus.
MENU>>	|NO SO :DIR?  |
Push corresponding top row buttons (in user mode) for direction of sight (north or south).
MENU>	|SU MO :BODY? |
Choose the body used in the sight (sun or moon)
MENU>>	|LIMB: UP C LO|
Choose the limb of the body used in the sight(upper, center, lower). The program then calculates and displays longitude and lattitude.
DATA STRUCTURE (For ALTRE)
see also NAV-1B ROM - uses up to reg 54
REG	DATA
01	HS	Sextant Height
02	SIND	Sextant Index Error
03	HE	Height of Eye
04	DIP	Dip to horizon
05	H  	Apparant Altitude (=HS+I-D)
06	Ro	Refraction at STP
07	T	in degrees Kelvin
08	P	mB*0.28
09	f	refraction correction for non STP conditions
10	fRo	
11	Ho	Observed Height

FLAGS	SET		CLEAR
  00	D.Mt		D.MS

  01	system		prompt for
	date & time	date & time

  02	Prompt for non	STP
	STP temp/pres

  07	Prompt for 	Run ALTRE as
	data input	sub routine

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	MSTAR
Date:		11/90
Subject:	Navigation
Size:		638 bytes

REQUIREMENTS
MODULES:	NAV-1B, ADVANTAGE
SUBS:		UT, *ALRE
HARDWARE: 	

Comments
Finds lat & long from 3 celestial sights by a closed solution to the vector matrix. Requires 3 sights. Program prompts for all inputs. First prompts for date and time, then the star numbers and sight information then converts star coordinates to xyz and builds matrix. The solution vector for this matrix is the observers position. Matrix is soved simultaneously using ADVANTAGE ROM matrix functions.
This program makes extensive use of NAV-1B and ADVANTAGE ROM sub routines.
DATA STRUCTURE
REG	DATA
58	1 star angle
59	2 star angle
60	3 star angle
61	1 star #
62	2 star #
63	3 star #
64	1 star accuracy rating
65	2 star accuracy rating
66	3 star accuracy rating
67	matrix ID
68	1 star x
69	1 star y
70	1 star z
71	2 star x
72	2 star y
73	2 star z
74	3 star x
75	3 star y
76	3 star z
77	SHA
78	dec
79	matrix ID
80	1 star cos angle/ position x
81	2 star cos angle/ position y
82	3 star cos angle/ position z
83	1 star time
84	2 star time
85	3 star time
86	heading
87	speed

FLAGS	S E T		C L E A R
00	D.Mt		D.MS

01	system		prompt for
	date & time	date & time

02	Prompt for non	STP
	STP temp/pres

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	NAV
Date:		12/94
Subject:	Navigation
Size:		91 bytes

REQUIREMENTS
MODULES:	NAV-1B
SUBS:		DDR, TWP, TMC
HARDWARE: 	

Comments

Menu program to run other navigation programs.

MENU   |DR WP C RL F|

Top row buttons correspond to menu items when in USER mode. 
Program does not set user mode.  As with all menu programs 
the J key returns the display to the menu.

DR (LBL A) runs the DDR sub.

WP (LBL B) runs the TWP sup.
 WP (LBL b) runs the WP sup in TWP.

C (LBL C) runs the TMC sub for true to compass.

RL (LBL D) runs the RL sub from the NAV-1B ROM.
 RL (LBL d) runs the GC sub from NAV-1B.

F (LBL E) runs the FX sub in DDR to input a fix for set and 
drift calculations.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	SADL
Date:		10/95
Subject:	sailing
Size:		57 bytes

REQUIREMENTS
MODULES:	
SUBS:		
HARDWARE: 	

Comments
SADL calculates the sail area-displacement ratio and the displacemet length ratio for a sail boat. the data is entered in the stack as follows:
	
	z	sail area in sqft
	y	displacement in lbs
	x	waterline length in ft

the results are returned to the alpha register for viewing.

The formulas used in the program are:
Sail Area Displacement Ratio -> SAD=SA/(disp/64)^2/3
Displacement Length Ratio -> DL=(disp/2240)/(.01*lwl)^3

DATA STRUCTURE
REG	DATA
00	scratch
01	scratch

PROGRAM LISTING 6/14/96
........................
LBL SADL  
.01  *  3  Y^X  X<>Y  
STO 00  2240  /  X<>Y  /  
STO 01  RDN  RCL 00  64  
/  2  3  /  Y^X  /  
FIX 1  CLA  ARCL X  
"|  "  FIX 0  CF 29  
ARCL 01  AVIEW  SF 29  
FIX 2  END
........................

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	SAJ
Date:		2/96
Subject:	sailing
Size:		80 bytes

REQUIREMENTS
MODULES:	
SUBS:		
HARDWARE: 	

Comments
SAJ calculates the area, luff perpendicular and %J of a sail. The length of the luff, leech and foot are entered in the z, y and x registers before the program is run. They must be in that order. The program displays the results in the alpha register. The J dimension of the boat is stored in the program on line 51 (in feet/100).
Formulas used IN SAJ

sail perimiter/2
	P2=(S1+S2+S3)/2
sail area
	SA=SQRT(P2*(p2-S1)*(P2-S2)*(P2-S3)
luff perpendicular
	LP=S2*SIN(2*ACOS(SQRT(P2*(P2-S3)/S1*S2)))

DISPLAY >> | area LP &J   |

DATA STRUCTURE
REG	DATA
10	perimiter/2
11	S1
12	S2
13	S3
14	area
15	Luff Perpendicular

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	SPEED
Date:		9/14/90
Subject:	AUTOMOBILE SPEED
Size:		

REQUIREMENTS
MODULES:	Time (or CX)
SUBS:		
HARDWARE: 	

Comments

DATA STRUCTURE
REG	DATA
01	alpha data

PROGRAM LISTING

LBL "SPEED"
FIX 2 0 SETSW SF 21 
"START" AVIEW RUNSW
"FINISH" AVIEW STOPSW
CLA RCLSW 100 * ATIME
ASTO 01 RCLSW HR 1/X CLA
ARCL X "| MPH" CF 21 
AVIEW END

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Program Name:	TALM
Date:		5/24/91	
Subject:	Timer Alarm	
Size:		106 BYTES

REQUIREMENTS
MODULES:	Time Module (or CX)
SUBS:		
HARDWARE: 	

Comments
Takes an elapsed time input in the X register (H.MMSS) and sets an alarm with the alpha lable "TIMER" for that many hours after the current system time. The time and date of the alarm is then displayed. The message "TIMER" is displayed when the alarm goes off.
CLTA is a loop program that clears all alarms with the "TIMER" message.
DATA STRUCTURE
REG	DATA
00	Scratch


PROGRAM LISTING

LBL "TALM"
"ET=? (H.MS)" PROMPT
FIX 3 CF 21 CF 26
STO 00 T+X 0 DATE
TIME "TIMER" RCL 00
CHS T+X RDN XYZALM
CLA ATIME FIX 1 X<>Y
"| " ADATE AVIEW
GTO 05

LBL "CLTA"
SF 25

LBL 02
FC? 25 GTO 04 "TIMER"
XROM 26,31 GTO 02

LBL 04
"TALMS CL" AVIEW

LBL 05
FIX 3 SF 26 END


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	TMC
Date:		12/94
Subject:	Navigation
Size:		394 bytes

REQUIREMENTS
MODULES:	
SUBS:		DEV to use deviation database (optional)	
HARDWARE: 	

Comments
Program does TVMDCAW and CDMVTAE calculations for compass navigation. The program is menu driven.
MENU>>    | TC CT R DS V |
Top row buttons correspond to menu items when in USER mode. Program does not set user mode. As with all menu programs the J key returns the display to the menu.
TC (LBL A) converts a true heading to a magnetic and compass heading.

CT (LBL B) converts a compass heading to a magnetic and true heading.

R (LBL C) finds and displays the recipricals to the TMC values. C is 
          recalculated using the deviation for the new true heading.

DS (LBL D) displays the TMC values.

V (LBL E) sets the variation value used in the program.

Data register usage is meant to be compatable with the NAV-1B ROM usage.

DATA STRUCTURE
REG	DATA
03	M	magnetic
04	C	compass
06	T	true
16	V	variation
17	D	deviation


FLAGS	SET		CLEAR
03	No prompts 	Prompt for
	for D & V	D & V

04	Get D from	Prompt for D
	DEV sub

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Program Name:	TWP	
Date:		12/94
Subject:	Navigation
Size:		143 bytes

REQUIREMENTS
MODULES:	NAV-1B	
SUBS:		UT, DDR
HARDWARE: 	

Comments
Finds HI (heading) and ETA to waypoint stored in R18 & R19 from current location in R7 & R8. This program is meant to be a subroutine to be used with the DDR program.
DATA STRUCTURE
REG	DATA
18	WPL	Waypoint Lat
19	WPLO	waypoint long
21	ETA	Arrival time day no. (see UT)
25	S	Speed in knots

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	TRP
Date:		6/91	
Subject:	Auto Trip Computer
Size:		759 bytes

REQUIREMENTS
MODULES:	TIME
SUBS:		
HARDWARE: 	

Comments
Trip computer program. This is a munu driven program.
MENU
Top row buttons correspond to menu items when in USER mode. Program does not set user mode. As with all menu programs the J key returns the display to the menu.
DATA STRUCTURE
REG	DATA
06	TIME
07	DPOD	departure odometer
08	DPTM	departure time
09	ODOM	current odometer
10	SPEED	current speed
11	DIST	distance to destination
12	ET	elapsed time
13	GAL	gallons
14	MPG	miles per gallon
15	ODFL	odometer at fillup
16	ARVO	arrival odometer
17	FLDS	fuel to destination
18	DTE	distance to empty	
19	TTE	time to empty
20	FCAP	fuel capacity
21	ODEM	odometer at empty
22	ARVT	arrival time
23	ARDT	arrival date
24	LOD	last odometer
25	LTM	last time

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	TW
Date:		5/97
Subject:	sailing
Size:		73 bytes

REQUIREMENTS
MODULES:	
SUBS:
HARDWARE: 	
Comments
Calculates true wind from boat heading (magnetic), boat speed, apparant wind angle and apparant wind speed. The input data goes in the stack.
STACK	DATA

T	HD	(boat heading)
Z	bs	(boat speed)
Y	AR	(apparant wind relative bearing)
X	AS	(apparant wind speed)
The apparant wind bearing is positive for starbord and negative for port. If the apparant wind is at 40 deg to stbd it is 40, if it is 40 degrees to port it is -40.

EXAMPLE 1
with a heading of 020, boat speed 5.5 knots, relative wind direction of 45 degrees (45 deg to stbd) and apparant wind speed of 13 knots you would make the following keystrokes:
20         Heading
ENTER
5.5        Boat Speed
ENTER
45         Apparant Wind Angle
ENTER
13         Apparant Wind Speed
XEQ TW
The display will read |T=68R,88M,10 |
This means the true wind is at 68 deg relative, 88 deg magnetic at 10 knots.
EXAMPLE 2
with a heading of 120, boat speed 6 knots, relative wind direction of -145 degrees (145 deg to port) and apparant wind speed of 7 knots you would make the following keystrokes:
120        Heading
CHS        Change to negative for wind to port
ENTER
6          Boat Speed
ENTER
145        Apparant Wind Angle
ENTER
7          Apparant Wind Speed
XEQ TW
The display will read |T=161R,41M,12|
This means the true wind is at 161 deg relative, 41 deg magnetic at 12 knots. The relative wind direction is not specified P or S. The program could be made to do this but it would complicate the code and the display. It should be pretty easy to look up and see which side of the boat the wind is on.

DISPLAY >> |T=nnnR,nnnM,nn|
(True wind realative bearing, magnetic bearing, speed)

DATA STRUCTURE
REG	DATA
11	AR	(apparant wind relative bearing)
12	AS	(apparant wind speed)
13	HD	(boat heading)
14	BS	(boat speed)

PROGRAM LISTING
LBL TW 
STO 12 RDN STO 11 RDN 
STO 14 RDN STO 13 90 
RCL 11 - RCL 12 P-R 
STO 11 RDN STO 12 90 
RCL 14 P-R ST- 11 RDN 
ST- 12 90 RCL 12 
RCL 11 R-P RDN - 
FIX 0 "T=" ARCL X 
"|R," RCL 13 + 360 
MOD R^ ARCL Y "|M," 
ARCL X AVIEW END

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Program Name:	UT, *UT, PRDT, DTd, dDT, dA
Date:		10/90
Subject:	Utility
Size:		158 bytes

Comments
UT
Converts the current internal clock date & time to Universal date & time. Date is stored in R30 in MM.DDYYYY format and time is storred in R34 in decimal hours (These are the same register assignments as used in the navigation ROM). The time zone offset is internal to the program and is in lines 9 and 17. These values should be 5 and -5 for EST, and 4 and -4 for EDT and so on. UT displays (or prints) the current time the same way the TIME command does.
*UT
Calculation subroutine used bt UT. It can be run alone when display of the time is not desired.
PRDT
Prints the date and time as stored in R30 and R34 and adds "UT" after the time.
DTd
Converts a date in Y (M.DDYYYY) and a time in X (decimal hours) to a day number with fraction. The day number is relative to 0000 hours 1/01/1900.
dDT
Converts a day number in X into a date (M.DDYYYY) in Y and time (decimal hours) in X. The day number is relative to 0000 hours 1/01/1900.
All processing for DTd and dDT is done in the stack. The number in Y is preserved but Z and T are lost.
NOTE ON ACCURACY
Calculator rounding results in up to a 4/10 second difference on a date/time processed DTd then back by dDT.
dA
Take a day number in X and places it as a date and time in the alpha register. The day number is relative to 0000 hours 1/01/1900.
DATA STRUCTURE
REG	DATA
30	date (MM.DDYYYY)
34	time (decimal)