# Copyright:	None.  The author, Ron Burkey, hereby places
#		this file into the public domain.
# Filename:	LM1.ini
# Purpose: 	This is a configuration file used by the
#		program yaDSKY.  This particular file configures
#		yaDSKY for an Apollo 17 LM DSKY.
# Mod history:	09/12/04 RSB.	Adapted from LM.ini.
#		06/27/05 RSB.	Added LMSIM

# The idea of the configuration file is to allow us to
# configure yaDSKY for the DSKYs used in different Apollo
# missions (or for CM vs. LM), without having to modify
# yaDSKY's source code.  The particular configuration file
# needed is selected at the yaDSKY command line.  Read the
# comments below to see how to modify the configuration file.

# -------------------------------------------------------------
# The following line determines if this is a CM or LM simulation.
LMSIM
#CMSIM

# -------------------------------------------------------------
# The following line determines which graphic file is used
# for the PRO/STBY/PROG pushbutton.  Examine the graphic file
# within an editor (such as The GIMP) if you want to see its
# characteristics.  The syntax is the word "PROKEY", followed
# by whitespace, followed by the name of the graphics file.
PROKEY ProUp.xpm

# -------------------------------------------------------------
# The following lines determine which graphic files are
# used to simulate the 14 indicator lamps.  The lamps,
# which are in two columns of 7 lamps each, are numbered
#	11	21
#	12	22
#	.	.
#	.	.
#	.	.
#	17	27
# Graphics must be provided both for the "on" (lit) condition
# and the "off" (dark) condition.  Fields within a line are
# separated by whitespace, are are as follows:  the word
# "IND", the number of the indicator lamp (11, 21, ..., 77),
# the filename of the graphic for the lit condition, and the
# filename of the graphic for the dark condtion.  The lines
# appear in no particular order.
#
# Note that at least one of the lines should contain the substring
# "KeyRel" and another should contain the substring "OprErr".
# (If not, then yaDSKY will be unable to flash the KEY REL or
# OPR ERR indicators.)
IND 11 UplinkActyOn.xpm UplinkActyOff.xpm
IND 12 NoAttOn.xpm NoAttOff.xpm
IND 13 StbyOn.xpm StbyOff.xpm
IND 14 KeyRelOn.xpm KeyRelOff.xpm
IND 15 OprErrOn.xpm OprErrOff.xpm
IND 16 NoDapOn.xpm NoDapOff.xpm
IND 17 PrioDispOn.xpm PrioDispOff.xpm
IND 21 TempOn.xpm TempOff.xpm
IND 22 GimbalLockOn.xpm GimbalLockOff.xpm
IND 23 ProgOn.xpm ProgOff.xpm
IND 24 RestartOn.xpm RestartOff.xpm
IND 25 TrackerOn.xpm TrackerOff.xpm
IND 26 AltOn.xpm AltOff.xpm
IND 27 VelOn.xpm VelOff.xpm

# -------------------------------------------------------------
# The following lines determine which bit-positions of which
# of the CPU's "output channels" correspond to the various
# indicator lamps (which are numbered as described above).
# The fields with the lines are delimited by whitespace.
# the fields are:  the word "CHAN", the number of the indicator
# lamp (11, ..., 77), the number (in octal) of the output
# channel, the bit position (in decimal) of the flag that
# indicates whether the lamp should be lit or not, and a
# flag (0 or 1) indicating the polarity of the signal.
# (The polarity is XOR-ed with the bitflag.)  Note that the
# numerical bases (octal vs. decimal) have been chosen to
# mimic the Luminary/Colossus source code.
#
# Note that some of the CHAN lines have 6 numbers rather 
# than 4 numbers.  This is because some of the indicator
# lights depend not only in bit flags within the output channel,
# but also on certain fields ("row latches") matching a certain
# pattern.  The fifth number is a mask (in octal) which must be
# applied to the value emitted on the output channel, while
# the sixth number is the number which must appear in that 
# masked field.
#
# Explanation:  There is a Apollo Guidance Computer (AGC)
# CPU instruction which can output a 15-bit word to an "output
# channel", and by this means can control peripheral devices
# like the DSKY.  The bits are numbered 1 through 15, with
# 1 being the least-significant bit.
#
# ... But!  So far, I don't know the complete i/o mapping,
# so the list below is incomplete.
CHAN 11  11  3 0		# UPLINK ACTY
CHAN 12  10  4 0 74000 60000	# NO ATT
CHAN 13  13 11 0		# STBY
CHAN 14  11  5 0		# KEY REL
CHAN 15  11  7 0		# OPR ERR
CHAN 16 377  1 0
CHAN 17 377  1 0
CHAN 21  11  4 0		# TEMP
CHAN 22  10  6 0 74000 60000	# GIMBAL LOCK
CHAN 23  10  9 0 74000 60000	# PROG
CHAN 24 377  1 0
CHAN 25  10  8 0 74000 60000	# TRACKER
CHAN 26  10  5 0 74000 60000    # ALT
CHAN 27  10  3 0 74000 60000    # VEL

# -------------------------------------------------------------
# The following lines are actually for yaAGC rather than for
# yaDSKY.  They determine the behavior of yaAGC whilst in
# "--debug-dsky" mode.  In that mode, rather than running
# AGC software, yaAGC echoes command-sequences to the DSKY
# (or other peripherals) in response to keystrokes from the
# DSKY.  The particular command-sequences used are defined here.
# If no command-sequences are defined here, then the --debug-dsky
# mode is not functional.  The syntax of any given line is:
#	DEBUG KeyCode Channel Logic Value
# KeyCode is decimal, Channel is octal, and Value is hexadecimal.
# The KeyCode is the numerical value which the DSKY provides to
# the CPU (i.e., to yaAGC) upon the key being pressed.  These
# keycodes are:
#	Key			KeyCode
#	---			-------
#	1			1
#	...			...
#	9			9
#	0			16
#	VERB			17
#	RSET			18
#	KEY REL			25
#	+			26
#	-			27
#	ENTR			28
#	CLR			30
#	NOUN			31
#	PRO/STBY/PROG		Different mechanism, but for
#				this purpose ONLY is treated
#				as the fictitious KeyCode 0.
# As many DEBUG lines can be defined for a given KeyCode as you
# like; they will all be used, in the order given.  The Channel
# is the output channel on which the command is transmitted.
# The Logic field is as follows:
#	Logic		Interpretation
#	-----		--------------
#	=		Outputs Value on the Channel
#	|		Bitwise-OR Value with the last
#			output on the Channel.
#	&		Bitwise-AND Value with the last
#			output on the Channel.
#	^		Bitwise-XOR Value with the last
#			output on the Channel.
# Thus, any bit-positions (or combination of bit-positions)
# on any Channel can be selectively set, reset, or toggled
# without affecting any other bits.  Or, sequences of outputs
# could be used to write to the numerical displays.  More
# complex debugging behaviors might be desirable under some
# circumstances, but you'll have to modify yaAGC source code
# if you want to implement them.
#
# IMPORTANT:  The Logic field should be preceded by precisely
# one blank space.

# PRO-key.  Toggle DSKY test mode.
DEBUG 0 13 ^ 0200
# 1-key.  Display "1" on top 5-digit display.
DEBUG 1 10 = 4000
DEBUG 1 10 = 3800
DEBUG 1 10 = 3003
# 2-key.  Display "2" on top 5-digit display.
DEBUG 2 10 = 4000
DEBUG 2 10 = 3800
DEBUG 2 10 = 3019
# 3-key.  Display "3" on top 5-digit display.
DEBUG 3 10 = 4000
DEBUG 3 10 = 3800
DEBUG 3 10 = 301b
# 4-key.  Display "4" on top 5-digit display.
DEBUG 4 10 = 4000
DEBUG 4 10 = 3800
DEBUG 4 10 = 300f
# 5-key.  Display "5" on top 5-digit display.
DEBUG 5 10 = 4000
DEBUG 5 10 = 3800
DEBUG 5 10 = 301e
# 6-key.  Display "6" on top 5-digit display.
DEBUG 6 10 = 4000
DEBUG 6 10 = 3800
DEBUG 6 10 = 301c
# 7-key.  Display "7" on top 5-digit display.
DEBUG 7 10 = 4000
DEBUG 7 10 = 3800
DEBUG 7 10 = 3013
# 8-key.  Display "8" on top 5-digit display.
DEBUG 8 10 = 4000
DEBUG 8 10 = 3800
DEBUG 8 10 = 301d
# 9-key.  Display "9" on top 5-digit display.
DEBUG 9 10 = 4000
DEBUG 9 10 = 3800
DEBUG 9 10 = 301f
# 0-key.  Display "0" on top 5-digit display.
DEBUG 16 10 = 4000
DEBUG 16 10 = 3800
DEBUG 16 10 = 3015
# VERB-key.  Toggle "TEMP" lamp.
DEBUG 17 11 ^ 8
# RSET-key.  Clear all lamps and numerical displays.
DEBUG 18 11 = 0
DEBUG 18 10 = 4000
DEBUG 18 10 = 3800
DEBUG 18 10 = 3000
# KEY REL key.  Toggle "KEY REL" lamp.
DEBUG 25 11 ^ 10
# + key.  Toggle VERB/NOUN flashing.
DEBUG 26 11 ^ 20
# - key.  Toggle "UPLINK ACTY" lamp.
DEBUG 27 11 ^ 4
# ENTR-key.  Display "+12345" on top 5-digit display.
DEBUG 28 10 = 4003
DEBUG 28 10 = 3f3b
DEBUG 28 10 = 31fe
# CLR-key.  Toggle "COMP ACTY" indicator.
DEBUG 30 11 ^ 2
# NOUN-key.  Toggle "OPR ERR" lamp.
DEBUG 31 11 ^ 40
