;:ts=8
	far	code
	far	data
;/*  TT8 specific includes  */
;#include        <TT8.h>                 /* Tattletale Model 8 Definitions */
;#include        <tat332.h>              /* 68332 Tattletale (7,8) Hardware Definitions */
;#include        <sim332.h>              /* 68332 System Integration Module Definitions */
;#include        <qsm332.h>              /* 68332 Queued Serial Module Definitions */
;#include        <dio332.h>              /* 68332 Digital I/O Port Pin Definitions */
;#include        <tt8lib.h>              /* definitions and prototypes for Model 8 library */
;
;/*  general C includes  */
;#include        <stdio.h>
;#include        <stdlib.h>
;#include		<string.h>
;#include		<ctype.h>
;#include		<userio.h>
;
;//  includes related to the data logger
;#include		"ASSERT.h"
;#include		"commands.h"
;#include		"science.h"
;#include		"engineer.h"
;#include		"eeprom.h"
;#include		"logtime.h"
	dseg
	ds	0
_LATEST_LOGGER_TIME:
	ds.b	0
	dc.l	$ffffffff
	dc.l	$0000
	cseg
	dseg
	ds	0
_EARLIEST_LOGGER_TIME:
	ds.b	0
	dc.l	$0000
	dc.l	$0000
	cseg
;#include		"logdisk.h"
;#include		"logger.h"
;#include		"text_log.h"
;#include		"misc.h"
;#include		"MacTrimp.h"
;#include		"power.h"
;#include		"lpsleep.h"
;
;#include		"AD7716.h"	//  delete this include in final version
;
;//  includes related to the disk drive
;#include		<pcdisk.h>
;
;//  defined in main.c.  Sets the minimum clock freqeuncy required
;//  for a sync time set or read.
;extern const long MIN_TIME_SET_FREQ;
;
;//  The working directory always contains at least a partition letter,
;//  the : and the \.  The default partition is A.
;//  Remember that the path must be all upper case.
;char wd[EMAXPATH] = "A:\\";
	dseg
	xdef	_wd
_wd:
	dc.b	65
	dc.b	58
	dc.b	92
	dc.b	0
	ds.b	256
	cseg
;
;
;//  structure used to parse a command string
;struct commands  {
;	char name[32];		//  character string used to invoke the command
;	int code;			//  integer code used to reference the command
;	int (*func) (char* string);
;						//  function used to implement the command.  All
;						//  functions return an integer to indicates success
;						//  or failure.  All functions take a pointer to the
;						//  remainder of the command string which may contain
;						//  additional arguments
;	char help[48];		//  character string to print when user asks for
;						//  help on allowed arguments
;};
;
;
;
;const struct commands cmd_ref[] = {
	ds	0
	xdef	_cmd_ref
_cmd_ref:
;	"QUIT",
	ds.b	0
	dc.b	81
	dc.b	85
	dc.b	73
	dc.b	84
	dc.b	0
	ds.b	27
;	CMD_QUIT,
	dc.w	2
;	cmd_quit,
	dc.l	_cmd_quit
;	" [no argument - debug only]",
	dc.b	32
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	32
	dc.b	45
	dc.b	32
	dc.b	100
	dc.b	101
	dc.b	98
	dc.b	117
	dc.b	103
	dc.b	32
	dc.b	111
	dc.b	110
	dc.b	108
	dc.b	121
	dc.b	93
	dc.b	0
	ds.b	20
;
;//	"HELP",
;//	CMD_HELP,
;//	cmd_help,
;//	"[no arguments]",
;//	
;	"?",
	ds.b	0
	dc.b	63
	dc.b	0
	ds.b	30
;	CMD_HELP,
	dc.w	1
;	cmd_help,
	dc.l	_cmd_help
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;	
;	"SUSPEND LOGGER",
	ds.b	0
	dc.b	83
	dc.b	85
	dc.b	83
	dc.b	80
	dc.b	69
	dc.b	78
	dc.b	68
	dc.b	32
	dc.b	76
	dc.b	79
	dc.b	71
	dc.b	71
	dc.b	69
	dc.b	82
	dc.b	0
	ds.b	17
;	CMD_SUSPEND_LOGGER,
	dc.w	3
;	cmd_suspend_logger,
	dc.l	_cmd_suspend_logger
;	"[number of seconds to suspend]",
	dc.b	91
	dc.b	110
	dc.b	117
	dc.b	109
	dc.b	98
	dc.b	101
	dc.b	114
	dc.b	32
	dc.b	111
	dc.b	102
	dc.b	32
	dc.b	115
	dc.b	101
	dc.b	99
	dc.b	111
	dc.b	110
	dc.b	100
	dc.b	115
	dc.b	32
	dc.b	116
	dc.b	111
	dc.b	32
	dc.b	115
	dc.b	117
	dc.b	115
	dc.b	112
	dc.b	101
	dc.b	110
	dc.b	100
	dc.b	93
	dc.b	0
	ds.b	17
;	
;	"START LOGGER",
	ds.b	0
	dc.b	83
	dc.b	84
	dc.b	65
	dc.b	82
	dc.b	84
	dc.b	32
	dc.b	76
	dc.b	79
	dc.b	71
	dc.b	71
	dc.b	69
	dc.b	82
	dc.b	0
	ds.b	19
;	CMD_START_LOGGER,
	dc.w	4
;	cmd_start_logger,
	dc.l	_cmd_start_logger
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;	
;	"SENSOR POWER",
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	78
	dc.b	83
	dc.b	79
	dc.b	82
	dc.b	32
	dc.b	80
	dc.b	79
	dc.b	87
	dc.b	69
	dc.b	82
	dc.b	0
	ds.b	19
;	CMD_SENSOR_POWER,
	dc.w	8
;	cmd_sensor_power,
	dc.l	_cmd_sensor_power
;	"ON or OFF",
	dc.b	79
	dc.b	78
	dc.b	32
	dc.b	111
	dc.b	114
	dc.b	32
	dc.b	79
	dc.b	70
	dc.b	70
	dc.b	0
	ds.b	38
;	
;	"SET SCIENCE CHANNELS",	//  Sets which science channels are recorded
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	83
	dc.b	67
	dc.b	73
	dc.b	69
	dc.b	78
	dc.b	67
	dc.b	69
	dc.b	32
	dc.b	67
	dc.b	72
	dc.b	65
	dc.b	78
	dc.b	78
	dc.b	69
	dc.b	76
	dc.b	83
	dc.b	0
	ds.b	11
;	CMD_SET_SCIENCE_CHANNELS,
	dc.w	107
;	cmd_set_science_channels,
	dc.l	_cmd_set_science_channels
;	"[channel #][,channel #]...",
	dc.b	91
	dc.b	99
	dc.b	104
	dc.b	97
	dc.b	110
	dc.b	110
	dc.b	101
	dc.b	108
	dc.b	32
	dc.b	35
	dc.b	93
	dc.b	91
	dc.b	44
	dc.b	99
	dc.b	104
	dc.b	97
	dc.b	110
	dc.b	110
	dc.b	101
	dc.b	108
	dc.b	32
	dc.b	35
	dc.b	93
	dc.b	46
	dc.b	46
	dc.b	46
	dc.b	0
	ds.b	21
;	
;	"SET SCIENCE GAIN",		//  Sets gain of a science channel
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	83
	dc.b	67
	dc.b	73
	dc.b	69
	dc.b	78
	dc.b	67
	dc.b	69
	dc.b	32
	dc.b	71
	dc.b	65
	dc.b	73
	dc.b	78
	dc.b	0
	ds.b	15
;	CMD_SET_SCIENCE_GAIN,   //  Arguments: channel number, gain
	dc.w	101
;	cmd_set_science_gain,
	dc.l	_cmd_set_science_gain
;	"[channel #, gain], where gain is 2.5 or 25",
	dc.b	91
	dc.b	99
	dc.b	104
	dc.b	97
	dc.b	110
	dc.b	110
	dc.b	101
	dc.b	108
	dc.b	32
	dc.b	35
	dc.b	44
	dc.b	32
	dc.b	103
	dc.b	97
	dc.b	105
	dc.b	110
	dc.b	93
	dc.b	44
	dc.b	32
	dc.b	119
	dc.b	104
	dc.b	101
	dc.b	114
	dc.b	101
	dc.b	32
	dc.b	103
	dc.b	97
	dc.b	105
	dc.b	110
	dc.b	32
	dc.b	105
	dc.b	115
	dc.b	32
	dc.b	50
	dc.b	46
	dc.b	53
	dc.b	32
	dc.b	111
	dc.b	114
	dc.b	32
	dc.b	50
	dc.b	53
	dc.b	0
	ds.b	5
;	
;	"SET SCIENCE RATE",		//  Sets conversion rate for all science channels
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	83
	dc.b	67
	dc.b	73
	dc.b	69
	dc.b	78
	dc.b	67
	dc.b	69
	dc.b	32
	dc.b	82
	dc.b	65
	dc.b	84
	dc.b	69
	dc.b	0
	ds.b	15
;	CMD_SET_SCIENCE_RATE,   //  Arguments: rate
	dc.w	102
;	cmd_set_science_rate,
	dc.l	_cmd_set_science_rate
;	"[rate], where rate = 129 or 257",
	dc.b	91
	dc.b	114
	dc.b	97
	dc.b	116
	dc.b	101
	dc.b	93
	dc.b	44
	dc.b	32
	dc.b	119
	dc.b	104
	dc.b	101
	dc.b	114
	dc.b	101
	dc.b	32
	dc.b	114
	dc.b	97
	dc.b	116
	dc.b	101
	dc.b	32
	dc.b	61
	dc.b	32
	dc.b	49
	dc.b	50
	dc.b	57
	dc.b	32
	dc.b	111
	dc.b	114
	dc.b	32
	dc.b	50
	dc.b	53
	dc.b	55
	dc.b	0
	ds.b	16
;	
;	"SET SCIENCE AVERAGING",	//  Sets the number of science samples which
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	83
	dc.b	67
	dc.b	73
	dc.b	69
	dc.b	78
	dc.b	67
	dc.b	69
	dc.b	32
	dc.b	65
	dc.b	86
	dc.b	69
	dc.b	82
	dc.b	65
	dc.b	71
	dc.b	73
	dc.b	78
	dc.b	71
	dc.b	0
	ds.b	10
;								//  are averaged together
;	CMD_SET_SCIENCE_AVERAGING,
	dc.w	111
;	cmd_set_science_averaging,
	dc.l	_cmd_set_science_averaging
;	"[#], where # is 1, 2, 3, or 4",
	dc.b	91
	dc.b	35
	dc.b	93
	dc.b	44
	dc.b	32
	dc.b	119
	dc.b	104
	dc.b	101
	dc.b	114
	dc.b	101
	dc.b	32
	dc.b	35
	dc.b	32
	dc.b	105
	dc.b	115
	dc.b	32
	dc.b	49
	dc.b	44
	dc.b	32
	dc.b	50
	dc.b	44
	dc.b	32
	dc.b	51
	dc.b	44
	dc.b	32
	dc.b	111
	dc.b	114
	dc.b	32
	dc.b	52
	dc.b	0
	ds.b	18
;	
;	"SET STA TIME",			//  Sets length of short term average
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	83
	dc.b	84
	dc.b	65
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	0
	ds.b	19
;	CMD_SET_STA_TIME,		//  Arguments: length of STA in seconds
	dc.w	103
;	cmd_set_STA_time,
	dc.l	_cmd_set_STA_time
;	"[length in seconds]",
	dc.b	91
	dc.b	108
	dc.b	101
	dc.b	110
	dc.b	103
	dc.b	116
	dc.b	104
	dc.b	32
	dc.b	105
	dc.b	110
	dc.b	32
	dc.b	115
	dc.b	101
	dc.b	99
	dc.b	111
	dc.b	110
	dc.b	100
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	28
;
;	"SET LTA TIME",			//  Sets length of short term average
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	76
	dc.b	84
	dc.b	65
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	0
	ds.b	19
;	CMD_SET_LTA_TIME,		//  Arguments: length of STA in seconds
	dc.w	104
;	cmd_set_LTA_time,
	dc.l	_cmd_set_LTA_time
;	"[length in seconds]",
	dc.b	91
	dc.b	108
	dc.b	101
	dc.b	110
	dc.b	103
	dc.b	116
	dc.b	104
	dc.b	32
	dc.b	105
	dc.b	110
	dc.b	32
	dc.b	115
	dc.b	101
	dc.b	99
	dc.b	111
	dc.b	110
	dc.b	100
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	28
;	
;	"SET TRIGGER LEVEL",	//  Sets the trigger level for all channels
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	84
	dc.b	82
	dc.b	73
	dc.b	71
	dc.b	71
	dc.b	69
	dc.b	82
	dc.b	32
	dc.b	76
	dc.b	69
	dc.b	86
	dc.b	69
	dc.b	76
	dc.b	0
	ds.b	14
;	CMD_SET_TRIGGER_LEVEL,
	dc.w	105
;	cmd_set_trigger_level,
	dc.l	_cmd_set_trigger_level
;	"[channel or ALL] [value of STA/LTA]",
	dc.b	91
	dc.b	99
	dc.b	104
	dc.b	97
	dc.b	110
	dc.b	110
	dc.b	101
	dc.b	108
	dc.b	32
	dc.b	111
	dc.b	114
	dc.b	32
	dc.b	65
	dc.b	76
	dc.b	76
	dc.b	93
	dc.b	32
	dc.b	91
	dc.b	118
	dc.b	97
	dc.b	108
	dc.b	117
	dc.b	101
	dc.b	32
	dc.b	111
	dc.b	102
	dc.b	32
	dc.b	83
	dc.b	84
	dc.b	65
	dc.b	47
	dc.b	76
	dc.b	84
	dc.b	65
	dc.b	93
	dc.b	0
	ds.b	12
;	
;	"SET PRE-EVENT TIME",	//  Sets length of the pre-event data
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	80
	dc.b	82
	dc.b	69
	dc.b	45
	dc.b	69
	dc.b	86
	dc.b	69
	dc.b	78
	dc.b	84
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	0
	ds.b	13
;	CMD_SET_PRE_EVENT_TIME,	//  Arguments: length of pre-event in seconds
	dc.w	108
;	cmd_set_pre_event_time,
	dc.l	_cmd_set_pre_event_time
;	"[length in seconds]",
	dc.b	91
	dc.b	108
	dc.b	101
	dc.b	110
	dc.b	103
	dc.b	116
	dc.b	104
	dc.b	32
	dc.b	105
	dc.b	110
	dc.b	32
	dc.b	115
	dc.b	101
	dc.b	99
	dc.b	111
	dc.b	110
	dc.b	100
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	28
;	
;	"SET POST-EVENT TIME",	//  Sets length of the post-event data
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	80
	dc.b	79
	dc.b	83
	dc.b	84
	dc.b	45
	dc.b	69
	dc.b	86
	dc.b	69
	dc.b	78
	dc.b	84
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	0
	ds.b	12
;	CMD_SET_POST_EVENT_TIME,//  Arguments: length of post-event in seconds
	dc.w	109
;	cmd_set_post_event_time,
	dc.l	_cmd_set_post_event_time
;	"[length in seconds]",
	dc.b	91
	dc.b	108
	dc.b	101
	dc.b	110
	dc.b	103
	dc.b	116
	dc.b	104
	dc.b	32
	dc.b	105
	dc.b	110
	dc.b	32
	dc.b	115
	dc.b	101
	dc.b	99
	dc.b	111
	dc.b	110
	dc.b	100
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	28
;	
;	"SET ENGINEERING RATE",	//  Sets the sample time for engineering channels
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	69
	dc.b	78
	dc.b	71
	dc.b	73
	dc.b	78
	dc.b	69
	dc.b	69
	dc.b	82
	dc.b	73
	dc.b	78
	dc.b	71
	dc.b	32
	dc.b	82
	dc.b	65
	dc.b	84
	dc.b	69
	dc.b	0
	ds.b	11
;	CMD_SET_ENGINEERING_RATE,
	dc.w	201
;	cmd_set_eng_rate,
	dc.l	_cmd_set_eng_rate
;	"[channel #, rate], rate is seconds/sample",
	dc.b	91
	dc.b	99
	dc.b	104
	dc.b	97
	dc.b	110
	dc.b	110
	dc.b	101
	dc.b	108
	dc.b	32
	dc.b	35
	dc.b	44
	dc.b	32
	dc.b	114
	dc.b	97
	dc.b	116
	dc.b	101
	dc.b	93
	dc.b	44
	dc.b	32
	dc.b	114
	dc.b	97
	dc.b	116
	dc.b	101
	dc.b	32
	dc.b	105
	dc.b	115
	dc.b	32
	dc.b	115
	dc.b	101
	dc.b	99
	dc.b	111
	dc.b	110
	dc.b	100
	dc.b	115
	dc.b	47
	dc.b	115
	dc.b	97
	dc.b	109
	dc.b	112
	dc.b	108
	dc.b	101
	dc.b	0
	ds.b	6
;	
;	"READ ENGINEERING", 	//  Reads an engineering channel
	ds.b	0
	dc.b	82
	dc.b	69
	dc.b	65
	dc.b	68
	dc.b	32
	dc.b	69
	dc.b	78
	dc.b	71
	dc.b	73
	dc.b	78
	dc.b	69
	dc.b	69
	dc.b	82
	dc.b	73
	dc.b	78
	dc.b	71
	dc.b	0
	ds.b	15
;	CMD_READ_ENGINEERING,
	dc.w	202
;	cmd_read_eng,
	dc.l	_cmd_read_eng
;	"[channel #]",
	dc.b	91
	dc.b	99
	dc.b	104
	dc.b	97
	dc.b	110
	dc.b	110
	dc.b	101
	dc.b	108
	dc.b	32
	dc.b	35
	dc.b	93
	dc.b	0
	ds.b	36
;
;	"READ SCIENCE",
	ds.b	0
	dc.b	82
	dc.b	69
	dc.b	65
	dc.b	68
	dc.b	32
	dc.b	83
	dc.b	67
	dc.b	73
	dc.b	69
	dc.b	78
	dc.b	67
	dc.b	69
	dc.b	0
	ds.b	19
;	CMD_READ_SCIENCE,
	dc.w	106
;	cmd_read_science,
	dc.l	_cmd_read_science
;	"[channel #]",
	dc.b	91
	dc.b	99
	dc.b	104
	dc.b	97
	dc.b	110
	dc.b	110
	dc.b	101
	dc.b	108
	dc.b	32
	dc.b	35
	dc.b	93
	dc.b	0
	ds.b	36
;	
;	//  commands which start with a "!" are intended for use by the graphical interface.
;	//  They are not displayed by the help screen.  They are kept short to minimize
;	//  transmission times.  They need not be particularly mneumonic since general users
;	//  don't have to remember them.
;	"!RBS",
	ds.b	0
	dc.b	33
	dc.b	82
	dc.b	66
	dc.b	83
	dc.b	0
	ds.b	27
;	CMD_READ_BINARY_SCIENCE,
	dc.w	110
;	cmd_read_binary_science,
	dc.l	_cmd_read_binary_science
;	"",
	dc.b	0
	ds.b	47
;	
;	"SET TIME",				//  Sets time when carriage return is hit
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	0
	ds.b	23
;	CMD_SET_TIME,
	dc.w	301
;	cmd_set_time,
	dc.l	_cmd_set_time
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;	
;	"PRINT TIME",			//  Gets time when carriage return is hit
	ds.b	0
	dc.b	80
	dc.b	82
	dc.b	73
	dc.b	78
	dc.b	84
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	0
	ds.b	21
;	CMD_PRINT_TIME,
	dc.w	303
;	cmd_print_time,
	dc.l	_cmd_print_time
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;	
;	"SYNC SET TIME",		//  Sets time on leading edge of input pulse
	ds.b	0
	dc.b	83
	dc.b	89
	dc.b	78
	dc.b	67
	dc.b	32
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	0
	ds.b	18
;	CMD_SYNC_SET_TIME,
	dc.w	302
;	cmd_sync_set_time,
	dc.l	_cmd_sync_set_time
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;
;	"SAVE SETUP",			//  Saves setup data to EEPROM
	ds.b	0
	dc.b	83
	dc.b	65
	dc.b	86
	dc.b	69
	dc.b	32
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	85
	dc.b	80
	dc.b	0
	ds.b	21
;	CMD_SAVE_SETUP,
	dc.w	6
;	cmd_save_setup,
	dc.l	_cmd_save_setup
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;	
;	"SYNC PRINT TIME ERROR",		//  Gets time on leading edge of input pulse
	ds.b	0
	dc.b	83
	dc.b	89
	dc.b	78
	dc.b	67
	dc.b	32
	dc.b	80
	dc.b	82
	dc.b	73
	dc.b	78
	dc.b	84
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	32
	dc.b	69
	dc.b	82
	dc.b	82
	dc.b	79
	dc.b	82
	dc.b	0
	ds.b	10
;	CMD_SYNC_PRINT_TIME_ERROR,      //  This routine MUST be in the structure before
	dc.w	305
;	cmd_sync_print_time_error,      //  the next in order for the parse routines to
	dc.l	_cmd_sync_print_time_error
;	"[no arguments]",               //  work properly.  If not, they will think this
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;									//  is the "sync print time" command with an argument
;									//  of "error"
;	
;	"SYNC PRINT TIME",		//  Gets time on leading edge of input pulse
	ds.b	0
	dc.b	83
	dc.b	89
	dc.b	78
	dc.b	67
	dc.b	32
	dc.b	80
	dc.b	82
	dc.b	73
	dc.b	78
	dc.b	84
	dc.b	32
	dc.b	84
	dc.b	73
	dc.b	77
	dc.b	69
	dc.b	0
	ds.b	16
;	CMD_SYNC_PRINT_TIME,
	dc.w	304
;	cmd_sync_print_time,
	dc.l	_cmd_sync_print_time
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;	
;	"SHOW SETUP DATA",
	ds.b	0
	dc.b	83
	dc.b	72
	dc.b	79
	dc.b	87
	dc.b	32
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	85
	dc.b	80
	dc.b	32
	dc.b	68
	dc.b	65
	dc.b	84
	dc.b	65
	dc.b	0
	ds.b	16
;	CMD_SHOW_SETUP_DATA,
	dc.w	5
;	cmd_show_setup_data,
	dc.l	_cmd_show_setup_data
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;	
;	"SHOW STATUS",
	ds.b	0
	dc.b	83
	dc.b	72
	dc.b	79
	dc.b	87
	dc.b	32
	dc.b	83
	dc.b	84
	dc.b	65
	dc.b	84
	dc.b	85
	dc.b	83
	dc.b	0
	ds.b	20
;	CMD_SHOW_STATUS,
	dc.w	10
;	cmd_show_status,
	dc.l	_cmd_show_status
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;	
;	"CD",
	ds.b	0
	dc.b	67
	dc.b	68
	dc.b	0
	ds.b	29
;	CMD_DISK_CD,
	dc.w	403
;	cmd_disk_cd,
	dc.l	_cmd_disk_cd
;	"[DOS path to use as working directory]",
	dc.b	91
	dc.b	68
	dc.b	79
	dc.b	83
	dc.b	32
	dc.b	112
	dc.b	97
	dc.b	116
	dc.b	104
	dc.b	32
	dc.b	116
	dc.b	111
	dc.b	32
	dc.b	117
	dc.b	115
	dc.b	101
	dc.b	32
	dc.b	97
	dc.b	115
	dc.b	32
	dc.b	119
	dc.b	111
	dc.b	114
	dc.b	107
	dc.b	105
	dc.b	110
	dc.b	103
	dc.b	32
	dc.b	100
	dc.b	105
	dc.b	114
	dc.b	101
	dc.b	99
	dc.b	116
	dc.b	111
	dc.b	114
	dc.b	121
	dc.b	93
	dc.b	0
	ds.b	9
;	
;	"PWD",
	ds.b	0
	dc.b	80
	dc.b	87
	dc.b	68
	dc.b	0
	ds.b	28
;	CMD_DISK_PWD,
	dc.w	404
;	cmd_disk_pwd,
	dc.l	_cmd_disk_pwd
;	"[no arguments]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	115
	dc.b	93
	dc.b	0
	ds.b	33
;
;	"DIR",
	ds.b	0
	dc.b	68
	dc.b	73
	dc.b	82
	dc.b	0
	ds.b	28
;	CMD_DISK_DIR,
	dc.w	401
;	cmd_disk_dir,
	dc.l	_cmd_disk_dir
;	"[optional path]",
	dc.b	91
	dc.b	111
	dc.b	112
	dc.b	116
	dc.b	105
	dc.b	111
	dc.b	110
	dc.b	97
	dc.b	108
	dc.b	32
	dc.b	112
	dc.b	97
	dc.b	116
	dc.b	104
	dc.b	93
	dc.b	0
	ds.b	32
;	
;	//  note that this command must follow the 'print setup' command
;	//  in this array, or it will be interpreted as print the file named
;	//  setup
;	"PRINT",
	ds.b	0
	dc.b	80
	dc.b	82
	dc.b	73
	dc.b	78
	dc.b	84
	dc.b	0
	ds.b	26
;	CMD_DISK_PRINT,
	dc.w	402
;	cmd_disk_print,
	dc.l	_cmd_disk_print
;	"[filename]",
	dc.b	91
	dc.b	102
	dc.b	105
	dc.b	108
	dc.b	101
	dc.b	110
	dc.b	97
	dc.b	109
	dc.b	101
	dc.b	93
	dc.b	0
	ds.b	37
;	
;	"TEST",					//  general purpose test routine adjusts as desired
	ds.b	0
	dc.b	84
	dc.b	69
	dc.b	83
	dc.b	84
	dc.b	0
	ds.b	27
;	CMD_TEST,               //  not for general user usage
	dc.w	7
;	cmd_test,
	dc.l	_cmd_test
;	"[no argument]",
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	93
	dc.b	0
	ds.b	34
;/*	
;	"",						//  last command is empty
;	NOOP,
;	NULL,
;	""
;*/	
;	"SET CLOCK",
	ds.b	0
	dc.b	83
	dc.b	69
	dc.b	84
	dc.b	32
	dc.b	67
	dc.b	76
	dc.b	79
	dc.b	67
	dc.b	75
	dc.b	0
	ds.b	22
;	CMD_SET_CLOCK,
	dc.w	50
;	cmd_set_clock,
	dc.l	_cmd_set_clock
;	"[new clock rate]",
	dc.b	91
	dc.b	110
	dc.b	101
	dc.b	119
	dc.b	32
	dc.b	99
	dc.b	108
	dc.b	111
	dc.b	99
	dc.b	107
	dc.b	32
	dc.b	114
	dc.b	97
	dc.b	116
	dc.b	101
	dc.b	93
	dc.b	0
	ds.b	31
;
;	"VERSION",
	ds.b	0
	dc.b	86
	dc.b	69
	dc.b	82
	dc.b	83
	dc.b	73
	dc.b	79
	dc.b	78
	dc.b	0
	ds.b	24
;	CMD_PRINT_VERSION,
	dc.w	9
;	cmd_print_version,
	dc.l	_cmd_print_version
;	"[no argument]"
;};
	dc.b	91
	dc.b	110
	dc.b	111
	dc.b	32
	dc.b	97
	dc.b	114
	dc.b	103
	dc.b	117
	dc.b	109
	dc.b	101
	dc.b	110
	dc.b	116
	dc.b	93
	dc.b	0
	ds.b	34
	cseg
;const short n_commands = sizeof (cmd_ref) / sizeof (struct commands);
	ds	0
	xdef	_n_commands
_n_commands:
	dc.w	33
	cseg
;
;
;//  array of error messages available to describe failed commands
;const char* cmd_error_msgs[] = {
	dseg
	ds	0
	xdef	_cmd_error_msgs
_cmd_error_msgs:
;	"Command executed",
	dc.l	.1+0
;	"Illegal channel number",
	dc.l	.1+17
;	"Illegal value for gain",
	dc.l	.1+40
;	"Bad command syntax",
	dc.l	.1+63
;	"Times must be non-negative",
	dc.l	.1+82
;	"Conversion rate is unavailable",
	dc.l	.1+109
;	"Out of memory - shouldn't happen",
	dc.l	.1+140
;	"Illegal value for trigger level",
	dc.l	.1+173
;	"Illegal number of samples to average",
	dc.l	.1+205
;	NULL
;};
	dc.l	$0000
	cseg
.1
	dc.b	67,111,109,109,97,110,100,32,101,120,101,99,117,116,101
	dc.b	100,0,73,108,108,101,103,97,108,32,99,104,97,110,110
	dc.b	101,108,32,110,117,109,98,101,114,0,73,108,108,101,103
	dc.b	97,108,32,118,97,108,117,101,32,102,111,114,32,103,97
	dc.b	105,110,0,66,97,100,32,99,111,109,109,97,110,100,32
	dc.b	115,121,110,116,97,120,0,84,105,109,101,115,32,109,117
	dc.b	115,116,32,98,101,32,110,111,110,45,110,101,103,97,116
	dc.b	105,118,101,0,67,111,110,118,101,114,115,105,111,110,32
	dc.b	114,97,116,101,32,105,115,32,117,110,97,118,97,105,108
	dc.b	97,98,108,101,0,79,117,116,32,111,102,32,109,101,109
	dc.b	111,114,121,32,45,32,115,104,111,117,108,100,110,39,116
	dc.b	32,104,97,112,112,101,110,0,73,108,108,101,103,97,108
	dc.b	32,118,97,108,117,101,32,102,111,114,32,116,114,105,103
	dc.b	103,101,114,32,108,101,118,101,108,0,73,108,108,101,103
	dc.b	97,108,32,110,117,109,98,101,114,32,111,102,32,115,97
	dc.b	109,112,108,101,115,32,116,111,32,97,118,101,114,97,103
	dc.b	101,0
	ds	0
;
;
;
;
;//  command_parse (char* string)
;//
;//  This subroutine takes a pointer to a character string which the user
;//  has typed, parses the string, executes the command, and prints an error
;//  message if the command failed.
;//
;//	Returns: non-negative on success; -1 on command failure;
;//		positive returns may indicate the specific command processed
;//
;int command_parse (char* string)  {
# 277 'commands.c' 678776205
| .3
	xdef	_command_parse
_command_parse:
	movem.l	d2/d3/a3/a4,-(sp)
	move.l	20(sp),a3
;	int n, result;
;	char* cp;
;
;	//  convert to all upper case for ease of processing
;	strupr (string);
~ n d2 "i"
~ result d3 "i"
~ cp a4 "#c"
~~ string a3 "#c"
^^^^^	move.l	a3,-(sp)
	jsr	_strupr
;	
;	//  skip any leading spaces
;	while (isspace (*string))
^^^	add.w	#4,sp
.10001
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#16,d0
	beq	.10002
;		string++;
^	add.l	#1,a3
	bra	.10001
.10002
;		
;	//  if there isn't anything left, just return	
;	if (*string == '\0')
^^^;		return 0;	
	tst.b	(a3)
	bne	.10003
^	move.l	#0,d0
.4
	movem.l	(sp)+,d2/d3/a3/a4
	rts
;	
;	//  otherwise, parse the input
;	for (n = 0; n < n_commands;  n++)  {
.10003
^^^	move.l	#0,d2
	bra	.10007
.10006
;		ASSERT (n < 40);
^;		
;        if (strncmp (cmd_ref[n].name, string, strlen(cmd_ref[n].name)) != 0)
^^;        	continue;
	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref,a0
	move.l	d0,a1
	add.l	a0,a1
	move.l	a1,d0
.5	tst.b	(a1)+
	bne.s	.5
	sub.l	d0,a1
	sub.l	#1,a1
	move.l	a1,-(sp)
	move.l	a3,-(sp)
	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref,a0
	add.l	a0,d0
	move.l	d0,-(sp)
	jsr	_strncmp
	tst.w	d0
	lea	12(sp),sp
	bne	.10004
;        	
;        cp = &string [strlen(cmd_ref[n].name)];
^^^	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref,a0
	move.l	d0,a1
	add.l	a0,a1
	move.l	a1,d0
.6	tst.b	(a1)+
	bne.s	.6
	sub.l	d0,a1
	sub.l	#1,a1
	move.l	a1,a4
	add.l	a3,a4
;        while (isspace (*cp))
^.10008
	move.b	(a4),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#16,d0
	beq	.10009
;        	cp++;
^	add.l	#1,a4
	bra	.10008
.10009
;        if (*cp == '?')  {
^	cmp.b	#63,(a4)
	bne	.10010
;        	printf ("Command syntax: %s %s\n\n", cmd_ref[n].name, cmd_ref[n].help);
^	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref+38,a0
	add.l	a0,d0
	move.l	d0,-(sp)
	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref,a0
	add.l	a0,d0
	move.l	d0,-(sp)
	pea	.2+0
	jsr	_printf
;	        return cmd_ref[n].code;
^	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref+32,a0
	move.w	(a0,d0.l),d0
	lea	12(sp),sp
	bra	.4
;        }		
^;        
;        //  if we get here we have a match; call the processing routine
;        //
;        //  Allowed returns from the processing routine are:
;        //		negative -> error, but the message is already printed
;        //		0 -> OK
;        //		positive -> error, print an error message using the error
;        //					number as an index into a message array
;        result = cmd_ref[n].func (cp);
.10010
^^^^^^^^^	move.l	a4,-(sp)
	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref+34,a0
	move.l	(a0,d0.l),a0
	jsr	(a0)
	move.w	d0,d3
;        if (result != 0)  {
^	tst.w	d3
	add.w	#4,sp
	beq	.10011
;        	if (result < 0)
^;        		return -1;
	tst.w	d3
	bge	.10012
^	move.l	#-1,d0
	bra	.4
;        	ASSERT (result < (sizeof(cmd_error_msgs)/sizeof (char*)));
.10012
^;        	ASSERT (cmd_error_msgs[result] != NULL);
^;        	printf ("Error executing '%s': %s\n", string, cmd_error_msgs[result]);
^	move.w	d3,d0
	ext.l	d0
	asl.l	#2,d0
	lea	_cmd_error_msgs,a0
	move.l	(a0,d0.l),-(sp)
	move.l	a3,-(sp)
	pea	.2+24
	jsr	_printf
;        	printf ("Command syntax: %s %s\n\n", cmd_ref[n].name, cmd_ref[n].help);
^	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref+38,a0
	add.l	a0,d0
	move.l	d0,-(sp)
	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref,a0
	add.l	a0,d0
	move.l	d0,-(sp)
	pea	.2+50
	jsr	_printf
;        	return -1;
^	move.l	#-1,d0
	lea	24(sp),sp
	bra	.4
;        }
^;        printf ("\n");
.10011
^	pea	.2+74
	jsr	_printf
;        return cmd_ref[n].code;
^	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref+32,a0
	move.w	(a0,d0.l),d0
	add.w	#4,sp
	bra	.4
;      }
^.10004
	add.w	#1,d2
.10007
	cmp.w	_n_commands,d2
	blt	.10006
.10005
;      
;      printf ("Unknown command: %s\n\n", string);
^^	move.l	a3,-(sp)
	pea	.2+76
	jsr	_printf
;      return -1;
^	move.l	#-1,d0
	add.w	#8,sp
	bra	.4
;}
^.3
.2
	dc.b	67,111,109,109,97,110,100,32,115,121,110,116,97,120,58
	dc.b	32,37,115,32,37,115,10,10,0,69,114,114,111,114,32
	dc.b	101,120,101,99,117,116,105,110,103,32,39,37,115,39,58
	dc.b	32,37,115,10,0,67,111,109,109,97,110,100,32,115,121
	dc.b	110,116,97,120,58,32,37,115,32,37,115,10,10,0,10
	dc.b	0,85,110,107,110,111,119,110,32,99,111,109,109,97,110
	dc.b	100,58,32,37,115,10,10,0
	ds	0
;
;
;//  cmd_quit
;//
;//	
;//
;int cmd_quit (char* args)  {
# 337
| .8
	xdef	_cmd_quit
_cmd_quit:
	movem.l	d2,-(sp)
;	uchar answer;
;
;	printf ("If you quit you will return to the TOM8 monitor.\n");
~ answer d2 "C"
~~ args 8 "#c"
^^^	pea	.7+0
	jsr	_printf
;	printf ("The data logger program will be completely disabled,\n");
^	pea	.7+50
	jsr	_printf
;	printf ("and will not be able to restart itself.\n");
^	pea	.7+104
	jsr	_printf
;	printf ("Do you really want to quit? [N] ");
^	pea	.7+145
	jsr	_printf
;	fflush (stdout);
^	pea	__iob+22
	jsr	_fflush
;	answer = SerGetByte ();
^	jsr	_SerGetByte
	move.b	d0,d2
;	printf ("%c\n", answer);
^	move.l	#0,d0
	move.b	d2,d0
	move.w	d0,-(sp)
	pea	.7+178
	jsr	_printf
;	if ((answer == 'y') || (answer == 'Y'))  {
^	cmp.b	#121,d2
	lea	26(sp),sp
	beq	.9
	cmp.b	#89,d2
	bne	.10013
.9
;		printf ("Quitting\n");
^	pea	.7+182
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	add.w	#4,sp
.10
	movem.l	(sp)+,d2
	rts
;	}	
^;		
;	//  a negative return prevents the implementation of this command
;	return -1;
.10013
^^^	move.l	#-1,d0
	bra	.10
;}	
^.8
.7
	dc.b	73,102,32,121,111,117,32,113,117,105,116,32,121,111,117
	dc.b	32,119,105,108,108,32,114,101,116,117,114,110,32,116,111
	dc.b	32,116,104,101,32,84,79,77,56,32,109,111,110,105,116
	dc.b	111,114,46,10,0,84,104,101,32,100,97,116,97,32,108
	dc.b	111,103,103,101,114,32,112,114,111,103,114,97,109,32,119
	dc.b	105,108,108,32,98,101,32,99,111,109,112,108,101,116,101
	dc.b	108,121,32,100,105,115,97,98,108,101,100,44,10,0,97
	dc.b	110,100,32,119,105,108,108,32,110,111,116,32,98,101,32
	dc.b	97,98,108,101,32,116,111,32,114,101,115,116,97,114,116
	dc.b	32,105,116,115,101,108,102,46,10,0,68,111,32,121,111
	dc.b	117,32,114,101,97,108,108,121,32,119,97,110,116,32,116
	dc.b	111,32,113,117,105,116,63,32,91,78,93,32,0,37,99
	dc.b	10,0,81,117,105,116,116,105,110,103,10,0
	ds	0
;
;
;
;
;
;//  cmd_set_science_gain (char* arguments)
;//
;//  Sets the gain of a particular science channel
;//
;//	Arguments: pointer to a character string consisting of an integer
;//		which is the channel number and a float which is the gain.  The
;//		gain must match a known value available with this hardware
;//	Returns: 0 if successful; non-zero on failure.  On failure the number
;//		returned may be used as an index into the array cmd_error_msgs[]
;//		to print an error message for the user.
;//	Failures: fails if the channel number is out of range or if the
;//		gain is an unrecognized value
;//
;int cmd_set_science_gain (char* args)  {
# 373
| .12
	xdef	_cmd_set_science_gain
_cmd_set_science_gain:
	movem.l	d2/d3/a3,-(sp)
;	float gain;
;	int channel;
;	char* cp;
;
;	//  first number should be a channel number
;	cp = args;
~ gain d3 "f"
~ channel d2 "i"
~ cp a3 "#c"
~~ args 8 "#c"
^^^^^^	move.l	16(sp),a3
;	channel = atoi (cp);
^	move.l	a3,-(sp)
	jsr	_atoi
	move.w	d0,d2
;	//  channels numbers start at 0 and are less than N_SCI_CHANNELS
;	if ((channel < 0) || (channel >= N_SCI_CHANNELS))
^^;		return ILLEGAL_CHANNEL_NUMBER;
	tst.w	d2
	add.w	#4,sp
	blt	.13
	cmp.w	#4,d2
	blt	.10014
.13
^	move.l	#1,d0
.14
	movem.l	(sp)+,d2/d3/a3
	rts
;	
;	//  skip the channel number and the following white space
;	while (isdigit (*cp))
.10014
^^^.10015
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#4,d0
	beq	.10016
;		cp++;
^	add.l	#1,a3
	bra	.10015
.10016
;	while (isspace (*cp))
^.10017
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#16,d0
	beq	.10018
;		cp++;
^	add.l	#1,a3
	bra	.10017
.10018
;	
;	//  get the gain and ask the science logger to set it
;	gain = (float)atof (cp);
^^^	move.l	a3,-(sp)
	jsr	_atof
	jsr	.dtof#
	move.l	d0,d3
;	if (sci_logger_set_gain (channel, gain) < 0)
^;		return ILLEGAL_GAIN;
	move.l	d3,-(sp)
	move.w	d2,-(sp)
	jsr	_sci_logger_set_gain
	tst.w	d0
	lea	10(sp),sp
	bge	.10019
^	move.l	#2,d0
	bra	.14
;		
;	//  set the initialization array - note that we don't set the array
;	//  unless the science logger verified that the gain was a known
;	//  value.  It must do this properly even if it is not open.	
;	setup_data.science_gain[channel] = gain;
.10019
^^^^^	move.w	d2,d0
	ext.l	d0
	asl.l	#2,d0
	lea	_setup_data+20,a0
	move.l	d0,a1
	add.l	a0,a1
	move.l	d3,(a1)
;	
;	printf ("Science channel %d set to gain %f\n", channel, gain);
^^	move.l	d3,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	move.w	d2,-(sp)
	pea	.11+0
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	14(sp),sp
	bra	.14
;}	
^.12
.11
	dc.b	83,99,105,101,110,99,101,32,99,104,97,110,110,101,108
	dc.b	32,37,100,32,115,101,116,32,116,111,32,103,97,105,110
	dc.b	32,37,102,10,0
	ds	0
;	
;	
;//  cmd_set_science_rate ()
;//
;//	Sets the conversion rate to use for the science channels.  All
;//  channels are converted at the same rate.
;//
;//	Returns: 0 on success; non-zero for illegal conversion rate
;//
;int cmd_set_science_rate (char* args)  {
# 413
| .16
	xdef	_cmd_set_science_rate
_cmd_set_science_rate:
	movem.l	d2,-(sp)
;	float rate;
;	
;	//  The science logger will stop the data logger and flush
;	//  all previous data from the internal buffers
;	printf ("All data buffers were emptied of data acquired at the original rate.\n");
~ rate d2 "f"
~~ args 8 "#c"
^^^^^	pea	.15+0
	jsr	_printf
;
;	rate = (float)atof (args);
^^	move.l	12(sp),-(sp)
	jsr	_atof
	jsr	.dtof#
	move.l	d0,d2
;	rate = sci_logger_set_conversion_rate (rate);
^	move.l	d2,-(sp)
	jsr	_sci_logger_set_conversion_rate
	jsr	.dtof#
	move.l	d0,d2
;	if (rate < 0)
^;		return ILLEGAL_RATE;
	move.l	d2,d0
	jsr	.Ftst#
	lea	12(sp),sp
	bge	.10020
^	move.l	#5,d0
.17
	movem.l	(sp)+,d2
	rts
;
;	//  set the initialization array	
;	setup_data.science_rate = rate;
.10020
^^^	move.l	d2,_setup_data+16
;	printf ("Conversion rate set to %.2f\n", rate);
^	move.l	d2,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.15+70
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	12(sp),sp
	bra	.17
;}
^.16
.15
	dc.b	65,108,108,32,100,97,116,97,32,98,117,102,102,101,114
	dc.b	115,32,119,101,114,101,32,101,109,112,116,105,101,100,32
	dc.b	111,102,32,100,97,116,97,32,97,99,113,117,105,114,101
	dc.b	100,32,97,116,32,116,104,101,32,111,114,105,103,105,110
	dc.b	97,108,32,114,97,116,101,46,10,0,67,111,110,118,101
	dc.b	114,115,105,111,110,32,114,97,116,101,32,115,101,116,32
	dc.b	116,111,32,37,46,50,102,10,0
	ds	0
;
;
;
;
;
;//  cmd_set_science_averaging
;//
;//  Sets the number of science samples which are averaged together
;//  before the data is used.  Can be 1 (no averaging), 2, 3, or 4.
;//  
;//	Returns: 0 on success; non-zero for illegal averaging number
;//
;int cmd_set_science_averaging (char* args)  {
# 442
| .19
	xdef	_cmd_set_science_averaging
_cmd_set_science_averaging:
	movem.l	d2/d3,-(sp)
;	short n_average;
;	short result;
;	
;	//  The science logger will stop the logger and flush all
;	//  previous data from the internal buffers
;	printf ("All data buffers were emptied of data acquired at the original rate.\n");
~ n_average d2 "i"
~ result d3 "i"
~~ args 8 "#c"
^^^^^^	pea	.18+0
	jsr	_printf
;	
;	n_average = atoi (args);
^^	move.l	16(sp),-(sp)
	jsr	_atoi
	move.w	d0,d2
;	result = sci_logger_set_averaging (n_average);
^	move.w	d2,-(sp)
	jsr	_sci_logger_set_averaging
	move.w	d0,d3
;	if (result < 0)
^;		return ILLEGAL_AVERAGING;
	tst.w	d3
	lea	10(sp),sp
	bge	.10021
^	move.l	#8,d0
.20
	movem.l	(sp)+,d2/d3
	rts
;		
;	setup_data.science_n_to_average = n_average;
.10021
^^	move.w	d2,_setup_data+76
;	printf ("Now averaging %d samples together.\n", n_average);
^	move.w	d2,-(sp)
	pea	.18+70
	jsr	_printf
;	printf ("The effective science data rate is %.3lf\n", sci_logger_get_conversion_rate ());
^	jsr	_sci_logger_get_conversion_rate
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.18+106
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	18(sp),sp
	bra	.20
;}
^.19
.18
	dc.b	65,108,108,32,100,97,116,97,32,98,117,102,102,101,114
	dc.b	115,32,119,101,114,101,32,101,109,112,116,105,101,100,32
	dc.b	111,102,32,100,97,116,97,32,97,99,113,117,105,114,101
	dc.b	100,32,97,116,32,116,104,101,32,111,114,105,103,105,110
	dc.b	97,108,32,114,97,116,101,46,10,0,78,111,119,32,97
	dc.b	118,101,114,97,103,105,110,103,32,37,100,32,115,97,109
	dc.b	112,108,101,115,32,116,111,103,101,116,104,101,114,46,10
	dc.b	0,84,104,101,32,101,102,102,101,99,116,105,118,101,32
	dc.b	115,99,105,101,110,99,101,32,100,97,116,97,32,114,97
	dc.b	116,101,32,105,115,32,37,46,51,108,102,10,0
	ds	0
;	
;		
;
;
;
;
;//  cmd_read_science
;//
;//	sets a particular channel for real-time data dump so the user
;//	can preview the data.  Arguments must be a legal channel number
;//  or the word "OFF"
;//
;int cmd_read_science (char* args)  {
# 472
| .22
	xdef	_cmd_read_science
_cmd_read_science:
	movem.l	d2/a3,-(sp)
	move.l	12(sp),a3
;	int channel;
;	
;	if (!isdigit (*args))
~ channel d2 "i"
~~ args a3 "#c"
^^^;		return ILLEGAL_CHANNEL_NUMBER;
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#4,d0
	bne	.10022
^	move.l	#1,d0
.23
	movem.l	(sp)+,d2/a3
	rts
;	
;	channel = atoi (args);
.10022
^^	move.l	a3,-(sp)
	jsr	_atoi
	move.w	d0,d2
;	if ((channel < 0) || (channel >= N_SCI_CHANNELS))
^;		return ILLEGAL_CHANNEL_NUMBER;
	tst.w	d2
	add.w	#4,sp
	blt	.24
	cmp.w	#4,d2
	blt	.10023
.24
^	move.l	#1,d0
	bra	.23
;	
;	if (sci_logger_is_open () == 0)
.10023
^^;		printf ("Science channels cannot be read unless the logger is started.\n");
	jsr	_sci_logger_is_open
	tst.w	d0
	bne	.10024
^	pea	.21+0
	jsr	_printf
;	else  {	
	add.w	#4,sp
	bra	.10025
.10024
^;		sci_logger_set_ASCII_preview (channel);
^	move.w	d2,-(sp)
	jsr	_sci_logger_set_ASCII_preview
;		if ((0x01 << channel)&setup_data.science_chans)
^;			printf ("Data preview for channel %d turned on.\n", channel);
	move.l	#1,d0
	asl.w	d2,d0
	and.w	_setup_data+36,d0
	add.w	#2,sp
	beq	.10026
^	move.w	d2,-(sp)
	pea	.21+63
	jsr	_printf
;		else
	add.w	#6,sp
	bra	.10027
.10026
;			printf ("Channel %d is not active and cannot be read.\n", channel);	
^^	move.w	d2,-(sp)
	pea	.21+103
	jsr	_printf
	add.w	#6,sp
.10027
;	}	
^.10025
;	return 0;
^	move.l	#0,d0
	bra	.23
;}	
^.22
.21
	dc.b	83,99,105,101,110,99,101,32,99,104,97,110,110,101,108
	dc.b	115,32,99,97,110,110,111,116,32,98,101,32,114,101,97
	dc.b	100,32,117,110,108,101,115,115,32,116,104,101,32,108,111
	dc.b	103,103,101,114,32,105,115,32,115,116,97,114,116,101,100
	dc.b	46,10,0,68,97,116,97,32,112,114,101,118,105,101,119
	dc.b	32,102,111,114,32,99,104,97,110,110,101,108,32,37,100
	dc.b	32,116,117,114,110,101,100,32,111,110,46,10,0,67,104
	dc.b	97,110,110,101,108,32,37,100,32,105,115,32,110,111,116
	dc.b	32,97,99,116,105,118,101,32,97,110,100,32,99,97,110
	dc.b	110,111,116,32,98,101,32,114,101,97,100,46,10,0
	ds	0
; 
; 
; 
;
;//  cmd_read_binary_science
;//
;//	Sets a particular channel for real-time binary data dump so the
;//	user can preview the data.  Arguments must be a legal channel
;//  number.
;//
;int cmd_read_binary_science (char* args)  {
# 503
| .26
	xdef	_cmd_read_binary_science
_cmd_read_binary_science:
	movem.l	d2/a3,-(sp)
	move.l	12(sp),a3
;	int channel;
;	
;	if (!isdigit (*args))
~ channel d2 "i"
~~ args a3 "#c"
^^^;		return BAD_SYNTAX;
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#4,d0
	bne	.10028
^	move.l	#3,d0
.27
	movem.l	(sp)+,d2/a3
	rts
;	
;	channel = atoi (args);
.10028
^^	move.l	a3,-(sp)
	jsr	_atoi
	move.w	d0,d2
;	if ((channel < 0) || (channel >= N_SCI_CHANNELS))
^;		return ILLEGAL_CHANNEL_NUMBER;
	tst.w	d2
	add.w	#4,sp
	blt	.28
	cmp.w	#4,d2
	blt	.10029
.28
^	move.l	#1,d0
	bra	.27
;	if (sci_logger_is_open () == 0)
.10029
^;		printf ("Science channels cannot be read unless the logger is started.\n");
	jsr	_sci_logger_is_open
	tst.w	d0
	bne	.10030
^	pea	.25+0
	jsr	_printf
;	else
	add.w	#4,sp
	bra	.10031
.10030
;		sci_logger_set_binary_preview (channel);
^^	move.w	d2,-(sp)
	jsr	_sci_logger_set_binary_preview
	add.w	#2,sp
.10031
;	return 0;
^	move.l	#0,d0
	bra	.27
;}	
^.26
.25
	dc.b	83,99,105,101,110,99,101,32,99,104,97,110,110,101,108
	dc.b	115,32,99,97,110,110,111,116,32,98,101,32,114,101,97
	dc.b	100,32,117,110,108,101,115,115,32,116,104,101,32,108,111
	dc.b	103,103,101,114,32,105,115,32,115,116,97,114,116,101,100
	dc.b	46,10,0
	ds	0
; 
; 
; 
;
;int cmd_set_STA_time (char* args)  {
# 522
| .30
	xdef	_cmd_set_STA_time
_cmd_set_STA_time:
	movem.l	d2,-(sp)
;	float t;
;	
;	t = (float)atof (args);
~ t d2 "f"
~~ args 8 "#c"
^^^	move.l	8(sp),-(sp)
	jsr	_atof
	jsr	.dtof#
	move.l	d0,d2
;	if (t < 0)
^;		return ILLEGAL_TIME;
	move.l	d2,d0
	jsr	.Ftst#
	add.w	#4,sp
	bge	.10032
^	move.l	#4,d0
.31
	movem.l	(sp)+,d2
	rts
;	if (sci_logger_set_STA_time (t) != 0)  {
.10032
^	move.l	d2,-(sp)
	jsr	_sci_logger_set_STA_time
	tst.w	d0
	add.w	#4,sp
	beq	.10033
;		printf ("Previous pre-event length error remains:\n");
^	pea	.29+0
	jsr	_printf
;		printf ("The pre-event time is longer than the data buffer length allows\n");
^	pea	.29+42
	jsr	_printf
;		printf ("and has been truncated.  A reduction in sampling rate may bring\n");
^	pea	.29+107
	jsr	_printf
;		printf ("it back within range.  If so, it will be adjusted automatically.\n");
^	pea	.29+172
	jsr	_printf
;	}
^;	setup_data.t_STA = t;
	lea	16(sp),sp
.10033
^	move.l	d2,_setup_data+40
;	
;	printf ("The short term average has been set to %.2f seconds.\n", t);
^^	move.l	d2,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.29+238
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	12(sp),sp
	bra	.31
;}
^.30
.29
	dc.b	80,114,101,118,105,111,117,115,32,112,114,101,45,101,118
	dc.b	101,110,116,32,108,101,110,103,116,104,32,101,114,114,111
	dc.b	114,32,114,101,109,97,105,110,115,58,10,0,84,104,101
	dc.b	32,112,114,101,45,101,118,101,110,116,32,116,105,109,101
	dc.b	32,105,115,32,108,111,110,103,101,114,32,116,104,97,110
	dc.b	32,116,104,101,32,100,97,116,97,32,98,117,102,102,101
	dc.b	114,32,108,101,110,103,116,104,32,97,108,108,111,119,115
	dc.b	10,0,97,110,100,32,104,97,115,32,98,101,101,110,32
	dc.b	116,114,117,110,99,97,116,101,100,46,32,32,65,32,114
	dc.b	101,100,117,99,116,105,111,110,32,105,110,32,115,97,109
	dc.b	112,108,105,110,103,32,114,97,116,101,32,109,97,121,32
	dc.b	98,114,105,110,103,10,0,105,116,32,98,97,99,107,32
	dc.b	119,105,116,104,105,110,32,114,97,110,103,101,46,32,32
	dc.b	73,102,32,115,111,44,32,105,116,32,119,105,108,108,32
	dc.b	98,101,32,97,100,106,117,115,116,101,100,32,97,117,116
	dc.b	111,109,97,116,105,99,97,108,108,121,46,10,0,84,104
	dc.b	101,32,115,104,111,114,116,32,116,101,114,109,32,97,118
	dc.b	101,114,97,103,101,32,104,97,115,32,98,101,101,110,32
	dc.b	115,101,116,32,116,111,32,37,46,50,102,32,115,101,99
	dc.b	111,110,100,115,46,10,0
	ds	0
;
;	
;int cmd_set_LTA_time (char* args)  {
# 541
| .33
	xdef	_cmd_set_LTA_time
_cmd_set_LTA_time:
	movem.l	d2,-(sp)
;	float t;
;	
;	t = (float)atof (args);
~ t d2 "f"
~~ args 8 "#c"
^^^	move.l	8(sp),-(sp)
	jsr	_atof
	jsr	.dtof#
	move.l	d0,d2
;	if (t < 0)
^;		return ILLEGAL_TIME;
	move.l	d2,d0
	jsr	.Ftst#
	add.w	#4,sp
	bge	.10034
^	move.l	#4,d0
.34
	movem.l	(sp)+,d2
	rts
;	if (sci_logger_set_LTA_time (t) != 0)  {
.10034
^	move.l	d2,-(sp)
	jsr	_sci_logger_set_LTA_time
	tst.w	d0
	add.w	#4,sp
	beq	.10035
;		printf ("Previous pre-event length error remains:\n");
^	pea	.32+0
	jsr	_printf
;		printf ("The pre-event time is longer than the data buffer length allows\n");
^	pea	.32+42
	jsr	_printf
;		printf ("and has been truncated.  A reduction in sampling rate may bring\n");
^	pea	.32+107
	jsr	_printf
;		printf ("it back within range.  If so, it will be adjusted automatically.\n");
^	pea	.32+172
	jsr	_printf
;	}
^;	setup_data.t_LTA = t;
	lea	16(sp),sp
.10035
^	move.l	d2,_setup_data+44
;
;	printf ("The long term average has been set to %.2f seconds.\n", t);
^^	move.l	d2,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.32+238
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	12(sp),sp
	bra	.34
;}
^.33
.32
	dc.b	80,114,101,118,105,111,117,115,32,112,114,101,45,101,118
	dc.b	101,110,116,32,108,101,110,103,116,104,32,101,114,114,111
	dc.b	114,32,114,101,109,97,105,110,115,58,10,0,84,104,101
	dc.b	32,112,114,101,45,101,118,101,110,116,32,116,105,109,101
	dc.b	32,105,115,32,108,111,110,103,101,114,32,116,104,97,110
	dc.b	32,116,104,101,32,100,97,116,97,32,98,117,102,102,101
	dc.b	114,32,108,101,110,103,116,104,32,97,108,108,111,119,115
	dc.b	10,0,97,110,100,32,104,97,115,32,98,101,101,110,32
	dc.b	116,114,117,110,99,97,116,101,100,46,32,32,65,32,114
	dc.b	101,100,117,99,116,105,111,110,32,105,110,32,115,97,109
	dc.b	112,108,105,110,103,32,114,97,116,101,32,109,97,121,32
	dc.b	98,114,105,110,103,10,0,105,116,32,98,97,99,107,32
	dc.b	119,105,116,104,105,110,32,114,97,110,103,101,46,32,32
	dc.b	73,102,32,115,111,44,32,105,116,32,119,105,108,108,32
	dc.b	98,101,32,97,100,106,117,115,116,101,100,32,97,117,116
	dc.b	111,109,97,116,105,99,97,108,108,121,46,10,0,84,104
	dc.b	101,32,108,111,110,103,32,116,101,114,109,32,97,118,101
	dc.b	114,97,103,101,32,104,97,115,32,98,101,101,110,32,115
	dc.b	101,116,32,116,111,32,37,46,50,102,32,115,101,99,111
	dc.b	110,100,115,46,10,0
	ds	0
;
;
;
;
;//  cmd_set_trigger_level ()
;//
;//	Sets the value of STA/LTA which causes the system to trigger.
;//
;int cmd_set_trigger_level (char* args)  {
# 566
| .36
	xdef	_cmd_set_trigger_level
_cmd_set_trigger_level:
	movem.l	d2/d3/d4/a3/a4,-(sp)
	move.l	24(sp),a4
;	float level;
;	char *cp;
;	int channel, n;
;	
;	//  first number should be a channel number or the word ALL
;	cp = args;
~ level d3 "f"
~ cp a3 "#c"
~ channel d2 "i"
~ n d4 "i"
~~ args a4 "#c"
^^^^^^	move.l	a4,a3
;	if (strncmp (args, "ALL", 3) == 0)  {
^	pea	3
	pea	.35+0
	move.l	a4,-(sp)
	jsr	_strncmp
	tst.w	d0
	lea	12(sp),sp
	bne	.10036
;		cp +=3;
^	lea	3(a3),a3
;		channel = -1;
^	move.l	#-1,d2
;	}  else  {
^	bra	.10037
.10036
;		channel = atoi (args);
^	move.l	a4,-(sp)
	jsr	_atoi
	move.w	d0,d2
;		if ((channel < 0) || (channel >= N_SCI_CHANNELS))
^;			return ILLEGAL_CHANNEL_NUMBER;
	tst.w	d2
	add.w	#4,sp
	blt	.37
	cmp.w	#4,d2
	blt	.10038
.37
^	move.l	#1,d0
.38
	movem.l	(sp)+,d2/d3/d4/a3/a4
	rts
;
;		//  skip the channel number
;		while (isdigit (*cp))
.10038
^^^.10039
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#4,d0
	beq	.10040
;			cp++;
^	add.l	#1,a3
	bra	.10039
.10040
;	}		
^.10037
;	//  skip any white space
;	while (isspace (*cp))
^^.10041
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#16,d0
	beq	.10042
;		cp++;
^	add.l	#1,a3
	bra	.10041
.10042
;	
;	//  convert the trigger level
;	level = (float)atof (cp);
^^^	move.l	a3,-(sp)
	jsr	_atof
	jsr	.dtof#
	move.l	d0,d3
;	if (level < 0)
^;		return ILLEGAL_TRIGGER;
	move.l	d3,d0
	jsr	.Ftst#
	add.w	#4,sp
	bge	.10043
^	move.l	#7,d0
	bra	.38
;		
;	//  set it and assign to the initialization struct
;	sci_logger_set_trigger_level (channel, level);
.10043
^^^	move.l	d3,-(sp)
	move.w	d2,-(sp)
	jsr	_sci_logger_set_trigger_level
;	if (channel == -1)  {
^	cmp.w	#-1,d2
	add.w	#6,sp
	bne	.10044
;		printf ("All channels now trigger when the STA/LTA exceeds %.2f.\n", level);
^	move.l	d3,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.35+4
	jsr	_printf
;		for (n = 0;  n < N_SCI_CHANNELS;  n++)
^	move.l	#0,d4
	lea	12(sp),sp
.10047
;			setup_data.trigger_level[n] = level;
^	move.w	d4,d0
	ext.l	d0
	asl.l	#2,d0
	lea	_setup_data+48,a0
	move.l	d0,a1
	add.l	a0,a1
	move.l	d3,(a1)
.10045
	add.w	#1,d4
	cmp.w	#4,d4
	blt	.10047
.10046
;	}  else  {
^	bra	.10048
.10044
;		printf ("Channel %d now triggers when the STA/LTA exceeds %.2f.\n",
^;																channel, level);
	move.l	d3,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	move.w	d2,-(sp)
	pea	.35+61
	jsr	_printf
;		if (((0x01 << channel) & (setup_data.science_chans)) == 0)
^^;			printf ("This channel is not yet active!\n");
	move.l	#1,d0
	asl.w	d2,d0
	and.w	_setup_data+36,d0
	lea	14(sp),sp
	bne	.10049
^	pea	.35+117
	jsr	_printf
;		setup_data.trigger_level[channel] = level;		
	add.w	#4,sp
.10049
^	move.w	d2,d0
	ext.l	d0
	asl.l	#2,d0
	lea	_setup_data+48,a0
	move.l	d0,a1
	add.l	a0,a1
	move.l	d3,(a1)
;	}
^.10048
;	
;	printf ("New code to change triggering\n");
^^	pea	.35+150
	jsr	_printf
;		
;	return 0;
^^	move.l	#0,d0
	add.w	#4,sp
	bra	.38
;}
^.36
.35
	dc.b	65,76,76,0,65,108,108,32,99,104,97,110,110,101,108
	dc.b	115,32,110,111,119,32,116,114,105,103,103,101,114,32,119
	dc.b	104,101,110,32,116,104,101,32,83,84,65,47,76,84,65
	dc.b	32,101,120,99,101,101,100,115,32,37,46,50,102,46,10
	dc.b	0,67,104,97,110,110,101,108,32,37,100,32,110,111,119
	dc.b	32,116,114,105,103,103,101,114,115,32,119,104,101,110,32
	dc.b	116,104,101,32,83,84,65,47,76,84,65,32,101,120,99
	dc.b	101,101,100,115,32,37,46,50,102,46,10,0,84,104,105
	dc.b	115,32,99,104,97,110,110,101,108,32,105,115,32,110,111
	dc.b	116,32,121,101,116,32,97,99,116,105,118,101,33,10,0
	dc.b	78,101,119,32,99,111,100,101,32,116,111,32,99,104,97
	dc.b	110,103,101,32,116,114,105,103,103,101,114,105,110,103,10
	dc.b	0
	ds	0
;			
;
;
;	
;
;
;//  cmd_set_pre_event_time ()
;//
;//	Sets the pre-event time.  The argument is the length in seconds.  This
;//  number must be positive.  If the length requested is longer than the
;//  buffer length than the science logger routines will reduce it to the
;//  maximum available length.
;//
;int cmd_set_pre_event_time (char* args)  {
# 625
| .40
	xdef	_cmd_set_pre_event_time
_cmd_set_pre_event_time:
	movem.l	d2,-(sp)
;	float t;
;	
;	t = (float)atof (args);
~ t d2 "f"
~~ args 8 "#c"
^^^	move.l	8(sp),-(sp)
	jsr	_atof
	jsr	.dtof#
	move.l	d0,d2
;	if (t < 0)
^;		return ILLEGAL_TIME;
	move.l	d2,d0
	jsr	.Ftst#
	add.w	#4,sp
	bge	.10050
^	move.l	#4,d0
.41
	movem.l	(sp)+,d2
	rts
;	if (sci_logger_set_pre_event (t) != 0)  {
.10050
^	move.l	d2,-(sp)
	jsr	_sci_logger_set_pre_event
	tst.w	d0
	add.w	#4,sp
	beq	.10051
;		printf ("The pre-event time is longer than the current buffer length\n");
^	pea	.39+0
	jsr	_printf
;		printf ("and has been truncated.  A reduction in sampling rate may bring\n");
^	pea	.39+61
	jsr	_printf
;		printf ("it back within range.  If so, it will be adjusted automatically.\n");
^	pea	.39+126
	jsr	_printf
;	}
^;	
;	setup_data.pre_event_time = t;
	lea	12(sp),sp
.10051
^^	move.l	d2,_setup_data+68
;	printf ("The pre-event time is now %.2f seconds.\n", t);
^	move.l	d2,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.39+192
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	12(sp),sp
	bra	.41
;}	
^.40
.39
	dc.b	84,104,101,32,112,114,101,45,101,118,101,110,116,32,116
	dc.b	105,109,101,32,105,115,32,108,111,110,103,101,114,32,116
	dc.b	104,97,110,32,116,104,101,32,99,117,114,114,101,110,116
	dc.b	32,98,117,102,102,101,114,32,108,101,110,103,116,104,10
	dc.b	0,97,110,100,32,104,97,115,32,98,101,101,110,32,116
	dc.b	114,117,110,99,97,116,101,100,46,32,32,65,32,114,101
	dc.b	100,117,99,116,105,111,110,32,105,110,32,115,97,109,112
	dc.b	108,105,110,103,32,114,97,116,101,32,109,97,121,32,98
	dc.b	114,105,110,103,10,0,105,116,32,98,97,99,107,32,119
	dc.b	105,116,104,105,110,32,114,97,110,103,101,46,32,32,73
	dc.b	102,32,115,111,44,32,105,116,32,119,105,108,108,32,98
	dc.b	101,32,97,100,106,117,115,116,101,100,32,97,117,116,111
	dc.b	109,97,116,105,99,97,108,108,121,46,10,0,84,104,101
	dc.b	32,112,114,101,45,101,118,101,110,116,32,116,105,109,101
	dc.b	32,105,115,32,110,111,119,32,37,46,50,102,32,115,101
	dc.b	99,111,110,100,115,46,10,0
	ds	0
;
;
;
;
;int cmd_set_post_event_time (char* args)  {
# 645
| .43
	xdef	_cmd_set_post_event_time
_cmd_set_post_event_time:
	movem.l	d2,-(sp)
;	float t;
;	
;	t = (float)atof (args);
~ t d2 "f"
~~ args 8 "#c"
^^^	move.l	8(sp),-(sp)
	jsr	_atof
	jsr	.dtof#
	move.l	d0,d2
;	if (t < 0)
^;		return ILLEGAL_TIME;
	move.l	d2,d0
	jsr	.Ftst#
	add.w	#4,sp
	bge	.10052
^	move.l	#4,d0
.44
	movem.l	(sp)+,d2
	rts
;	if (sci_logger_set_post_event (t) != 0)  {
.10052
^	move.l	d2,-(sp)
	jsr	_sci_logger_set_post_event
	tst.w	d0
	add.w	#4,sp
	beq	.10053
;		printf ("Previous pre-event time error remains:\n");
^	pea	.42+0
	jsr	_printf
;		printf ("The pre-event time is longer than the current buffer length\n");
^	pea	.42+40
	jsr	_printf
;		printf ("and has been truncated.  A reduction in sampling rate may bring\n");
^	pea	.42+101
	jsr	_printf
;		printf ("it back within range.  If so, it will be adjusted automatically.\n");
^	pea	.42+166
	jsr	_printf
;	}
^;	
;	setup_data.post_event_time = t;
	lea	16(sp),sp
.10053
^^	move.l	d2,_setup_data+64
;	printf ("The post-event time is now %.2f seconds.\n", t);
^	move.l	d2,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.42+232
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	12(sp),sp
	bra	.44
;}
^.43
.42
	dc.b	80,114,101,118,105,111,117,115,32,112,114,101,45,101,118
	dc.b	101,110,116,32,116,105,109,101,32,101,114,114,111,114,32
	dc.b	114,101,109,97,105,110,115,58,10,0,84,104,101,32,112
	dc.b	114,101,45,101,118,101,110,116,32,116,105,109,101,32,105
	dc.b	115,32,108,111,110,103,101,114,32,116,104,97,110,32,116
	dc.b	104,101,32,99,117,114,114,101,110,116,32,98,117,102,102
	dc.b	101,114,32,108,101,110,103,116,104,10,0,97,110,100,32
	dc.b	104,97,115,32,98,101,101,110,32,116,114,117,110,99,97
	dc.b	116,101,100,46,32,32,65,32,114,101,100,117,99,116,105
	dc.b	111,110,32,105,110,32,115,97,109,112,108,105,110,103,32
	dc.b	114,97,116,101,32,109,97,121,32,98,114,105,110,103,10
	dc.b	0,105,116,32,98,97,99,107,32,119,105,116,104,105,110
	dc.b	32,114,97,110,103,101,46,32,32,73,102,32,115,111,44
	dc.b	32,105,116,32,119,105,108,108,32,98,101,32,97,100,106
	dc.b	117,115,116,101,100,32,97,117,116,111,109,97,116,105,99
	dc.b	97,108,108,121,46,10,0,84,104,101,32,112,111,115,116
	dc.b	45,101,118,101,110,116,32,116,105,109,101,32,105,115,32
	dc.b	110,111,119,32,37,46,50,102,32,115,101,99,111,110,100
	dc.b	115,46,10,0
	ds	0
;	
;
;
;
;//  cmd_set_science_channels ()
;//
;//  Sets which science channels are considered for recording
;//
;int cmd_set_science_channels (char* args)  {
# 670
| .46
	xdef	_cmd_set_science_channels
_cmd_set_science_channels:
	movem.l	d2/d3/d4/a3/a4,-(sp)
	move.l	24(sp),a4
;	char* cp;
;	int channel_bits;
;	int n;
;	int print_flag;
;	
;	//  need a channel number; don't let a null look like channel 0
;	if (!isdigit (*args))
~ cp a3 "#c"
~ channel_bits d3 "i"
~ n d2 "i"
~ print_flag d4 "i"
~~ args a4 "#c"
^^^^^^^;		return ILLEGAL_CHANNEL_NUMBER;
	move.b	(a4),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#4,d0
	bne	.10054
^	move.l	#1,d0
.47
	movem.l	(sp)+,d2/d3/d4/a3/a4
	rts
;	
;	
;	if (strcmp (args, "OFF") == 0)  {
.10054
^^^	move.l	a4,a0
	lea	.45,a1
.48	move.b	(a0)+,d0
	cmp.b	(a1)+,d0
	bne.s	.49
	tst.b	d0
	bne.s	.48
.49	sub.b	-(a1),d0
	ext.w	d0
	bne	.10055
;		//  turn all science channels off
;		setup_data.science_chans = 0x0;
^^	clr.w	_setup_data+36
;		if (sci_logger_activate_chans (setup_data.science_chans) != 0)  {
^	move.w	_setup_data+36,-(sp)
	jsr	_sci_logger_activate_chans
	tst.w	d0
	add.w	#2,sp
	beq	.10056
;			printf ("Could not disable the science data logger channels.\n");
^	pea	.45+4
	jsr	_printf
;			return -1;
^	move.l	#-1,d0
	add.w	#4,sp
	bra	.47
;		}
^;		printf ("All science data channels turned off.\n");
.10056
^	pea	.45+57
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	add.w	#4,sp
	bra	.47
;	}
^;
;	channel_bits = 0;
.10055
^^	move.l	#0,d3
;	cp = args;
^	move.l	a4,a3
;	do  {
^.10059
;		n = atoi (cp);
^	move.l	a3,-(sp)
	jsr	_atoi
	move.w	d0,d2
;		if ((n < 0) || (n >= N_SCI_CHANNELS))
^;			return ILLEGAL_CHANNEL_NUMBER;
	tst.w	d2
	add.w	#4,sp
	blt	.50
	cmp.w	#4,d2
	blt	.10060
.50
^	move.l	#1,d0
	bra	.47
;		channel_bits |= (0x01 << n);
.10060
^	move.l	#1,d0
	asl.w	d2,d0
	or.w	d0,d3
;		
;		while (isdigit (*cp))
^^.10061
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#4,d0
	beq	.10062
;			cp++;
^	add.l	#1,a3
	bra	.10061
.10062
;		while (isspace (*cp))
^.10063
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#16,d0
	beq	.10064
;			cp++;
^	add.l	#1,a3
	bra	.10063
.10064
;			
;		if (*cp == ',')
^^;			cp++;
	cmp.b	#44,(a3)
	bne	.10065
^	add.l	#1,a3
;		while (isspace (*cp))
.10065
^.10066
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#16,d0
	beq	.10067
;			cp++;
^	add.l	#1,a3
	bra	.10066
.10067
;	}  while (isdigit (*cp));
^.10057
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#4,d0
	bne	.10059
.10058
;	//  a channel number must be followed by a "," or the end of the
;	//  command line.  Any other character is illegal.	
;	if ((*cp != '\0') || (channel_bits == 0))
^^^;		return BAD_SYNTAX;
	tst.b	(a3)
	bne	.51
	tst.w	d3
	bne	.10068
.51
^	move.l	#3,d0
	bra	.47
;	
;
;	//  REVIEW - we may want to change this at a later data
;	//  For now, all recorded channels are used for triggering		
;	setup_data.science_chans = channel_bits;
.10068
^^^^^	move.w	d3,_setup_data+36
;	setup_data.trigger_chans = channel_bits;
^	move.w	d3,_setup_data+38
;
;	//  The next few lines don't do anything unless the logger is open
;	if (sci_logger_activate_chans (setup_data.science_chans) != 0)  {
^^^	move.w	_setup_data+36,-(sp)
	jsr	_sci_logger_activate_chans
	tst.w	d0
	add.w	#2,sp
	beq	.10069
;		printf ("Could not activate science data logger channels.\n");
^	pea	.45+96
	jsr	_printf
;		return -1;
^	move.l	#-1,d0
	add.w	#4,sp
	bra	.47
;	}
^;	
;	printf ("Science channel");
.10069
^^	pea	.45+146
	jsr	_printf
;	print_flag = 0;
^	move.l	#0,d4
;	for (n = 0;  n < N_SCI_CHANNELS;  n++)  {
^	move.l	#0,d2
	add.w	#4,sp
.10072
;		if ((0x01 << n) & channel_bits)
^;			print_flag++;
	move.l	#1,d0
	asl.w	d2,d0
	and.w	d3,d0
	beq	.10073
^	add.w	#1,d4
;	}
.10073
^.10070
	add.w	#1,d2
	cmp.w	#4,d2
	blt	.10072
.10071
;	if (print_flag > 1)
^;		printf ("s ");
	cmp.w	#1,d4
	ble	.10074
^	pea	.45+162
	jsr	_printf
;	else
	add.w	#4,sp
	bra	.10075
.10074
;		printf (" ");
^^	pea	.45+165
	jsr	_printf
	add.w	#4,sp
.10075
;	print_flag = 0;		
^	move.l	#0,d4
;	for (n = 0;  n < N_SCI_CHANNELS;  n++)  {
^	move.l	#0,d2
.10078
;		if ((0x01 << n) & channel_bits)  {
^	move.l	#1,d0
	asl.w	d2,d0
	and.w	d3,d0
	beq	.10079
;			if (print_flag++ != 0)
^;				printf (", ");
	move.w	d4,d0
	add.w	#1,d4
	tst.w	d0
	beq	.10080
^	pea	.45+167
	jsr	_printf
;			printf ("%d", n);
	add.w	#4,sp
.10080
^	move.w	d2,-(sp)
	pea	.45+170
	jsr	_printf
;		}	
^;	}
	add.w	#6,sp
.10079
^.10076
	add.w	#1,d2
	cmp.w	#4,d2
	blt	.10078
.10077
;	if (print_flag > 1)
^;		printf (" are");
	cmp.w	#1,d4
	ble	.10081
^	pea	.45+173
	jsr	_printf
;	else
	add.w	#4,sp
	bra	.10082
.10081
;		printf (" is");	
^^	pea	.45+178
	jsr	_printf
	add.w	#4,sp
.10082
;	printf (" now marked for processing.\n");
^	pea	.45+182
	jsr	_printf
;
;	//  Need to restart the data flow after changing the channels
;	//  This has no affect if the logger is suspended
;	sci_logger_start_data ();
^^^^	jsr	_sci_logger_start_data
;	return 0;
^	move.l	#0,d0
	add.w	#4,sp
	bra	.47
;}
^.46
.45
	dc.b	79,70,70,0,67,111,117,108,100,32,110,111,116,32,100
	dc.b	105,115,97,98,108,101,32,116,104,101,32,115,99,105,101
	dc.b	110,99,101,32,100,97,116,97,32,108,111,103,103,101,114
	dc.b	32,99,104,97,110,110,101,108,115,46,10,0,65,108,108
	dc.b	32,115,99,105,101,110,99,101,32,100,97,116,97,32,99
	dc.b	104,97,110,110,101,108,115,32,116,117,114,110,101,100,32
	dc.b	111,102,102,46,10,0,67,111,117,108,100,32,110,111,116
	dc.b	32,97,99,116,105,118,97,116,101,32,115,99,105,101,110
	dc.b	99,101,32,100,97,116,97,32,108,111,103,103,101,114,32
	dc.b	99,104,97,110,110,101,108,115,46,10,0,83,99,105,101
	dc.b	110,99,101,32,99,104,97,110,110,101,108,0,115,32,0
	dc.b	32,0,44,32,0,37,100,0,32,97,114,101,0,32,105
	dc.b	115,0,32,110,111,119,32,109,97,114,107,101,100,32,102
	dc.b	111,114,32,112,114,111,99,101,115,115,105,110,103,46,10
	dc.b	0
	ds	0
;
;
;
;
;//  cmd_set_eng_rate (char* arguments)
;//
;//  Sets the delay between engineering channel samples
;//
;//	Returns: 0 if successful; non-zero on failure.  On failure the number
;//		returned may be used as an index into the array cmd_error_msgs[]
;//		to print an error message for the user.
;//	Failures: fails if the channel number is out of range or if the
;//		gain is an unrecognized value
;//
;int cmd_set_eng_rate (char* args)  {
# 770
| .53
	xdef	_cmd_set_eng_rate
_cmd_set_eng_rate:
	movem.l	d2/d3/d4/d5/a3,-(sp)
;	long delay;
;	int channel;
;	char* cp;
;
;	//  first number should be a channel number
;	cp = args;
~ delay d4 "l"
~ channel d5 "i"
~ cp a3 "#c"
~~ args 8 "#c"
^^^^^^	move.l	24(sp),a3
;	//  channels numbers must lie within range
;	channel = atoi (cp);
^^	move.l	a3,-(sp)
	jsr	_atoi
	move.w	d0,d5
;	if ((channel < 0) || (channel >= N_ENG_CHANNELS))
^;		return ILLEGAL_CHANNEL_NUMBER;
	tst.w	d5
	add.w	#4,sp
	blt	.54
	cmp.w	#4,d5
	blt	.10083
.54
^	move.l	#1,d0
.55
	movem.l	(sp)+,d2/d3/d4/d5/a3
	rts
;	
;	//  skip the channel number and the following white space
;	while (isdigit (*cp))
.10083
^^^.10084
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#4,d0
	beq	.10085
;		cp++;
^	add.l	#1,a3
	bra	.10084
.10085
;	while (isspace (*cp))
^.10086
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#16,d0
	beq	.10087
;		cp++;
^	add.l	#1,a3
	bra	.10086
.10087
;	if (*cp != ',')  {
^	cmp.b	#44,(a3)
	beq	.10088
;		printf ("Time must be separated from the channel number with a ','.\n");
^	pea	.52+0
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	add.w	#4,sp
	bra	.55
;	}
^;	cp++;
.10088
^	add.l	#1,a3
;	while (isspace (*cp))
^.10089
	move.b	(a3),d0
	ext.w	d0
	lea	__ctype+1,a0
	move.b	(a0,d0.w),d0
	and.b	#16,d0
	beq	.10090
;		cp++;
^	add.l	#1,a3
	bra	.10089
.10090
;	
;	//  get the rate
;	if (strcmp (cp, "OFF") == 0)  {
^^^	move.l	a3,a0
	lea	.52+60,a1
.56	move.b	(a0)+,d0
	cmp.b	(a1)+,d0
	bne.s	.57
	tst.b	d0
	bne.s	.56
.57	sub.b	-(a1),d0
	ext.w	d0
	bne	.10091
;		delay = 0;
^	move.l	#0,d4
;		printf ("Channel %d will be turned off.\n", channel);
^	move.w	d5,-(sp)
	pea	.52+64
	jsr	_printf
;	}  else  {
^	add.w	#6,sp
	bra	.10092
.10091
;		delay = (long)(atof (cp) + 0.5F);
^	move.l	a3,-(sp)
	jsr	_atof
	move.l	#$00000000,d3
	move.l	#$3fe00000,d2
	jsr	.Padd#
	jsr	.Pfix#
	move.l	d0,d4
;		if (delay <= 0)  {
^	tst.l	d4
	add.w	#4,sp
	bgt	.10093
;			printf ("A time between samples of %f is unacceptable.\n", delay);
^	move.l	d4,-(sp)
	pea	.52+96
	jsr	_printf
;			printf ("The time between samples must be a positive number.\n");
^	pea	.52+143
	jsr	_printf
;			printf ("Use OFF to disable a channel.\n");
^	pea	.52+196
	jsr	_printf
;			return 0;
^	move.l	#0,d0
	lea	16(sp),sp
	bra	.55
;		}
^;	}
.10093
^.10092
;
;	//  set the initialization array	
;	setup_data.eng_rate[channel] = delay;
^^^	move.w	d5,d0
	ext.l	d0
	asl.l	#2,d0
	lea	_setup_data,a0
	move.l	d4,(a0,d0.l)
;
;	//  set the logger if active
;	if (eng_logger_channel_setup (channel, delay) < 0)  {
^^^	move.l	d4,-(sp)
	move.w	d5,-(sp)
	jsr	_eng_logger_channel_setup
	tst.w	d0
	add.w	#6,sp
	bge	.10094
;		printf ("Out of memory.  Contact GEOSense.\n");
^	pea	.52+227
	jsr	_printf
;		return OUT_OF_MEMORY;
^	move.l	#6,d0
	add.w	#4,sp
	bra	.55
;	}
^;	
;	if (delay > 0)
.10094
^^;		printf ("Engineering channel %d will now be collected every %ld seconds.\n",
	tst.l	d4
	ble	.10095
^;																		channel, delay);
	move.l	d4,-(sp)
	move.w	d5,-(sp)
	pea	.52+262
	jsr	_printf
;	return 0;
	lea	10(sp),sp
.10095
^^	move.l	#0,d0
	bra	.55
;}	
^.53
.52
	dc.b	84,105,109,101,32,109,117,115,116,32,98,101,32,115,101
	dc.b	112,97,114,97,116,101,100,32,102,114,111,109,32,116,104
	dc.b	101,32,99,104,97,110,110,101,108,32,110,117,109,98,101
	dc.b	114,32,119,105,116,104,32,97,32,39,44,39,46,10,0
	dc.b	79,70,70,0,67,104,97,110,110,101,108,32,37,100,32
	dc.b	119,105,108,108,32,98,101,32,116,117,114,110,101,100,32
	dc.b	111,102,102,46,10,0,65,32,116,105,109,101,32,98,101
	dc.b	116,119,101,101,110,32,115,97,109,112,108,101,115,32,111
	dc.b	102,32,37,102,32,105,115,32,117,110,97,99,99,101,112
	dc.b	116,97,98,108,101,46,10,0,84,104,101,32,116,105,109
	dc.b	101,32,98,101,116,119,101,101,110,32,115,97,109,112,108
	dc.b	101,115,32,109,117,115,116,32,98,101,32,97,32,112,111
	dc.b	115,105,116,105,118,101,32,110,117,109,98,101,114,46,10
	dc.b	0,85,115,101,32,79,70,70,32,116,111,32,100,105,115
	dc.b	97,98,108,101,32,97,32,99,104,97,110,110,101,108,46
	dc.b	10,0,79,117,116,32,111,102,32,109,101,109,111,114,121
	dc.b	46,32,32,67,111,110,116,97,99,116,32,71,69,79,83
	dc.b	101,110,115,101,46,10,0,69,110,103,105,110,101,101,114
	dc.b	105,110,103,32,99,104,97,110,110,101,108,32,37,100,32
	dc.b	119,105,108,108,32,110,111,119,32,98,101,32,99,111,108
	dc.b	108,101,99,116,101,100,32,101,118,101,114,121,32,37,108
	dc.b	100,32,115,101,99,111,110,100,115,46,10,0
	ds	0
;
;
;
;
;//	cmd_read_eng ()
;//
;//	Reads and prints an engineering channel
;//
;int cmd_read_eng (char* arg)  {
# 831
| .59
	xdef	_cmd_read_eng
_cmd_read_eng:
	movem.l	d2/d3/d4,-(sp)
;	int channel, value;
;	float mVolts;
;	
;	channel = atoi (arg);
~ channel d2 "i"
~ value d3 "i"
~ mVolts d4 "f"
~~ arg 8 "#c"
^^^^	move.l	16(sp),-(sp)
	jsr	_atoi
	move.w	d0,d2
;	if ((channel < 0) || (channel >= N_ENG_CHANNELS))
^;		return ILLEGAL_CHANNEL_NUMBER;
	tst.w	d2
	add.w	#4,sp
	blt	.60
	cmp.w	#4,d2
	blt	.10096
.60
^	move.l	#1,d0
.61
	movem.l	(sp)+,d2/d3/d4
	rts
;/*
;switch (channel)  {
;  case 0:
;	printf ("power cycle and restart of bus\n");
;	PConfInp (F, 4);
;	Max186PowerUp ();
;	Max186PowerDown ();
;	printf ("power down\n");
;	AD7716_SPI_interface_init ();
;	printf ("int init\n");
;	PConfBus (F, 4);
;	printf ("bus\n");
;	return 0;
;
;  case 1:
;	printf ("power cycle; no restart of bus\n");
;	PConfInp (F, 4);
;	Max186PowerUp ();
;	Max186PowerDown ();
;	printf ("power down\n");
;	AD7716_SPI_interface_init ();
;	printf ("int init\n");
;	return 0;
;  	
;  case 2:	
;	printf ("power off\n");
;	Max186PowerDown ();
;	return 0;
;
;  case 3:
;  	printf ("read chan 0; power down\n");
;	Max186PowerUp ();
;	value = eng_logger_read_channel (0, 20);
;	if (value == 0x8000)  {
;		printf ("Unknown error while reading channel %d\n", channel);
;	}  else  {
;		mVolts = AtoDtoMilliVolts (value);
;		printf ("Channel %d reads %f mVolts\n", channel, mVolts);
;	}	
;	printf ("QPAR = 0x%02X\n", (short)(*QPAR));
;	printf ("QDDR = 0x%02X\n", (short)(*QDDR));
;	printf ("QPDR = 0x%02X\n", (short)(*QPDR));
;
;	Max186PowerDown ();
;	return 0;
;}
;
;*/	
;	//  REVIEW - this will not work if the logger is not active because the
;	//  power will not be turned on to the analog sections
;	value = eng_logger_read_channel (channel, 10);
.10096
^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^	move.w	#10,-(sp)
	move.w	d2,-(sp)
	jsr	_eng_logger_read_channel
	move.w	d0,d3
;	if (value == 0x8000)  {
^	cmp.w	#32768,d3
	add.w	#4,sp
	bne	.10097
;		printf ("Unknown error while reading channel %d\n", channel);
^	move.w	d2,-(sp)
	pea	.58+0
	jsr	_printf
;	}  else  {
^	add.w	#6,sp
	bra	.10098
.10097
;		mVolts = AtoDtoMilliVolts (value);
^	move.w	d3,d0
	asr.w	#3,d0
	ext.l	d0
	jsr	.Fflt#
	move.l	d0,d4
;		printf ("Channel %d input is at %.0f mVolts\n", channel, mVolts);
^	move.l	d4,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	move.w	d2,-(sp)
	pea	.58+40
	jsr	_printf
;	}	
^	lea	14(sp),sp
.10098
;	return 0;
^	move.l	#0,d0
	bra	.61
;}
^.59
.58
	dc.b	85,110,107,110,111,119,110,32,101,114,114,111,114,32,119
	dc.b	104,105,108,101,32,114,101,97,100,105,110,103,32,99,104
	dc.b	97,110,110,101,108,32,37,100,10,0,67,104,97,110,110
	dc.b	101,108,32,37,100,32,105,110,112,117,116,32,105,115,32
	dc.b	97,116,32,37,46,48,102,32,109,86,111,108,116,115,10
	dc.b	0
	ds	0
;	
;
;
;
;//  cmd_set_time ()
;//
;//	Queries user for a data and time, then sets the logger time immediately
;//
;int cmd_set_time (char* args)  {
# 905
| .63
	xdef	_cmd_set_time
_cmd_set_time:
	link	a6,#.64
	movem.l	d2/d3,-(sp)
;	struct tm tp;
;	int result;
;	long suspend_time;
;	
;	//  out how much time is left on our suspension, and save it so we
;	//  can restart the suspension after changing the time.  Otherwise
;	//  the system will automatically come out of suspension if we change
;	//  the time by a large number
;	suspend_time = logger_get_seconds_to_start ();
~ 'tm'
~ 1 10 20
~ tm_sec 0 "i"
~ tm_min 2 "i"
~ tm_hour 4 "i"
~ tm_mday 6 "i"
~ tm_mon 8 "i"
~ tm_year 10 "i"
~ tm_wday 12 "i"
~ tm_yday 14 "i"
~ tm_isdst 16 "i"
~ tm_hsec 18 "i"
~ tp -20 ":" 1
~ result d3 "i"
~ suspend_time d2 "l"
~~ args 8 "#c"
^^^^^^^^^	jsr	_logger_get_seconds_to_start
	move.l	d0,d2
;	
;	//  REVIEW - we should also investigate how changing the time affects
;	//  the engineering logger if it is running when the time is changed
;	
;	//	tp.tm_sec = tp.tm_min = tp.tm_hour = tp.tm_year = tp.tm_mon = tp.tm_mday = -1;
;	result = logger_time_query_time (&tp);	
^^^^^^	pea	-20(a6)
	jsr	_logger_time_query_time
	move.w	d0,d3
;	if (result != 0)
^;		return 0;
	tst.w	d3
	add.w	#4,sp
	beq	.10099
^	move.l	#0,d0
.65
	movem.l	(sp)+,d2/d3
	unlk	a6
	rts
;		
;	//  REVIEW
;	//  why is this here?
;	if (tp.tm_sec < 0)
.10099
^^^^;		return 0;
	tst.w	-20(a6)
	bge	.10100
^	move.l	#0,d0
	bra	.65
;	logger_time_set_time (&tp);
.10100
^	pea	-20(a6)
	jsr	_logger_time_set_time
;	printf ("Time now set to:\n");
^	pea	.62+0
	jsr	_printf
;	cmd_print_time (args);
^	move.l	8(a6),-(sp)
	jsr	_cmd_print_time
;	
;	if (suspend_time > 0)
^^;		logger_suspend (suspend_time);
	tst.l	d2
	lea	12(sp),sp
	ble	.10101
^	move.l	d2,-(sp)
	jsr	_logger_suspend
;	return 0;
	add.w	#4,sp
.10101
^	move.l	#0,d0
	bra	.65
;}
^.63
.64	equ	-20
.62
	dc.b	84,105,109,101,32,110,111,119,32,115,101,116,32,116,111
	dc.b	58,10,0
	ds	0
;
;
;
;
;//  cmd_sync_set_time ()
;//
;//	Queries user for a data and time, then sets the logger time on the
;//  falling edge of TPU input 15
;//
;int cmd_sync_set_time (char* args)  {
# 945
| .67
	xdef	_cmd_sync_set_time
_cmd_sync_set_time:
	link	a6,#.68
	movem.l	d2/d3/d4/d5,-(sp)
;	struct tm tp;
;	int result;
;	long freq, baud, suspend_time;
;
;	printf ("The time will be set on the falling edge of the sync pulse.\n");
~ tp -20 ":" 1
~ result d5 "i"
~ freq d3 "l"
~ baud d2 "l"
~ suspend_time d4 "l"
~~ args 8 "#c"
^^^^^	pea	.66+0
	jsr	_printf
;	suspend_time = logger_get_seconds_to_start ();
^	jsr	_logger_get_seconds_to_start
	move.l	d0,d4
;	
;	//  Make sure the clock rate is set at some minimum before we
;	//  wait for the interrupt.  The query time routine will print,
;	//  so we also adjust the baud rate.  If the current clock
;	//  exceed the min, don't bother changing
;	freq = SimGetFSys ();
^^^^^^	jsr	_SimGetFSys
	move.l	d0,d3
;	if (freq < MIN_TIME_SET_FREQ)  {
^	cmp.l	_MIN_TIME_SET_FREQ,d3
	add.w	#4,sp
	bge	.10102
;		baud = SerGetBaud (0, 0);
^	clr.l	-(sp)
	clr.l	-(sp)
	jsr	_SerGetBaud
	move.l	d0,d2
;		SimSetFSys (MIN_TIME_SET_FREQ);
^	move.l	_MIN_TIME_SET_FREQ,-(sp)
	jsr	_SimSetFSys
;		SerSetBaud (baud, 0);
^	clr.l	-(sp)
	move.l	d2,-(sp)
	jsr	_SerSetBaud
;	}  else
^	lea	20(sp),sp
	bra	.10103
.10102
;		baud = -1;	
^	move.l	#-1,d2
.10103
;	
;	result = logger_time_query_time (&tp);	
^^	pea	-20(a6)
	jsr	_logger_time_query_time
	move.w	d0,d5
;	if (result != 0)
^;		return 0;
	tst.w	d5
	add.w	#4,sp
	beq	.10104
^	move.l	#0,d0
.69
	movem.l	(sp)+,d2/d3/d4/d5
	unlk	a6
	rts
;	logger_time_sync_set_time (&tp);
.10104
^	pea	-20(a6)
	jsr	_logger_time_sync_set_time
;	
;	if (baud > 0)  {
^^	tst.l	d2
	add.w	#4,sp
	ble	.10105
;		SimSetFSys (freq);
^	move.l	d3,-(sp)
	jsr	_SimSetFSys
;		SerSetBaud (baud, 0);
^	clr.l	-(sp)
	move.l	d2,-(sp)
	jsr	_SerSetBaud
;	}
^;	printf ("Time now set to:\n");
	lea	12(sp),sp
.10105
^	pea	.66+61
	jsr	_printf
;	cmd_print_time (args);
^	move.l	8(a6),-(sp)
	jsr	_cmd_print_time
;	if (suspend_time > 0)
^;		logger_suspend (suspend_time);
	tst.l	d4
	add.w	#8,sp
	ble	.10106
^	move.l	d4,-(sp)
	jsr	_logger_suspend
;	return 0;
	add.w	#4,sp
.10106
^	move.l	#0,d0
	bra	.69
;}	
^.67
.68	equ	-20
.66
	dc.b	84,104,101,32,116,105,109,101,32,119,105,108,108,32,98
	dc.b	101,32,115,101,116,32,111,110,32,116,104,101,32,102,97
	dc.b	108,108,105,110,103,32,101,100,103,101,32,111,102,32,116
	dc.b	104,101,32,115,121,110,99,32,112,117,108,115,101,46,10
	dc.b	0,84,105,109,101,32,110,111,119,32,115,101,116,32,116
	dc.b	111,58,10,0
	ds	0
;
;
;		
;
;int cmd_print_time (char* args)  {
# 984
| .71
	xdef	_cmd_print_time
_cmd_print_time:
	link	a6,#.72
;	time_tt now;        
;	
;	now = logger_time_get_time ();
~ ''
~ 2 2 8
~ secs 0 "L"
~ ticks 4 "l"
~ now -8 ":" 2
~~ args 8 "#c"
^^^	lea	-8(a6),a0
	move.l	a0,-(sp)
	jsr	_logger_time_get_time
	move.l	d0,a0
	move.l	(sp)+,a1
	move.l	(a0)+,(a1)+
	move.l	(a0)+,(a1)+
;	printf ("%s", logger_time_get_string (&now));
^	pea	-8(a6)
	jsr	_logger_time_get_string
	add.w	#4,sp
	move.l	d0,-(sp)
	pea	.70+0
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	add.w	#8,sp
.73
	unlk	a6
	rts
;}
^.71
.72	equ	-8
.70
	dc.b	37,115,0
	ds	0
;	
;
;
;	
;	
;int cmd_sync_print_time (char* args)  {
# 996
| .75
	xdef	_cmd_sync_print_time
_cmd_sync_print_time:
	link	a6,#.76
	movem.l	d2/d3,-(sp)
;	time_tt now;
;	long freq;
;	short freq_set;
;	
;	//  Make sure the clock rate is set at some minimum before we
;	//  wait for the interrupt.  The query time routine will print,
;	//  so we also adjust the baud rate.  If the current clock
;	//  exceed the min, don't bother changing
;	freq = SimGetFSys ();
~ now -8 ":" 2
~ freq d2 "l"
~ freq_set d3 "i"
~~ args 8 "#c"
^^^^^^^^^	jsr	_SimGetFSys
	move.l	d0,d2
;	if (freq < MIN_TIME_SET_FREQ)  {
^	cmp.l	_MIN_TIME_SET_FREQ,d2
	bge	.10107
;		SimSetFSys (MIN_TIME_SET_FREQ);
^	move.l	_MIN_TIME_SET_FREQ,-(sp)
	jsr	_SimSetFSys
;		freq_set = 1;
^	move.l	#1,d3
;	}  else
^	add.w	#4,sp
	bra	.10108
.10107
;		freq_set = 0;	
^	move.l	#0,d3
.10108
;	now = logger_time_sync_get_time ();
^	lea	-8(a6),a0
	move.l	a0,-(sp)
	jsr	_logger_time_sync_get_time
	move.l	d0,a0
	move.l	(sp)+,a1
	move.l	(a0)+,(a1)+
	move.l	(a0)+,(a1)+
;
;	//  and reset the freq back to the original	if necessary
;	if (freq_set)
^^^;		SimSetFSys (freq);
	tst.w	d3
	beq	.10109
^	move.l	d2,-(sp)
	jsr	_SimSetFSys
;	printf ("%s", logger_time_get_string (&now));
	add.w	#4,sp
.10109
^	pea	-8(a6)
	jsr	_logger_time_get_string
	add.w	#4,sp
	move.l	d0,-(sp)
	pea	.74+0
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	add.w	#8,sp
.77
	movem.l	(sp)+,d2/d3
	unlk	a6
	rts
;}
^.75
.76	equ	-8
.74
	dc.b	37,115,0
	ds	0
;	
;
;
;
;int cmd_sync_print_time_error (char* args)  {
# 1023
| .79
	xdef	_cmd_sync_print_time_error
_cmd_sync_print_time_error:
	link	a6,#.80
	movem.l	d2/d3/d4/d5/d6,-(sp)
;	time_tt from_logger, from_user;
;	struct tm tm;
;	long delta;
;	float dt;
;	long freq, baud;
;	short sign;
;	
;	//  Make sure the clock rate is set at some minimum before we
;	//  wait for the interrupt.  The query time routine will print,
;	//  so we also adjust the baud rate.  If the current clock
;	//  exceed the min, don't bother changing
;	freq = SimGetFSys ();
~ from_logger -8 ":" 2
~ from_user -16 ":" 2
~ tm -36 ":" 1
~ delta d3 "l"
~ dt d4 "f"
~ freq d6 "l"
~ baud d2 "l"
~ sign d5 "i"
~~ args 8 "#c"
^^^^^^^^^^^^	jsr	_SimGetFSys
	move.l	d0,d6
;	if (freq < MIN_TIME_SET_FREQ)  {
^	cmp.l	_MIN_TIME_SET_FREQ,d6
	bge	.10110
;		baud = SerGetBaud (0, 0);
^	clr.l	-(sp)
	clr.l	-(sp)
	jsr	_SerGetBaud
	move.l	d0,d2
;		SimSetFSys (MIN_TIME_SET_FREQ);
^	move.l	_MIN_TIME_SET_FREQ,-(sp)
	jsr	_SimSetFSys
;		SerSetBaud (baud, 0);
^	clr.l	-(sp)
	move.l	d2,-(sp)
	jsr	_SerSetBaud
;	}  else
^	lea	20(sp),sp
	bra	.10111
.10110
;		baud = -1;	
^	move.l	#-1,d2
.10111
;
;	if (logger_time_query_time (&tm) != 0)
^^;		return 0;
	pea	-36(a6)
	jsr	_logger_time_query_time
	tst.w	d0
	add.w	#4,sp
	beq	.10112
^	move.l	#0,d0
.81
	movem.l	(sp)+,d2/d3/d4/d5/d6
	unlk	a6
	rts
;		
;	from_logger = logger_time_sync_get_time ();
.10112
^^	lea	-8(a6),a0
	move.l	a0,-(sp)
	jsr	_logger_time_sync_get_time
	move.l	d0,a0
	move.l	(sp)+,a1
	move.l	(a0)+,(a1)+
	move.l	(a0)+,(a1)+
;	
;	//  reset the clock as quickly as possible to minimize power usage
;	if (baud > 0)  {
^^^	tst.l	d2
	ble	.10113
;		SimSetFSys (freq);
^	move.l	d6,-(sp)
	jsr	_SimSetFSys
;		SerSetBaud (baud, 0);
^	clr.l	-(sp)
	move.l	d2,-(sp)
	jsr	_SerSetBaud
;	}
^;
;	from_user.secs = mktime (&tm);
	lea	12(sp),sp
.10113
^^	pea	-36(a6)
	jsr	_mktime
	move.l	d0,-16(a6)
;	from_user.ticks = 0;
^	clr.l	-12(a6)
;
;	delta = ttmcmp (from_logger, from_user);
^^	sub.w	#8,sp
	move.l	sp,a0
	lea	-16(a6),a1
	move.l	(a1)+,(a0)+
	move.l	(a1)+,(a0)+
	sub.w	#8,sp
	move.l	sp,a0
	lea	-8(a6),a1
	move.l	(a1)+,(a0)+
	move.l	(a1)+,(a0)+
	jsr	_ttmcmp
	move.l	d0,d3
;	if (delta < 0)
^;		sign = -1;
	tst.l	d3
	lea	20(sp),sp
	bge	.10114
^	move.l	#-1,d5
;	else
	bra	.10115
.10114
;		sign = 1;	
^^	move.l	#1,d5
.10115
;
;	//  complex crap is necessary to handle negative numbers properly
;	dt = labs(delta) / GetTickRate();
^^^	move.l	d3,-(sp)
	jsr	_labs
	add.w	#4,sp
	move.l	d0,-(sp)
	jsr	_GetTickRate
	move.l	d0,d1
	move.l	(sp)+,d0
	jsr	.divs#
	jsr	.Fflt#
	move.l	d0,d4
;	dt += (labs(delta)%GetTickRate()) / ((float)GetTickRate());
^	move.l	d3,-(sp)
	jsr	_labs
	add.w	#4,sp
	move.l	d0,-(sp)
	jsr	_GetTickRate
	move.l	d0,d1
	move.l	(sp)+,d0
	jsr	.mods#
	jsr	.Fflt#
	move.l	d0,-(sp)
	jsr	_GetTickRate
	jsr	.Fflt#
	move.l	d0,d1
	move.l	(sp)+,d0
	jsr	.Fdiv#
	move.l	d4,d1
	jsr	.Fadd#
	move.l	d0,d4
;	dt *= sign;
^	move.w	d5,a0
	move.l	a0,d0
	jsr	.Fflt#
	move.l	d4,d1
	jsr	.Fmul#
	move.l	d0,d4
;	
;	printf ("Difference is %.3f seconds\n", dt);
^^	move.l	d4,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.78+0
	jsr	_printf
;	if (sign > 0)
^;		printf ("The logger is fast by this amount.\n");
	tst.w	d5
	lea	12(sp),sp
	ble	.10116
^	pea	.78+28
	jsr	_printf
;	else
	add.w	#4,sp
	bra	.10117
.10116
;		printf ("The logger is slow by this amount.\n");	
^^	pea	.78+64
	jsr	_printf
	add.w	#4,sp
.10117
;	return 0;
^	move.l	#0,d0
	bra	.81
;}
^.79
.80	equ	-36
.78
	dc.b	68,105,102,102,101,114,101,110,99,101,32,105,115,32,37
	dc.b	46,51,102,32,115,101,99,111,110,100,115,10,0,84,104
	dc.b	101,32,108,111,103,103,101,114,32,105,115,32,102,97,115
	dc.b	116,32,98,121,32,116,104,105,115,32,97,109,111,117,110
	dc.b	116,46,10,0,84,104,101,32,108,111,103,103,101,114,32
	dc.b	105,115,32,115,108,111,119,32,98,121,32,116,104,105,115
	dc.b	32,97,109,111,117,110,116,46,10,0
	ds	0
;	
;
;
;
;int cmd_help (char* args)  {
# 1079
| .83
	xdef	_cmd_help
_cmd_help:
	movem.l	d2,-(sp)
;	int n;
;	
;	printf ("The following commands are available:\n");
~ n d2 "i"
~~ args 8 "#c"
^^^	pea	.82+0
	jsr	_printf
;	for (n = 0;  n < n_commands; n++)  {
^	move.l	#0,d2
	add.w	#4,sp
	bra	.10121
.10120
;		//  don't print help message for commands which start
;		//  with a "!", because these are commands which are
;		//  not intended for use by the user with an ASCII
;		//  interface
;		if (cmd_ref[n].name[0] != '!')
^^^^^;			printf (" %s %s\n", cmd_ref[n].name, cmd_ref[n].help);
	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref,a0
	move.b	(a0,d0.l),d0
	ext.w	d0
	cmp.w	#33,d0
	beq	.10122
^	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref+38,a0
	add.l	a0,d0
	move.l	d0,-(sp)
	move.w	d2,d0
	muls.w	#86,d0
	lea	_cmd_ref,a0
	add.l	a0,d0
	move.l	d0,-(sp)
	pea	.82+39
	jsr	_printf
;	}	
	lea	12(sp),sp
.10122
^.10118
	add.w	#1,d2
.10121
	cmp.w	_n_commands,d2
	blt	.10120
.10119
;	return 0;
^	move.l	#0,d0
.84
	movem.l	(sp)+,d2
	rts
;}
^.83
.82
	dc.b	84,104,101,32,102,111,108,108,111,119,105,110,103,32,99
	dc.b	111,109,109,97,110,100,115,32,97,114,101,32,97,118,97
	dc.b	105,108,97,98,108,101,58,10,0,32,37,115,32,37,115
	dc.b	10,0
	ds	0
;
;
;
;//  This command is used to show any interesting status information that the user might
;//  want.  Add freely to it.
;//
;int cmd_show_status (char* args)  {
# 1099
| .86
	xdef	_cmd_show_status
_cmd_show_status:
	movem.l	d2/d3,-(sp)
;	extern const float SOFTWARE_VERSION;
;	
;	printf ("This is software version %.2f\n", SOFTWARE_VERSION);
~~ args 8 "#c"
^^^	move.l	_SOFTWARE_VERSION,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.85+0
	jsr	_printf
;	#ifdef DEBUG
;		printf ("This code was compiled in debug mode, and is NOT appropriate for deployment.\n");
;	#endif
;	#ifdef SIMULATE_DATA
;		printf ("This code simulates data, and is NOT appropriate for deployment.\n");
;	#endif
;	#if !defined(SIMULATE_DATA) && !defined(DEBUG)
;		printf ("This code was NOT compiled for debugging or simulation, and is suitable for deployment.\n");	
^^^^^^^^	pea	.85+31
	jsr	_printf
;	#endif	
;
;	if (sci_logger_is_open())  {
^^^	jsr	_sci_logger_is_open
	tst.w	d0
	lea	16(sp),sp
	beq	.10123
;		printf ("The logger is running.\n");
^	pea	.85+120
	jsr	_printf
;	}  else  {
^	add.w	#4,sp
	bra	.10124
.10123
;		printf ("The logger is NOT running.\n");
^	pea	.85+144
	jsr	_printf
;	}
^	add.w	#4,sp
.10124
;	printf ("The clock rate is currently set to %.3f MHz\n", (SimGetFSys ()/1.0e6));
^	jsr	_SimGetFSys
	jsr	.Pflt#
	move.l	#$00000000,d3
	move.l	#$412e8480,d2
	jsr	.Pdiv#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.85+172
	jsr	_printf
;	logger_disk_show_status ();
^	jsr	_logger_disk_show_status
;	sci_logger_show_status ();
^	jsr	_sci_logger_show_status
;	return 0;
^	move.l	#0,d0
	lea	12(sp),sp
.87
	movem.l	(sp)+,d2/d3
	rts
;}
^.86
.85
	dc.b	84,104,105,115,32,105,115,32,115,111,102,116,119,97,114
	dc.b	101,32,118,101,114,115,105,111,110,32,37,46,50,102,10
	dc.b	0,84,104,105,115,32,99,111,100,101,32,119,97,115,32
	dc.b	78,79,84,32,99,111,109,112,105,108,101,100,32,102,111
	dc.b	114,32,100,101,98,117,103,103,105,110,103,32,111,114,32
	dc.b	115,105,109,117,108,97,116,105,111,110,44,32,97,110,100
	dc.b	32,105,115,32,115,117,105,116,97,98,108,101,32,102,111
	dc.b	114,32,100,101,112,108,111,121,109,101,110,116,46,10,0
	dc.b	84,104,101,32,108,111,103,103,101,114,32,105,115,32,114
	dc.b	117,110,110,105,110,103,46,10,0,84,104,101,32,108,111
	dc.b	103,103,101,114,32,105,115,32,78,79,84,32,114,117,110
	dc.b	110,105,110,103,46,10,0,84,104,101,32,99,108,111,99
	dc.b	107,32,114,97,116,101,32,105,115,32,99,117,114,114,101
	dc.b	110,116,108,121,32,115,101,116,32,116,111,32,37,46,51
	dc.b	102,32,77,72,122,10,0
	ds	0
;
;	
;
;
;int cmd_disk_cd (char* args)  {
# 1127
| .89
	xdef	_cmd_disk_cd
_cmd_disk_cd:
	movem.l	a3,-(sp)
	move.l	8(sp),a3
;	ASSERT (args != NULL);
~~ args a3 "#c"
^;
;	//  A full path starting with a '\' is treated as an absolute path on
;	//  the current partition.  A path starting with a letter and a ':' is
;	//  treated as a full path including the partition.  Anything else is
;	//  treated as an additional path to add to the current working directory.
;	if ((args[0] != '\0') && (args[1] == ':'))  {
^^^^^^	tst.b	(a3)
	beq	.10125
	cmp.b	#58,1(a3)
	bne	.10125
;		//  user has provided a complete path including a partition letter
;		strcpy (wd, args);
^^	lea	_wd,a0
	move.l	a3,a1
.90	move.b	(a1)+,(a0)+
	bne.s	.90
;	}  else  {
^	bra	.10126
.10125
;		if (args[0] == '\\')  {
^	cmp.b	#92,(a3)
	bne	.10127
;			//  User specified a complete path from the root, but no partition
;			//  Keep the current partition
;			strcpy (&wd[2], args);
^^^	lea	_wd+2,a0
	move.l	a3,a1
.91	move.b	(a1)+,(a0)+
	bne.s	.91
;		}  else  {
^	bra	.10128
.10127
;			//  User specified a relative path
;			//  Add this directory name to our current path
;			if (strcmp (args, "..") == 0)
^^^;				printf ("The .. convention is not yet implemented.\n");
	move.l	a3,a0
	lea	.88,a1
.92	move.b	(a0)+,d0
	cmp.b	(a1)+,d0
	bne.s	.93
	tst.b	d0
	bne.s	.92
.93	sub.b	-(a1),d0
	ext.w	d0
	bne	.10129
^	pea	.88+3
	jsr	_printf
;			else
	add.w	#4,sp
	bra	.10130
.10129
;				strcat (wd, args);
^^	move.l	a3,-(sp)
	pea	_wd
	jsr	_strcat
	add.w	#8,sp
.10130
;		}
^.10128
;	}	
^.10126
;	//  make sure our current working directory always ends with a '\'
;	if (wd[strlen(wd)-1] != '\\')
^^;		strcat (wd, "\\");
	lea	_wd,a0
	move.l	a0,d0
.94	tst.b	(a0)+
	bne.s	.94
	sub.l	d0,a0
	sub.l	#1,a0
	lea	_wd-1,a1
	cmp.b	#92,(a1,a0.l)
	beq	.10131
^	pea	.88+46
	pea	_wd
	jsr	_strcat
;	printf ("The working directory is now '%s'\n", wd);	
	add.w	#8,sp
.10131
^	pea	_wd
	pea	.88+48
	jsr	_printf
;	return 0;	
^	move.l	#0,d0
	add.w	#8,sp
.95
	movem.l	(sp)+,a3
	rts
;}	
^.89
.88
	dc.b	46,46,0,84,104,101,32,46,46,32,99,111,110,118,101
	dc.b	110,116,105,111,110,32,105,115,32,110,111,116,32,121,101
	dc.b	116,32,105,109,112,108,101,109,101,110,116,101,100,46,10
	dc.b	0,92,0,84,104,101,32,119,111,114,107,105,110,103,32
	dc.b	100,105,114,101,99,116,111,114,121,32,105,115,32,110,111
	dc.b	119,32,39,37,115,39,10,0
	ds	0
;
;
;
;
;int cmd_disk_pwd (char* args)  {
# 1161
| .97
	xdef	_cmd_disk_pwd
_cmd_disk_pwd:
;	printf ("Current working directory: %s\n", wd);
~~ args 8 "#c"
^	pea	_wd
	pea	.96+0
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	add.w	#8,sp
.98
	rts
;}	
^.97
.96
	dc.b	67,117,114,114,101,110,116,32,119,111,114,107,105,110,103
	dc.b	32,100,105,114,101,99,116,111,114,121,58,32,37,115,10
	dc.b	0
	ds	0
;
;
;
;int cmd_disk_dir (char* args)  {
# 1168
| .100
	xdef	_cmd_disk_dir
_cmd_disk_dir:
	link	a6,#.101
	movem.l	a3,-(sp)
	move.l	8(a6),a3
;	char path[128];
;	int pc_seedir(char *);
;	ASSERT (args != NULL);
~ path -128 "[128c"
~~ args a3 "#c"
^^^;	
;	//  print time stamp; args not used
;	cmd_print_time (args);
^^^	move.l	a3,-(sp)
	jsr	_cmd_print_time
;	
;//	printf ("dos show dir\n");	
;	//  if user provides a full path, including the partition, use it
;	if ((args[0] != '\0') && (args[1] == ':'))
^^^^;		strcpy (path, args);
	tst.b	(a3)
	add.w	#4,sp
	beq	.10132
	cmp.b	#58,1(a3)
	bne	.10132
^	lea	-128(a6),a0
	move.l	a3,a1
.102	move.b	(a1)+,(a0)+
	bne.s	.102
;	else  {
	bra	.10133
.10132
^;		//  If the user hasn't provided a full path, then we will use
;		//  at least some part of the current working directory.
; 		//  If user has provided no path, use default
;		strcpy (path, wd);
^^^^	lea	-128(a6),a0
	lea	_wd,a1
.103	move.b	(a1)+,(a0)+
	bne.s	.103
;		if (args[0] == '\\')
^;			//  if user provides part of a path, but no partition, use current
;			//  partition and the users path
;			strcpy (&path[2], args);
	cmp.b	#92,(a3)
	bne	.10134
^^^	lea	-126(a6),a0
	move.l	a3,a1
.104	move.b	(a1)+,(a0)+
	bne.s	.104
;		else  {
	bra	.10135
.10134
^;			//  This takes care of the case where the user has provided a partial
;			//  path.  It also must take care of the case where the user has
;			//  provided no argument at all.  This code relies on the fact that
;			//  the argument passed to this subroutine has had all white space
;			//  eliminated before the argument was passed.
;			strcat (path, args);	
^^^^^^	move.l	a3,-(sp)
	pea	-128(a6)
	jsr	_strcat
;		}
^	add.w	#8,sp
.10135
;	}		
^.10133
;	if (path[strlen(path)-1] != '\\')
^;		strcat (path, "\\");
	lea	-128(a6),a0
	move.l	a0,d0
.105	tst.b	(a0)+
	bne.s	.105
	sub.l	d0,a0
	sub.l	#1,a0
	lea	-129(a6),a1
	cmp.b	#92,(a1,a0.l)
	beq	.10136
^	pea	.99+0
	pea	-128(a6)
	jsr	_strcat
;	strcat (path, "*");
	add.w	#8,sp
.10136
^	pea	.99+2
	pea	-128(a6)
	jsr	_strcat
;	printf ("Directory of %s:\n", path);	
^	pea	-128(a6)
	pea	.99+4
	jsr	_printf
;	
;	#ifdef DEBUG
;//	printf ("Calling disk power on (dir '%s')\n", path);
;	#endif
;	disk_power_on (path);
^^^^^	pea	-128(a6)
	jsr	_disk_power_on
;	
;
;	/* Now do the dir */
;	pc_seedir(&path[0]);
^^^^	pea	-128(a6)
	jsr	_pc_seedir
;
;	//  Release all resources used by the disk the disk
;//	pc_dskclose(&path[0]);
;//	ide_close((int)(path[0]-'A'));									/*__fn__*/
;//	pc_memory_close();
;
;	#ifdef DEBUG
;//	printf ("Calling disk power off (dir '%s')\n", path);
;	#endif
;	disk_power_off (path);
^^^^^^^^^^	pea	-128(a6)
	jsr	_disk_power_off
;
;	return 0;
^^	move.l	#0,d0
	lea	28(sp),sp
.106
	movem.l	(sp)+,a3
	unlk	a6
	rts
;}	
^.100
.101	equ	-128
.99
	dc.b	92,0,42,0,68,105,114,101,99,116,111,114,121,32,111
	dc.b	102,32,37,115,58,10,0
	ds	0
;
;
;
;
;//  List directory, and return number of matching file
;int pc_seedir(char *path)                                          /*__fn__*/
;{
# 1229
^| .108
	xdef	_pc_seedir
_pc_seedir:
	link	a6,#.109
	movem.l	d2/d3/d4/d5/d6/d7/a3/a4,-(sp)
	move.l	8(a6),a4
;    char *dirstr;
;    int fcount = 0;
;    DSTAT statobj;
;    int year;
;	unsigned long blocks_free, blocks_total;
;	unsigned long nfree, Mbytes, kbytes, fraction;;
~ dirstr a3 "#c"
~ fcount d3 "i"
~ 'dstat'
~ 3 14 578
~ fname 0 "[9c"
~ fext 9 "[4c"
~ lfname 13 "[256C"
~ filename 269 "[15c"
~ fattribute 284 "C"
~ ftime 286 "I"
~ fdate 288 "I"
~ fsize 290 "L"
~ driveno 294 "i"
~ pname 296 "[9C"
~ pext 305 "[4C"
~ path 309 "[260c"
~ pobj 570 "#v"
~ pmom 574 "#v"
~ statobj -578 ":" 3
~ year d2 "i"
~ blocks_free -582 "L"
~ blocks_total -586 "L"
~ nfree d7 "L"
~ Mbytes d5 "L"
~ kbytes d4 "L"
~ fraction d6 "L"
~~ path a4 "#c"
	move.l	#0,d3
^^^^^^;
;    /* Get the first match   */
;//	printf ("pc_gfirst\n");    
;    if (pc_gfirst(&statobj, path))
^^^^;    {
	move.l	a4,-(sp)
	pea	-578(a6)
	jsr	_pc_gfirst
	tst.w	d0
	add.w	#8,sp
	beq	.10137
^;//	printf ("outside while true\n");    
;        while (TRUE)
^^.10138
;        {
^;//	printf ("inside while true\n");        
;            fcount++;
^^	add.w	#1,d3
;            if (statobj.fattribute & AVOLUME)
^;                 dirstr = "<VOL>";
	move.b	-294(a6),d0
	and.b	#8,d0
	beq	.10140
^	lea	.107,a3
;            else if (statobj.fattribute & ADIRENT)
	bra	.10141
.10140
^;                 dirstr = "<DIR>";
	move.b	-294(a6),d0
	and.b	#16,d0
	beq	.10142
^	lea	.107+6,a3
;            else
	bra	.10143
.10142
;                 dirstr = "     ";
^^	lea	.107+12,a3
.10143
.10141
;
;            printf("%-8s.%-3s", &(statobj.fname[0]), &(statobj.fext[0]));
^^	pea	-569(a6)
	pea	-578(a6)
	pea	.107+18
	jsr	_printf
;            printf(" %7ld %5s", statobj.fsize, dirstr);
^	move.l	a3,-(sp)
	move.l	-288(a6),-(sp)
	pea	.107+28
	jsr	_printf
;            printf(" %02d",(statobj.fdate >> 5 ) & 0xf); /* Month */
^	move.w	-290(a6),d0
	lsr.w	#5,d0
	and.w	#15,d0
	move.w	d0,-(sp)
	pea	.107+38
	jsr	_printf
;            printf("-%02d",(statobj.fdate & 0x1f));      /* Day */
^	move.w	-290(a6),d0
	and.w	#31,d0
	move.w	d0,-(sp)
	pea	.107+44
	jsr	_printf
;            year = 80 +(statobj.fdate >> 9) & 0xff;
^	move.w	-290(a6),d0
	move.l	#9,d1
	lsr.w	d1,d0
	add.w	#80,d0
	move.w	d0,d2
	and.w	#255,d2
;            if (year >= 100)
^;            	year -= 100;
	cmp.w	#100,d2
	lea	36(sp),sp
	blt	.10144
^	sub.w	#100,d2
;            printf("-%02d", year); /* Year */
.10144
^	move.w	d2,-(sp)
	pea	.107+50
	jsr	_printf
;            printf(" %02d",(statobj.ftime >> 11) & 0x1f);    /* Hour */
^	move.w	-292(a6),d0
	move.l	#11,d1
	lsr.w	d1,d0
	and.w	#31,d0
	move.w	d0,-(sp)
	pea	.107+56
	jsr	_printf
;            printf(":%02d",(statobj.ftime >> 5) & 0x3f);    /* Minute */
^	move.w	-292(a6),d0
	lsr.w	#5,d0
	and.w	#63,d0
	move.w	d0,-(sp)
	pea	.107+62
	jsr	_printf
;#if (VFAT)
;            printf(" - %s\n", statobj.lfname);
^^	pea	-565(a6)
	pea	.107+68
	jsr	_printf
;#else
;            printf("  \n");
;#endif
;             /* Get the next   */
;             if (!pc_gnext(&statobj))
^^^^^;                 break;
	pea	-578(a6)
	jsr	_pc_gnext
	tst.w	d0
	lea	30(sp),sp
	beq	.10139
;        }
^^	bra	.10138
.10139
;        /* Call gdone to free up internal resources used by statobj   */
;        pc_gdone(&statobj);
^^	pea	-578(a6)
	jsr	_pc_gdone
;    }
^;
;	//  And print the bytes remaining */
;//	printf ("pc_free\n");	
;	blocks_total = blocks_free = -1;
	add.w	#4,sp
.10137
^^^^	move.l	#-1,-582(a6)
	move.l	#-1,-586(a6)
;	nfree = pc_free (&path[0], &blocks_total, &blocks_free);
^	pea	-582(a6)
	pea	-586(a6)
	move.l	a4,-(sp)
	jsr	_pc_free
	move.l	d0,d7
;	if (blocks_total != -1)  {
^	cmp.l	#-1,-586(a6)
	lea	12(sp),sp
	beq	.10145
;		ASSERT (blocks_total > 0);
^;		//  Nfree is wrong for large drives because a long isn't enough to hold the number
;		//  of bytes.  Report in k instead
;		kbytes = (blocks_free /2);
^^^	move.l	-582(a6),d4
	lsr.l	#1,d4
;		Mbytes = kbytes / 1024;
^	move.l	d4,d5
	move.l	#10,d0
	lsr.l	d0,d5
;		kbytes = (kbytes % 1024L);
^	and.l	#1023,d4
;		fraction = (1000*kbytes)/1024L;
^	move.l	d4,d0
	move.l	#1000,d1
	jsr	.mulu#
	move.l	d0,d6
	move.l	#10,d0
	lsr.l	d0,d6
;		printf ("       %-6d File(s)   %lu.%03lu MBytes free\n", fcount, Mbytes, fraction);
^	move.l	d6,-(sp)
	move.l	d5,-(sp)
	move.w	d3,-(sp)
	pea	.107+75
	jsr	_printf
;	}  else
^	lea	14(sp),sp
	bra	.10146
.10145
;		printf ("The disk did not respond\n");	
^	pea	.107+120
	jsr	_printf
	add.w	#4,sp
.10146
;
;    return(fcount);
^^	move.w	d3,d0
.110
	movem.l	(sp)+,d2/d3/d4/d5/d6/d7/a3/a4
	unlk	a6
	rts
;}
^.108
.109	equ	-586
.107
	dc.b	60,86,79,76,62,0,60,68,73,82,62,0,32,32,32
	dc.b	32,32,0,37,45,56,115,46,37,45,51,115,0,32,37
	dc.b	55,108,100,32,37,53,115,0,32,37,48,50,100,0,45
	dc.b	37,48,50,100,0,45,37,48,50,100,0,32,37,48,50
	dc.b	100,0,58,37,48,50,100,0,32,45,32,37,115,10,0
	dc.b	32,32,32,32,32,32,32,37,45,54,100,32,70,105,108
	dc.b	101,40,115,41,32,32,32,37,108,117,46,37,48,51,108
	dc.b	117,32,77,66,121,116,101,115,32,102,114,101,101,10,0
	dc.b	84,104,101,32,100,105,115,107,32,100,105,100,32,110,111
	dc.b	116,32,114,101,115,112,111,110,100,10,0
	ds	0
;
;
;
;
;
;int cmd_disk_print (char* args)  {
# 1300
| .112
	xdef	_cmd_disk_print
_cmd_disk_print:
	link	a6,#.113
	movem.l	d2/d3/d4/a3/a4,-(sp)
	move.l	8(a6),a4
;	char filename[EMAXPATH];
;	char* cp;
;	PCFD fd;
;	int n, nread, word_length;
;	char buffer[512];
;	
;	if ((args == NULL) || (*args == '\0'))  {
~ filename -260 "[260c"
~ cp a3 "#c"
~ fd d3 "i"
~ n d2 "i"
~ nread d4 "i"
~ buffer -772 "[512c"
~~ args a4 "#c"
^^^^^^^	move.l	a4,d0
	beq	.114
	tst.b	(a4)
	bne	.10147
.114
;		printf ("Need the name of the file to print.\n");
^	pea	.111+0
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	add.w	#4,sp
.115
	movem.l	(sp)+,d2/d3/d4/a3/a4
	unlk	a6
	rts
;	}
^;	
;	//  if user provides a full path, including the partition, use it
;	if ((args[0] != '\0') && (args[1] == ':'))
.10147
^^^;		strcpy (filename, args);
	tst.b	(a4)
	beq	.10148
	cmp.b	#58,1(a4)
	bne	.10148
^	lea	-260(a6),a0
	move.l	a4,a1
.116	move.b	(a1)+,(a0)+
	bne.s	.116
;	else  {
	bra	.10149
.10148
^;		//  If the user hasn't provided a full path, then we will use
;		//  at least some part of the current working directory.
;		//  If user has provided no path, use default
;		strcpy (filename, wd);
^^^^	lea	-260(a6),a0
	lea	_wd,a1
.117	move.b	(a1)+,(a0)+
	bne.s	.117
;		if (args[0] == '\\')
^;			//  if user provides part of a path, but no partition, use current
;			//  partition and the users path
;			strcpy (&filename[2], args);
	cmp.b	#92,(a4)
	bne	.10150
^^^	lea	-258(a6),a0
	move.l	a4,a1
.118	move.b	(a1)+,(a0)+
	bne.s	.118
;		else  {
	bra	.10151
.10150
^;			//  This takes care of the case where the user has provided a partial
;			//  path.  It also must take care of the case where the user has
;			//  provided no argument at all.  This code relies on the fact that
;			//  the argument passed to this subroutine has had all white space
;			//  eliminated before the argument was passed.
;			strcat (filename, args);	
^^^^^^	move.l	a4,-(sp)
	pea	-260(a6)
	jsr	_strcat
;		}
^	add.w	#8,sp
.10151
;	}		
^.10149
;//	printf ("Printing file %s:\n", filename);	
;
;	disk_power_on (filename);
^^^	pea	-260(a6)
	jsr	_disk_power_on
;
;	//  open the file
;	fd = po_open (filename, (unsigned int)(PO_BINARY|PO_RDONLY), PS_IREAD);
^^^	move.w	#128,-(sp)
	move.w	#32768,-(sp)
	pea	-260(a6)
	jsr	_po_open
	move.w	d0,d3
;	if (fd < 0)  {
^	tst.w	d3
	lea	12(sp),sp
	bge	.10152
;		printf ("Cannot open '%s': %s\n\n", filename, get_errno_string (-1));
^	move.w	#-1,-(sp)
	jsr	_get_errno_string
	add.w	#2,sp
	move.l	d0,-(sp)
	pea	-260(a6)
	pea	.111+37
	jsr	_printf
;	    // Release all resources used by the disk the disk
; 		disk_power_off (filename);
^^	pea	-260(a6)
	jsr	_disk_power_off
;		return -1;
^	move.l	#-1,d0
	lea	16(sp),sp
	bra	.115
;	}
^;	
;	//  Files are assumed to be either science data files, ending with ".SCI" or
;	//	engineering data files, ending with "ENG", or they are treated as normal
;	//  text files.  The individual loggers are called to print their own
;	//  files rather than having the command program make an assumption regarding
;	//  the format.
;	cp = filename;
.10152
^^^^^^^	lea	-260(a6),a0
	move.l	a0,a3
;	while ((*cp != '.') && (*cp != '\0'))
^.10153
	cmp.b	#46,(a3)
	beq	.10154
	tst.b	(a3)
	beq	.10154
;		cp++;
^	add.l	#1,a3
	bra	.10153
.10154
;	if ((*cp != '\0') && (strcmp (cp+1, "SCI") == 0))  {
^	tst.b	(a3)
	beq	.10155
	lea	1(a3),a0
	lea	.111+60,a1
.119	move.b	(a0)+,d0
	cmp.b	(a1)+,d0
	bne.s	.120
	tst.b	d0
	bne.s	.119
.120	sub.b	-(a1),d0
	ext.w	d0
	bne	.10155
;		sci_logger_print_file (fd);
^	move.w	d3,-(sp)
	jsr	_sci_logger_print_file
;	}  else  {
^	add.w	#2,sp
	bra	.10156
.10155
;		if ((*cp != '\0') && (strcmp (cp+1, "ENG") == 0))  {
^	tst.b	(a3)
	beq	.10157
	lea	1(a3),a0
	lea	.111+64,a1
.121	move.b	(a0)+,d0
	cmp.b	(a1)+,d0
	bne.s	.122
	tst.b	d0
	bne.s	.121
.122	sub.b	-(a1),d0
	ext.w	d0
	bne	.10157
;			eng_logger_print_file (fd);
^	move.w	d3,-(sp)
	jsr	_eng_logger_print_file
;		}  else  {
^	add.w	#2,sp
	bra	.10158
.10157
;			//  normal text file
;			printf ("Printing text file '%s':\n", filename);
^^	pea	-260(a6)
	pea	.111+68
	jsr	_printf
;			while ((nread = po_read(fd,(byte*)buffer, sizeof(buffer))) > 0)  {
^	add.w	#8,sp
.10159
	move.w	#512,-(sp)
	pea	-772(a6)
	move.w	d3,-(sp)
	jsr	_po_read
	move.w	d0,d4
	add.w	#8,sp
	ble	.10160
;				for (n = 0;  n < nread;  n++)
^	move.l	#0,d2
	bra	.10164
.10163
;					putchar (buffer[n]);
^	move.l	__iob+22,a0
	cmp.l	__iob+26,a0
	bcc	.123
	lea	-772(a6),a0
	move.l	__iob+22,a1
	add.l	#1,__iob+22
	move.b	(a0,d2.w),(a1)
	move.l	#0,d0
	move.b	(a0,d2.w),d0
	bra	.124
.123
	lea	-772(a6),a0
	move.l	#0,d0
	move.b	(a0,d2.w),d0
	move.w	d0,-(sp)
	pea	__iob+22
	jsr	__flsbuf
	add.w	#6,sp
.124
.10161
	add.w	#1,d2
.10164
	cmp.w	d4,d2
	blt	.10163
.10162
;				if (SerByteAvail ())  {
^	jsr	_SerByteAvail
	tst.w	d0
	beq	.10165
;					printf ("\n\nPrint command interrupted.\n");	
^	pea	.111+94
	jsr	_printf
;					break;
^	add.w	#4,sp
	bra	.10160
;				}	
^;			}
.10165
^	bra	.10159
.10160
;			printf ("\n");
^	pea	.111+124
	jsr	_printf
;			if (nread < 0)  {
^	tst.w	d4
	add.w	#4,sp
	bge	.10166
;				printf ("cmd_disk_print: Error while reading file (%s)\n", get_errno_string (-1));
^	move.w	#-1,-(sp)
	jsr	_get_errno_string
	add.w	#2,sp
	move.l	d0,-(sp)
	pea	.111+126
	jsr	_printf
;				printf ("Aborting file print.\n");
^	pea	.111+173
	jsr	_printf
;			}	
^;		}	
	lea	12(sp),sp
.10166
^.10158
;	}	
^.10156
;	
;	//  close out file descriptor
;	po_close(fd);
^^^	move.w	d3,-(sp)
	jsr	_po_close
;
;    // Release all resources used by the disk the disk
; 	disk_power_off (filename);
^^^	pea	-260(a6)
	jsr	_disk_power_off
; 	return 0;
^	move.l	#0,d0
	add.w	#6,sp
	bra	.115
;}
^.112
.113	equ	-772
.111
	dc.b	78,101,101,100,32,116,104,101,32,110,97,109,101,32,111
	dc.b	102,32,116,104,101,32,102,105,108,101,32,116,111,32,112
	dc.b	114,105,110,116,46,10,0,67,97,110,110,111,116,32,111
	dc.b	112,101,110,32,39,37,115,39,58,32,37,115,10,10,0
	dc.b	83,67,73,0,69,78,71,0,80,114,105,110,116,105,110
	dc.b	103,32,116,101,120,116,32,102,105,108,101,32,39,37,115
	dc.b	39,58,10,0,10,10,80,114,105,110,116,32,99,111,109
	dc.b	109,97,110,100,32,105,110,116,101,114,114,117,112,116,101
	dc.b	100,46,10,0,10,0,99,109,100,95,100,105,115,107,95
	dc.b	112,114,105,110,116,58,32,69,114,114,111,114,32,119,104
	dc.b	105,108,101,32,114,101,97,100,105,110,103,32,102,105,108
	dc.b	101,32,40,37,115,41,10,0,65,98,111,114,116,105,110
	dc.b	103,32,102,105,108,101,32,112,114,105,110,116,46,10,0
	ds	0
;
;
;
;
;
;//  cmd_show_setup_data ()
;//
;//  Prints the current setup data
;//
;int cmd_show_setup_data (char* args)  {
# 1394
| .126
	xdef	_cmd_show_setup_data
_cmd_show_setup_data:
;	eeprom_print_setup_data ();
~~ args 8 "#c"
^	jsr	_eeprom_print_setup_data
;	return 0;
^	move.l	#0,d0
.127
	rts
;}
^.126
;	
;
;
;
;//  cmd_suspend_logger ()
;//
;//  Shuts down the logger function for the specified length of
;//  time, if the length is valid.  This routine seems a little
;//  odd in that it accesses routines in the file main.c, which
;//  is nominally a level above this, not below
;//
;int cmd_suspend_logger (char* args)  {
# 1409
| .128
	xdef	_cmd_suspend_logger
_cmd_suspend_logger:
	movem.l	d2/a3,-(sp)
	move.l	12(sp),a3
;	long length;
;
;	if (args[0] == '\0')  {
~ length d2 "l"
~~ args a3 "#c"
^^^	tst.b	(a3)
	bne	.10167
;		printf ("You must specify how long to suspend for.\n");
^	pea	.125+0
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	add.w	#4,sp
.129
	movem.l	(sp)+,d2/a3
	rts
;	}
^;
;	length = atol (args);
.10167
^^	move.l	a3,-(sp)
	jsr	_atol
	move.l	d0,d2
;	if (length <= 0)  {
^	tst.l	d2
	add.w	#4,sp
	bgt	.10168
;		printf ("Suspension times must be greater than zero.\n");
^	pea	.125+43
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	add.w	#4,sp
	bra	.129
;	}	
^;	
;	if (logger_suspend (length) < 0)  {
.10168
^^	move.l	d2,-(sp)
	jsr	_logger_suspend
	tst.w	d0
	add.w	#4,sp
	bge	.10169
;		printf ("Suspend logger command NOT executed.\n");
^	pea	.125+88
	jsr	_printf
;		printf ("The logger can be suspended for at most %ld seconds\n",
^;															MAX_SUSPENSION_TIME);
	pea	43200
	pea	.125+126
	jsr	_printf
;		return 0;
^^	move.l	#0,d0
	lea	12(sp),sp
	bra	.129
;	}
^;
;	printf ("The logger has been suspended for %ld seconds.\n", length);
.10169
^^	move.l	d2,-(sp)
	pea	.125+179
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	add.w	#8,sp
	bra	.129
;}
^.128
.125
	dc.b	89,111,117,32,109,117,115,116,32,115,112,101,99,105,102
	dc.b	121,32,104,111,119,32,108,111,110,103,32,116,111,32,115
	dc.b	117,115,112,101,110,100,32,102,111,114,46,10,0,83,117
	dc.b	115,112,101,110,115,105,111,110,32,116,105,109,101,115,32
	dc.b	109,117,115,116,32,98,101,32,103,114,101,97,116,101,114
	dc.b	32,116,104,97,110,32,122,101,114,111,46,10,0,83,117
	dc.b	115,112,101,110,100,32,108,111,103,103,101,114,32,99,111
	dc.b	109,109,97,110,100,32,78,79,84,32,101,120,101,99,117
	dc.b	116,101,100,46,10,0,84,104,101,32,108,111,103,103,101
	dc.b	114,32,99,97,110,32,98,101,32,115,117,115,112,101,110
	dc.b	100,101,100,32,102,111,114,32,97,116,32,109,111,115,116
	dc.b	32,37,108,100,32,115,101,99,111,110,100,115,10,0,84
	dc.b	104,101,32,108,111,103,103,101,114,32,104,97,115,32,98
	dc.b	101,101,110,32,115,117,115,112,101,110,100,101,100,32,102
	dc.b	111,114,32,37,108,100,32,115,101,99,111,110,100,115,46
	dc.b	10,0
	ds	0
;
;
;
;
;//  cmd_start_logger ()
;//
;//	Restarts the logger
;//  Equivalent to suspend_logger (0)
;//
;int cmd_start_logger (char* args)  {
# 1442
| .131
	xdef	_cmd_start_logger
_cmd_start_logger:
;	if (logger_start () < 0)  {
~~ args 8 "#c"
^	jsr	_logger_start
	tst.w	d0
	bge	.10170
;		log_printf ("Could not start the logger.\n");
^	pea	.130+0
	jsr	_log_printf
;		return -1;
^	move.l	#-1,d0
	add.w	#4,sp
.132
	rts
;	}
^;	
;	printf ("The data logger is now processing data.\n");
.10170
^^	pea	.130+29
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	add.w	#4,sp
	bra	.132
;}
^.131
.130
	dc.b	67,111,117,108,100,32,110,111,116,32,115,116,97,114,116
	dc.b	32,116,104,101,32,108,111,103,103,101,114,46,10,0,84
	dc.b	104,101,32,100,97,116,97,32,108,111,103,103,101,114,32
	dc.b	105,115,32,110,111,119,32,112,114,111,99,101,115,115,105
	dc.b	110,103,32,100,97,116,97,46,10,0
	ds	0
;
;
;
;int cmd_save_setup (char* args)  {
# 1454
| .134
	xdef	_cmd_save_setup
_cmd_save_setup:
;	setup_data.tick_offset = logger_time_get_tick_offset ();
~~ args 8 "#c"
^	jsr	_logger_time_get_tick_offset
	move.l	d0,_setup_data+78
;	if (eeprom_write_setup_data (0) != 0)  {
^	clr.w	-(sp)
	jsr	_eeprom_write_setup_data
	tst.w	d0
	add.w	#2,sp
	beq	.10171
;		printf ("Error: write of setup data failed.\n");
^	pea	.133+0
	jsr	_printf
;		return -1;
^	move.l	#-1,d0
	add.w	#4,sp
.135
	rts
;	}  else
^.10171
;		printf ("Setup data saved to EEPROM.\n");
^	pea	.133+36
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	add.w	#4,sp
	bra	.135
;}	
^.134
.133
	dc.b	69,114,114,111,114,58,32,119,114,105,116,101,32,111,102
	dc.b	32,115,101,116,117,112,32,100,97,116,97,32,102,97,105
	dc.b	108,101,100,46,10,0,83,101,116,117,112,32,100,97,116
	dc.b	97,32,115,97,118,101,100,32,116,111,32,69,69,80,82
	dc.b	79,77,46,10,0
	ds	0
;
;
;
;int cmd_sensor_power (char* args)  {
# 1466
| .137
	xdef	_cmd_sensor_power
_cmd_sensor_power:
	movem.l	a3,-(sp)
	move.l	8(sp),a3
;	ASSERT (args != NULL);
~~ args a3 "#c"
^;	
;	if (strcmp (args, "ON") == 0)  {
^^	move.l	a3,a0
	lea	.136,a1
.138	move.b	(a0)+,d0
	cmp.b	(a1)+,d0
	bne.s	.139
	tst.b	d0
	bne.s	.138
.139	sub.b	-(a1),d0
	ext.w	d0
	bne	.10172
;		SensorPowerON ();
^	jsr	_SensorPowerON
;		printf ("The sensor power is now on.\n");
^	pea	.136+3
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	add.w	#4,sp
.140
	movem.l	(sp)+,a3
	rts
;	}
^;
;	if (strcmp (args, "OFF") == 0)  {
.10172
^^	move.l	a3,a0
	lea	.136+32,a1
.141	move.b	(a0)+,d0
	cmp.b	(a1)+,d0
	bne.s	.142
	tst.b	d0
	bne.s	.141
.142	sub.b	-(a1),d0
	ext.w	d0
	bne	.10173
;		SensorPowerOFF();
^	jsr	_SensorPowerOFF
;		printf ("The sensor power is now off.\n");
^	pea	.136+36
	jsr	_printf
;		printf ("You MUST turn it back on manually before final deployment.\n");
^	pea	.136+66
	jsr	_printf
;		printf ("The software will NOT do this automatically!\n");
^	pea	.136+126
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	lea	12(sp),sp
	bra	.140
;	}
^;	
;	printf ("Must specify whether power is to be turned ON or OFF.\n\n");
.10173
^^	pea	.136+172
	jsr	_printf
;	return -1;
^	move.l	#-1,d0
	add.w	#4,sp
	bra	.140
;}
^.137
.136
	dc.b	79,78,0,84,104,101,32,115,101,110,115,111,114,32,112
	dc.b	111,119,101,114,32,105,115,32,110,111,119,32,111,110,46
	dc.b	10,0,79,70,70,0,84,104,101,32,115,101,110,115,111
	dc.b	114,32,112,111,119,101,114,32,105,115,32,110,111,119,32
	dc.b	111,102,102,46,10,0,89,111,117,32,77,85,83,84,32
	dc.b	116,117,114,110,32,105,116,32,98,97,99,107,32,111,110
	dc.b	32,109,97,110,117,97,108,108,121,32,98,101,102,111,114
	dc.b	101,32,102,105,110,97,108,32,100,101,112,108,111,121,109
	dc.b	101,110,116,46,10,0,84,104,101,32,115,111,102,116,119
	dc.b	97,114,101,32,119,105,108,108,32,78,79,84,32,100,111
	dc.b	32,116,104,105,115,32,97,117,116,111,109,97,116,105,99
	dc.b	97,108,108,121,33,10,0,77,117,115,116,32,115,112,101
	dc.b	99,105,102,121,32,119,104,101,116,104,101,114,32,112,111
	dc.b	119,101,114,32,105,115,32,116,111,32,98,101,32,116,117
	dc.b	114,110,101,100,32,79,78,32,111,114,32,79,70,70,46
	dc.b	10,10,0
	ds	0
;
;
;
;int cmd_print_version (char* args)  {
# 1489
| .144
	xdef	_cmd_print_version
_cmd_print_version:
;    extern const float SOFTWARE_VERSION;
;    
;    printf ("This is software version %.3f\n", SOFTWARE_VERSION);
~~ args 8 "#c"
^^^	move.l	_SOFTWARE_VERSION,d0
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.143+0
	jsr	_printf
; 	printf("Compiled on %s at %s\n", __DATE__, __TIME__);
^	pea	.143+65
	pea	.143+53
	pea	.143+31
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	24(sp),sp
.145
	rts
;}	    
^.144
.143
	dc.b	84,104,105,115,32,105,115,32,115,111,102,116,119,97,114
	dc.b	101,32,118,101,114,115,105,111,110,32,37,46,51,102,10
	dc.b	0,67,111,109,112,105,108,101,100,32,111,110,32,37,115
	dc.b	32,97,116,32,37,115,10,0,77,97,114,32,50,54,32
	dc.b	50,48,48,48,0,49,55,58,49,53,58,51,54,0
	ds	0
;
;
;
;
;int cmd_set_clock (char* args)  {
# 1500
| .147
	xdef	_cmd_set_clock
_cmd_set_clock:
	movem.l	d2/d3/d4,-(sp)
;	long freq;
;	long baud;
;	
;	printf ("Current frequency is %ld\n", SimGetFSys ());
~ freq d4 "l"
~~ args 8 "#c"
^^^^	jsr	_SimGetFSys
	move.l	d0,-(sp)
	pea	.146+0
	jsr	_printf
;
;	freq = atol (args);
^^	move.l	24(sp),-(sp)
	jsr	_atol
	move.l	d0,d4
;	if ((freq > 16e6) ||
^;		(freq < 1e6 )   )  {
	move.l	d4,d0
	jsr	.Pflt#
	move.l	#$00000000,d3
	move.l	#$416e8480,d2
	jsr	.Pcmp#
	lea	12(sp),sp
	bgt	.148
	move.l	d4,d0
	jsr	.Pflt#
	move.l	#$00000000,d3
	move.l	#$412e8480,d2
	jsr	.Pcmp#
	bge	.10174
.148
^;		printf ("Unacceptable frequency %ld\n", freq);
^	move.l	d4,-(sp)
	pea	.146+26
	jsr	_printf
;		printf ("Limits are 1 and 16 MHz\n");
^	pea	.146+54
	jsr	_printf
;		return 0;
^	move.l	#0,d0
	lea	12(sp),sp
.149
	movem.l	(sp)+,d2/d3/d4
	rts
;	}
^;	logger_set_clock_rate (freq);
.10174
^	move.l	d4,-(sp)
	jsr	_logger_set_clock_rate
;	printf ("New frequency is %.3f MHz\n", SimGetFSys()/1e6);
^	jsr	_SimGetFSys
	jsr	.Pflt#
	move.l	#$00000000,d3
	move.l	#$412e8480,d2
	jsr	.Pdiv#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.146+79
	jsr	_printf
;	printf ("Baud rate is %ld\n", (long)SerGetBaud (0, 0));
^	clr.l	-(sp)
	clr.l	-(sp)
	jsr	_SerGetBaud
	add.w	#8,sp
	move.l	d0,-(sp)
	pea	.146+106
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	lea	24(sp),sp
	bra	.149
;}	
^.147
.146
	dc.b	67,117,114,114,101,110,116,32,102,114,101,113,117,101,110
	dc.b	99,121,32,105,115,32,37,108,100,10,0,85,110,97,99
	dc.b	99,101,112,116,97,98,108,101,32,102,114,101,113,117,101
	dc.b	110,99,121,32,37,108,100,10,0,76,105,109,105,116,115
	dc.b	32,97,114,101,32,49,32,97,110,100,32,49,54,32,77
	dc.b	72,122,10,0,78,101,119,32,102,114,101,113,117,101,110
	dc.b	99,121,32,105,115,32,37,46,51,102,32,77,72,122,10
	dc.b	0,66,97,117,100,32,114,97,116,101,32,105,115,32,37
	dc.b	108,100,10,0
	ds	0
;
;
;
;	
;	
;int cmd_test (char* args)  {
# 1523
| .151
	xdef	_cmd_test
_cmd_test:
	movem.l	d2/d3,-(sp)
;    int a, b, c;
;    long test, baud;
;
;	pc_file_system_reset ();
~~ args 8 "#c"
^^^^	jsr	_pc_file_system_reset
;	printf ("%ld memory available\n", mem_find_max_malloc());
^	jsr	_mem_find_max_malloc
	move.l	d0,-(sp)
	pea	.150+0
	jsr	_printf
;	return 0;
^	move.l	#0,d0
	add.w	#8,sp
.152
	movem.l	(sp)+,d2/d3
	rts
;	
;	
;	sci_logger_setup_partition ();
^^^	jsr	_sci_logger_setup_partition
;	return 0;
^	move.l	#0,d0
	bra	.152
;
;	printf ("There are %ld points waiting.\n", AD7716_get_n_waiting ());
^^	jsr	_AD7716_get_n_waiting
	move.l	d0,-(sp)
	pea	.150+22
	jsr	_printf
;	printf ("Elapsed time = %.3f\n", (float)((float)StopWatchTime()/1.0e6));
^	jsr	_StopWatchTime
	jsr	.Fflu#
	jsr	.ftod#
	move.l	#$00000000,d3
	move.l	#$412e8480,d2
	jsr	.Pdiv#
	jsr	.dtof#
	jsr	.ftod#
	move.l	d1,-(sp)
	move.l	d0,-(sp)
	pea	.150+53
	jsr	_printf
;	StopWatchStart ();
^	jsr	_StopWatchStart
;	AD7716_icount_print ();
^	jsr	_AD7716_icount_print
;//	printf ("cmd_test: entering low power sleep mode\n");
;//	low_power_start_sleep ();
;    return 0;
^^^	move.l	#0,d0
	lea	20(sp),sp
	bra	.152
;    
;//	printf ("Hit any key to quit reading time.\n");
;//  while (SerByteAvail () == 0)  {
;//    	cmd_sync_print_time (NULL);
;//	}
;    return 0;
^^^^^^	move.l	#0,d0
	bra	.152
;}	
^.151
.150
	dc.b	37,108,100,32,109,101,109,111,114,121,32,97,118,97,105
	dc.b	108,97,98,108,101,10,0,84,104,101,114,101,32,97,114
	dc.b	101,32,37,108,100,32,112,111,105,110,116,115,32,119,97
	dc.b	105,116,105,110,103,46,10,0,69,108,97,112,115,101,100
	dc.b	32,116,105,109,101,32,61,32,37,46,51,102,10,0
	ds	0
;		
;
# 1549
|
~ _pc_seedir * "(i"
~ _SOFTWARE_VERSION * "f"
~ _cmd_error_msgs * "[10#c"
~ _n_commands * "i"
~ 'commands'
~ 4 4 86
~ name 0 "[32c"
~ code 32 "i"
~ func 34 "#(i"
~ help 38 "[48c"
~ _cmd_ref * "[33:" 4
~ _wd * "[260c"
~ _MIN_TIME_SET_FREQ * "l"
~ _AD7716_icount_print * "(v"
~ _AD7716_get_n_waiting * "(l"
~ _SensorPowerOFF * "(v"
~ _SensorPowerON * "(v"
~ _get_errno_string * "(#c"
~ _mem_find_max_malloc * "(l"
~ _log_printf * "(i"
~ 'text_log'
~ 5 5 1068
~ filename 0 "[32c"
~ data 32 "[1024c"
~ n_data 1056 "i"
~ n_filled 1058 "i"
~ oldest_data 1060 ":" 2
~ _logger_set_clock_rate * "(v"
~ _logger_get_seconds_to_start * "(l"
~ _logger_suspend * "(i"
~ _logger_start * "(i"
~ _logger_disk_show_status * "(v"
~ 'system_user'
~ 6 4 46
~ task_handle 0 "i"
~ rtfs_errno 2 "i"
~ dfltdrv 4 "i"
~ lcwd 6 "[10#v"
~ PSYSTEM_USER "#:" 6
~ SYSTEM_USER ":" 6
~ _pc_file_system_reset * "(v"
~ 'finode'
~ 'ddrive'
~ 'fatswap'
~ 9 7 300
~ n_to_swap 0 "I"
~ n_blocks_used 2 "I"
~ n_blocks_total 4 "I"
~ pdirty 6 "[32C"
~ block_0_is_valid 38 "i"
~ data_map 40 "[256C"
~ data_array 296 "#C"
~ 8 37 484
~ opencount 0 "i"
~ volume_serialno 2 "L"
~ volume_label 6 "[14C"
~ drv_serial_number 20 "[62C"
~ partition_base 82 "L"
~ partition_size 86 "L"
~ partition_type 90 "C"
~ current_power_count 92 "L"
~ bytespcluster 96 "I"
~ byte_into_cl_mask 98 "L"
~ fasize 102 "I"
~ rootblock 104 "L"
~ firstclblock 108 "L"
~ driveno 112 "I"
~ maxfindex 114 "L"
~ fatblock 118 "L"
~ secproot 122 "I"
~ fat_is_dirty 124 "i"
~ fat_swap_structure 126 ":" 9
~ bootaddr 426 "L"
~ oemname 430 "[9c"
~ bytspsector 440 "I"
~ secpalloc 442 "C"
~ log2_secpalloc 444 "I"
~ secreserved 446 "I"
~ numfats 448 "C"
~ numroot 450 "I"
~ numsecs 452 "L"
~ mediadesc 456 "C"
~ secpfat 458 "L"
~ secptrk 462 "I"
~ numhead 464 "I"
~ numhide 466 "L"
~ free_contig_base 470 "L"
~ free_contig_pointer 474 "L"
~ known_free_clusters 478 "l"
~ infosec 482 "I"
~ 'segdesc'
~ 10 4 14
~ nsegs 0 "i"
~ segindex 2 "i"
~ ncksum 4 "C"
~ segblock 6 "[2L"
~ 7 18 72
~ fname 0 "[8C"
~ fext 8 "[3C"
~ fattribute 11 "C"
~ resarea 12 "[8C"
~ fclusterhi 20 "I"
~ ftime 22 "I"
~ fdate 24 "I"
~ fcluster 26 "I"
~ fsize 28 "L"
~ alloced_size 32 "L"
~ opencount 36 "i"
~ openflags 38 "i"
~ my_drive 40 "#:" 8
~ my_block 44 "L"
~ my_index 48 "i"
~ pnext 50 "#:" 7
~ pprev 54 "#:" 7
~ s 58 ":" 10
~ 'drobj'
~ 'dirblk'
~ 12 3 10
~ my_frstblock 0 "L"
~ my_block 4 "L"
~ my_index 8 "i"
~ 'blkbuff'
~ 13 7 532
~ pnext 0 "#:" 13
~ lru 4 "L"
~ pdrive 8 "#:" 8
~ blockno 12 "L"
~ use_count 16 "i"
~ pad_to_4_align 18 "i"
~ data 20 "[512C"
~ 11 5 24
~ pdrive 0 "#:" 8
~ finode 4 "#:" 7
~ blkinfo 8 ":" 12
~ isroot 18 "i"
~ pblkbuff 20 "#:" 13
~ 'datestr'
~ 14 2 4
~ date 0 "I"
~ time 2 "I"
~ 'pc_file'
~ 15 8 24
~ pobj 0 "#:" 11
~ flag 4 "I"
~ fptr 6 "L"
~ fptr_cluster 10 "L"
~ fptr_block 14 "L"
~ needs_flush 18 "i"
~ is_free 20 "i"
~ at_eof 22 "i"
~ 'block_alloc'
~ 16 1 512
~ core 0 "[512C"
~ 'ptable'
~ 'ptable_entry'
~ 18 8 16
~ boot 0 "C"
~ s_head 1 "C"
~ s_cyl 2 "I"
~ p_typ 4 "C"
~ e_head 5 "C"
~ e_cyl 6 "I"
~ r_sec 8 "L"
~ p_size 12 "L"
~ 17 2 66
~ ents 0 "[4:" 18
~ signature 64 "I"
~ PTABLE ":" 17
~ PTABLE_ENTRY ":" 18
~ 'format_dec_tree'
~ 19 3 8
~ sec_p_alloc 0 "I"
~ ents_p_root 2 "I"
~ n_blocks 4 "L"
~ FORMAT_DEC_TREE ":" 19
~ PC_FILE ":" 15
~ DROBJ ":" 11
~ BLKBUFF ":" 13
~ DIRBLK ":" 12
~ FINODE ":" 7
~ SEGDESC ":" 10
~ 'lfninode'
~ 20 8 32
~ lfnorder 0 "C"
~ lfname1 1 "[10C"
~ lfnattribute 11 "C"
~ lfnres 12 "C"
~ lfncksum 13 "C"
~ lfname2 14 "[12C"
~ lfncluster 26 "I"
~ lfname3 28 "[4C"
~ LFNINODE ":" 20
~ 'dosinode'
~ 21 9 32
~ fname 0 "[8C"
~ fext 8 "[3C"
~ fattribute 11 "C"
~ resarea 12 "[8C"
~ fclusterhi 20 "I"
~ ftime 22 "I"
~ fdate 24 "I"
~ fcluster 26 "I"
~ fsize 28 "L"
~ DOSINODE ":" 21
~ DDRIVE ":" 8
~ FATSWAP ":" 9
~ BLOCK_ALLOC ":" 16
~ CLUSTERTYPE "L"
~ 'ide_control'
~ 'ide_drive_desc'
~ ''
~ 'atapi_packet_desc'
~ 'transfer_length'
~ 26 2 2
~ msb 0 "C"
~ lsb 1 "C"
~ 25 8 14
~ op_code 0 "C"
~ lun 1 "C"
~ lba 2 "L"
~ reserved1 6 "C"
~ transfer_length 8 ":" 26
~ reserved2 10 "C"
~ reserved3 11 "C"
~ reserved4 12 "C"
~ 'atapi_mode_sense_packet_desc'
~ 27 11 14
~ op_code 0 "C"
~ lun 1 "C"
~ pc_code_page 2 "C"
~ reserved1 3 "C"
~ reserved2 4 "C"
~ reserved3 5 "C"
~ reserved4 6 "C"
~ transfer_length 8 ":" 26
~ reserved5 10 "C"
~ reserved6 11 "C"
~ reserved7 12 "C"
~ 'atapi_format_unit_packet_desc'
~ 28 5 12
~ op_code 0 "C"
~ defect_list_format 1 "C"
~ track_number 2 "C"
~ interleave 3 "[2C"
~ reserved 5 "[7C"
~ 'atapi_old_format_unit_packet_de'
~ 29 7 12
~ op_code 0 "C"
~ reserved1 1 "C"
~ medium 2 "C"
~ reserved2 3 "[3C"
~ control_byte 6 "C"
~ track_number 7 "C"
~ reserved3 8 "[4C"
~ 'atapi_start_stop_packet_desc'
~ 30 6 12
~ op_code 0 "C"
~ lun 1 "C"
~ reserved1 2 "C"
~ reserved2 3 "C"
~ eject 4 "C"
~ reserved 5 "[7C"
~ 24 5 14
~ generic 0 ":" 25
~ mode_sense 0 ":" 27
~ format 0 ":" 28
~ old_format 0 ":" 29
~ start_stop 0 ":" 30
~ 23 17 48
~ num_heads 0 "C"
~ sec_p_track 1 "C"
~ sec_p_cyl 2 "I"
~ num_cylinders 4 "I"
~ max_multiple 6 "C"
~ supports_lba 8 "i"
~ total_lba 10 "L"
~ enable_mapping 14 "i"
~ media_changed 16 "i"
~ volume_start 18 "L"
~ volume_end 22 "L"
~ protocol 26 "C"
~ atapi_packet 28 ":" 24
~ atapi_packet_size 42 "I"
~ media_descriptor 44 "C"
~ medium_type_code 45 "C"
~ allocation_unit 46 "C"
~ 22 29 138
~ opencount 0 "i"
~ register_file_address 2 "#I"
~ interrupt_number 6 "i"
~ controller_number 8 "i"
~ command_complete 10 "i"
~ error_code 12 "I"
~ timer 14 "I"
~ block_size 16 "C"
~ sectors_remaining 18 "I"
~ user_address 20 "#C"
~ drive 24 "[2:" 23
~ vo_write_precomp 120 "C"
~ vo_sector_count 121 "C"
~ vo_sector_number 122 "C"
~ vo_cyl_low 123 "C"
~ vo_cyl_high 124 "C"
~ vo_drive_head 125 "C"
~ vo_feature 126 "C"
~ vo_command 127 "C"
~ vo_dig_out 128 "C"
~ vi_error 129 "C"
~ vi_sector_count 130 "C"
~ vi_sector_number 131 "C"
~ vi_cyl_low 132 "C"
~ vi_cyl_high 133 "C"
~ vi_drive_head 134 "C"
~ vi_status 135 "C"
~ vi_alt_status 136 "C"
~ vi_drive_addr 137 "C"
~ PIDE_CONTROLLER "#:" 22
~ IDE_CONTROLLER ":" 22
~ IDE_DRIVE_DESC ":" 23
~ ATAPI_PACKET ":" 24
~ ATAPI_PACKET_DESC ":" 25
~ ATAPI_OLD_FORMAT_UNIT_PACKET_DE ":" 29
~ ATAPI_START_STOP_UNIT_PACKET_DE ":" 30
~ ATAPI_FORMAT_UNIT_PACKET_DESC ":" 28
~ ATAPI_MODE_SENSE_PACKET_DESC ":" 27
~ 'Himawari_format_descriptor'
~ 'Himawari_defect_list_header'
~ 32 4 4
~ reserved 0 "C"
~ control_byte 1 "C"
~ length_msb 2 "C"
~ length_lsb 3 "C"
~ 'Himawari_formattable_capacity_d'
~ 33 3 8
~ number_of_blocks 0 "[4C"
~ reserved 4 "C"
~ block_length 5 "[3C"
~ 31 2 12
~ dlheader 0 ":" 32
~ capacity_descriptor 4 ":" 33
~ HIMAWARI_FORMAT_DESCRIPTOR ":" 31
~ HIMAWARI_FORMATTABLE_CAPACITY_D ":" 33
~ HIMAWARI_DEFECT_LIST_HEADER ":" 32
~ 'himawari_flexible_disk_page'
~ 34 17 32
~ page_code 0 "C"
~ page_length 1 "C"
~ transfer_rate_msb 2 "C"
~ transfer_rate_lsb 3 "C"
~ number_of_heads 4 "C"
~ sectors_per_track 5 "C"
~ bytes_per_cylinder_msb 6 "C"
~ bytes_per_cylinder_lsb 7 "C"
~ number_of_cylinders_msb 8 "C"
~ number_of_cylinders_lsb 9 "C"
~ reserved1 10 "[10C"
~ motor_off_delay 20 "C"
~ swp_swpp 21 "C"
~ reserved2 22 "[6C"
~ medium_rotation_rate_msb 28 "C"
~ medium_rotation_rate_lsb 29 "C"
~ reserved3 30 "[2C"
~ HIMAWARI_FLEXIBLE_DISK_PAGE ":" 34
~ TRANSFER_LENGTH ":" 26
~ BLOCKT "L"
~ _disk_power_off * "(v"
~ _disk_power_on * "(v"
~ _pc_gdone * "(v"
~ _pc_gnext * "(i"
~ _pc_gfirst * "(i"
~ _pc_free * "(l"
~ _po_close * "(i"
~ _po_read * "(i"
~ _po_open * "(i"
~ 'fmtparms'
~ 35 15 52
~ oemname 0 "[9c"
~ secpalloc 9 "C"
~ secreserved 10 "I"
~ numfats 12 "C"
~ secpfat 14 "L"
~ fmttype 18 "C"
~ numhide 20 "L"
~ numroot 24 "I"
~ mediadesc 26 "C"
~ secptrk 28 "I"
~ numhead 30 "I"
~ numcyl 32 "I"
~ physical_drive_no 34 "C"
~ binary_volume_label 36 "L"
~ text_volume_label 40 "[12c"
~ FMTPARMS ":" 35
~ 'freelistinfo'
~ 36 2 8
~ cluster 0 "L"
~ nclusters 4 "l"
~ FREELISTINFO ":" 36
~ 'fileseginfo'
~ 37 2 8
~ block 0 "l"
~ nblocks 4 "l"
~ FILESEGINFO ":" 37
~ 'stat'
~ 38 12 38
~ st_dev 0 "i"
~ st_ino 2 "i"
~ st_mode 4 "L"
~ st_nlink 8 "i"
~ st_rdev 10 "i"
~ st_size 12 "L"
~ st_atime 16 ":" 14
~ st_mtime 20 ":" 14
~ st_ctime 24 ":" 14
~ st_blksize 28 "l"
~ st_blocks 32 "l"
~ fattribute 36 "C"
~ STAT ":" 38
~ DSTAT ":" 3
~ DATESTR ":" 14
~ PCFD "i"
~ UNICODE "I"
~ IOADDRESS "#I"
~ PFCBYTE "#C"
~ PFCCHAR "#c"
~ PFVOID "#v"
~ PFCHAR "#c"
~ PFDWORD "#L"
~ PFLONG "#l"
~ PFWORD "#I"
~ PFINT "#i"
~ PFBYTE "#C"
~ BOOLEAN "i"
~ dword "L"
~ word "I"
~ byte "C"
~ PSPErr "c"
~ _PRAM "[8I"
~ _logger_time_get_tick_offset * "(l"
~ _logger_time_query_time * "(i"
~ _logger_time_get_string * "(#c"
~ _logger_time_sync_get_time * "(:" 2
~ _logger_time_sync_set_time * "(v"
~ _logger_time_set_time * "(v"
~ _logger_time_get_time * "(:" 2
~ EARLIEST_LOGGER_TIME _EARLIEST_LOGGER_TIME ":" 2
~ LATEST_LOGGER_TIME _LATEST_LOGGER_TIME ":" 2
~ _eeprom_print_setup_data * "(v"
~ _eeprom_write_setup_data * "(i"
~ 'setup_variables'
~ 39 13 82
~ eng_rate 0 "[4l"
~ science_rate 16 "f"
~ science_gain 20 "[4f"
~ science_chans 36 "i"
~ trigger_chans 38 "i"
~ t_STA 40 "f"
~ t_LTA 44 "f"
~ trigger_level 48 "[4f"
~ post_event_time 64 "f"
~ pre_event_time 68 "f"
~ min_disk_write 72 "l"
~ science_n_to_average 76 "i"
~ tick_offset 78 "l"
~ _setup_data * ":" 39
~ _eng_logger_print_file * "(i"
~ _eng_logger_read_channel * "(i"
~ _eng_logger_channel_setup * "(i"
~ _sci_logger_show_status * "(v"
~ _sci_logger_is_open * "(i"
~ _sci_logger_print_file * "(i"
~ _sci_logger_setup_partition * "(v"
~ _sci_logger_set_binary_preview * "(v"
~ _sci_logger_set_ASCII_preview * "(v"
~ _sci_logger_set_LTA_time * "(i"
~ _sci_logger_set_STA_time * "(i"
~ _sci_logger_set_post_event * "(i"
~ _sci_logger_set_pre_event * "(i"
~ _sci_logger_set_gain * "(i"
~ _sci_logger_set_trigger_level * "(v"
~ _sci_logger_activate_chans * "(i"
~ _sci_logger_get_conversion_rate * "(d"
~ _sci_logger_set_averaging * "(i"
~ _sci_logger_set_conversion_rate * "(d"
~ _sci_logger_start_data * "(v"
~ _cmd_disk_pwd * "(i"
~ _cmd_disk_cd * "(i"
~ _cmd_disk_print * "(i"
~ _cmd_disk_dir * "(i"
~ _cmd_sync_print_time_error * "(i"
~ _cmd_sync_print_time * "(i"
~ _cmd_print_time * "(i"
~ _cmd_sync_set_time * "(i"
~ _cmd_set_time * "(i"
~ _cmd_read_eng * "(i"
~ _cmd_set_eng_rate * "(i"
~ _cmd_set_science_averaging * "(i"
~ _cmd_read_binary_science * "(i"
~ _cmd_set_science_channels * "(i"
~ _cmd_read_science * "(i"
~ _cmd_set_post_event_time * "(i"
~ _cmd_set_pre_event_time * "(i"
~ _cmd_set_trigger_level * "(i"
~ _cmd_set_LTA_time * "(i"
~ _cmd_set_STA_time * "(i"
~ _cmd_set_science_rate * "(i"
~ _cmd_set_science_gain * "(i"
~ _cmd_set_clock * "(i"
~ _cmd_show_status * "(i"
~ _cmd_print_version * "(i"
~ _cmd_sensor_power * "(i"
~ _cmd_test * "(i"
~ _cmd_save_setup * "(i"
~ _cmd_start_logger * "(i"
~ _cmd_suspend_logger * "(i"
~ _cmd_show_setup_data * "(i"
~ _cmd_quit * "(i"
~ _cmd_help * "(i"
~ _command_parse * "(i"
~ __ctype * "[0c"
~ _strupr * "(#c"
~ _strncmp * "(i"
~ _strcat * "(#c"
~ ''
~ 40 2 8
~ quot 0 "l"
~ rem 4 "l"
~ _labs * "(l"
~ ''
~ 41 2 4
~ quot 0 "i"
~ rem 2 "i"
~ _atol * "(l"
~ _atoi * "(i"
~ _atof * "(d"
~ ldiv_t ":" 40
~ div_t ":" 41
~ '__stdio'
~ 42 8 22
~ _bp 0 "#C"
~ _bend 4 "#C"
~ _buff 8 "#C"
~ _flags 12 "I"
~ _unit 14 "c"
~ _bytbuf 15 "C"
~ _buflen 16 "L"
~ _tmpnum 20 "I"
~ __flsbuf * "(i"
~ _printf * "(i"
~ _fflush * "(i"
~ __iob * "[0:" 42
~ FILE ":" 42
~ fpos_t "l"
~ va_list "#c"
~ ''
~ 43 13 46
~ libVersion 0 "l"
~ ramBase 4 "#c"
~ ramSize 8 "l"
~ ramWaits 12 "i"
~ flashBase 14 "#c"
~ flashSize 18 "l"
~ flashWaits 22 "i"
~ heapBot 24 "#v"
~ heapTop 28 "#v"
~ heapCur 32 "#v"
~ statusReg 36 "I"
~ vectorBase 38 "#v"
~ stackPtr 42 "#v"
~ infoAction "c"
~ TT8info ":" 43
~ UeeErr "c"
~ _GetTickRate * "(l"
~ _ttmcmp * "(l"
~ _StopWatchTime * "(L"
~ _StopWatchStart * "(v"
~ _SimGetFSys * "(l"
~ _SimSetFSys * "(l"
~ time_tt ":" 2
~ _SerSetBaud * "(l"
~ _SerGetBaud * "(l"
~ _SerByteAvail * "(i"
~ _SerGetByte * "(i"
~ XmdmErr "c"
~ FlashErr "c"
~ ''
~ 44 4 24
~ eSR 0 "I"
~ ePC 2 "L"
~ vectofs 6 "I"
~ states 8 "[8I"
~ ''
~ 45 4 20
~ preamble 0 "[4I"
~ jump 8 "I"
~ target 10 "L"
~ postamble 14 "[3I"
~ ExcCFramePtr "#:" 45
~ ExcCFrame ":" 45
~ ExcStackFrame ":" 44
~ _mktime * "(L"
~ time_t "L"
~ clock_t "L"
~ wchar_t "c"
~ ptrdiff_t "l"
~ size_t "L"
~ bool "c"
~ vfptr "#(v"
~ ptr "#c"
~ ulpv "#L"
~ ulong "L"
~ uspv "#I"
~ unsint "I"
~ ushort "I"
~ ucpv "#C"
~ uchar "C"
	xref	_AD7716_icount_print
	xref	_AD7716_get_n_waiting
	xref	_SensorPowerOFF
	xref	_SensorPowerON
	xref	_get_errno_string
	xref	_mem_find_max_malloc
	xref	_log_printf
	xref	_logger_set_clock_rate
	xref	_logger_get_seconds_to_start
	xref	_logger_suspend
	xref	_logger_start
	xref	_logger_disk_show_status
	xref	_pc_file_system_reset
	xref	_disk_power_off
	xref	_disk_power_on
	xref	_pc_gdone
	xref	_pc_gnext
	xref	_pc_gfirst
	xref	_pc_free
	xref	_po_close
	xref	_po_read
	xref	_po_open
	xref	_logger_time_get_tick_offset
	xref	_logger_time_query_time
	xref	_logger_time_get_string
	xref	_logger_time_sync_get_time
	xref	_logger_time_sync_set_time
	xref	_logger_time_set_time
	xref	_logger_time_get_time
	xref	_eeprom_print_setup_data
	xref	_eeprom_write_setup_data
	xref	_eng_logger_print_file
	xref	_eng_logger_read_channel
	xref	_eng_logger_channel_setup
	xref	_sci_logger_show_status
	xref	_sci_logger_is_open
	xref	_sci_logger_print_file
	xref	_sci_logger_setup_partition
	xref	_sci_logger_set_binary_preview
	xref	_sci_logger_set_ASCII_preview
	xref	_sci_logger_set_LTA_time
	xref	_sci_logger_set_STA_time
	xref	_sci_logger_set_post_event
	xref	_sci_logger_set_pre_event
	xref	_sci_logger_set_gain
	xref	_sci_logger_set_trigger_level
	xref	_sci_logger_activate_chans
	xref	_sci_logger_get_conversion_rate
	xref	_sci_logger_set_averaging
	xref	_sci_logger_set_conversion_rate
	xref	_sci_logger_start_data
	xref	_strupr
	xref	_strncmp
	xref	_strcat
	xref	_labs
	xref	_atol
	xref	_atoi
	xref	_atof
	xref	__flsbuf
	xref	_printf
	xref	_fflush
	xref	_GetTickRate
	xref	_ttmcmp
	xref	_StopWatchTime
	xref	_StopWatchStart
	xref	_SimGetFSys
	xref	_SimSetFSys
	xref	_SerSetBaud
	xref	_SerGetBaud
	xref	_SerByteAvail
	xref	_SerGetByte
	xref	_mktime
	xref	.begin
	dseg
	xref	_SOFTWARE_VERSION
	xref	_MIN_TIME_SET_FREQ
	xref	_setup_data
	xref	__ctype
	xref	__iob
	end
