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
ENTER
6          Boat Speed
ENTER
145        Apparant Wind Angle
CHS        Change to negative for wind to port
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

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