ASxxxx Assembler V02.21  (Motorola 6809), page 1.
PHS Constant definitions
HV-Control

                              1 	.sbttl	HV-Control
                              2 
                              3 	.module	hvctrl
                              4 
ASxxxx Assembler V02.21  (Motorola 6809), page 2.
PHS Constant definitions
HV-Control

                              5 	.include	/area.def/
                              1 	.sbttl	Area Definitions and Linking Order
                              2 
                              3 	; indexed label definitions
                              4 
                              5 	.area	PORTDATA	(ABS,OVR)
                              6 	.area	ACQBUFR		(ABS,OVR)
                              7 	.area	ACQVARBL	(ABS,OVR)
                              8 
                              9 	; data areas
                             10 
                             11 	.area	WORKPG		(REL,CON)
                             12 	.area	BUFSAV		(REL,CON)
                             13 	.area	ACQDATA		(REL,CON)
                             14 
                             15 	; program areas
                             16 
                             17 	.area	PGMSAV		(REL,CON)
                             18 	.area	ACIA		(REL,CON)
                             19 	.area	ACQ		(REL,CON)
                             20 	.area	HVCTRL		(REL,CON)
                             21 	.area	TERMIO		(REL,CON)
                             22 	.area	SELECT		(REL,CON)
                             23 	.area	SCREEN		(REL,CON)
                             24 	.area	SCRNUPDT	(REL,CON)
                             25 	.area	AICONV		(REL,CON)
                             26 	.area	MONDEB		(REL,CON)
                             27 	.area	IRQVEC		(REL,CON)
                             28 
                             29 	.sbttl	Default Direct Page
                             30 
                             31 	.setdp	0,PORTDATA
                             32 
ASxxxx Assembler V02.21  (Motorola 6809), page 3.
PHS Constant definitions
Default Direct Page

                              6 	.include	/define.def/
                              1 	.title	PHS Constant definitions
                              2 
                              3 
                              4 	.sbttl	VT1xx screen definitions
                              5 
                              6 	.radix	d
                              7 
                              8 ;
                              9 ;	VT1xx screen definitions
                             10 ;
                             11 
                    0050     12 	SCRNW	==	80		; screen width
                             13 
                    0000     14 	SCRNTP	==	 0		; ypos for top    line of edit area
                    0017     15 	SCRNBT	==	23		; ypos for bottom line of edit area
                    0000     16 	STATUS	==	 0		; ypos for status/command-input line
                             17 
                    0018     18 	SCRNL	==	24		; screen length
                             19 
                             20 
                             21 ; ----------------------------------------------------------
                             22 ; Definitions for various parameters
                             23 
                    FFFF     24 	ERR	==	(-1)
                    FFFE     25 	END	==	(-2)
                             26 
                    0000     27 	EOS	==	0
                    0001     28 	OK	==	1
                             29 
                    0000     30 	NO	==	0
                    0001     31 	YES	==	1
                             32 
                             33 ; ----------------------------------------------------------
                             34 ; Definitions for the Keypad
                             35 
                             36 			; zero not allowed
                    FFFF     37 	SELECT	==	 (-1)
                    FFFE     38 	CUT	==	 (-2)
                    FFFD     39 	APPEND	==	 (-3)
                    FFFC     40 	FNDNXT	==	 (-4)
                    FFFB     41 	GOLD	==	 (-5)
                    FFFA     42 	HELP	==	 (-6)
                    FFF9     43 	ENTER	==	 (-7)
                    0008     44 	SCRLL	==	   8	; backspace = 8
                    0009     45 	TAB	==	   9	; horizontal tab = 9
                    000A     46 	LF	==	  10	; linefeed = 10
                    000B     47 	SCRLU	==	  11	; vertical tab = 11
                    000C     48 	FF	==	  12	; formfeed = 12
                    000D     49 	CR	==	  13	; carriage return = 13
                    FFF2     50 	CHAR	==	(-14)
                    FFF1     51 	WORD	==	(-15)
                    FFF0     52 	LINE	==	(-16)
                    FFEF     53 	DELC	==	(-17)
                    FFEE     54 	DELW	==	(-18)
                    FFED     55 	DELL	==	(-19)
ASxxxx Assembler V02.21  (Motorola 6809), page 4.
PHS Constant definitions
VT1xx screen definitions

                    FFEC     56 	EOL	==	(-20)
                    0015     57 	CTRLU	==	  21	; ^U
                    FFEA     58 	ADVANCE	==	(-22)
                    0017     59 	CTRLW	==	  23	; ^W
                    FFE8     60 	SECTION	==	(-24)
                    FFE7     61 	PAGE	==	(-25)
                    001A     62 	CTRLZ	==	  26	; ^Z
                    001B     63 	ESCAPE	==	  27	; esc character
                    FFE4     64 	SCRLD	==	(-28)
                    FFE3     65 	SCRLR	==	(-29)
                    FFE2     66 	BACKUP	==	(-30)
                    FFE1     67 	ERROR	==	(-31)
                             68 				; characters 32-126 are valid
                    007F     69 	DELETE	==	 127	; delete to left of cursor
                    007F     70 	CRLF	==	0x7F	; internal line termination
                    0080     71 	REVERSE	==	0x80	; internal reverse video bit
                    0000     72 	NORMAL	==	0x00	; internal normal  video
                             73 
                             74 ; ----------------------------------------------------------
                             75 
                             76 	; VT1xx keypad definitions
                             77 	;
                             78 	;	(ESC O l)	--> (DELC)
                             79 	;	(ESC O m)	--> (DELW)
                             80 	;	(ESC O n)	--> (SELECT)
                             81 	;	(ESC O p)	--> (LINE)
                             82 	;	(ESC O q)	--> (WORD)
                             83 	;	(ESC O r)	--> (EOL)
                             84 	;	(ESC O s)	--> (CHAR)
                             85 	;	(ESC O t)	--> (ADVANCE)
                             86 	;	(ESC O u)	--> (BACKUP)
                             87 	;	(ESC O v)	--> (CUT)
                             88 	;	(ESC O w)	--> (PAGE)
                             89 	;	(ESC O x)	--> (SECTION)
                             90 	;	(ESC O y)	--> (APPEND)
                             91 	;	(ESC O M)	--> (ENTER)
                             92 	;	(ESC O P)	--> (GOLD)
                             93 	;	(ESC O Q)	--> (HELP)
                             94 	;	(ESC O R)	--> (FNDNXT)
                             95 	;	(ESC O S)	--> (DELL)
                             96 	;	(ESC O other)	--> (ERROR)
                             97 	;
                             98 	;	(GOLD)(DELC)	--> (UNDEL C)
                             99 	;	(GOLD)(DELW)	--> (UNDEL W)
                            100 	;	(GOLD)(SELECT)	--> (RESET)
                            101 	;	(GOLD)(LINE)	--> (OPENLINE)
                            102 	;	(GOLD)(WORD)	--> (CHNGCASE)
                            103 	;	(GOLD)(EOL)	--> (DEL EOL)
                            104 	;	(GOLD)(CHAR)	--> (BOTTOM)
                            105 	;	(GOLD)(BACKUP)	--> (TOP)
                            106 	;	(GOLD)(CUT)	--> (PASTE)
                            107 	;	(GOLD)(PAGE)	--> (COMMAND)
                            108 	;	(GOLD)(SECTION)	--> (MOVE CURSOR)
                            109 	;	(GOLD)(APPEND)	--> (REPLACE)
                            110 	;	(GOLD)(ENTER)	--> (SUBS)
                            111 	;	(GOLD)(GOLD)	--> (GOLD)
ASxxxx Assembler V02.21  (Motorola 6809), page 5.
PHS Constant definitions
VT1xx screen definitions

                            112 	;	(GOLD)(HELP)	--> (HELP)
                            113 	;	(GOLD)(FNDNXT)	--> (FIND)
                            114 	;	(GOLD)(DELL)	--> (UNDEL L)
                            115 	;
                            116 	;	(ESC [ A)	--> (SCRLU)
                            117 	;	(ESC [ B)	--> (SCRLD)
                            118 	;	(ESC [ C)	--> (SCRLL)
                            119 	;	(ESC [ D)	--> (SCRLR)
                            120 	;	(ESC [ other)	--> (ERROR)
                            121 
                            122 
                            123 	.sbttl	Acquisition Definitions
                            124 
                    0000    125 	$STOP	==	0b00000000	; acq$sts bits
                    0001    126 	$SCAN	==	0b00000001
                    0002    127 	$FAILED	==	0b00000010
                    0004    128 	$HOLD	==	0b00000100
                    0008    129 	$ACTIVE	==	0b00001000
                            130 
                    0003    131 	$OFF	==	0b00000011	; LED control bits
                    0000    132 	$YELLOW	==	0b00000000
                    0003    133 	$YFLASH	==	0b00000011
                    0001    134 	$RED	==	0b00000001
                    0002    135 	$RFLASH	==	0b00000010
                    0002    136 	$GREEN	==	0b00000010
                    0001    137 	$GFLASH	==	0b00000001
                            138 
                            139 	.sbttl	HV-Status
                            140 
                    0000    141 	$HVQMRK	==	0		; unknown state
                    0001    142 	$HVOFF	==	1
                    0002    143 	$HVON	==	2
                    0003    144 	$HVZERO	==	3
                    0004    145 	$HVFAIL	==	4
                            146 
                            147 	.sbttl	HV-Queue Functions
                            148 
                    0001    149 	M16F	==	1		; HV-Off
                    0002    150 	M16N	==	2		; HV-On
                    0003    151 	M16S	==	3		; HV-Status
                    0004    152 	M16D	==	4		; Demand Voltages
                    0005    153 	M16V	==	5		; Voltage Readings
                    0006    154 	M16CxxG	==	6		; Get Channel Voltage
                    0007    155 	M16CxxS	==	7		; Set Channel Voltage
                    0008    156 	M16CxxZ	==	8		; Zero Channel
                    0009    157 	M16CxxR	==	9		; Restore Channel
                    000A    158 	M16UPDT	==	10		; Update Sequence
                    000B    159 	M16WAIT	==	11		; 5 Second Wait
                            160 
                            161 
ASxxxx Assembler V02.21  (Motorola 6809), page 6.
PHS Constant definitions
HV-Queue Functions

                              7 
                              8 	.area	HVCTRL
                              9 
                             10 
                             11 
                             12 	; Enqueue a HV command
                             13 
   92FF                      14 en$que::
   92FF 34 5F                15 	pshs	cc,d,dp,x,u
   9301 1A 50                16 	orcc	#0q120			; hold interrupts
                             17 
   9303 CC 34 00             18 	ldd	#port2			; HV port
   9306 1F 03                19 	tfr	d,u
   9308 1F 8B                20 	tfr	a,dp
                             21 
   930A 96 D0                22 	lda	*que$cntr		; elements queued
   930C 81 20                23 	cmpa	#0d32
   930E 24 13                24 	bhis	1$			; too many - just exit
   9310 30 C9 00 88          25 	leax	que$bufr,u		; buffer address
   9314 96 CE                26 	lda	*que$inp		; input position
   9316 84 1F                27 	anda	#0x1F			; mod 32
   9318 48                   28 	asla
   9319 30 86                29 	leax	a,x			; que$inp pointer
   931B EC 61                30 	ldd	1,s			; new element
   931D ED 84                31 	std	,x
   931F 0C CE                32 	inc	*que$inp		; next position
   9321 0C D0                33 	inc	*que$cntr		; one more queued
                             34 
   9323 35 5F                35 1$:	puls	cc,d,dp,x,u
   9325 39                   36 	rts
                             37 
                             38 	; Dequeue a HV command
                             39 
   9326                      40 de$que::
   9326 34 4F                41 	pshs	d,cc,dp,u
   9328 1A 50                42 	orcc	#0q120			; hold interrupts
                             43 
   932A CC 34 00             44 	ldd	#port2			; HV port
   932D 1F 03                45 	tfr	d,u
   932F 1F 8B                46 	tfr	a,dp
                             47 
   9331 0C CF                48 	inc	*que$oup		; next position
   9333 0A D0                49 	dec	*que$cntr		; one less element
                             50 
   9335 35 4F                51 	puls	d,cc,dp,u
   9337 39                   52 	rts
                             53 
                             54 
   9338                      55 que$proc::
   9338 34 7E                56 	pshs	d,dp,x,y,u
                             57 
   933A CC 34 00             58 	ldd	#port2
   933D 1F 03                59 	tfr	d,u
   933F 1F 8B                60 	tfr	a,dp
                             61 
   9341 0D D0                62 	tst	*que$cntr		; active ?
ASxxxx Assembler V02.21  (Motorola 6809), page 7.
PHS Constant definitions
HV-Queue Functions

   9343 27 50                63 	beq	5$			; no - skip
                             64 
   9345 31 C9 00 88          65 	leay	que$bufr,u		; buffer
   9349 96 CF                66 	lda	*que$oup		; current queue element
   934B 84 1F                67 	anda	#0x1F
   934D 48                   68 	asla
   934E 31 A6                69 	leay	a,y			; get queue element address
                             70 
   9350 9E CC                71 	ldx	*q$gosub		; active process ?
   9352 27 1C                72 	beq	1$			; no - skip
   9354 DC C8                73 	ldd	*que$timr		; check timeout
   9356 83 00 01             74 	subd	#1
   9359 DD C8                75 	std	*que$timr
   935B 2E 33                76 	bgt	3$			; proceed with process
   935D EC A4                77 	ldd	,y			; get queue element
   935F 8E 8C 16             78 	ldx	#acqvtbl
   9362 58                   79 	aslb
   9363 30 95                80 	leax	[b,x]
   9365 8B 0C                81 	adda	#HVC$ERR		; offset
   9367 A7 89 00 13          82 	sta	hvc$sts,x		; set failure status
   936B 8E 94 30             83 	ldx	#q$error		; use error routine
   936E 20 20                84 	bra	3$
                             85 
   9370 EC A4                86 1$:	ldd	,y			; valid queued function ?
   9372 D7 D1                87 	stb	*que$chnl		; channel number
   9374 C1 20                88 	cmpb	#0d32			; valid channel ?
   9376 22 24                89 	bhi	6$			; no - skip
   9378 4D                   90 	tsta				; valid function ?
   9379 27 21                91 	beq	6$			; no - skip
   937B 81 0B                92 	cmpa	#QUE$FNCT		; valid function ?
   937D 22 1D                93 	bhi	6$			; no - skip
   937F 48                   94 	asla
   9380 48                   95 	asla
   9381 8E 94 8C             96 	ldx	#que$disp		; initial function dispatch
   9384 30 86                97 	leax	a,x
                             98 
   9386 EC 02                99 	ldd	2,x			; setup timeout counter
   9388 DD C8               100 	std	*que$timr
   938A 30 94               101 	leax	[,x]			; function address
                            102 
   938C 8D 14               103 2$:	bsr	que$scan		; scan for HV4032A
   938E 26 FC               104 	bne	2$			; failing channel report
                            105 
   9390 AD 84               106 3$:	jsr	,x			; dispatch to the function
                            107 
   9392 35 7E               108 4$:	puls	d,dp,x,y,u
   9394 39                  109 	rts
                            110 
   9395 8D 0B               111 5$:	bsr	que$scan		; scan for HV4032A
   9397 26 FC               112 	bne	5$			; failing channel report
   9399 35 7E               113 	puls	d,dp,x,y,u
   939B 39                  114 	rts
                            115 
   939C BD 93 26            116 6$:	jsr	de$que			; dump this queue element
   939F 35 7E               117 	puls	d,dp,x,y,u
   93A1 39                  118 	rts
ASxxxx Assembler V02.21  (Motorola 6809), page 8.
PHS Constant definitions
HV-Queue Functions

                            119 
   93A2                     120 que$scan:
   93A2 34 14               121 	pshs	b,x
   93A4 BD 83 1A            122 	jsr	tt_inp			; have an unsolicited char ?
   93A7 27 14               123 	beq	3$			; no - skip
   93A9 D6 EA               124 	ldb	*hvc$fseq		; go to current sequencer state
   93AB 58                  125 	aslb
   93AC C1 0A               126 	cmpb	#5$-4$
   93AE 24 0B               127 	bhis	2$
   93B0 8E 93 C2            128 	ldx	#4$
   93B3 AD 95               129 	jsr	[b,x]
   93B5 0C EA               130 	inc	*hvc$fseq		; next sequence
   93B7 20 04               131 	bra	3$
                            132 
   93B9 32 62               133 1$:	leas	2,s			; pop return
   93BB 0F EA               134 2$:	clr	*hvc$fseq		; restart
   93BD 35 14               135 3$:	puls	b,x
   93BF 96 2F               136 	lda	*char
   93C1 39                  137 	rts
                            138 
   93C2 93 CC 93 D1 93 D6   139 4$:	.word	5$,6$,7$,8$,9$
        93 DB 93 EF
                            140 
   93CC 81 2A               141 5$:	cmpa	#'*			; the channel failure status
   93CE 26 E9               142 	bne	1$			; is of the form *CHxx
   93D0 39                  143 	rts
                            144 
   93D1 81 43               145 6$:	cmpa	#'C
   93D3 26 E4               146 	bne	1$
   93D5 39                  147 	rts
                            148 
   93D6 81 48               149 7$:	cmpa	#'H
   93D8 26 DF               150 	bne	1$
   93DA 39                  151 	rts
                            152 
   93DB 81 30               153 8$:	cmpa	#'0			; tens digit
   93DD 25 DA               154 	blo	1$
   93DF 81 39               155 	cmpa	#'9
   93E1 22 D6               156 	bhi	1$
   93E3 80 30               157 	suba	#'0
   93E5 48                  158 	asla
   93E6 A7 E2               159 	sta	,-s
   93E8 48                  160 	asla
   93E9 48                  161 	asla
   93EA AB E0               162 	adda	,s+
   93EC 97 EB               163 	sta	*hvc$fchn
   93EE 39                  164 	rts
                            165 
   93EF 81 30               166 9$:	cmpa	#'0			; ones digit
   93F1 25 C6               167 	blo	1$
   93F3 81 39               168 	cmpa	#'9
   93F5 22 C2               169 	bhi	1$
   93F7 80 30               170 	suba	#'0
   93F9 9B EB               171 	adda	*hvc$fchn
   93FB 97 EB               172 	sta	*hvc$fchn
   93FD 81 1F               173 	cmpa	#0d31			; verify a valid channel
ASxxxx Assembler V02.21  (Motorola 6809), page 9.
PHS Constant definitions
HV-Queue Functions

   93FF 22 B8               174 	bhi	1$
   9401 48                  175 	asla
   9402 8E 8C 16            176 	ldx	#acqvtbl
   9405 30 96               177 	leax	[a,x]
   9407 86 04               178 	lda	#$HVFAIL		; set FAIL status
   9409 A7 89 00 12         179 	sta	hv$sts,x
   940D CC 00 00            180 	ldd	#0
   9410 ED 89 00 1A         181 	std	hv$volt,x		; voltage = 0
                            182 
   9414 A6 89 00 03         183 	lda	acq$sts,x
   9418 27 9F               184 	beq	1$
   941A 8A 04               185 	ora	#$HOLD			; implicit HOLD
   941C A7 89 00 03         186 	sta	acq$sts,x
   9420 20 97               187 	bra	1$
                            188 
                            189 
   9422                     190 q$nxtgos:
   9422 AE E1               191 	ldx	,s++			; next entry
   9424 9F CC               192 	stx	*q$gosub
   9426 39                  193 	rts				; finished
                            194 
   9427                     195 q$deque:
   9427 BD 93 26            196 	jsr	de$que			; finished
                            197 
   942A                     198 q$endgos:
   942A 8E 00 00            199 	ldx	#0			; no entry
   942D 9F CC               200 	stx	*q$gosub
   942F 39                  201 	rts				; finished
                            202 
   9430                     203 q$error:
   9430 CC 04 B0            204 	ldd	#0d1200			; 10 second timeout
   9433 DD C8               205 	std	*que$timr
   9435 BD 94 22            206 	jsr	q$nxtgos
   9438 86 0D               207 	lda	#0q015			; try a CR
   943A BD 82 F3            208 	jsr	tt_out
                            209 
   943D CC 00 F0            210 	ldd	#0d240			; set wait timer
   9440 DD CA               211 	std	*que$wait		; for a 2 second wait
   9442 BD 94 22            212 	jsr	q$nxtgos
   9445 BD 83 1A            213 	jsr	tt_inp			; wait for '>
   9448 81 3E               214 	cmpa	#'>
   944A 27 24               215 	beq	1$			; ok - have a response
   944C BD 97 9C            216 	jsr	wait$seq		; wait que$wait ticks
                            217 
   944F 86 0D               218 	lda	#0q015			; try another CR
   9451 BD 82 F3            219 	jsr	tt_out
                            220 
   9454 CC 00 F0            221 	ldd	#0d240			; set wait timer
   9457 DD CA               222 	std	*que$wait		; for a 2 second wait
   9459 BD 94 22            223 	jsr	q$nxtgos
   945C BD 83 1A            224 	jsr	tt_inp			; wait for '>
   945F 81 3E               225 	cmpa	#'>
   9461 27 0D               226 	beq	1$			; ok - have a response
   9463 BD 97 9C            227 	jsr	wait$seq		; wait que$wait ticks
                            228 
   9466 8E 94 88            229 	ldx	#2$			; try a selection
ASxxxx Assembler V02.21  (Motorola 6809), page 10.
PHS Constant definitions
HV-Queue Functions

   9469 9F D4               230 	stx	*hvc$pntr
   946B BD 97 E6            231 	jsr	wrt$strng
   946E 20 C0               232 	bra	q$error			; and try again for a completion
                            233 
   9470 CC 00 78            234 1$:	ldd	#0d120			; set wait timer
   9473 DD CA               235 	std	*que$wait		; for a 1 second wait
   9475 BD 94 22            236 	jsr	q$nxtgos
   9478 BD 97 9C            237 	jsr	wait$seq		; wait que$wait ticks
   947B BD 83 1A            238 	jsr	tt_inp			; input buffer must be empty
   947E 26 B0               239 	bne	q$error			; else - loop
   9480 CC 00 00            240 	ldd	#0			; retry aborted process
   9483 DD C8               241 	std	*que$timr		; clear timer
   9485 DD CC               242 	std	*q$gosub		; kill error process
   9487 39                  243 	rts
                            244 
   9488 4D 31 36 00         245 2$:	.asciz	"M16"			; unit selection
                            246 
                            247 
                    000B    248 	QUE$FNCT  =  0d11		; number of functions
                            249 
   948C                     250 que$disp::
                            251 	;	function	timeout
                            252 	;	--------	-------
   948C 94 2A 00 00         253 	.word	q$endgos,	0d0	; invalid function	0
   9490 94 BC 04 B0         254 	.word	fM16F,		0d1200	; HV-Off		1
   9494 94 E9 04 B0         255 	.word	fM16N,		0d1200	; HV-On			2
   9498 95 07 07 08         256 	.word	fM16S,		0d1800	; HV-Status		3
   949C 95 AC 07 08         257 	.word	fM16D,		0d1800	; Demand Voltages	4
   94A0 95 EB 07 08         258 	.word	fM16V,		0d1800	; Voltage Readings	5
   94A4 96 3A 02 58         259 	.word	fM16CxxG,	0d600	; Get Channel Voltage	6
   94A8 96 A2 02 58         260 	.word	fM16CxxS,	0d600	; Set Channel Voltage	7
   94AC 96 EF 02 58         261 	.word	fM16CxxZ,	0d600	; Zero Channel		8
   94B0 97 21 02 58         262 	.word	fM16CxxR,	0d600	; Restore Channel	9
   94B4 97 44 02 58         263 	.word	fM16UPDT,	0d600	; Update Sequence	10
   94B8 97 72 7F FF         264 	.word	fM16WAIT,	0x7FFF	; Wait			11
                            265 
                            266 
   94BC                     267 fM16F:
   94BC 8E 77 41            268 	ldx	#acqvar
   94BF C6 20               269 	ldb	#0d32			; check all acq$sts's
   94C1 A6 89 00 03         270 1$:	lda	acq$sts,x
   94C5 27 06               271 	beq	2$
   94C7 8A 04               272 	ora	#$HOLD			; place on HOLD
   94C9 A7 89 00 03         273 	sta	acq$sts,x
   94CD 30 89 00 2C         274 2$:	leax	ACQVARSZ,x
   94D1 5A                  275 	decb
   94D2 2E ED               276 	bgt	1$
                            277 
   94D4 CC 00 78            278 	ldd	#0d120			; set wait timer
   94D7 DD CA               279 	std	*que$wait		; for a 1 second wait
   94D9 D3 C8               280 	addd	*que$timr		; update timeout counter
   94DB DD C8               281 	std	*que$timr
                            282 
   94DD BD 94 22            283 	jsr	q$nxtgos		; wait que$wait ticks to allow
   94E0 BD 97 9C            284 	jsr	wait$seq		; completion of any acq updates
                            285 
ASxxxx Assembler V02.21  (Motorola 6809), page 11.
PHS Constant definitions
HV-Queue Functions

   94E3 BD 97 AD            286 	jsr	wrt$cmd			; send command
   94E6 7E 97 88            287 	jmp	fM16$end
                            288 
                            289 
   94E9                     290 fM16N:
   94E9 8E 77 41            291 	ldx	#acqvar
   94EC C6 20               292 	ldb	#0d32			; check all acq$sts's
   94EE A6 89 00 03         293 1$:	lda	acq$sts,x
   94F2 27 06               294 	beq	2$
   94F4 8A 04               295 	ora	#$HOLD			; place on HOLD
   94F6 A7 89 00 03         296 	sta	acq$sts,x
   94FA 30 89 00 2C         297 2$:	leax	ACQVARSZ,x
   94FE 5A                  298 	decb
   94FF 2E ED               299 	bgt	1$
                            300 
   9501 BD 97 AD            301 	jsr	wrt$cmd			; send command
   9504 7E 97 88            302 	jmp	fM16$end
                            303 
                            304 
   9507                     305 fM16S:
   9507 BD 97 AD            306 	jsr	wrt$cmd			; send command
   950A BD 94 22            307 	jsr	q$nxtgos
                            308 
   950D 34 14               309 	pshs	b,x
   950F BD 83 1A            310 	jsr	tt_inp			; have a cahr ?
   9512 27 14               311 	beq	3$			; no - skip
   9514 D6 EC               312 	ldb	*hvc$sseq		; go to current sequencer state
   9516 58                  313 	aslb
   9517 C1 10               314 	cmpb	#5$-4$
   9519 24 0B               315 	bhis	2$
   951B 8E 95 2B            316 	ldx	#4$
   951E AD 95               317 	jsr	[b,x]
   9520 0C EC               318 	inc	*hvc$sseq		; next sequence
   9522 20 04               319 	bra	3$
                            320 
   9524 32 62               321 1$:	leas	2,s			; pop return
   9526 0F EC               322 2$:	clr	*hvc$sseq		; restart
   9528 35 14               323 3$:	puls	b,x
   952A 39                  324 	rts
                            325 
   952B 95 3B 95 44 95 49   326 4$:	.word	5$,6$,7$,8$		; CHxx
        95 5D
   9533 95 82 95 87 95 8C   327 	.word	10$,11$,12$,13$		; HV ON / HV OFF
        95 91
                            328 
   953B 81 48               329 5$:	cmpa	#'H			; the status is of the
   953D 27 3E               330 	beq	9$			; form 'HV ON' or 'HV OFF'
                            331 
   953F 81 43               332 	cmpa	#'C			; channel failure is of
   9541 26 E1               333 	bne	1$			; the form CHxx
   9543 39                  334 	rts
                            335 
   9544 81 48               336 6$:	cmpa	#'H
   9546 26 DC               337 	bne	1$
   9548 39                  338 	rts
                            339 
ASxxxx Assembler V02.21  (Motorola 6809), page 12.
PHS Constant definitions
HV-Queue Functions

   9549 81 30               340 7$:	cmpa	#'0			; tens digit
   954B 25 D7               341 	blo	1$
   954D 81 39               342 	cmpa	#'9
   954F 22 D3               343 	bhi	1$
   9551 80 30               344 	suba	#'0
   9553 48                  345 	asla
   9554 A7 E2               346 	sta	,-s
   9556 48                  347 	asla
   9557 48                  348 	asla
   9558 AB E0               349 	adda	,s+
   955A 97 EB               350 	sta	*hvc$fchn
   955C 39                  351 	rts
                            352 
   955D 81 30               353 8$:	cmpa	#'0			; ones digit
   955F 25 C3               354 	blo	1$
   9561 81 39               355 	cmpa	#'9
   9563 22 BF               356 	bhi	1$
   9565 80 30               357 	suba	#'0
   9567 9B EB               358 	adda	*hvc$fchn
   9569 97 EB               359 	sta	*hvc$fchn
   956B 81 1F               360 	cmpa	#0d31			; verify a valid channel
   956D 22 B5               361 	bhi	1$
   956F 48                  362 	asla
   9570 8E 8C 16            363 	ldx	#acqvtbl
   9573 30 96               364 	leax	[a,x]
   9575 86 04               365 	lda	#$HVFAIL		; set FAIL status
   9577 A7 89 00 12         366 	sta	hv$sts,x
   957B 20 A7               367 	bra	1$
                            368 
   957D 86 03               369 9$:	lda	#4-1
   957F 97 EC               370 	sta	*hvc$sseq		; this sequence next
   9581 39                  371 	rts
                            372 
   9582 81 56               373 10$:	cmpa	#'V
   9584 26 9E               374 	bne	1$
   9586 39                  375 	rts
                            376 
   9587 81 20               377 11$:	cmpa	#(' )
   9589 26 99               378 	bne	1$
   958B 39                  379 	rts
                            380 
   958C 81 4F               381 12$:	cmpa	#'O
   958E 26 94               382 	bne	1$
   9590 39                  383 	rts
                            384 
   9591 81 4E               385 13$:	cmpa	#'N			; ON ?
   9593 26 04               386 	bne	14$
   9595 86 02               387 	lda	#$HVON
   9597 20 09               388 	bra	16$
                            389 
   9599 81 46               390 14$:	cmpa	#'F			; OFF ?
   959B 26 04               391 	bne	15$
   959D 86 01               392 	lda	#$HVOFF
   959F 20 01               393 	bra	16$
                            394 
   95A1 4F                  395 15$:	clra				; unknown state
ASxxxx Assembler V02.21  (Motorola 6809), page 13.
PHS Constant definitions
HV-Queue Functions

                            396 
   95A2 8E 7D C1            397 16$:	ldx	#tmpvar
   95A5 A7 89 00 12         398 	sta	hv$sts,x
   95A9 7E 97 88            399 	jmp	fM16$end
                            400 
                            401 
   95AC                     402 fM16D:
   95AC BD 97 AD            403 	jsr	wrt$cmd			; send command
                            404 
   95AF 0F D1               405 	clr	*que$chnl		; clear loop counter/channel
                            406 
                            407 	; skip lines from HV4032A
                            408 
   95B1 BD 98 5A            409 	jsr	skp$line		; skip line
   95B4 BD 98 5A            410 	jsr	skp$line		; skip line
                            411 
                            412 	; skip channel specification
                            413 
   95B7 BD 98 5A            414 1$:	jsr	skp$line		; skip line
                            415 
   95BA BD 98 8A            416 	jsr	skp$spcs		; skip any leading spaces
   95BD BD 98 A6            417 	jsr	skp$char		; skip to spaces
                            418 
                            419 	; 8 channels per line
                            420 
   95C0 BD 98 8A            421 2$:	jsr	skp$spcs		; skip any leading spaces
   95C3 BD 98 EA            422 	jsr	vltg$scn		; scan for voltage
   95C6 10 29 01 C4         423 	lbvs	fM16$err		; invalid string
   95CA 34 06               424 	pshs	d
   95CC 8E 8C 16            425 	ldx	#acqvtbl		; variables
   95CF D6 D1               426 	ldb	*que$chnl		; current channel
   95D1 58                  427 	aslb
   95D2 30 95               428 	leax	[b,x]
   95D4 35 06               429 	puls	d
   95D6 ED 89 00 18         430 	std	hv$dmnd,x		; demand voltage
                            431 
   95DA 0C D1               432 	inc	*que$chnl
   95DC 96 D1               433 	lda	*que$chnl
   95DE 84 07               434 	anda	#0x07			; 8 values per line
   95E0 26 DE               435 	bne	2$
                            436 
   95E2 96 D1               437 	lda	*que$chnl
   95E4 81 20               438 	cmpa	#0d32
   95E6 25 CF               439 	blo	1$
                            440 
   95E8 7E 97 88            441 	jmp	fM16$end		; finished
                            442 
                            443 
   95EB                     444 fM16V:
   95EB BD 97 AD            445 	jsr	wrt$cmd			; send command
                            446 
   95EE 0F D1               447 	clr	*que$chnl		; clear loop counter/channel
                            448 
                            449 	; skip line from HV4032A
                            450 
   95F0 BD 98 5A            451 	jsr	skp$line		; skip line
ASxxxx Assembler V02.21  (Motorola 6809), page 14.
PHS Constant definitions
HV-Queue Functions

   95F3 BD 98 5A            452 	jsr	skp$line		; skip line
                            453 
                            454 	; skip channel specification
                            455 
   95F6 BD 98 5A            456 1$:	jsr	skp$line		; skip line
                            457 
   95F9 BD 98 8A            458 	jsr	skp$spcs		; skip any leading spaces
   95FC BD 98 A6            459 	jsr	skp$char		; skip to spaces
                            460 
                            461 	; 8 channels per line
                            462 
   95FF BD 98 8A            463 2$:	jsr	skp$spcs		; skip any leading spaces
   9602 BD 98 EA            464 	jsr	vltg$scn		; scan for voltage
   9605 10 29 01 85         465 	lbvs	fM16$err		; invalid string
   9609 34 06               466 	pshs	d
   960B 8E 8C 16            467 	ldx	#acqvtbl		; variables
   960E D6 D1               468 	ldb	*que$chnl
   9610 58                  469 	aslb
   9611 30 95               470 	leax	[b,x]
   9613 35 06               471 	puls	d
   9615 ED 89 00 1A         472 	std	hv$volt,x		; current voltage
                            473 
   9619 10 83 00 4B         474 	cmpd	#0d75			; Check on or off
   961D 25 04               475 	blo	3$
   961F 86 02               476 	lda	#$HVON
   9621 20 02               477 	bra	4$
   9623 86 01               478 3$:	lda	#$HVOFF
   9625 A7 89 00 12         479 4$:	sta	hv$sts,x		; load status
                            480 
   9629 0C D1               481 	inc	*que$chnl
   962B 96 D1               482 	lda	*que$chnl
   962D 84 07               483 	anda	#0x07			; 8 values per line
   962F 26 CE               484 	bne	2$
                            485 
   9631 96 D1               486 	lda	*que$chnl
   9633 81 20               487 	cmpa	#0d32
   9635 25 BF               488 	blo	1$
                            489 
   9637 7E 97 88            490 	jmp	fM16$end		; finished
                            491 
                            492 
   963A                     493 fM16CxxG:
   963A BD 97 AD            494 	jsr	wrt$cmd			; send command
   963D BD 98 C2            495 	jsr	csts$scn		; check for ZERO/FAIL
   9640 BD 98 5A            496 	jsr	skp$line		; skip line
   9643 BD 98 8A            497 	jsr	skp$spcs		; skip any leading spaces
   9646 BD 98 EA            498 	jsr	vltg$scn		; scan for voltage
   9649 10 29 01 41         499 	lbvs	fM16$err		; invalid string
   964D 10 25 01 2F         500 	lbcs	fM16$fin		; ZERO / FAIL
   9651 34 06               501 	pshs	d
   9653 8E 8C 16            502 	ldx	#acqvtbl		; variables
   9656 D6 D1               503 	ldb	*que$chnl
   9658 58                  504 	aslb
   9659 30 95               505 	leax	[b,x]
                            506 
   965B 96 E9               507 	lda	*hvc$csts		; ZERO / FAIL ?
ASxxxx Assembler V02.21  (Motorola 6809), page 15.
PHS Constant definitions
HV-Queue Functions

   965D 27 2A               508 	beq	4$			; no - skip
   965F 81 5A               509 	cmpa	#'Z			; ZERO ?
   9661 26 04               510 	bne	1$
   9663 86 03               511 	lda	#$HVZERO
   9665 20 06               512 	bra	2$
                            513 
   9667 81 46               514 1$:	cmpa	#'F			; FAIL ?
   9669 26 1E               515 	bne	4$
   966B 86 04               516 	lda	#$HVFAIL
                            517 
   966D A7 89 00 12         518 2$:	sta	hv$sts,x
   9671 CC 00 00            519 	ldd	#0
   9674 ED 89 00 1A         520 	std	hv$volt,x		; voltage = 0
   9678 35 06               521 	puls	d			; pop the read demand voltage
   967A A6 89 00 03         522 	lda	acq$sts,x
   967E 27 06               523 	beq	3$
   9680 8A 04               524 	ora	#$HOLD			; implicit HOLD
   9682 A7 89 00 03         525 	sta	acq$sts,x
   9686 7E 97 80            526 3$:	jmp	fM16$fin		; do completion
                            527 
   9689 35 06               528 4$:	puls	d
   968B ED 89 00 1A         529 	std	hv$volt,x		; current voltage
   968F 10 83 00 4B         530 	cmpd	#0d75			; Check on or off
   9693 25 04               531 	blo	5$
   9695 86 02               532 	lda	#$HVON
   9697 20 02               533 	bra	6$
   9699 86 01               534 5$:	lda	#$HVOFF
   969B A7 89 00 12         535 6$:	sta	hv$sts,x		; load status
   969F 7E 97 80            536 	jmp	fM16$fin		; do completion
                            537 
                            538 
   96A2                     539 fM16CxxS:
   96A2 8E 8C 16            540 	ldx	#acqvtbl		; pointer to variables
   96A5 D6 D1               541 	ldb	*que$chnl
   96A7 58                  542 	aslb
   96A8 30 95               543 	leax	[b,x]
   96AA A6 89 00 03         544 	lda	acq$sts,x
   96AE 27 15               545 	beq	1$
   96B0 8A 04               546 	ora	#$HOLD			; implicit HOLD
   96B2 A7 89 00 03         547 	sta	acq$sts,x
                            548 
   96B6 CC 00 78            549 	ldd	#0d120			; set wait timer
   96B9 DD CA               550 	std	*que$wait		; for a 1 second wait
   96BB D3 C8               551 	addd	*que$timr		; update timeout counter
   96BD DD C8               552 	std	*que$timr
                            553 
   96BF BD 94 22            554 	jsr	q$nxtgos		; wait que$wait ticks to allow
   96C2 BD 97 9C            555 	jsr	wait$seq		; completion of any acq updates
                            556 
   96C5 BD 97 AD            557 1$:	jsr	wrt$cmd			; send command
   96C8 BD 98 5A            558 	jsr	skp$line		; skip line
   96CB BD 98 8A            559 	jsr	skp$spcs		; skip any leading spaces
   96CE BD 98 EA            560 	jsr	vltg$scn		; scan for voltage
   96D1 10 29 00 B9         561 	lbvs	fM16$err		; invalid string
   96D5 10 25 00 A7         562 	lbcs	fM16$fin		; ZERO / FAIL
   96D9 8E 8C 16            563 	ldx	#acqvtbl		; variables
ASxxxx Assembler V02.21  (Motorola 6809), page 16.
PHS Constant definitions
HV-Queue Functions

   96DC EC A4               564 	ldd	,y
   96DE 58                  565 	aslb
   96DF 30 95               566 	leax	[b,x]
   96E1 EC 89 00 1C         567 	ldd	hv$setv,x		; new set voltage
   96E5 ED 89 00 18         568 	std	hv$dmnd,x
   96E9 BD 98 12            569 	jsr	wrt$vltg
   96EC 7E 97 88            570 	jmp	fM16$end
                            571 
                            572 
   96EF                     573 fM16CxxZ:
   96EF 8E 8C 16            574 	ldx	#acqvtbl		; pointer to variables
   96F2 D6 D1               575 	ldb	*que$chnl
   96F4 58                  576 	aslb
   96F5 30 95               577 	leax	[b,x]
   96F7 A6 89 00 03         578 	lda	acq$sts,x
   96FB 27 15               579 	beq	1$
   96FD 8A 04               580 	ora	#$HOLD			; implicit HOLD
   96FF A7 89 00 03         581 	sta	acq$sts,x
                            582 
   9703 CC 00 78            583 	ldd	#0d120			; set wait timer
   9706 DD CA               584 	std	*que$wait		; for a 1 second wait
   9708 D3 C8               585 	addd	*que$timr		; update timeout counter
   970A DD C8               586 	std	*que$timr
                            587 
   970C BD 94 22            588 	jsr	q$nxtgos		; wait que$wait ticks to allow
   970F BD 97 9C            589 	jsr	wait$seq		; completion of any acq updates
                            590 
   9712 BD 97 AD            591 1$:	jsr	wrt$cmd			; send command
   9715 BD 98 38            592 	jsr	cmd$end			; check for completion
   9718 86 03               593 	lda	#$HVZERO		; voltage zeroed
   971A A7 89 00 12         594 	sta	hv$sts,x
   971E 7E 94 27            595 	jmp	q$deque			; finished here
                            596 
                            597 
   9721                     598 fM16CxxR:
   9721 8E 8C 16            599 	ldx	#acqvtbl		; pointer to variables
   9724 D6 D1               600 	ldb	*que$chnl
   9726 58                  601 	aslb
   9727 30 95               602 	leax	[b,x]
   9729 A6 89 00 03         603 	lda	acq$sts,x
   972D 27 06               604 	beq	1$
   972F 8A 04               605 	ora	#$HOLD			; implicit HOLD
   9731 A7 89 00 03         606 	sta	acq$sts,x
                            607 
   9735 BD 97 AD            608 1$:	jsr	wrt$cmd			; send command
   9738 BD 98 38            609 	jsr	cmd$end			; check for completion
   973B 86 02               610 	lda	#$HVON			; voltage on
   973D A7 89 00 12         611 	sta	hv$sts,x
   9741 7E 94 27            612 	jmp	q$deque			; finished here
                            613 
                            614 
   9744                     615 fM16UPDT:
   9744 BD 97 AD            616 	jsr	wrt$cmd			; send command
   9747 BD 98 5A            617 	jsr	skp$line		; skip line
   974A BD 98 8A            618 	jsr	skp$spcs		; skip any leading spaces
   974D BD 98 EA            619 	jsr	vltg$scn		; scan for voltage (discard)
ASxxxx Assembler V02.21  (Motorola 6809), page 17.
PHS Constant definitions
HV-Queue Functions

   9750 10 29 00 3A         620 	lbvs	fM16$err		; invalid string
   9754 10 25 00 28         621 	lbcs	fM16$fin		; ZERO / FAIL
   9758 8E 8C 16            622 	ldx	#acqvtbl		; variables
   975B D6 D1               623 	ldb	*que$chnl
   975D 58                  624 	aslb
   975E 30 95               625 	leax	[b,x]
   9760 EC 89 00 1A         626 	ldd	hv$volt,x		; get voltage
   9764 E3 89 00 21         627 	addd	hv$chng,x		; change required
   9768 ED 89 00 18         628 	std	hv$dmnd,x		; new demand value
   976C BD 98 12            629 	jsr	wrt$vltg
   976F 7E 97 88            630 	jmp	fM16$end
                            631 
                            632 
   9772                     633 fM16WAIT:
   9772 CC 00 F0            634 	ldd	#0d240			; set wait timer
   9775 DD CA               635 	std	*que$wait		; for a 2 second wait
   9777 BD 94 22            636 	jsr	q$nxtgos
   977A BD 97 9C            637 	jsr	wait$seq
   977D 7E 94 27            638 	jmp	q$deque
                            639 
                            640 
   9780                     641 fM16$fin:
   9780 BD 94 22            642 	jsr	q$nxtgos
   9783 86 0D               643 	lda	#0q015			; terminate the command
   9785 BD 82 F3            644 	jsr	tt_out
                            645 
   9788                     646 fM16$end:
   9788 BD 98 38            647 	jsr	cmd$end			; check for completion
   978B 7E 94 27            648 	jmp	q$deque			; finished here
                            649 
                            650 
   978E                     651 fM16$err:
   978E BD 94 22            652 	jsr	q$nxtgos
   9791 86 0D               653 	lda	#0q015			; terminate the command
   9793 BD 82 F3            654 	jsr	tt_out
   9796 BD 98 38            655 	jsr	cmd$end
   9799 7E 94 2A            656 	jmp	q$endgos		; retry same command
                            657 
                            658 
   979C                     659 wait$seq:
   979C DC CA               660 	ldd	*que$wait		; update wait counter
   979E 83 00 01            661 	subd	#1
   97A1 2E 03               662 	bgt	1$
   97A3 CC 00 00            663 	ldd	#0
   97A6 DD CA               664 1$:	std	*que$wait
   97A8 27 02               665 	beq	2$
   97AA 32 62               666 	leas	2,s			; pop return
   97AC 39                  667 2$:	rts
                            668 
                            669 
   97AD                     670 wrt$cmd:
   97AD EC A4               671 	ldd	,y			; get queue element
   97AF 8E 8C 16            672 	ldx	#acqvtbl
   97B2 58                  673 	aslb
   97B3 30 95               674 	leax	[b,x]
   97B5 A7 89 00 13         675 	sta	hvc$sts,x		; updating note
ASxxxx Assembler V02.21  (Motorola 6809), page 18.
PHS Constant definitions
HV-Queue Functions

                            676 
   97B9 8E 99 ED            677 	ldx	#hv$cmnd
   97BC 48                  678 	asla
   97BD 30 96               679 	leax	[a,x]			; address of command string
   97BF 33 C9 00 D6         680 	leau	hvc$strng,u		; buffer address
   97C3 DF D4               681 	stu	*hvc$pntr
                            682 
   97C5 A6 80               683 1$:	lda	,x+
   97C7 A7 C0               684 	sta	,u+
   97C9 2E FA               685 	bgt	1$
   97CB 27 17               686 	beq	2$
   97CD 33 5F               687 	leau	-1,u			; backup pointer
                            688 
                            689 	; Insert Channel Number
                            690 
   97CF 34 10               691 	pshs	x
   97D1 32 7C               692 	leas	-4,s			; temporary area
   97D3 1F 41               693 	tfr	s,x
   97D5 D6 D1               694 	ldb	*que$chnl		; channel number
   97D7 BD E3 DC            695 	jsr	i$b$d
   97DA EC 61               696 	ldd	1,s			; last two digits
   97DC ED C1               697 	std	,u++
   97DE 32 64               698 	leas	4,s
   97E0 35 10               699 	puls	x
   97E2 20 E1               700 	bra	1$			; go complete sequence
                            701 
   97E4 DE 00               702 2$:	ldu	*lclstk			; restore user stack pointer
                            703 
   97E6                     704 wrt$strng:
   97E6 AE E1               705 	ldx	,s++			; save return address
   97E8 9F D2               706 	stx	*hvc$gosub
                            707 
   97EA BD 94 22            708 1$:	jsr	q$nxtgos
   97ED 9E D4               709 	ldx	*hvc$pntr
   97EF A6 80               710 	lda	,x+
   97F1 9F D4               711 	stx	*hvc$pntr
   97F3 97 E8               712 	sta	*hvc$char		; save character
   97F5 2F 10               713 	ble	3$
   97F7 BD 82 F3            714 	jsr	tt_out			; send character
   97FA BD 94 22            715 	jsr	q$nxtgos
   97FD BD 83 1A            716 	jsr	tt_inp			; wait for echo of character
   9800 27 04               717 	beq	2$			; none - exit
   9802 91 E8               718 	cmpa	*hvc$char		; skip all other characters
   9804 27 E4               719 	beq	1$
   9806 39                  720 2$:	rts
                            721 
   9807 2D 05               722 3$:	blt	4$
   9809 86 0D               723 	lda	#0q015			; terminate with CR
   980B BD 82 F3            724 	jsr	tt_out
                            725 
   980E 6E D9 00 D2         726 4$:	jmp	[hvc$gosub,u]		; return inline
                            727 	
                            728 
   9812                     729 wrt$vltg:
   9812 ED E3               730 	std	,--s
   9814 EC E1               731 	ldd	,s++
ASxxxx Assembler V02.21  (Motorola 6809), page 19.
PHS Constant definitions
HV-Queue Functions

   9816 2A 03               732 	bpl	1$
   9818 CC 00 00            733 	ldd	#0			; minimum voltage
   981B 10 83 0B B8         734 1$:	cmpd	#0d3000
   981F 23 03               735 	blos	2$
   9821 CC 0B B8            736 	ldd	#0d3000			; maximum voltage
   9824 BD 99 9E            737 2$:	jsr	vltg$sav		; save update voltage / time
   9827 30 C9 00 D6         738 	leax	hvc$strng,u		; use this buffer
   982B 30 01               739 	leax	1,x
   982D 9F D4               740 	stx	*hvc$pntr		; last 4 digits
   982F 30 1F               741 	leax	-1,x
   9831 BD E3 FE            742 	jsr	i$w$d			; convert to string
   9834 6F 84               743 	clr	,x			; terminate string
   9836 20 AE               744 	bra	wrt$strng
                            745 
                            746 
   9838                     747 cmd$end:
   9838 EC E1               748 	ldd	,s++
   983A DD D2               749 	std	*hvc$gosub		; save return
                            750 
   983C BD 83 1A            751 1$:	jsr	tt_inp			; any input from HV ?
   983F 27 04               752 	beq	2$			; no - skip
   9841 81 3E               753 	cmpa	#'>			; command finished ?
   9843 27 05               754 	beq	3$			; yes - skip
   9845 BD 94 22            755 2$:	jsr	q$nxtgos
   9848 20 F2               756 	bra	1$
                            757 
   984A 8E 8C 16            758 3$:	ldx	#acqvtbl		; pointer to variables
   984D D6 D1               759 	ldb	*que$chnl
   984F 58                  760 	aslb
   9850 30 95               761 	leax	[b,x]
   9852 6F 89 00 13         762 	clr	hvc$sts,x		; clear status
                            763 
   9856 6E D9 00 D2         764 	jmp	[hvc$gosub,u]		; return in line
                            765 
                            766 
                            767 
ASxxxx Assembler V02.21  (Motorola 6809), page 20.
PHS Constant definitions
TT_INP Scanning Functions

                            769 	.sbttl	TT_INP Scanning Functions
                            770 
   985A                     771 skp$line:
   985A EC E1               772 	ldd	,s++
   985C DD D2               773 	std	*hvc$gosub		; save return
                            774 
   985E 96 2F               775 1$:	lda	*char			; a character ?
   9860 26 05               776 	bne	2$			; yes process it
   9862 BD 83 1A            777 	jsr	tt_inp			; else try to get one
   9865 27 06               778 	beq	3$			; none - skip
   9867 81 20               779 2$:	cmpa	#(' )			; scan until a CR / LF
   9869 25 07               780 	blo	4$
   986B 0F 2F               781 	clr	*char			; clear the character
   986D BD 94 22            782 3$:	jsr	q$nxtgos
   9870 20 EC               783 	bra	1$
                            784 
   9872 96 2F               785 4$:	lda	*char			; a character ?
   9874 26 05               786 	bne	5$			; yes process it
   9876 BD 83 1A            787 	jsr	tt_inp			; else try to get one
   9879 27 06               788 	beq	6$			; none - skip
   987B 81 20               789 5$:	cmpa	#(' )			; scan until past CR / LF
   987D 24 07               790 	bhis	7$
   987F 0F 2F               791 	clr	*char			; clear the character
   9881 BD 94 22            792 6$:	jsr	q$nxtgos
   9884 20 EC               793 	bra	4$
                            794 
   9886 6E D9 00 D2         795 7$:	jmp	[hvc$gosub,u]		; return in line
                            796 
                            797 
   988A                     798 skp$spcs:
   988A EC E1               799 	ldd	,s++
   988C DD D2               800 	std	*hvc$gosub		; save return
                            801 
   988E 96 2F               802 1$:	lda	*char			; a character ?
   9890 26 05               803 	bne	2$			; yes process it
   9892 BD 83 1A            804 	jsr	tt_inp			; else try to get one
   9895 27 06               805 	beq	3$			; none - skip
   9897 81 20               806 2$:	cmpa	#(' )			; scan until past spaces
   9899 26 07               807 	bne	4$
   989B 0F 2F               808 	clr	*char			; clear the character
   989D BD 94 22            809 3$:	jsr	q$nxtgos
   98A0 20 EC               810 	bra	1$
                            811 
   98A2 6E D9 00 D2         812 4$:	jmp	[hvc$gosub,u]		; return in line
                            813 
                            814 
   98A6                     815 skp$char:
   98A6 EC E1               816 	ldd	,s++
   98A8 DD D2               817 	std	*hvc$gosub		; save return
                            818 
   98AA 96 2F               819 1$:	lda	*char			; a character ?
   98AC 26 05               820 	bne	2$			; yes process it
   98AE BD 83 1A            821 	jsr	tt_inp			; else try to get one
   98B1 27 04               822 	beq	3$			; none - skip
   98B3 81 20               823 2$:	cmpa	#(' )			; scan until past characters
   98B5 23 07               824 	blos	4$			; space or CR / LF terminates scan
ASxxxx Assembler V02.21  (Motorola 6809), page 21.
PHS Constant definitions
TT_INP Scanning Functions

   98B7 0F 2F               825 3$:	clr	*char			; clear the character
   98B9 BD 94 22            826 	jsr	q$nxtgos
   98BC 20 EC               827 	bra	1$
                            828 
   98BE 6E D9 00 D2         829 4$:	jmp	[hvc$gosub,u]		; return in line
                            830 
                            831 
   98C2                     832 csts$scn:
   98C2 EC E1               833 	ldd	,s++
   98C4 DD D2               834 	std	*hvc$gosub		; save return
   98C6 0F E9               835 	clr	*hvc$csts		; clear readout status
                            836 
   98C8 96 2F               837 1$:	lda	*char			; a character ?
   98CA 26 05               838 	bne	2$			; yes process it
   98CC BD 83 1A            839 	jsr	tt_inp			; else try to get one
   98CF 27 0E               840 	beq	4$			; none - skip
   98D1 81 20               841 2$:	cmpa	#(' )			; scan until past characters
   98D3 25 11               842 	blo	5$			; CR / LF terminates scan
   98D5 81 5A               843 	cmpa	#'Z			; Zeroed channel ?
   98D7 27 04               844 	beq	3$
   98D9 81 46               845 	cmpa	#'F			; Failed channel ?
   98DB 26 02               846 	bne	4$
   98DD 97 E9               847 3$:	sta	*hvc$csts		; save csts
   98DF 0F 2F               848 4$:	clr	*char			; clear the character
   98E1 BD 94 22            849 	jsr	q$nxtgos
   98E4 20 E2               850 	bra	1$
                            851 
   98E6 6E D9 00 D2         852 5$:	jmp	[hvc$gosub,u]		; return in line
                            853 
                            854 
                            855 	; Scan string for ZERO / FAIL / voltage string
                            856 	;
                            857 	;	return - 'C' set if ZERO / FAIL
                            858 	;	return - 'V' set if not a voltage
                            859 	;	return - 'C' and 'V' clear if a voltage string
                            860 	;
                            861 	;	return - voltage in d
                            862 
   98EA                     863 vltg$scn:
   98EA EC E1               864 	ldd	,s++
   98EC DD D2               865 	std	*hvc$gosub		; save return
   98EE 0F E6               866 	clr	*hvc$cntr		; clear counter
                            867 
   98F0 96 2F               868 1$:	lda	*char			; a character ?
   98F2 26 05               869 	bne	2$			; yes process it
   98F4 BD 83 1A            870 	jsr	tt_inp			; else try to get one
   98F7 27 15               871 	beq	4$			; none - skip
   98F9 81 20               872 2$:	cmpa	#(' )
   98FB 22 01               873 	bhi	3$			; space or CR / LF terminates scan
   98FD 4F                  874 	clra
   98FE 30 C9 00 D6         875 3$:	leax	hvc$strng,u		; buffer
   9902 D6 E6               876 	ldb	*hvc$cntr		; position
   9904 A7 85               877 	sta	b,x			; '0' is end of scan
   9906 27 0D               878 	beq	5$
   9908 C1 04               879 	cmpb	#4			; no more than 4 digits
   990A 24 02               880 	bhis	4$
ASxxxx Assembler V02.21  (Motorola 6809), page 22.
PHS Constant definitions
TT_INP Scanning Functions

   990C 0C E6               881 	inc	*hvc$cntr		; update position
   990E 0F 2F               882 4$:	clr	*char			; clear the character
   9910 BD 94 22            883 	jsr	q$nxtgos
   9913 20 DB               884 	bra	1$
                            885 
   9915 8E 8C 16            886 5$:	ldx	#acqvtbl		; pointer to variables
   9918 D6 D1               887 	ldb	*que$chnl
   991A 58                  888 	aslb
   991B 30 95               889 	leax	[b,x]
                            890 	
   991D 34 30               891 	pshs	x,y
   991F 30 C9 00 D6         892 6$:	leax	hvc$strng,u		; buffer
   9923 10 8E 99 94         893 	ldy	#16$			; ZERO ?
   9927 C6 04               894 	ldb	#4			; position
   9929 A6 80               895 7$:	lda	,x+
   992B A1 A0               896 	cmpa	,y+
   992D 26 09               897 	bne	8$
   992F 5A                  898 	decb
   9930 2E F7               899 	bgt	7$
                            900 
   9932 35 30               901 	puls	x,y
   9934 86 03               902 	lda	#$HVZERO		; ZERO -> Zero
   9936 20 17               903 	bra	10$
                            904 
   9938 30 C9 00 D6         905 8$:	leax	hvc$strng,u		; buffer
   993C 10 8E 99 99         906 	ldy	#17$			; FAIL ?
   9940 C6 04               907 	ldb	#4			; position
   9942 A6 80               908 9$:	lda	,x+
   9944 A1 A0               909 	cmpa	,y+
   9946 26 1F               910 	bne	12$
   9948 5A                  911 	decb
   9949 2E F7               912 	bgt	9$
                            913 
   994B 35 30               914 	puls	x,y
   994D 86 04               915 	lda	#$HVFAIL		; FAIL -> Fail
                            916 
   994F A7 89 00 12         917 10$:	sta	hv$sts,x
   9953 A6 89 00 03         918 	lda	acq$sts,x
   9957 27 06               919 	beq	11$
   9959 8A 04               920 	ora	#$HOLD			; implicit HOLD
   995B A7 89 00 03         921 	sta	acq$sts,x
                            922 
   995F 4F                  923 11$:	clra				; ZERO / FAIL
   9960 5F                  924 	clrb
   9961 1A 01               925 	sec
   9963 6E D9 00 D2         926 	jmp	[hvc$gosub,u]		; return in line
                            927 
   9967 30 C9 00 D6         928 12$:	leax	hvc$strng,u		; buffer
   996B A6 80               929 13$:	lda	,x+
   996D 27 0A               930 	beq	14$
   996F 81 30               931 	cmpa	#'0
   9971 25 17               932 	blo	15$
   9973 81 39               933 	cmpa	#'9
   9975 22 13               934 	bhi	15$
   9977 20 F2               935 	bra	13$
                            936 
ASxxxx Assembler V02.21  (Motorola 6809), page 23.
PHS Constant definitions
TT_INP Scanning Functions

   9979 30 C9 00 D6         937 14$:	leax	hvc$strng,u		; buffer
   997D BD E3 34            938 	jsr	a$d$i			; convert to integer
   9980 35 30               939 	puls	x,y
   9982 1C FE               940 	clc				; a voltage
   9984 1C FD               941 	clv
   9986 6E D9 00 D2         942 	jmp	[hvc$gosub,u]		; return in line
                            943 
   998A 35 30               944 15$:	puls	x,y
   998C 4F                  945 	clra				; not a voltage
   998D 5F                  946 	clrb
   998E 1A 02               947 	sev
   9990 6E D9 00 D2         948 	jmp	[hvc$gosub,u]		; return in line
                            949 	
                            950 
   9994 5A 45 52 4F 00      951 16$:	.asciz	"ZERO"
   9999 46 41 49 4C 00      952 17$:	.asciz	"FAIL"
                            953 
                            954 
                            955 	; Save the voltage update and current time in the
                            956 	; acquisition array for this channel.
                            957 
   999E                     958 vltg$sav:
   999E 34 16               959 	pshs	d,x
                            960 
   99A0 96 D1               961 	lda	*que$chnl		; channel
   99A2 48                  962 	asla
   99A3 8E 8C 16            963 	ldx	#acqvtbl		; variables this channel
   99A6 30 96               964 	leax	[a,x]
   99A8 E6 89 00 14         965 	ldb	hv$index,x		; current index
   99AC 34 04               966 	pshs	b			; save
   99AE 5C                  967 	incb
   99AF C4 3F               968 	andb	#0x3F			; mod 64
   99B1 E7 89 00 14         969 	stb	hv$index,x		; next index
   99B5 8E 8B D4            970 	ldx	#acqbtbl		; buffers this channel
   99B8 30 96               971 	leax	[a,x]
   99BA 35 04               972 	puls	b			; array index
   99BC 58                  973 	aslb
   99BD 30 85               974 	leax	b,x			; offset into buffer
   99BF EC E4               975 	ldd	,s			; high voltage
   99C1 ED 89 01 00         976 	std	acq$vltg,x
   99C5 B6 37 22            977 	lda	days			; compute time
   99C8 C6 05               978 	ldb	#0d5			; 1440. * days
   99CA 3D                  979 	mul				; days <= 44.
   99CB 1E 89               980 	exg	a,b
   99CD ED E3               981 	std	,--s
   99CF B6 37 22            982 	lda	days
   99D2 C6 A0               983 	ldb	#0d160
   99D4 3D                  984 	mul
   99D5 E3 E4               985 	addd	,s
   99D7 ED E4               986 	std	,s
   99D9 B6 37 21            987 	lda	hours
   99DC C6 3C               988 	ldb	#0d60			; 60. * hours
   99DE 3D                  989 	mul
   99DF E3 E1               990 	addd	,s++
   99E1 FB 37 20            991 	addb	minutes
   99E4 89 00               992 	adca	#0
ASxxxx Assembler V02.21  (Motorola 6809), page 24.
PHS Constant definitions
TT_INP Scanning Functions

   99E6 ED 89 01 80         993 	std	acq$time,x		; current time
                            994 
   99EA 35 16               995 	puls	d,x
   99EC 39                  996 	rts
                            997 
                            998 
   99ED                     999 hv$cmnd:
   99ED 9A 05 9A 06 9A 0B  1000 	.word	1$,2$,3$,4$,5$,6$,7$,8$,9$,10$,11$,12$
        9A 10 9A 15 9A 1A
        9A 1F 9A 25 9A 2B
        9A 32 9A 39 9A 3F
                           1001 
   9A05 00                 1002 1$:	.asciz	""			; not a command
   9A06 4D 31 36 46 00     1003 2$:	.asciz	"M16F"			; HV-OFF
   9A0B 4D 31 36 4E 00     1004 3$:	.asciz	"M16N"			; HV-ON
   9A10 4D 31 36 53 00     1005 4$:	.asciz	"M16S"			; Status
   9A15 4D 31 36 44 00     1006 5$:	.asciz	"M16D"			; Demand settings
   9A1A 4D 31 36 56 00     1007 6$:	.asciz	"M16V"			; Voltage readings
   9A1F 4D 31 36 43        1008 7$:	.ascii	"M16C"			; Get voltage
   9A23 80                 1009 	.byte	0q200
   9A24 00                 1010 	.asciz	""
   9A25 4D 31 36 43        1011 8$:	.ascii	"M16C"			; Set voltage
   9A29 80                 1012 	.byte	0q200
   9A2A 00                 1013 	.asciz	""
   9A2B 4D 31 36 43        1014 9$:	.ascii	"M16C"			; Zero voltage
   9A2F 80                 1015 	.byte	0q200
   9A30 5A 00              1016 	.asciz	"Z"
   9A32 4D 31 36 43        1017 10$:	.ascii	"M16C"			; Restore voltage
   9A36 80                 1018 	.byte	0q200
   9A37 52 00              1019 	.asciz	"R"
   9A39 4D 31 36 43        1020 11$:	.ascii	"M16C"			; Update voltage
   9A3D 80                 1021 	.byte	0q200
   9A3E 00                 1022 	.asciz	""
   9A3F 00                 1023 12$:	.asciz	""			; not a command
                           1024 
                           1025 
   9A40                    1026 hvc$optn::
   9A40 9A 70 9A 8A 9A A4  1027 	.word	1$,2$,3$,4$,5$,6$,7$,8$,9$,10$,11$,12$
        9A BE 9A D8 9A F2
        9B 0C 9B 26 9B 40
        9B 5A 9B 74 9B 8E
   9A58 9B A8 9B C2 9B DC  1028 	.word	13$,14$,15$,16$,17$,18$,19$,20$,21$,22$,23$,24$
        9B F6 9C 10 9C 2A
        9C 44 9C 5E 9C 78
        9C 92 9C AC 9C C6
                           1029 
   9A70 20 20 20 20 20 20  1030 1$:	.asciz	"                         "	; ok
        20 20 20 20 20 20
        20 20 20 20 20 20
        20 20 20 20 20 20
        20 00
   9A8A 20 53 65 6E 64 69  1031 2$:	.asciz	" Sending HV-OFF Command  "	; HV-OFF
        6E 67 20 48 56 2D
        4F 46 46 20 43 6F
        6D 6D 61 6E 64 20
        20 00
ASxxxx Assembler V02.21  (Motorola 6809), page 25.
PHS Constant definitions
TT_INP Scanning Functions

   9AA4 20 53 65 6E 64 69  1032 3$:	.asciz	" Sending HV-ON Command   "	; HV-ON
        6E 67 20 48 56 2D
        4F 4E 20 43 6F 6D
        6D 61 6E 64 20 20
        20 00
   9ABE 20 20 20 52 65 61  1033 4$:	.asciz	"   Reading HV-Status     "	; Status
        64 69 6E 67 20 48
        56 2D 53 74 61 74
        75 73 20 20 20 20
        20 00
   9AD8 20 20 52 65 61 64  1034 5$:	.asciz	"  Reading Demand Values  "	; Demand settings
        69 6E 67 20 44 65
        6D 61 6E 64 20 56
        61 6C 75 65 73 20
        20 00
   9AF2 20 52 65 61 64 69  1035 6$:	.asciz	" Reading Voltage Levels  "	; Voltage readings
        6E 67 20 56 6F 6C
        74 61 67 65 20 4C
        65 76 65 6C 73 20
        20 00
   9B0C 20 52 65 61 64 69  1036 7$:	.asciz	" Reading Channel Voltage "	; Get voltage
        6E 67 20 43 68 61
        6E 6E 65 6C 20 56
        6F 6C 74 61 67 65
        20 00
   9B26 20 53 65 74 74 69  1037 8$:	.asciz	" Setting Channel Voltage "	; Set voltage
        6E 67 20 43 68 61
        6E 6E 65 6C 20 56
        6F 6C 74 61 67 65
        20 00
   9B40 20 20 20 20 20 5A  1038 9$:	.asciz	"     Zeroing Channel     "	; Zero voltage
        65 72 6F 69 6E 67
        20 43 68 61 6E 6E
        65 6C 20 20 20 20
        20 00
   9B5A 20 20 20 20 52 65  1039 10$:	.asciz	"    Restoring Channel    "	; Restore voltage
        73 74 6F 72 69 6E
        67 20 43 68 61 6E
        6E 65 6C 20 20 20
        20 00
   9B74 20 50 2E 48 2E 53  1040 11$:	.asciz	" P.H.S. Updating Channel "	; PHS Updating
        2E 20 55 70 64 61
        74 69 6E 67 20 43
        68 61 6E 6E 65 6C
        20 00
   9B8E 20 20 20 20 20 20  1041 12$:	.asciz	"                         "	; Wait
        20 20 20 20 20 20
        20 20 20 20 20 20
        20 20 20 20 20 20
        20 00
                           1042 
                    000C   1043 	HVC$ERR	= 0d12				; error offset
                           1044 
   9BA8 20 20 20 20 20 20  1045 13$:	.asciz	"                         "	; ok
        20 20 20 20 20 20
        20 20 20 20 20 20
        20 20 20 20 20 20
        20 00
ASxxxx Assembler V02.21  (Motorola 6809), page 26.
PHS Constant definitions
TT_INP Scanning Functions

   9BC2 20 20 20 20 20 48  1046 14$:	.asciz	"     HV-OFF  Failed      "	; HV-OFF
        56 2D 4F 46 46 20
        20 46 61 69 6C 65
        64 20 20 20 20 20
        20 00
   9BDC 20 20 20 20 20 48  1047 15$:	.asciz	"     HV-ON  Failed       "	; HV-ON
        56 2D 4F 4E 20 20
        46 61 69 6C 65 64
        20 20 20 20 20 20
        20 00
   9BF6 20 20 20 20 48 56  1048 16$:	.asciz	"    HV-Status Failed     "	; Status
        2D 53 74 61 74 75
        73 20 46 61 69 6C
        65 64 20 20 20 20
        20 00
   9C10 20 20 44 65 6D 61  1049 17$:	.asciz	"  Demand Readout Failed  "	; Demand settings
        6E 64 20 52 65 61
        64 6F 75 74 20 46
        61 69 6C 65 64 20
        20 00
   9C2A 20 56 6F 6C 74 61  1050 18$:	.asciz	" Voltage Readout Failed  "	; Voltage readings
        67 65 20 52 65 61
        64 6F 75 74 20 46
        61 69 6C 65 64 20
        20 00
   9C44 20 20 20 52 65 61  1051 19$:	.asciz	"   Read Voltage Failed   "	; Get voltage
        64 20 56 6F 6C 74
        61 67 65 20 46 61
        69 6C 65 64 20 20
        20 00
   9C5E 20 20 20 53 65 74  1052 20$:	.asciz	"   Set Voltage Failed    "	; Set voltage
        20 56 6F 6C 74 61
        67 65 20 46 61 69
        6C 65 64 20 20 20
        20 00
   9C78 20 20 20 20 20 20  1053 21$:	.asciz	"      Zero Failed        "	; Zero voltage
        5A 65 72 6F 20 46
        61 69 6C 65 64 20
        20 20 20 20 20 20
        20 00
   9C92 20 20 20 20 20 52  1054 22$:	.asciz	"     Restore Failed      "	; Restore voltage
        65 73 74 6F 72 65
        20 46 61 69 6C 65
        64 20 20 20 20 20
        20 00
   9CAC 20 50 2E 48 2E 53  1055 23$:	.asciz	" P.H.S. Updating Failed  "	; PHS Updating
        2E 20 55 70 64 61
        74 69 6E 67 20 46
        61 69 6C 65 64 20
        20 00
   9CC6 20 20 20 20 20 20  1056 24$:	.asciz	"                         "	; Wait
        20 20 20 20 20 20
        20 20 20 20 20 20
        20 20 20 20 20 20
        20 00
                           1057 
