ASxxxx Assembler V02.21  (Motorola 6809), page 1.
PHS Constant definitions
Screen Selector

                              1 	.sbttl	Screen Selector
                              2 
                              3 	.module	select
                              4 
ASxxxx Assembler V02.21  (Motorola 6809), page 2.
PHS Constant definitions
Screen Selector

                              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	SELECT
                              9 
   A0BF                      10 sel$scrn::
   A0BF DC 41                11 	ldd	*scrn$sts	; screen status
   A0C1 2A 23                12 	bpl	2$		; inactive - skip
   A0C3 84 0F                13 	anda	#0x0F		; mask to screen select
   A0C5 27 18                14 	beq	1$		; if slc$scrn - skip
   A0C7 48                   15 	asla
   A0C8 81 14                16 	cmpa	#4$-3$		; valid screen ?
   A0CA 24 1A                17 	bhis	2$		; no - skip
   A0CC 8E A0 E7             18 	ldx	#3$		; screen execution list
   A0CF AD 96                19 	jsr	[a,x]		; execute routine
                             20 
   A0D1 0D 47                21 	tst	*s$state	; exiting from a screen ?
   A0D3 26 11                22 	bne	2$		; no - skip
   A0D5 0F 2F                23 	clr	*char		; no character
   A0D7 96 41                24 	lda	*scrn$sts	; screen #
   A0D9 84 F0                25 	anda	#~0x0F
   A0DB 97 41                26 	sta	*scrn$sts
   A0DD 20 E0                27 	bra	sel$scrn	; else - rescan
                             28 
   A0DF AD 9C 05             29 1$:	jsr	[3$,pcr]	; selection screen
   A0E2 0D 47                30 	tst	*s$state	; exiting to a screen ?
   A0E4 27 D9                31 	beq	sel$scrn	; yes - loop
                             32 
   A0E6 39                   33 2$:	rts
                             34 
                             35 	; Forground Screen Update List
                             36 
   A0E7 A0 FB                37 3$:	.word	slc$scrn	; selection screen
   A0E9 A5 26                38 	.word	sph$scrn	; P.H.S. status screen
   A0EB AB 25                39 	.word	chn$scrn	; channel control / status screen
   A0ED B9 09                40 	.word	phs$scrn	; pulse height screen
   A0EF BA C9                41 	.word	avg$scrn	; average pulse height screen
   A0F1 B3 C7                42 	.word	prm$scrn	; stabilization parameters screen
   A0F3 A7 BA                43 	.word	shv$scrn	; HV4032A status screen
   A0F5 BC 3A                44 	.word	hvh$scrn	; high voltage histo screen
   A0F7 B1 86                45 	.word	hvu$scrn	; high voltage update screen
   A0F9 C1 A9                46 	.word	hlp$scrn	; setup / help screens
   A0FB                      47 4$:
                             48 
ASxxxx Assembler V02.21  (Motorola 6809), page 7.
PHS Constant definitions
Update Variables

                             50 	.sbttl	Update Variables
                             51 
                             52 	.area	BUFSAV
                             53 
   371E                      54 tics::		.blkb	0d1	; tics
   371F                      55 seconds::	.blkb	0d1	; seconds
   3720                      56 minutes::	.blkb	0d1	; minutes
   3721                      57 hours::		.blkb	0d1	; hours
   3722                      58 days::		.blkb	0d1	; days
   3723                      59 pri$low::	.blkb	0d1	; low priority active flag
                             60 
                             61 
                             62 	.area	SCRNUPDT
                             63 
   D619                      64 upd$scrn::
   D619 7C 37 1E             65 	inc	tics
   D61C 86 78                66 	lda	#0d120		; ~ 120 tics per second
   D61E B1 37 1E             67 	cmpa	tics
   D621 22 37                68 	bhi	1$
   D623 7F 37 1E             69 	clr	tics
                             70 	
   D626 7C 37 1F             71 	inc	seconds
   D629 86 3C                72 	lda	#0d60
   D62B B1 37 1F             73 	cmpa	seconds
   D62E 22 2A                74 	bhi	1$
   D630 7F 37 1F             75 	clr	seconds
                             76 
   D633 7C 37 20             77 	inc	minutes
   D636 86 3C                78 	lda	#0d60
   D638 B1 37 20             79 	cmpa	minutes
   D63B 22 1D                80 	bhi	1$
   D63D 7F 37 20             81 	clr	minutes
                             82 
   D640 7C 37 21             83 	inc	hours
   D643 86 18                84 	lda	#0d24
   D645 B1 37 21             85 	cmpa	hours
   D648 22 10                86 	bhi	1$
   D64A 7F 37 21             87 	clr	hours
                             88 
   D64D 7C 37 22             89 	inc	days		; maximum is 44/23:59
   D650 86 2D                90 	lda	#0d45
   D652 B1 37 22             91 	cmpa	days
   D655 22 03                92 	bhi	1$
   D657 7F 37 22             93 	clr	days
                             94 
                             95 	; High Priority Acquisition
                             96 
   D65A BD 8D B8             97 1$:	jsr	chan$upd	; do acquisition / LED panel
                             98 
                             99 	; Low Priority Routines
                            100 
   D65D 7D 37 23            101 	tst	pri$low		; busy ?
   D660 26 2D               102 	bne	3$		; yes - skip
                            103 
   D662 7C 37 23            104 	inc	pri$low		; busy
   D665 34 01               105 	pshs	cc
ASxxxx Assembler V02.21  (Motorola 6809), page 8.
PHS Constant definitions
Update Variables

   D667 1C AF               106 	andcc	#0q257		; enable interrupts
                            107 
   D669 BD 93 38            108 	jsr	que$proc	; process the HV queue/port
                            109 
   D66C CE 10 00            110 	ldu	#port0		; local port
   D66F BD 9F E9            111 	jsr	outblk
   D672 CE 22 00            112 	ldu	#port1		; remote port
   D675 BD 9F E9            113 	jsr	outblk
                            114 
   D678 7D 37 1E            115 	tst	tics		; 1 second routines
   D67B 26 0D               116 	bne	2$
                            117 
   D67D BD 92 58            118 	jsr	led$comp	; LED temperature compensation
                            119 
                            120 	; Specific Screen Update Routines
                            121 
   D680 CE 10 00            122 	ldu	#port0		; local port
   D683 8D 0B               123 	bsr	4$
   D685 CE 22 00            124 	ldu	#port1		; remote port
   D688 8D 06               125 	bsr	4$
                            126 
   D68A 35 01               127 2$:	puls	cc
   D68C 7F 37 23            128 	clr	pri$low		; not busy
                            129 
   D68F 39                  130 3$:	rts
                            131 
   D690 1F 30               132 4$:	tfr	u,d		; setup dp
   D692 1F 8B               133 	tfr	a,dp
   D694 DC 41               134 	ldd	*scrn$sts	; screen status
   D696 2A 0C               135 	bpl	5$		; inactive - exit
   D698 84 0F               136 	anda	#0x0F		; mask to screen select
   D69A 48                  137 	asla
   D69B 81 14               138 	cmpa	#7$-6$		; valid screen
   D69D 24 05               139 	bhis	5$		; no - skip
   D69F 8E D6 A5            140 	ldx	#6$		; screen execution list
   D6A2 AD 96               141 	jsr	[a,x]		; execute routine
   D6A4 39                  142 5$:	rts
                            143 
                            144 	; Background Screen Update List
                            145 
   D6A5 D6 A4               146 6$:	.word	5$		; screen 0
   D6A7 D6 B9               147 	.word	sph$updt	; screen 1
   D6A9 D9 DA               148 	.word	chn$updt	; screen 2
   D6AB DD 83               149 	.word	phs$hst		; screen 3
   D6AD DF 38               150 	.word	avg$hst		; screen 4
   D6AF DD 20               151 	.word	prm$updt	; screen 5
   D6B1 D8 99               152 	.word	shv$updt	; screen 6
   D6B3 E1 35               153 	.word	hvh$hst		; screen 7
   D6B5 DC 2A               154 	.word	hvu$updt	; screen 8
   D6B7 D6 A4               155 	.word	5$		; screen 9
   D6B9                     156 7$:
                            157 
ASxxxx Assembler V02.21  (Motorola 6809), page 9.
PHS Constant definitions
Channel Status Screen

                            159 	.sbttl	Channel Status Screen
                            160 
                            161 	.area	SCREEN
                            162 
   A0FB                     163 slc$scrn::
   A0FB 34 36               164 	pshs	d,x,y
                            165 
   A0FD D6 47               166 1$:	ldb	*s$state	; check state
   A0FF 27 14               167 	beq	3$
   A101 96 2F               168 	lda	*char
   A103 81 17               169 	cmpa	#CTRLW		; redraw screen ?
   A105 26 06               170 	bne	2$
   A107 6F E4               171 	clr	,s		; CTRLW seen
   A109 C6 01               172 	ldb	#1
   A10B D7 47               173 	stb	*s$state	; new state
   A10D 58                  174 2$:	aslb
   A10E C1 08               175 	cmpb	#5$-4$		; check for valid state
   A110 25 03               176 	blo	3$
   A112 5F                  177 	clrb
   A113 D7 47               178 	stb	*s$state
   A115 8E A1 1A            179 3$:	ldx	#4$
   A118 6E 95               180 	jmp	[b,x]
                            181 
   A11A A1 22 A1 30 A1 38   182 4$:	.word	5$,7$,8$,9$
        A1 42
                            183 
   A122 DC 43               184 5$:	ldd	*slc$optp	; get last position
   A124 26 03               185 	bne	6$		; if none - use default
   A126 FC A2 6C            186 	ldd	r$slc1		; default option position
   A129 BD A3 DD            187 6$:	jsr	init$opt
   A12C DD 45               188 	std	*scrn$pos
   A12E 0C 47               189 	inc	*s$state	; next state
                            190 
   A130 BD A3 AF            191 7$:	jsr	clr$scrn	; clear the screen
   A133 BD A1 5B            192 	jsr	slc$page	; do page outline
   A136 0C 47               193 	inc	*s$state	; next state
                            194 
   A138 BD A2 4D            195 8$:	jsr	slc$lgnd	; load up legends
   A13B DC 45               196 	ldd	*scrn$pos	; reload cursor position
   A13D BD A3 CA            197 	jsr	pos$scrn
   A140 0C 47               198 	inc	*s$state	; next state
                            199 
   A142 96 2F               200 9$:	lda	*char
   A144 BD A4 81            201 	jsr	scn$scrl	; try scrolling to a new option
   A147 97 2F               202 	sta	*char
   A149 26 08               203 	bne	10$
   A14B 96 72               204 	lda	*opt$posn	; save the option position
   A14D C6 19               205 	ldb	#$SLCPOS
   A14F DD 43               206 	std	*slc$optp
   A151 20 05               207 	bra	11$
   A153 BD A3 95            208 10$:	jsr	slc$slct	; try selecting a new screen
   A156 97 2F               209 	sta	*char
                            210 
   A158 35 36               211 11$:	puls	d,x,y
   A15A 39                  212 	rts
                            213 
ASxxxx Assembler V02.21  (Motorola 6809), page 10.
PHS Constant definitions
Channel Status Screen

                            214 
                            215 	; slc$scrn  Page Outline
                            216 
   A15B                     217 slc$page::
   A15B 10 8E A1 70         218 	ldy	#3$
   A15F EC A1               219 1$:	ldd	,y++
   A161 AE A1               220 	ldx	,y++
   A163 27 05               221 	beq	2$
   A165 BD 9D 9A            222 	jsr	fmthtxt
   A168 20 F5               223 	bra	1$
                            224 
                            225 	; fill in unit number
                            226 
   A16A DC 74               227 2$:	ldd	*fmtrow		; end of last entry
   A16C BD A5 0A            228 	jsr	scn$unit
   A16F 39                  229 	rts
                            230 
                            231 
   A170 00 1E               232 3$:	.byte	SCRNTP+0d0,	0d30
   A172 A1 8C               233 	.word	4$
   A174 13 18               234 	.byte	SCRNTP+0d19,	0d24
   A176 A1 AB               235 	.word	6$
   A178 14 12               236 	.byte	SCRNTP+0d20,	0d18
   A17A A1 C9               237 	.word	7$
   A17C 15 12               238 	.byte	SCRNTP+0d21,	0d18
   A17E A1 F3               239 	.word	8$
   A180 16 10               240 	.byte	SCRNTP+0d22,	0d16
   A182 A2 1D               241 	.word	9$
   A184 0F 1E               242 	.byte	SCRNTP+0d15,	0d30		; unit number
   A186 A1 9C               243 	.word	5$
   A188 00 00               244 	.byte	0,		0		; end of list
   A18A 00 00               245 	.word	0
                            246 
   A18C 50 2E 48 2E 53 2E   247 4$:	.asciz	              "P.H.S.   System"
        20 20 20 53 79 73
        74 65 6D 00
                            248 
   A19C 50 2E 48 2E 53 2E   249 5$:	.asciz		      "P.H.S. Unit # "
        20 55 6E 69 74 20
        23 20 00
                            250 
   A1AB 5E 57 20 28 63 6F   251 6$:	.asciz	        "^W (control-W) redraws screen"
        6E 74 72 6F 6C 2D
        57 29 20 72 65 64
        72 61 77 73 20 73
        63 72 65 65 6E 00
   A1C9 55 73 65 20 55 50   252 7$:	.asciz	  "Use UP / DOWN Arrows to move to an option"
        20 2F 20 44 4F 57
        4E 20 41 72 72 6F
        77 73 20 74 6F 20
        6D 6F 76 65 20 74
        6F 20 61 6E 20 6F
        70 74 69 6F 6E 00
   A1F3 53 65 6C 65 63 74   253 8$:	.asciz	  "Select option with the keypad 'ENTER' key"
        20 6F 70 74 69 6F
        6E 20 77 69 74 68
        20 74 68 65 20 6B
        65 79 70 61 64 20
        27 45 4E 54 45 52
        27 20 6B 65 79 00
ASxxxx Assembler V02.21  (Motorola 6809), page 11.
PHS Constant definitions
Channel Status Screen

   A21D 54 65 72 6D 69 6E   254 9$:	.asciz	"Terminate option entry with 'RETURN' or 'ENTER'"
        61 74 65 20 6F 70
        74 69 6F 6E 20 65
        6E 74 72 79 20 77
        69 74 68 20 27 52
        45 54 55 52 4E 27
        20 6F 72 20 27 45
        4E 54 45 52 27 00
                            255 
                            256 
                            257 	;
                            258 	; slc$scrn Legends
                            259 	;
                            260 
   A24D                     261 slc$lgnd::
   A24D 34 10               262 	pshs	x
                            263 
   A24F 8E A2 58            264 	ldx	#1$
   A252 BD A4 B4            265 	jsr	scn$lgnd	; do legends
                            266 
   A255 35 10               267 	puls	x
   A257 39                  268 	rts
                            269 
                            270 	; Channel Control
                            271 
   A258 A2 6C A2 72 A2 78   272 1$:	.word	r$slc1,	r$slc2,	r$slc3,	r$slc4,	r$slc5
        A2 7E A2 84
   A262 A2 8A A2 90 A2 96   273 	.word	r$slc6,	r$slc7, r$slc8, r$slc9,	0
        A2 9C 00 00
                            274 
                    0019    275 	$SLCPOS  =  0d25
                            276 
                            277 	;	row		column		video		option
                            278 	;-------------------------------------------------------------
   A26C                     279 r$slc1:
   A26C 03 19 80 01         280 	.byte	SCRNTP+0d3,	$SLCPOS,	REVERSE,	1
   A270 A2 A2               281 	.word	2$		; "P.H.S. System Status"
                    0177    282 r$slc2	= .
   A272 04 19 80 02         283 	.byte	SCRNTP+0d4,	$SLCPOS,	REVERSE,	2
   A276 A2 BD               284 	.word	3$		; "Channel Control / Status"
                    017D    285 r$slc3	= .
   A278 05 19 80 03         286 	.byte	SCRNTP+0d5,	$SLCPOS,	REVERSE,	3
   A27C A2 D8               287 	.word	4$		; "Pulse Height Spectra"
                    0183    288 r$slc4	= .
   A27E 06 19 80 04         289 	.byte	SCRNTP+0d6,	$SLCPOS,	REVERSE,	4
   A282 A2 F3               290 	.word	5$		; "Pulse Height Averages"
                    0189    291 r$slc5	= .
   A284 07 19 80 05         292 	.byte	SCRNTP+0d7,	$SLCPOS,	REVERSE,	5
   A288 A3 0E               293 	.word	6$		; "Stabilization Parameters"
                    018F    294 r$slc6	= .
   A28A 08 19 80 06         295 	.byte	SCRNTP+0d8,	$SLCPOS,	REVERSE,	6
   A28E A3 29               296 	.word	7$		; "HV4032A Status"
                    0195    297 r$slc7	= .
   A290 09 19 80 07         298 	.byte	SCRNTP+0d9,	$SLCPOS,	REVERSE,	7
   A294 A3 44               299 	.word	8$		; "High Voltage Histograms"
                    019B    300 r$slc8	= .
ASxxxx Assembler V02.21  (Motorola 6809), page 12.
PHS Constant definitions
Channel Status Screen

   A296 0A 19 80 08         301 	.byte	SCRNTP+0d10,	$SLCPOS,	REVERSE,	8
   A29A A3 5F               302 	.word	9$		; "High Voltage Updates"
                    01A1    303 r$slc9	= .
   A29C 0B 19 80 09         304 	.byte	SCRNTP+0d11,	$SLCPOS,	REVERSE,	9
   A2A0 A3 7A               305 	.word	10$		; "Setup and Help"
                            306 
                            307 ;          1111111111222222222233333333334444444444555555555566666666667
                            308 ;01234567890123456789012345678901234567890123456789012345678901234567890
   A2A2 20 20 20 50 2E 48   309 2$:	.asciz		 "   P.H.S. System Status   "	; 1
        2E 53 2E 20 53 79
        73 74 65 6D 20 53
        74 61 74 75 73 20
        20 20 00
   A2BD 20 43 68 61 6E 6E   310 3$:	.asciz	         " Channel Control / Status "	; 2
        65 6C 20 43 6F 6E
        74 72 6F 6C 20 2F
        20 53 74 61 74 75
        73 20 00
   A2D8 20 20 20 50 75 6C   311 4$:	.asciz	         "   Pulse Height Spectra   "	; 3
        73 65 20 48 65 69
        67 68 74 20 53 70
        65 63 74 72 61 20
        20 20 00
   A2F3 20 20 20 50 75 6C   312 5$:	.asciz	         "   Pulse Height Averages  "	; 4
        73 65 20 48 65 69
        67 68 74 20 41 76
        65 72 61 67 65 73
        20 20 00
   A30E 20 53 74 61 62 69   313 6$:	.asciz		 " Stabilization Parameters "	; 5
        6C 69 7A 61 74 69
        6F 6E 20 50 61 72
        61 6D 65 74 65 72
        73 20 00
   A329 20 20 20 20 20 20   314 7$:	.asciz	         "      HV4032A Status      "	; 6
        48 56 34 30 33 32
        41 20 53 74 61 74
        75 73 20 20 20 20
        20 20 00
   A344 20 20 48 69 67 68   315 8$:	.asciz	         "  High Voltage Histograms "	; 7
        20 56 6F 6C 74 61
        67 65 20 48 69 73
        74 6F 67 72 61 6D
        73 20 00
   A35F 20 20 20 48 69 67   316 9$:	.asciz	         "   High Voltage Updates   "	; 8
        68 20 56 6F 6C 74
        61 67 65 20 55 70
        64 61 74 65 73 20
        20 20 00
   A37A 20 20 20 20 20 20   317 10$:	.asciz	         "      Setup and Help      "	; 9
        53 65 74 75 70 20
        61 6E 64 20 48 65
        6C 70 20 20 20 20
        20 20 00
                            318 
                            319 
                            320 	;
ASxxxx Assembler V02.21  (Motorola 6809), page 13.
PHS Constant definitions
Channel Status Screen

                            321 	; slc$scrn Selection
                            322 	;
                            323 
   A395                     324 slc$slct::
   A395 81 F9               325 	cmpa	#ENTER		; selecting ?
   A397 26 15               326 	bne	1$		; no - exit
                            327 
   A399 34 14               328 	pshs	b,x
   A39B 96 41               329 	lda	*scrn$sts
   A39D 84 F0               330 	anda	#~0x0F		; mask out old screen number
   A39F 30 C9 00 5A         331 	leax	optarray,u	; get option
   A3A3 D6 72               332 	ldb	*opt$posn
   A3A5 AA 85               333 	ora	b,x		; mask in new screen number
   A3A7 97 41               334 	sta	*scrn$sts
   A3A9 0F 47               335 	clr	*s$state	; new screen
   A3AB 4F                  336 	clra			; dump character
   A3AC 35 14               337 	puls	b,x
                            338 
   A3AE 39                  339 1$:	rts
                            340 
                            341 
ASxxxx Assembler V02.21  (Motorola 6809), page 14.
PHS Constant definitions
Screen Utilities

                            343 	.sbttl	Screen Utilities
                            344 
                            345 	; Clear Screen
                            346 
   A3AF                     347 clr$scrn::
   A3AF 34 02               348 	pshs	a
                            349 
   A3B1 34 01               350 	pshs	cc
   A3B3 1A 50               351 	orcc	#0q120		; hold interrupts
   A3B5 96 41               352 	lda	*scrn$sts	; set clear screen bit
   A3B7 8A 40               353 	ora	#0q100
   A3B9 97 41               354 	sta	*scrn$sts
   A3BB 35 01               355 	puls	cc		; restore interrupts
                            356 
   A3BD 0D 41               357 	tst	*scrn$sts
   A3BF 2A 06               358 	bpl	2$		; screen not on - don't wait
   A3C1 86 40               359 1$:	lda	#0q100
   A3C3 95 41               360 	bita	*scrn$sts	; wait for completion
   A3C5 26 FA               361 	bne	1$
   A3C7 35 02               362 2$:	puls	a
   A3C9 39                  363 	rts
                            364 
                            365 
                            366 	; Position Cursor on Screen
                            367 
   A3CA                     368 pos$scrn::
   A3CA 34 06               369 	pshs	d
   A3CC DD 45               370 	std	*scrn$pos	; load position
                            371 
   A3CE 34 01               372 	pshs	cc
   A3D0 1A 50               373 	orcc	#0q120		; hold interrupts
   A3D2 96 41               374 	lda	*scrn$sts	; set position flag
   A3D4 8A 20               375 	ora	#0q040
   A3D6 97 41               376 	sta	*scrn$sts
   A3D8 35 01               377 	puls	cc		; restore interrupts
                            378 
   A3DA 35 06               379 	puls	d
   A3DC 39                  380 	rts
                            381 
                            382 	;
                            383 	;  Initialize the scanning options array
                            384 	;
                            385 
   A3DD                     386 init$opt::
   A3DD 34 16               387 	pshs	d,x
                            388 
   A3DF C6 18               389 	ldb	#SCRNBT-SCRNTP+1
   A3E1 30 C9 00 5A         390 	leax	optarray,u
   A3E5 6F 80               391 1$:	clr	,x+		; clear options list
   A3E7 5A                  392 	decb
   A3E8 2E FB               393 	bgt	1$
                            394 
   A3EA 35 16               395 	puls	d,x
                            396 
   A3EC 5D                  397 	tstb
   A3ED 27 04               398 	beq	2$
ASxxxx Assembler V02.21  (Motorola 6809), page 15.
PHS Constant definitions
Screen Utilities

   A3EF 5A                  399 	decb
   A3F0 27 01               400 	beq	2$
   A3F2 5A                  401 	decb
   A3F3 DD 72               402 2$:	std	*opt$posn	; save default option position
   A3F5 0F 48               403 	clr	*o$state	; no options selected
   A3F7 39                  404 	rts
                            405 
                            406 	;
                            407 	; Return current option display row in a
                            408 	; Return current option number in b
                            409 	;
                            410 
   A3F8                     411 option::
   A3F8 34 10               412 	pshs	x
   A3FA 30 C9 00 5A         413 	leax	optarray,u
   A3FE 96 72               414 	lda	*opt$posn
   A400 E6 86               415 	ldb	a,x
   A402 35 10               416 	puls	x
   A404 39                  417 	rts
                            418 
                            419 
                            420 	; Check for a 'yes' answer
                            421 	;
                            422 	;	eq if yes
                            423 	;	ne if no
                            424 	;
                            425 
   A405                     426 ans$yes::
   A405 96 49               427 	lda	*s$string	; get character
   A407 81 59               428 	cmpa	#'Y
   A409 27 02               429 	beq	1$
   A40B 81 79               430 	cmpa	#'y
   A40D 39                  431 1$:	rts
                            432 
                            433 
                            434 	; Build a string from the input character stream.
                            435 	;
                            436 	; This routine never blocks and returns a NULL
                            437 	; until a terminator is found.
                            438 	;
                            439 	; input:
                            440 	;	a	-	keyboard input
                            441 	;
                            442 	; output:
                            443 	;	a	-	NULL or termination character
                            444 	;
                            445 
   A40E                     446 scn$gets::
   A40E 34 34               447 	pshs	b,x,y
   A410 34 02               448 	pshs	a
                            449 
   A412 30 C9 00 49         450 	leax	s$string,u	; local string buffer
   A416 96 59               451 	lda	*s$strlen
   A418 30 86               452 	leax	a,x		; next string position ,x
   A41A DC 45               453 	ldd	*scrn$pos	; screen
   A41C DD 74               454 	std	*fmtrow
ASxxxx Assembler V02.21  (Motorola 6809), page 16.
PHS Constant definitions
Screen Utilities

   A41E BD 9D 5E            455 	jsr	fmtindex	; next fmtbuf position ,y
                            456 
   A421 35 02               457 	puls	a
                            458 
                            459 	; DEL and BS checks
                            460 
   A423 81 08               461 	cmpa	#0q010		; BS ?
   A425 27 04               462 	beq	1$
   A427 81 7F               463 	cmpa	#0q177		; DEL ?
   A429 26 09               464 	bne	3$
                            465 
   A42B 0D 59               466 1$:	tst	*s$strlen	; any characters ?
   A42D 27 03               467 	beq	2$
   A42F BD A4 74            468 	jsr	13$		; delete a character
   A432 20 39               469 2$:	bra	11$
                            470 
                            471 	; ^U check
                            472 
   A434 81 15               473 3$:	cmpa	#'U & 0x1F	; ^U ?
   A436 26 0C               474 	bne	6$
                            475 
   A438 D6 59               476 	ldb	*s$strlen	; any characters ?
   A43A 27 06               477 	beq	5$
   A43C BD A4 74            478 4$:	jsr	13$		; delete the characters
   A43F 5A                  479 	decb
   A440 2E FA               480 	bgt	4$
   A442 20 29               481 5$:	bra	11$
                            482 
                            483 	; Termination of line
                            484 
   A444 81 0D               485 6$:	cmpa	#0q015		; CR ?
   A446 27 04               486 	beq	7$		; yes - finish up
   A448 81 F9               487 	cmpa	#ENTER		; keypad ENTER ?
   A44A 26 04               488 	bne	8$		; no - skip
                            489 
   A44C 0F 59               490 7$:	clr	*s$strlen	; input done
   A44E 20 1E               491 	bra	12$		; return termination character
                            492 
                            493 	; Any non printing character
                            494 
   A450 81 20               495 8$:	cmpa	#(' )		; any non printing character ?
   A452 2D 06               496 	blt	9$		; yes - just ring BELL
                            497 
                            498 	; Room Check
                            499 
   A454 C6 0F               500 	ldb	#0d16-1		; space ?
   A456 D1 59               501 	cmpb	*s$strlen
   A458 22 07               502 	bhi	10$		; yes - skip
                            503 
   A45A 86 07               504 9$:	lda	#0q007		; BELL
   A45C BD 82 F3            505 	jsr	tt_out
   A45F 20 0C               506 	bra	11$
                            507 
                            508 	; Add a character
                            509 
   A461 A7 80               510 10$:	sta	,x+		; in string
ASxxxx Assembler V02.21  (Motorola 6809), page 17.
PHS Constant definitions
Screen Utilities

   A463 A7 A4               511 	sta	,y		; in buffer
   A465 0C 46               512 	inc	*scrn$pos+1	; forward one space
   A467 0C 59               513 	inc	*s$strlen	; one more character in string
   A469 96 45               514 	lda	*scrn$pos	; make outblk scan this line
   A46B 97 7B               515 	sta	*index
                            516 
                            517 	; Exit
                            518 
   A46D 4F                  519 11$:	clra			; NULL return
                            520 
   A46E 6F 84               521 12$:	clr	,x		; terminate string always
   A470 35 34               522 	puls	b,x,y
   A472 4D                  523 	tsta			; set cc's
   A473 39                  524 	rts
                            525 
                            526 	; Delete Character Routine
                            527 	
   A474 86 20               528 13$:	lda	#(' )		; erase buffer charatcer
   A476 A7 A2               529 	sta	,-y
   A478 0A 46               530 	dec	*scrn$pos+1	; backup up one space
   A47A 0A 59               531 	dec	*s$strlen	; one less character in string
   A47C 96 45               532 	lda	*scrn$pos	; make outblk scan this line
   A47E 97 7B               533 	sta	*index
   A480 39                  534 	rts
                            535 
                            536 
                            537 	;
                            538 	; xxx$scrn  Scroll to next option position
                            539 	;
                            540 
   A481                     541 scn$scrl::
   A481 34 14               542 	pshs	b,x
   A483 30 C9 00 5A         543 	leax	optarray,u	; get current option line
   A487 D6 72               544 	ldb	*opt$posn
                            545 
                            546 	; moving cursor up
                            547 
   A489 81 0B               548 	cmpa	#SCRLU
   A48B 26 0B               549 	bne	2$
   A48D C1 00               550 1$:	cmpb	#SCRNTP
   A48F 27 14               551 	beq	4$
   A491 5A                  552 	decb
   A492 6D 85               553 	tst	b,x
   A494 27 F7               554 	beq	1$
   A496 20 0D               555 	bra	4$
                            556 
                            557 	; moving cursor down
                            558 
   A498 81 E4               559 2$:	cmpa	#SCRLD
   A49A 26 15               560 	bne	6$
   A49C C1 17               561 3$:	cmpb	#SCRNBT
   A49E 27 05               562 	beq	4$
   A4A0 5C                  563 	incb
   A4A1 6D 85               564 	tst	b,x
   A4A3 27 F7               565 	beq	3$
                            566 
ASxxxx Assembler V02.21  (Motorola 6809), page 18.
PHS Constant definitions
Screen Utilities

   A4A5 6D 85               567 4$:	tst	b,x		; new option ?
   A4A7 27 07               568 	beq	5$		; no - exit
   A4A9 D7 72               569 	stb	*opt$posn
                            570 
   A4AB DC 72               571 	ldd	*opt$posn
   A4AD BD A3 CA            572 	jsr	pos$scrn
                            573 
   A4B0 4F                  574 5$:	clra			; character used
                            575 
   A4B1 35 14               576 6$:	puls	b,x
   A4B3 39                  577 	rts			; return position
                            578 
                            579 
ASxxxx Assembler V02.21  (Motorola 6809), page 19.
PHS Constant definitions
Screen Legends

                            581 	.sbttl	Screen Legends
                            582 
                            583 	; This puts the list of legends on the screen
                            584 	;
                            585 	; Enter with x pointing to a list of screen entries.
                            586 	; If the scn$chnl routine is to be used, the last screen
                            587 	; line must must be the "Channel #  " entry.
                            588 
   A4B4                     589 scn$lgnd::
   A4B4 34 26               590 	pshs	d,y
   A4B6 32 7D               591 	leas	-3,s
                            592 
   A4B8 AF 61               593 1$:	stx	1,s
   A4BA AE 84               594 	ldx	,x		; next entry
   A4BC 27 28               595 	beq	5$		; finished
   A4BE EC 81               596 	ldd	,x++		; row/column
   A4C0 BD 9D 5E            597 	jsr	fmtindex
   A4C3 E6 80               598 	ldb	,x+		; video mode
   A4C5 E7 E4               599 	stb	,s
   A4C7 E6 80               600 	ldb	,x+		; option
   A4C9 AE 81               601 	ldx	,x++		; get string address
                            602 
   A4CB A6 80               603 2$:	lda	,x+		; get string character
   A4CD 27 06               604 	beq	3$
   A4CF AA E4               605 	ora	,s		; set NORMAL/REVERSE video
   A4D1 A7 A0               606 	sta	,y+		; place in buffer
   A4D3 20 F6               607 	bra	2$
                            608 
   A4D5 10 9F 76            609 3$:	sty	*findex		; save position
   A4D8 31 C9 00 5A         610 	leay	optarray,u	; save option number
   A4DC 96 74               611 	lda	*fmtrow
   A4DE E7 A6               612 	stb	a,y
   A4E0 AE 61               613 4$:	ldx	1,s
   A4E2 30 02               614 	leax	2,x		; next entry
   A4E4 20 D2               615 	bra	1$
                            616 
   A4E6 32 63               617 5$:	leas	3,s
   A4E8 35 26               618 	puls	d,y
   A4EA 39                  619 	rts
                            620 
                            621 	; Place the channel number on the screen
                            622 
   A4EB                     623 scn$chnl::
   A4EB 34 36               624 	pshs	d,x,y
   A4ED 32 7C               625 	leas	-4,s		; result space
                            626 
   A4EF 1F 41               627 	tfr	s,x		; place output string at ,s
   A4F1 6F E2               628 	clr	,-s		; front termination
   A4F3 D6 42               629 	ldb	*scrn$sts+1	; channel #
   A4F5 BD E3 ED            630 	jsr	i$b$dz		; convert to decimal ascii / zeros suppressed
                            631 				; returns x pointing at string termination
   A4F8 10 9E 76            632 	ldy	*findex		; output position + 1
                            633 
   A4FB A6 82               634 1$:	lda	,-x		; get character
   A4FD 2F 06               635 	ble	2$
   A4FF 8A 80               636 	ora	#0q200		; reverse video !
ASxxxx Assembler V02.21  (Motorola 6809), page 20.
PHS Constant definitions
Screen Legends

   A501 A7 A2               637 	sta	,-y
   A503 20 F6               638 	bra	1$
                            639 
   A505 32 65               640 2$:	leas	5,s		; pop output string
   A507 35 36               641 	puls	d,x,y
   A509 39                  642 	rts
                            643 
                            644 	; Place the unit number on the screen
                            645 
   A50A                     646 scn$unit::
   A50A 34 36               647 	pshs	d,x,y
   A50C BD 9D 5E            648 	jsr	fmtindex	; position to place unit number
                            649 
   A50F 32 7C               650 	leas	-4,s		; result space
                            651 
   A511 1F 41               652 	tfr	s,x		; place output string at ,s
   A513 6F E2               653 	clr	,-s		; front termination
   A515 F6 7F 00            654 	ldb	sys$id		; unit #
   A518 C4 0F               655 	andb	#0x0F
   A51A BD E4 64            656 	jsr	i$b$hz		; convert to hexidecimal / zeros suppressed
                            657 				; returns x pointing at string termination
                            658 
   A51D A6 82               659 	lda	,-x		; get character
   A51F A7 A4               660 	sta	,y
                            661 
   A521 32 65               662 	leas	5,s		; pop output string
   A523 35 36               663 	puls	d,x,y
   A525 39                  664 	rts
                            665 
