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

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

                              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 
                    0040      8 	$HSTWIDTH	==	0d64
                    0001      9 	$HSTROW		==	SCRNTP+1
                    000E     10 	$HSTCOL		==	0d14
                             11 
                             12 	.area	SCREEN
                             13 
                             14 	.sbttl	Pulse Height Spectrum Screen
                             15 
                             16 
   B909                      17 phs$scrn::
   B909 34 36                18 	pshs	d,x,y
                             19 
   B90B D6 47                20 1$:	ldb	*s$state	; check state
   B90D 27 14                21 	beq	3$
   B90F 96 2F                22 	lda	*char
   B911 81 17                23 	cmpa	#CTRLW		; redraw screen ?
   B913 26 06                24 	bne	2$
   B915 6F E4                25 	clr	,s		; CTRLW seen
   B917 C6 01                26 	ldb	#1
   B919 D7 47                27 	stb	*s$state	; new state
   B91B 58                   28 2$:	aslb
   B91C C1 08                29 	cmpb	#5$-4$		; check for valid state
   B91E 25 03                30 	blo	3$
   B920 5F                   31 	clrb
   B921 D7 47                32 	stb	*s$state
   B923 8E B9 28             33 3$:	ldx	#4$
   B926 6E 95                34 	jmp	[b,x]
                             35 
   B928 B9 30 B9 3A B9 62    36 4$:	.word	5$,6$,9$,10$
        B9 6C
                             37 
   B930 FC BF 2E             38 5$:	ldd	r$lin4		; default option position
   B933 BD A3 DD             39 	jsr	init$opt
   B936 DD 45                40 	std	*scrn$pos
   B938 0C 47                41 	inc	*s$state	; next state
                             42 
   B93A BD A3 AF             43 6$:	jsr	clr$scrn	; clear the screen
   B93D BD BD AE             44 	jsr	hst$axis	; draw the axis
                             45 
   B940 0D 48                46 	tst	*o$state	; active options sequence ?
   B942 27 1C                47 	beq	8$		; no - skip
   B944 86 F9                48 	lda	#ENTER		; redo question
   B946 BD C0 12             49 	jsr	hst$ques
   B949 0D 59                50 	tst	*s$strlen	; answer ?
   B94B 27 13                51 	beq	8$		; no - skip
   B94D DC 45                52 	ldd	*scrn$pos	; cursor position
   B94F BD 9D 5E             53 	jsr	fmtindex
   B952 30 C9 00 49          54 	leax	s$string,u	; answer string
   B956 A6 80                55 7$:	lda	,x+		; copy string
   B958 2F 06                56 	ble	8$
   B95A A7 A0                57 	sta	,y+
   B95C 0C 46                58 	inc	*scrn$pos+1	; update cursor position
   B95E 20 F6                59 	bra	7$
                             60 
   B960 0C 47                61 8$:	inc	*s$state	; next state
ASxxxx Assembler V02.21  (Motorola 6809), page 7.
PHS Constant definitions
Pulse Height Spectrum Screen

                             62 
   B962 BD B9 94             63 9$:	jsr	phs$lgnd	; load up legends
   B965 DC 45                64 	ldd	*scrn$pos	; reload cursor position
   B967 BD A3 CA             65 	jsr	pos$scrn
   B96A 0C 47                66 	inc	*s$state	; next state
                             67 
   B96C 0D 48                68 10$:	tst	*o$state	; processing an option ?
   B96E 27 13                69 	beq	11$		; no  - skip
                             70 
   B970 96 2F                71 	lda	*char		; get the character
   B972 BD B9 BD             72 	jsr	phs$optn	; yes - service the option
   B975 97 2F                73 	sta	*char		; character used
                             74 
   B977 0D 47                75 	tst	*s$state	; exit screen ?
   B979 27 16                76 	beq	12$		; yes - doit
                             77 
   B97B 0D 48                78 	tst	*o$state	; processing finished ?
   B97D 10 27 FF 8A          79 	lbeq	1$		; yes - rescan new settup
   B981 20 0E                80 	bra	12$
                             81 
   B983 96 2F                82 11$:	lda	*char
   B985 BD A4 81             83 	jsr	scn$scrl	; try scrolling to a new option
   B988 97 2F                84 	sta	*char
   B98A 27 05                85 	beq	12$
   B98C BD C0 12             86 	jsr	hst$ques	; try selecting an option
   B98F 97 2F                87 	sta	*char
                             88 
   B991 35 36                89 12$:	puls	d,x,y
   B993 39                   90 	rts
                             91 
                             92 
                             93 	;
                             94 	; phs$scrn Legends
                             95 	;
                             96 
   B994                      97 phs$lgnd::
   B994 34 16                98 	pshs	d,x
                             99 
   B996 5F                  100 	clrb			; compute screen entry
   B997 96 42               101 	lda	*scrn$sts+1	; channel #
   B999 81 20               102 	cmpa	#0d32		; valid channel ?
   B99B 22 1D               103 	bhi	3$		; no - exit
   B99D 25 02               104 	blo	1$		; detector
   B99F CB 02               105 	addb	#2		; temperature
   B9A1 48                  106 1$:	asla
   B9A2 8E 8C 16            107 	ldx	#acqvtbl	; acquisition variable table
   B9A5 30 96               108 	leax	[a,x]		; this channel's variables
   B9A7 6D 89 00 0C         109 	tst	phs$vscl,x
   B9AB 2A 02               110 	bpl	2$		; autoscaling
   B9AD CB 04               111 	addb	#4		; scaling
   B9AF 8E BE 38            112 2$:	ldx	#phs$list	; now get list pointer
   B9B2 30 95               113 	leax	[b,x]
                            114 
   B9B4 BD A4 B4            115 	jsr	scn$lgnd	; do legends
   B9B7 BD A4 EB            116 	jsr	scn$chnl	; and channel
                            117 
ASxxxx Assembler V02.21  (Motorola 6809), page 8.
PHS Constant definitions
Pulse Height Spectrum Screen

   B9BA 35 16               118 3$:	puls	d,x
   B9BC 39                  119 	rts
                            120 
                            121 
                            122 	;
                            123 	; phs$scrn Options
                            124 	;
                            125 
   B9BD                     126 phs$optn::
   B9BD BD A4 0E            127 	jsr	scn$gets	; build a response string
   B9C0 27 3A               128 	beq	3$		; not finished
   B9C2 0D 49               129 	tst	*s$string	; NULL string ?
   B9C4 2F 28               130 	ble	2$		; yes - terminate option
                            131 
   B9C6 BD A3 F8            132 	jsr	option		; get the option number
   B9C9 58                  133 	aslb
   B9CA C1 14               134 	cmpb	#5$-4$		; valid option ?
   B9CC 24 20               135 	bhis	2$		; no - terminate request
                            136 
   B9CE 96 42               137 	lda	*scrn$sts+1	; get channel number
   B9D0 81 20               138 	cmpa	#0d32		; valid channel ?
   B9D2 22 1A               139 	bhi	2$		; no - terminate option
   B9D4 48                  140 	asla
                            141 
   B9D5 10 8E B9 EE         142 	ldy	#2$		; options return address
   B9D9 34 20               143 	pshs	y
                            144 
   B9DB 10 8E B9 FE         145 	ldy	#4$		; jump table
   B9DF 31 B5               146 	leay	[b,y]		; get address of option routine
   B9E1 34 20               147 	pshs	y		; push as a return address
                            148 
   B9E3 30 C9 00 49         149 	leax	s$string,u	; string pointer
                            150 
   B9E7 10 8E 8C 16         151 	ldy	#acqvtbl	; variables address for this channel
   B9EB 31 B6               152 	leay	[a,y]
                            153 
   B9ED 39                  154 1$:	rts			; do option
                            155 
   B9EE 0F 48               156 2$:	clr	*o$state	; option completed
   B9F0 86 17               157 	lda	#SCRNBT
   B9F2 C6 00               158 	ldb	#0
   B9F4 BD 9D 75            159 	jsr	fmtdeol		; clear option question and answer
                            160 
   B9F7 DC 72               161 	ldd	*opt$posn	; option position
   B9F9 BD A3 CA            162 	jsr	pos$scrn	; restore cursor
                            163 
   B9FC 4F                  164 3$:	clra			; input character always used
   B9FD 39                  165 	rts
                            166 
   B9FE B9 ED               167 4$:	.word	1$		; invalid option
   BA00 BA 12               168 	.word	5$		; new channel
   BA02 BA 20               169 	.word	7$		; exit screen
   BA04 BA 28               170 	.word	9$		; change to fixed scale
   BA06 BA 3C               171 	.word	11$		; change to auto scale
   BA08 BA 50               172 	.word	13$		; zero
   BA0A BA 59               173 	.word	15$		; set vertical scale
ASxxxx Assembler V02.21  (Motorola 6809), page 9.
PHS Constant definitions
Pulse Height Spectrum Screen

   BA0C BA 75               174 	.word	17$		; set vertical offset
   BA0E BA 80               175 	.word	19$		; set horizontal scale
   BA10 BA 96               176 	.word	21$		; set horizontal offset
                            177 
                            178 	; New Channel Number
                            179 
   BA12 BD E3 34            180 5$:	jsr	a$d$i		; convert to an integer
   BA15 C1 20               181 	cmpb	#0d32		; valid ?
   BA17 22 06               182 	bhi	6$		; no - skip
   BA19 D7 42               183 	stb	*scrn$sts+1	; save new channel #
   BA1B 86 02               184 	lda	#2		; redraw legends
   BA1D 97 47               185 	sta	*s$state	
   BA1F 39                  186 6$:	rts
                            187 
                            188 	; Exit Screen
                            189 
   BA20 BD A4 05            190 7$:	jsr	ans$yes		; yes ?
   BA23 26 02               191 	bne	8$		; no - skip
   BA25 0F 47               192 	clr	*s$state	; just exit
   BA27 39                  193 8$:	rts
                            194 
                            195 	; Change to Fixed Scale
                            196 
   BA28 BD A4 05            197 9$:	jsr	ans$yes		; yes ?
   BA2B 26 0E               198 	bne	10$		; no - skip
   BA2D A6 A9 00 0C         199 	lda	phs$vscl,y	; make fixed scale
   BA31 8A 80               200 	ora	#0q200
   BA33 A7 A9 00 0C         201 	sta	phs$vscl,y
   BA37 86 02               202 	lda	#2		; redraw legends
   BA39 97 47               203 	sta	*s$state	
   BA3B 39                  204 10$:	rts
                            205 
                            206 	; Change to Auto Scale
                            207 
   BA3C BD A4 05            208 11$:	jsr	ans$yes		; yes ?
   BA3F 26 0E               209 	bne	12$		; no - skip
   BA41 A6 A9 00 0C         210 	lda	phs$vscl,y	; make fixed scale
   BA45 84 7F               211 	anda	#~0q200
   BA47 A7 A9 00 0C         212 	sta	phs$vscl,y
   BA4B 86 02               213 	lda	#2		; redraw legends
   BA4D 97 47               214 	sta	*s$state	
   BA4F 39                  215 12$:	rts
                            216 
                            217 	; Zero
                            218 
   BA50 BD A4 05            219 13$:	jsr	ans$yes		; yes ?
   BA53 26 03               220 	bne	14$		; no - skip
   BA55 BD BA A7            221 	jsr	phs$clr		; clear the histogram
   BA58 39                  222 14$:	rts
                            223 
                            224 	; Vertical scale
                            225 
   BA59 BD E3 34            226 15$:	jsr	a$d$i		; convert to an integer
   BA5C C1 0F               227 	cmpb	#0d15
   BA5E 22 14               228 	bhi	16$
   BA60 C1 04               229 	cmpb	#0d4
ASxxxx Assembler V02.21  (Motorola 6809), page 10.
PHS Constant definitions
Pulse Height Spectrum Screen

   BA62 25 10               230 	blo	16$
   BA64 C0 04               231 	subb	#4		; 2^4 is 16, minimum full scale
   BA66 E7 E2               232 	stb	,-s
   BA68 E6 A9 00 0C         233 	ldb	phs$vscl,y	; mask out scale
   BA6C C4 F0               234 	andb	#0xF0
   BA6E EA E0               235 	orb	,s+
   BA70 E7 A9 00 0C         236 	stb	phs$vscl,y
   BA74 39                  237 16$:	rts
                            238 	
                            239 	; Vertical Offset
                            240 
   BA75 BD E3 34            241 17$:	jsr	a$d$i		; convert to an integer
   BA78 4D                  242 	tsta
   BA79 2B 04               243 	bmi	18$
   BA7B ED A9 00 0A         244 	std	phs$vofs,y
   BA7F 39                  245 18$:	rts
                            246 
                            247 	; Horizontal Scale
                            248 
   BA80 BD E3 34            249 19$:	jsr	a$d$i		; convert to an integer
   BA83 C1 0A               250 	cmpb	#0d10
   BA85 22 0E               251 	bhi	20$
   BA87 C1 06               252 	cmpb	#0d6
   BA89 25 0A               253 	blo	20$
   BA8B 50                  254 	negb
   BA8C CB 0A               255 	addb	#0d10		; 10 - n
   BA8E E7 A9 00 09         256 	stb	phs$hscl,y
   BA92 BD BA A7            257 	jsr	phs$clr		; clear the histogram
   BA95 39                  258 20$:	rts
                            259 	
                            260 	; Horizontal Offset
                            261 
   BA96 BD E3 34            262 21$:	jsr	a$d$i		; convert to an integer
   BA99 10 83 03 FF         263 	cmpd	#0d1023
   BA9D 22 07               264 	bhi	22$
   BA9F ED A9 00 07         265 	std	phs$hofs,y
   BAA3 BD BA A7            266 	jsr	phs$clr		; clear the histogram
   BAA6 39                  267 22$:	rts
                            268 
                            269 
ASxxxx Assembler V02.21  (Motorola 6809), page 11.
PHS Constant definitions
Pulse Height Histogram Clear Routine

                            271 	.sbttl	Pulse Height Histogram Clear Routine
                            272 
                            273 	;	Clear histogram specified by *scrn$sts
                            274 
   BAA7                     275 phs$clr::
   BAA7 34 36               276 	pshs	d,x,y
                            277 
   BAA9 96 42               278 	lda	*scrn$sts+1	; selected channel
   BAAB 81 20               279 	cmpa	#0d32		; temperature or LED data ?
   BAAD 22 17               280 	bhi	4$		; no - exit
   BAAF 48                  281 	asla
   BAB0 8E 8B D4            282 	ldx	#acqbtbl	; data pointers
   BAB3 30 96               283 	leax	[a,x]
                            284 
   BAB5 30 89 00 00         285 2$:	leax	acq$phs,x
   BAB9 10 8E 00 40         286 	ldy	#0d64
   BABD CC 00 00            287 	ldd	#0
   BAC0 ED 81               288 3$:	std	,x++
   BAC2 31 3F               289 	leay	-1,y
   BAC4 26 FA               290 	bne	3$
                            291 
   BAC6 35 36               292 4$:	puls	d,x,y
   BAC8 39                  293 	rts
                            294 
                            295 
ASxxxx Assembler V02.21  (Motorola 6809), page 12.
PHS Constant definitions
Pulse Height Histogramming Routine

                            297 	.sbttl	Pulse Height Histogramming Routine
                            298 
                            299 	.area	SCRNUPDT
                            300 
                            301 	;	Enter with channel number in b
                            302 	;
                            303 	;	the following stack frame is created :
                            304 	;
                            305 	;	8,s	u
                            306 	;	6,s	y
                            307 	;	4,s	x
                            308 	;	2,s	d	(4,s)	a	(5,s)	b
                            309 	;	0,s	scale jump address
                            310 	;
                            311 
                    0008    312 	$OLDU	= 0d8
                    0006    313 	$OLDY	= 0d6
                    0004    314 	$OLDX	= 0d4
                    0002    315 	$OLDD	= 0d2
                    0000    316 	$JUMP	= 0d0
                            317 
   DD83                     318 phs$hst::
   DD83 34 76               319 	pshs	d,x,y,u		; save all
   DD85 32 7E               320 	leas	-2,s		; jump address
                            321 
   DD87 C1 20               322 	cmpb	#0d32		; temperature or LED data ?
   DD89 10 22 01 0D         323 	lbhi	10$		; no - exit
   DD8D 58                  324 	aslb
   DD8E 8E 8B D4            325 	ldx	#acqbtbl	; data pointers
   DD91 30 95               326 	leax	[b,x]
   DD93 10 8E 8C 16         327 	ldy	#acqvtbl
   DD97 31 B5               328 	leay	[b,y]
                            329 
   DD99 A6 A9 00 0C         330 1$:	lda	phs$vscl,y
   DD9D 2B 35               331 	bmi	6$		; skip if not auto scale
                            332 
                            333 	; auto scaling routine
                            334 
   DD9F 34 30               335 	pshs	x,y
   DDA1 30 89 00 00         336 	leax	acq$phs,x	; histo data
   DDA5 10 8E 00 40         337 	ldy	#0d64		; histo length
   DDA9 CC 00 00            338 	ldd	#0		; smallest value
   DDAC 10 A3 81            339 2$:	cmpd	,x++		; find largest
   DDAF 24 02               340 	bhis	3$
   DDB1 EC 1E               341 	ldd	-2,x
   DDB3 31 3F               342 3$:	leay	-1,y
   DDB5 26 F5               343 	bne	2$
   DDB7 35 30               344 	puls	x,y
                            345 
   DDB9 6F A9 00 0C         346 	clr	phs$vscl,y	; auto scale
                            347 
   DDBD 10 83 00 13         348 4$:	cmpd	#0d19		; now compute scaling factor
   DDC1 23 0A               349 	blos	5$		; 0 - 19 is allowed pulse height
   DDC3 1C FE               350 	clc			; divide by two
   DDC5 46                  351 	rora
   DDC6 56                  352 	rorb
ASxxxx Assembler V02.21  (Motorola 6809), page 13.
PHS Constant definitions
Pulse Height Histogramming Routine

   DDC7 6C A9 00 0C         353 	inc	phs$vscl,y	; update scaling
   DDCB 20 F0               354 	bra	4$
                            355 
   DDCD CC 00 00            356 5$:	ldd	#0		; clear the offset
   DDD0 ED A9 00 0A         357 	std	phs$vofs,y
                            358 
                            359 	; scale the data and plot
                            360 
   DDD4 A6 A9 00 0C         361 6$:	lda	phs$vscl,y	; get the scaling factor
   DDD8 84 0F               362 	anda	#0x0F
   DDDA 48                  363 	asla
   DDDB 40                  364 	nega
   DDDC 33 8C 33            365 	leau	8$,pcr		; compute jump address for scaling
   DDDF 33 C6               366 	leau	a,u
   DDE1 EF 60               367 	stu	$JUMP,s
   DDE3 33 89 00 00         368 	leau	acq$phs,x	; data buffer address
   DDE7 6F A9 00 06         369 	clr	phs$index,y	; clear the index
                            370 
   DDEB EC C1               371 7$:	ldd	,u++		; get the data
   DDED A3 A9 00 0A         372 	subd	phs$vofs,y	; take off offset
   DDF1 6E F8 00            373 	jmp	[$JUMP,s]	; do proper scaling
   DDF4 47                  374 	asra			; / 2^15
   DDF5 56                  375 	rorb
   DDF6 47                  376 	asra			; / 2^14
   DDF7 56                  377 	rorb
   DDF8 47                  378 	asra			; / 2^13
   DDF9 56                  379 	rorb
   DDFA 47                  380 	asra			; / 2^12
   DDFB 56                  381 	rorb
   DDFC 47                  382 	asra			; / 2^11
   DDFD 56                  383 	rorb
   DDFE 47                  384 	asra			; / 2^10
   DDFF 56                  385 	rorb
   DE00 47                  386 	asra			; / 2^9
   DE01 56                  387 	rorb
   DE02 47                  388 	asra			; / 2^8
   DE03 56                  389 	rorb
   DE04 47                  390 	asra			; / 2^7
   DE05 56                  391 	rorb
   DE06 47                  392 	asra			; / 2^6
   DE07 56                  393 	rorb
   DE08 47                  394 	asra			; / 2^5
   DE09 56                  395 	rorb
   DE0A 47                  396 	asra			; / 2^4
   DE0B 56                  397 	rorb
   DE0C 47                  398 	asra			; / 2^3
   DE0D 56                  399 	rorb
   DE0E 47                  400 	asra			; / 2^2
   DE0F 56                  401 	rorb
   DE10 47                  402 	asra			; / 2^1
   DE11 56                  403 	rorb
   DE12 A6 A9 00 06         404 8$:	lda	phs$index,y	; column
   DE16 BD DE CC            405 	jsr	phs$clmn	; plot the data
   DE19 4C                  406 	inca
   DE1A A7 A9 00 06         407 	sta	phs$index,y	; next column
   DE1E 81 40               408 	cmpa	#0d64		; finished
ASxxxx Assembler V02.21  (Motorola 6809), page 14.
PHS Constant definitions
Pulse Height Histogramming Routine

   DE20 25 C9               409 	blo	7$		; no - loop
   DE22 EE 68               410 	ldu	$OLDU,s		; restore u
                            411 
                            412 	; Vertical Scale Update
                            413 
   DE24 A6 A9 00 0C         414 	lda	phs$vscl,y	; get the scaling factor
   DE28 84 0F               415 	anda	#0x0F
   DE2A 48                  416 	asla
   DE2B 8E DE 9F            417 	ldx	#11$
   DE2E EC 86               418 	ldd	a,x		; 1/2 full scale
   DE30 AE A9 00 0A         419 	ldx	phs$vofs,y	; offset
   DE34 AF E3               420 	stx	,--s
   DE36 30 8B               421 	leax	d,x		; offset + 1/2 full scale
   DE38 AF E3               422 	stx	,--s
   DE3A 30 8B               423 	leax	d,x		; offset + 2/2 full scale
   DE3C 86 00               424 	lda	#SCRNTP
   DE3E C6 06               425 	ldb	#$HSTCOL-0d8
   DE40 BD 9E 9F            426 	jsr	fmt6rjint
                            427 
   DE43 AE E1               428 	ldx	,s++
   DE45 86 0A               429 	lda	#SCRNTP+0d10
   DE47 C6 06               430 	ldb	#$HSTCOL-0d8
   DE49 BD 9E 9F            431 	jsr	fmt6rjint
                            432 
   DE4C AE E1               433 	ldx	,s++
   DE4E 86 14               434 	lda	#SCRNTP+0d20
   DE50 C6 06               435 	ldb	#$HSTCOL-0d8
   DE52 BD 9E 9F            436 	jsr	fmt6rjint
                            437 
                            438 	; Horizontal Scale Update
                            439 
   DE55 A6 A9 00 09         440 	lda	phs$hscl,y	; get the scaling factor
   DE59 81 04               441 	cmpa	#0d4
   DE5B 23 01               442 	blos	9$
   DE5D 4F                  443 	clra
   DE5E 48                  444 9$:	asla
   DE5F 8E DE B7            445 	ldx	#12$
   DE62 EC 86               446 	ldd	a,x		; full scale
   DE64 AE A9 00 07         447 	ldx	phs$hofs,y	; offset
   DE68 AF E3               448 	stx	,--s
   DE6A 30 8B               449 	leax	d,x		; offset + full scale
   DE6C 86 16               450 	lda	#SCRNTP+0d22
   DE6E C6 49               451 	ldb	#$HSTCOL+$HSTWIDTH-0d5
   DE70 BD 9E 9F            452 	jsr	fmt6rjint
                            453 
   DE73 AE E1               454 	ldx	,s++
   DE75 86 16               455 	lda	#SCRNTP+0d22
   DE77 C6 0E               456 	ldb	#$HSTCOL
   DE79 BD 9E C5            457 	jsr	fmt6ljint
                            458 
                            459 	; Average Update
                            460 
   DE7C EC A9 00 00         461 	ldd	acq$sum,y	; get sum of array
   DE80 59                  462 	rolb			; divide by 64
   DE81 49                  463 	rola
   DE82 59                  464 	rolb
ASxxxx Assembler V02.21  (Motorola 6809), page 15.
PHS Constant definitions
Pulse Height Histogramming Routine

   DE83 49                  465 	rola
   DE84 59                  466 	rolb
   DE85 1E 89               467 	exg	a,b
   DE87 84 03               468 	anda	#0x03
   DE89 ED E3               469 	std	,--s		; current average
                            470 
   DE8B 8E DE C1            471 	ldx	#13$
   DE8E 86 16               472 	lda	#SCRNTP+0d22
   DE90 C6 26               473 	ldb	#$HSTCOL+($HSTWIDTH/2)-0d8
   DE92 BD 9D 9A            474 	jsr	fmthtxt
                            475 
   DE95 AE E1               476 	ldx	,s++
   DE97 BD 9E C5            477 	jsr	fmt6ljint
                            478 
                            479 	; finished
                            480 
   DE9A 32 62               481 10$:	leas	2,s		; pop jump address
   DE9C 35 76               482 	puls	d,x,y,u		; restore all
   DE9E 39                  483 	rts
                            484 
                            485 
   DE9F 00 0A 00 14 00 28   486 11$:	.word	0d10,	0d20,	0d40,	0d80,	0d160,	0d320
        00 50 00 A0 01 40
   DEAB 02 80 05 00 0A 00   487 	.word	0d640,	0d1280,	0d2560,	0d5120,	0d10240,0d20480
        14 00 28 00 50 00
                            488 
   DEB7 04 00 02 00 01 00   489 12$:	.word	0d1024,	0d512,	0d256,	0d128,	0d64
        00 80 00 40
                            490 
   DEC1 61 76 65 72 61 67   491 13$:	.asciz	"average = "
        65 20 3D 20 00
                            492 
                            493 
ASxxxx Assembler V02.21  (Motorola 6809), page 16.
PHS Constant definitions
Plot Data in Column

                            495 	.sbttl	Plot Data in Column
                            496 
                            497 	;  a	-	histo column for new data point
                            498 	;  b	-	data value to plot
                            499 
   DECC                     500 phs$clmn::
   DECC 34 16               501 	pshs	d,x		; have added 0d6 to stack frame
                            502 
   DECE AE 6E               503 	ldx	$OLDU+0d6,s	; get original u
   DED0 30 89 03 5E         504 	leax	fmtbuf+$HSTROW*SCRNW+$HSTCOL,x
   DED4 30 86               505 	leax	a,x		; top of selected column
   DED6 86 20               506 	lda	#(' )		; space character
   DED8 A7 00               507 	sta	0d0  * SCRNW,x	; clear the whole column fast !
   DEDA A7 88 50            508 	sta	0d1  * SCRNW,x
   DEDD A7 89 00 A0         509 	sta	0d2  * SCRNW,x
   DEE1 A7 89 00 F0         510 	sta	0d3  * SCRNW,x
   DEE5 A7 89 01 40         511 	sta	0d4  * SCRNW,x
   DEE9 A7 89 01 90         512 	sta	0d5  * SCRNW,x
   DEED A7 89 01 E0         513 	sta	0d6  * SCRNW,x
   DEF1 A7 89 02 30         514 	sta	0d7  * SCRNW,x
   DEF5 A7 89 02 80         515 	sta	0d8  * SCRNW,x
   DEF9 A7 89 02 D0         516 	sta	0d9  * SCRNW,x
   DEFD A7 89 03 20         517 	sta	0d10 * SCRNW,x
   DF01 A7 89 03 70         518 	sta	0d11 * SCRNW,x
   DF05 A7 89 03 C0         519 	sta	0d12 * SCRNW,x
   DF09 A7 89 04 10         520 	sta	0d13 * SCRNW,x
   DF0D A7 89 04 60         521 	sta	0d14 * SCRNW,x
   DF11 A7 89 04 B0         522 	sta	0d15 * SCRNW,x
   DF15 A7 89 05 00         523 	sta	0d16 * SCRNW,x
   DF19 A7 89 05 50         524 	sta	0d17 * SCRNW,x
   DF1D A7 89 05 A0         525 	sta	0d18 * SCRNW,x
   DF21 A7 89 05 F0         526 	sta	0d19 * SCRNW,x
                            527 
   DF25 C1 13               528 	cmpb	#0d19		; check range
   DF27 22 0C               529 	bhi	1$		; don't plot if out of range
                            530 
   DF29 50                  531 	negb			; compute data position within this column
   DF2A CB 13               532 	addb	#0d19
   DF2C 86 50               533 	lda	#SCRNW
   DF2E 3D                  534 	mul
   DF2F 30 8B               535 	leax	d,x
   DF31 86 2A               536 	lda	#'*		; plot data point
   DF33 A7 84               537 	sta	,x
                            538 
   DF35 35 16               539 1$:	puls	d,x
   DF37 39                  540 	rts
                            541 
                            542 
ASxxxx Assembler V02.21  (Motorola 6809), page 17.
PHS Constant definitions
Average Pulse Height Spectrum Screen

                            544 	.sbttl	Average Pulse Height Spectrum Screen
                            545 
                            546 	.area	SCREEN
                            547 
   BAC9                     548 avg$scrn::
   BAC9 34 36               549 	pshs	d,x,y
                            550 
   BACB D6 47               551 1$:	ldb	*s$state	; check state
   BACD 27 14               552 	beq	3$
   BACF 96 2F               553 	lda	*char
   BAD1 81 17               554 	cmpa	#CTRLW		; redraw screen ?
   BAD3 26 06               555 	bne	2$
   BAD5 6F E4               556 	clr	,s		; CTRLW seen
   BAD7 C6 01               557 	ldb	#1
   BAD9 D7 47               558 	stb	*s$state	; new state
   BADB 58                  559 2$:	aslb
   BADC C1 08               560 	cmpb	#5$-4$		; check for valid state
   BADE 25 03               561 	blo	3$
   BAE0 5F                  562 	clrb
   BAE1 D7 47               563 	stb	*s$state
   BAE3 8E BA E8            564 3$:	ldx	#4$
   BAE6 6E 95               565 	jmp	[b,x]
                            566 
   BAE8 BA F0 BA FA BB 22   567 4$:	.word	5$,6$,9$,10$
        BB 2C
                            568 
   BAF0 FC BF 2E            569 5$:	ldd	r$lin4		; default option position
   BAF3 BD A3 DD            570 	jsr	init$opt
   BAF6 DD 45               571 	std	*scrn$pos
   BAF8 0C 47               572 	inc	*s$state	; next state
                            573 
   BAFA BD A3 AF            574 6$:	jsr	clr$scrn	; clear the screen
   BAFD BD BD AE            575 	jsr	hst$axis	; draw the axis
                            576 
   BB00 0D 48               577 	tst	*o$state	; active options sequence ?
   BB02 27 1C               578 	beq	8$		; no - skip
   BB04 86 F9               579 	lda	#ENTER		; redo question
   BB06 BD C0 12            580 	jsr	hst$ques
   BB09 0D 59               581 	tst	*s$strlen	; answer ?
   BB0B 27 13               582 	beq	8$		; no - skip
   BB0D DC 45               583 	ldd	*scrn$pos	; cursor position
   BB0F BD 9D 5E            584 	jsr	fmtindex
   BB12 30 C9 00 49         585 	leax	s$string,u	; answer string
   BB16 A6 80               586 7$:	lda	,x+		; copy string
   BB18 2F 06               587 	ble	8$
   BB1A A7 A0               588 	sta	,y+
   BB1C 0C 46               589 	inc	*scrn$pos+1	; update cursor position
   BB1E 20 F6               590 	bra	7$
                            591 
   BB20 0C 47               592 8$:	inc	*s$state	; next state
                            593 
   BB22 BD BB 54            594 9$:	jsr	avg$lgnd	; load up legends
   BB25 DC 45               595 	ldd	*scrn$pos	; reload cursor position
   BB27 BD A3 CA            596 	jsr	pos$scrn
   BB2A 0C 47               597 	inc	*s$state	; next state
                            598 
ASxxxx Assembler V02.21  (Motorola 6809), page 18.
PHS Constant definitions
Average Pulse Height Spectrum Screen

   BB2C 0D 48               599 10$:	tst	*o$state	; processing an option ?
   BB2E 27 13               600 	beq	11$		; no  - skip
                            601 
   BB30 96 2F               602 	lda	*char		; get the character
   BB32 BD BB 7D            603 	jsr	avg$optn	; yes - service the option
   BB35 97 2F               604 	sta	*char		; character used
                            605 
   BB37 0D 47               606 	tst	*s$state	; exit screen ?
   BB39 27 16               607 	beq	12$		; yes - doit
                            608 
   BB3B 0D 48               609 	tst	*o$state	; processing finished ?
   BB3D 10 27 FF 8A         610 	lbeq	1$		; yes - rescan new settup
   BB41 20 0E               611 	bra	12$
                            612 
   BB43 96 2F               613 11$:	lda	*char
   BB45 BD A4 81            614 	jsr	scn$scrl	; try scrolling to a new option
   BB48 97 2F               615 	sta	*char
   BB4A 27 05               616 	beq	12$
   BB4C BD C0 12            617 	jsr	hst$ques	; try selecting an option
   BB4F 97 2F               618 	sta	*char
                            619 
   BB51 35 36               620 12$:	puls	d,x,y
   BB53 39                  621 	rts
                            622 
                            623 
                            624 	;
                            625 	; avg$scrn Legends
                            626 	;
                            627 
   BB54                     628 avg$lgnd::
   BB54 34 16               629 	pshs	d,x
                            630 
   BB56 5F                  631 	clrb			; compute screen entry
   BB57 96 42               632 	lda	*scrn$sts+1	; channel #
   BB59 81 20               633 	cmpa	#0d32		; valid channel ?
   BB5B 22 1D               634 	bhi	3$		; no - exit
   BB5D 25 02               635 	blo	1$		; detector
   BB5F CB 02               636 	addb	#2		; temperature
   BB61 48                  637 1$:	asla
   BB62 8E 8C 16            638 	ldx	#acqvtbl	; acquisition variable table
   BB65 30 96               639 	leax	[a,x]		; this channel's variables
   BB67 6D 89 00 0F         640 	tst	avg$vscl,x
   BB6B 2A 02               641 	bpl	2$		; autoscaling
   BB6D CB 04               642 	addb	#4		; scaling
   BB6F 8E BE 98            643 2$:	ldx	#avg$list	; now get list pointer
   BB72 30 95               644 	leax	[b,x]
                            645 
   BB74 BD A4 B4            646 	jsr	scn$lgnd	; do legends
   BB77 BD A4 EB            647 	jsr	scn$chnl	; and channel number
                            648 
   BB7A 35 16               649 3$:	puls	d,x
   BB7C 39                  650 	rts
                            651 
                            652 
                            653 	;
                            654 	; avg$scrn Options
ASxxxx Assembler V02.21  (Motorola 6809), page 19.
PHS Constant definitions
Average Pulse Height Spectrum Screen

                            655 	;
                            656 
   BB7D                     657 avg$optn::
   BB7D BD A4 0E            658 	jsr	scn$gets	; build a response string
   BB80 27 3A               659 	beq	3$		; not finished
   BB82 0D 49               660 	tst	*s$string	; NULL string ?
   BB84 2F 28               661 	ble	2$		; yes - terminate option
                            662 
   BB86 BD A3 F8            663 	jsr	option		; get the option number
   BB89 58                  664 	aslb
   BB8A C1 14               665 	cmpb	#5$-4$		; valid option ?
   BB8C 24 20               666 	bhis	2$		; no - terminate request
                            667 
   BB8E 96 42               668 	lda	*scrn$sts+1	; get channel number
   BB90 81 20               669 	cmpa	#0d32		; valid channel ?
   BB92 22 1A               670 	bhi	2$		; no - terminate option
   BB94 48                  671 	asla
                            672 
   BB95 10 8E BB AE         673 	ldy	#2$		; options return address
   BB99 34 20               674 	pshs	y
                            675 
   BB9B 10 8E BB BE         676 	ldy	#4$		; jump table
   BB9F 31 B5               677 	leay	[b,y]		; get address of option routine
   BBA1 34 20               678 	pshs	y		; push as a return address
                            679 
   BBA3 30 C9 00 49         680 	leax	s$string,u	; string pointer
                            681 
   BBA7 10 8E 8C 16         682 	ldy	#acqvtbl	; variables address for this channel
   BBAB 31 B6               683 	leay	[a,y]
                            684 
   BBAD 39                  685 1$:	rts			; do option
                            686 
   BBAE 0F 48               687 2$:	clr	*o$state	; option completed
   BBB0 86 17               688 	lda	#SCRNBT
   BBB2 C6 00               689 	ldb	#0
   BBB4 BD 9D 75            690 	jsr	fmtdeol		; clear option question and answer
                            691 
   BBB7 DC 72               692 	ldd	*opt$posn	; option position
   BBB9 BD A3 CA            693 	jsr	pos$scrn	; restore cursor
                            694 
   BBBC 4F                  695 3$:	clra			; input character always used
   BBBD 39                  696 	rts
                            697 
   BBBE BB AD               698 4$:	.word	1$		; invalid option
   BBC0 BB D2               699 	.word	5$		; new channel
   BBC2 BB E0               700 	.word	7$		; exit screen
   BBC4 BB E8               701 	.word	9$		; change to fixed scale
   BBC6 BB FC               702 	.word	11$		; change to auto scale
   BBC8 BC 10               703 	.word	13$		; zero				unused
   BBCA BC 11               704 	.word	14$		; set vertical scale
   BBCC BC 2D               705 	.word	16$		; set vertical offset
   BBCE BC 38               706 	.word	18$		; set horizontal scale		unused
   BBD0 BC 39               707 	.word	19$		; set horizontal offset		unused
                            708 
                            709 	; New Channel Number
                            710 
ASxxxx Assembler V02.21  (Motorola 6809), page 20.
PHS Constant definitions
Average Pulse Height Spectrum Screen

   BBD2 BD E3 34            711 5$:	jsr	a$d$i		; convert to an integer
   BBD5 C1 20               712 	cmpb	#0d32		; valid ?
   BBD7 22 06               713 	bhi	6$		; no - skip
   BBD9 D7 42               714 	stb	*scrn$sts+1	; save new channel #
   BBDB 86 02               715 	lda	#2		; redraw legends
   BBDD 97 47               716 	sta	*s$state	
   BBDF 39                  717 6$:	rts
                            718 
                            719 	; Exit Screen
                            720 
   BBE0 BD A4 05            721 7$:	jsr	ans$yes		; yes ?
   BBE3 26 02               722 	bne	8$		; no - skip
   BBE5 0F 47               723 	clr	*s$state	; just exit
   BBE7 39                  724 8$:	rts
                            725 
                            726 	; Change to Fixed Scale
                            727 
   BBE8 BD A4 05            728 9$:	jsr	ans$yes		; yes ?
   BBEB 26 0E               729 	bne	10$		; no - skip
   BBED A6 A9 00 0F         730 	lda	avg$vscl,y	; make fixed scale
   BBF1 8A 80               731 	ora	#0q200
   BBF3 A7 A9 00 0F         732 	sta	avg$vscl,y
   BBF7 86 02               733 	lda	#2		; redraw legends
   BBF9 97 47               734 	sta	*s$state	
   BBFB 39                  735 10$:	rts
                            736 
                            737 	; Change to Auto Scale
                            738 
   BBFC BD A4 05            739 11$:	jsr	ans$yes		; yes ?
   BBFF 26 0E               740 	bne	12$		; no - skip
   BC01 A6 A9 00 0F         741 	lda	avg$vscl,y	; make fixed scale
   BC05 84 7F               742 	anda	#~0q200
   BC07 A7 A9 00 0F         743 	sta	avg$vscl,y
   BC0B 86 02               744 	lda	#2		; redraw legends
   BC0D 97 47               745 	sta	*s$state	
   BC0F 39                  746 12$:	rts
                            747 
                            748 	; Zero
                            749 
   BC10 39                  750 13$:	rts			; unused option
                            751 
                            752 	; Vertical scale
                            753 
   BC11 BD E3 34            754 14$:	jsr	a$d$i		; convert to an integer
   BC14 C1 0F               755 	cmpb	#0d15
   BC16 22 14               756 	bhi	15$
   BC18 C1 04               757 	cmpb	#0d4
   BC1A 25 10               758 	blo	15$
   BC1C C0 04               759 	subb	#4		; 2^4 is 16, minimum full scale
   BC1E E7 E2               760 	stb	,-s
   BC20 E6 A9 00 0F         761 	ldb	avg$vscl,y	; mask out scale
   BC24 C4 F0               762 	andb	#0xF0
   BC26 EA E0               763 	orb	,s+
   BC28 E7 A9 00 0F         764 	stb	avg$vscl,y
   BC2C 39                  765 15$:	rts
                            766 	
ASxxxx Assembler V02.21  (Motorola 6809), page 21.
PHS Constant definitions
Average Pulse Height Spectrum Screen

                            767 	; Vertical Offset
                            768 
   BC2D BD E3 34            769 16$:	jsr	a$d$i		; convert to an integer
   BC30 4D                  770 	tsta
   BC31 2B 04               771 	bmi	17$
   BC33 ED A9 00 0D         772 	std	avg$vofs,y
   BC37 39                  773 17$:	rts
                            774 
                            775 	; Horizontal Scale
                            776 
   BC38 39                  777 18$:	rts			; unused option
                            778 	
                            779 	; Horizontal Offset
                            780 
   BC39 39                  781 19$:	rts			; unused option
                            782 
                            783 
ASxxxx Assembler V02.21  (Motorola 6809), page 22.
PHS Constant definitions
Average Pulse Height Histogramming Routine

                            785 	.sbttl	Average Pulse Height Histogramming Routine
                            786 
                            787 	.area	SCRNUPDT
                            788 
                            789 	;	Enter with channel number in b
                            790 	;
                            791 	;	the following stack frame is created :
                            792 	;
                            793 	;	8,s	u
                            794 	;	6,s	y
                            795 	;	4,s	x
                            796 	;	2,s	d	(4,s)	a	(5,s)	b
                            797 	;	0,s	scale jump address
                            798 	;
                            799 
                    0008    800 	$OLDU	= 0d8
                    0006    801 	$OLDY	= 0d6
                    0004    802 	$OLDX	= 0d4
                    0002    803 	$OLDD	= 0d2
                    0000    804 	$JUMP	= 0d0
                            805 
   DF38                     806 avg$hst::
   DF38 34 76               807 	pshs	d,x,y,u		; save all
   DF3A 32 7E               808 	leas	-2,s		; jump address
                            809 
   DF3C C1 20               810 	cmpb	#0d32		; temperature or LED data ?
   DF3E 10 22 01 44         811 	lbhi	12$		; no - exit
   DF42 58                  812 	aslb
   DF43 8E 8B D4            813 	ldx	#acqbtbl	; data pointers
   DF46 30 95               814 	leax	[b,x]
   DF48 10 8E 8C 16         815 	ldy	#acqvtbl
   DF4C 31 B5               816 	leay	[b,y]
                            817 
   DF4E A6 A9 00 0F         818 1$:	lda	avg$vscl,y
   DF52 2B 7F               819 	bmi	9$		; skip if not auto scale
                            820 
                            821 	; auto scaling routine
                            822 
   DF54 34 30               823 	pshs	x,y
   DF56 30 89 00 80         824 	leax	acq$avrg,x	; averaged histo data
   DF5A 10 8E 00 40         825 	ldy	#0d64		; histo length
   DF5E CC 00 00            826 	ldd	#0		; smallest value
   DF61 10 A3 81            827 2$:	cmpd	,x++		; find largest
   DF64 24 02               828 	bhis	3$
   DF66 EC 1E               829 	ldd	-2,x
   DF68 31 3F               830 3$:	leay	-1,y
   DF6A 26 F5               831 	bne	2$
   DF6C 35 30               832 	puls	x,y
                            833 
   DF6E ED E3               834 	std	,--s		; save largest
                            835 
   DF70 34 30               836 	pshs	x,y
   DF72 30 89 00 80         837 	leax	acq$avrg,x	; averaged histo data
   DF76 10 8E 00 40         838 	ldy	#0d64		; histo length
   DF7A CC FF FF            839 	ldd	#-1		; largest value
   DF7D 10 A3 81            840 4$:	cmpd	,x++		; find smallest
ASxxxx Assembler V02.21  (Motorola 6809), page 23.
PHS Constant definitions
Average Pulse Height Histogramming Routine

   DF80 23 02               841 	blos	5$
   DF82 EC 1E               842 	ldd	-2,x
   DF84 31 3F               843 5$:	leay	-1,y
   DF86 26 F5               844 	bne	4$
   DF88 35 30               845 	puls	x,y
                            846 
   DF8A ED E3               847 	std	,--s		; save smallest
                            848 
   DF8C EC 62               849 	ldd	2,s		; largest
   DF8E A3 60               850 	subd	0,s		; smallest
   DF90 58                  851 	aslb			; (l-s)*2
   DF91 49                  852 	rola
                            853 
   DF92 6F A9 00 0F         854 	clr	avg$vscl,y	; auto scale
                            855 
   DF96 10 83 00 13         856 6$:	cmpd	#0d19		; now compute scaling factor
   DF9A 23 0A               857 	blos	7$		; 0 - 19 is allowed pulse height
   DF9C 1C FE               858 	clc			; divide by two
   DF9E 46                  859 	rora
   DF9F 56                  860 	rorb
   DFA0 6C A9 00 0F         861 	inc	avg$vscl,y	; update scaling
   DFA4 20 F0               862 	bra	6$
                            863 
   DFA6 EC E1               864 7$:	ldd	,s++		; smallest
   DFA8 E3 E1               865 	addd	,s++		; smallest
   DFAA 1C FE               866 	clc			; (l+s)/2
   DFAC 46                  867 	rora
   DFAD 56                  868 	rorb
   DFAE ED A9 00 0D         869 	std	avg$vofs,y	; save average of min/max
                            870 
   DFB2 34 10               871 	pshs	x
   DFB4 A6 A9 00 0F         872 	lda	avg$vscl,y	; get the scaling factor
   DFB8 84 0F               873 	anda	#0x0F
   DFBA 48                  874 	asla
   DFBB 8E E0 8B            875 	ldx	#13$
   DFBE EC 86               876 	ldd	a,x		; 1/2 full scale
   DFC0 ED E3               877 	std	,--s
                            878 
   DFC2 EC A9 00 0D         879 	ldd	avg$vofs,y
   DFC6 A3 E1               880 	subd	,s++		; (l+s)/2 - 1/2 full scale
   DFC8 2A 03               881 	bpl	8$		; no negative offsets
   DFCA CC 00 00            882 	ldd	#0
   DFCD ED A9 00 0D         883 8$:	std	avg$vofs,y
   DFD1 35 10               884 	puls	x
                            885 
                            886 	; scale the data and plot
                            887 
   DFD3 A6 A9 00 0F         888 9$:	lda	avg$vscl,y	; get the scaling factor
   DFD7 84 0F               889 	anda	#0x0F
   DFD9 48                  890 	asla
   DFDA 40                  891 	nega
   DFDB 33 8C 33            892 	leau	11$,pcr		; compute jump address for scaling
   DFDE 33 C6               893 	leau	a,u
   DFE0 EF 60               894 	stu	$JUMP,s
   DFE2 33 89 00 80         895 	leau	acq$avrg,x	; data buffer address
   DFE6 6F A9 00 10         896 	clr	run$index,y	; clear the index
ASxxxx Assembler V02.21  (Motorola 6809), page 24.
PHS Constant definitions
Average Pulse Height Histogramming Routine

                            897 
   DFEA EC C1               898 10$:	ldd	,u++		; get the data
   DFEC A3 A9 00 0D         899 	subd	avg$vofs,y	; take off offset
   DFF0 6E F8 00            900 	jmp	[$JUMP,s]	; do proper scaling
   DFF3 47                  901 	asra			; / 2^15
   DFF4 56                  902 	rorb
   DFF5 47                  903 	asra			; / 2^14
   DFF6 56                  904 	rorb
   DFF7 47                  905 	asra			; / 2^13
   DFF8 56                  906 	rorb
   DFF9 47                  907 	asra			; / 2^12
   DFFA 56                  908 	rorb
   DFFB 47                  909 	asra			; / 2^11
   DFFC 56                  910 	rorb
   DFFD 47                  911 	asra			; / 2^10
   DFFE 56                  912 	rorb
   DFFF 47                  913 	asra			; / 2^9
   E000 56                  914 	rorb
   E001 47                  915 	asra			; / 2^8
   E002 56                  916 	rorb
   E003 47                  917 	asra			; / 2^7
   E004 56                  918 	rorb
   E005 47                  919 	asra			; / 2^6
   E006 56                  920 	rorb
   E007 47                  921 	asra			; / 2^5
   E008 56                  922 	rorb
   E009 47                  923 	asra			; / 2^4
   E00A 56                  924 	rorb
   E00B 47                  925 	asra			; / 2^3
   E00C 56                  926 	rorb
   E00D 47                  927 	asra			; / 2^2
   E00E 56                  928 	rorb
   E00F 47                  929 	asra			; / 2^1
   E010 56                  930 	rorb
   E011 A6 A9 00 10         931 11$:	lda	run$index,y	; column
   E015 BD E0 B8            932 	jsr	avg$clmn	; plot the data
   E018 4C                  933 	inca
   E019 A7 A9 00 10         934 	sta	run$index,y	; next column
   E01D 81 40               935 	cmpa	#0d64		; finished
   E01F 25 C9               936 	blo	10$		; no - loop
   E021 EE 68               937 	ldu	$OLDU,s		; restore u
                            938 
                            939 	; Vertical Scale Update
                            940 
   E023 A6 A9 00 0F         941 	lda	avg$vscl,y	; get the scaling factor
   E027 84 0F               942 	anda	#0x0F
   E029 48                  943 	asla
   E02A 8E E0 8B            944 	ldx	#13$
   E02D EC 86               945 	ldd	a,x		; 1/2 full scale
   E02F AE A9 00 0D         946 	ldx	avg$vofs,y	; offset
   E033 AF E3               947 	stx	,--s
   E035 30 8B               948 	leax	d,x		; offset + 1/2 full scale
   E037 AF E3               949 	stx	,--s
   E039 30 8B               950 	leax	d,x		; offset + 2/2 full scale
   E03B 86 00               951 	lda	#SCRNTP
   E03D C6 06               952 	ldb	#$HSTCOL-0d8
ASxxxx Assembler V02.21  (Motorola 6809), page 25.
PHS Constant definitions
Average Pulse Height Histogramming Routine

   E03F BD 9E 9F            953 	jsr	fmt6rjint
                            954 
   E042 AE E1               955 	ldx	,s++
   E044 86 0A               956 	lda	#SCRNTP+0d10
   E046 C6 06               957 	ldb	#$HSTCOL-0d8
   E048 BD 9E 9F            958 	jsr	fmt6rjint
                            959 
   E04B AE E1               960 	ldx	,s++
   E04D 86 14               961 	lda	#SCRNTP+0d20
   E04F C6 06               962 	ldb	#$HSTCOL-0d8
   E051 BD 9E 9F            963 	jsr	fmt6rjint
                            964 
                            965 	; Horizontal Scale Update
                            966 
   E054 8E 00 40            967 	ldx	#0d64
   E057 86 16               968 	lda	#SCRNTP+0d22
   E059 C6 49               969 	ldb	#$HSTCOL+$HSTWIDTH-0d5
   E05B BD 9E 9F            970 	jsr	fmt6rjint
                            971 
   E05E 8E 00 00            972 	ldx	#0
   E061 86 16               973 	lda	#SCRNTP+0d22
   E063 C6 0E               974 	ldb	#$HSTCOL
   E065 BD 9E C5            975 	jsr	fmt6ljint
                            976 
                            977 	; Average Update
                            978 
   E068 EC A9 00 00         979 	ldd	acq$sum,y	; get sum of array
   E06C 59                  980 	rolb			; divide by 64
   E06D 49                  981 	rola
   E06E 59                  982 	rolb
   E06F 49                  983 	rola
   E070 59                  984 	rolb
   E071 1E 89               985 	exg	a,b
   E073 84 03               986 	anda	#0x03
   E075 ED E3               987 	std	,--s		; current average
                            988 
   E077 8E E0 AD            989 	ldx	#15$
   E07A 86 16               990 	lda	#SCRNTP+0d22
   E07C C6 26               991 	ldb	#$HSTCOL+($HSTWIDTH/2)-0d8
   E07E BD 9D 9A            992 	jsr	fmthtxt
                            993 
   E081 AE E1               994 	ldx	,s++
   E083 BD 9E C5            995 	jsr	fmt6ljint
                            996 
                            997 	; finished
                            998 
   E086 32 62               999 12$:	leas	2,s		; pop jump address
   E088 35 76              1000 	puls	d,x,y,u		; restore all
   E08A 39                 1001 	rts
                           1002 
                           1003 
   E08B 00 0A 00 14 00 28  1004 13$:	.word	0d10,	0d20,	0d40,	0d80,	0d160,	0d320
        00 50 00 A0 01 40
   E097 02 80 05 00 0A 00  1005 	.word	0d640,	0d1280,	0d2560,	0d5120,	0d10240,0d20480
        14 00 28 00 50 00
                           1006 
ASxxxx Assembler V02.21  (Motorola 6809), page 26.
PHS Constant definitions
Average Pulse Height Histogramming Routine

   E0A3 04 00 02 00 01 00  1007 14$:	.word	0d1024,	0d512,	0d256,	0d128,	0d64
        00 80 00 40
                           1008 
   E0AD 61 76 65 72 61 67  1009 15$:	.asciz	"average = "
        65 20 3D 20 00
                           1010 
                           1011 
ASxxxx Assembler V02.21  (Motorola 6809), page 27.
PHS Constant definitions
Plot Data in Column

                           1013 	.sbttl	Plot Data in Column
                           1014 
                           1015 	;  a	-	histo column for new data point
                           1016 	;  b	-	data value to plot
                           1017 
   E0B8                    1018 avg$clmn::
   E0B8 34 16              1019 	pshs	d,x		; have added 0d6 to stack frame
                           1020 
   E0BA AE 6E              1021 	ldx	$OLDU+0d6,s	; get original u
   E0BC 30 89 03 5E        1022 	leax	fmtbuf+$HSTROW*SCRNW+$HSTCOL,x
   E0C0 30 86              1023 	leax	a,x		; top of selected column
   E0C2 86 20              1024 	lda	#(' )		; space character
   E0C4 A7 00              1025 	sta	0d0  * SCRNW,x	; clear the whole column fast !
   E0C6 A7 88 50           1026 	sta	0d1  * SCRNW,x
   E0C9 A7 89 00 A0        1027 	sta	0d2  * SCRNW,x
   E0CD A7 89 00 F0        1028 	sta	0d3  * SCRNW,x
   E0D1 A7 89 01 40        1029 	sta	0d4  * SCRNW,x
   E0D5 A7 89 01 90        1030 	sta	0d5  * SCRNW,x
   E0D9 A7 89 01 E0        1031 	sta	0d6  * SCRNW,x
   E0DD A7 89 02 30        1032 	sta	0d7  * SCRNW,x
   E0E1 A7 89 02 80        1033 	sta	0d8  * SCRNW,x
   E0E5 A7 89 02 D0        1034 	sta	0d9  * SCRNW,x
   E0E9 A7 89 03 20        1035 	sta	0d10 * SCRNW,x
   E0ED A7 89 03 70        1036 	sta	0d11 * SCRNW,x
   E0F1 A7 89 03 C0        1037 	sta	0d12 * SCRNW,x
   E0F5 A7 89 04 10        1038 	sta	0d13 * SCRNW,x
   E0F9 A7 89 04 60        1039 	sta	0d14 * SCRNW,x
   E0FD A7 89 04 B0        1040 	sta	0d15 * SCRNW,x
   E101 A7 89 05 00        1041 	sta	0d16 * SCRNW,x
   E105 A7 89 05 50        1042 	sta	0d17 * SCRNW,x
   E109 A7 89 05 A0        1043 	sta	0d18 * SCRNW,x
   E10D A7 89 05 F0        1044 	sta	0d19 * SCRNW,x
                           1045 
   E111 C1 13              1046 	cmpb	#0d19		; check range
   E113 22 1D              1047 	bhi	3$		; don't plot if out of range
                           1048 
   E115 50                 1049 	negb			; compute data position within this column
   E116 CB 13              1050 	addb	#0d19
   E118 86 50              1051 	lda	#SCRNW
   E11A 3D                 1052 	mul
   E11B 30 8B              1053 	leax	d,x
   E11D 86 2A              1054 	lda	#'*		; plot data point
   E11F E6 A9 00 02        1055 	ldb	acq$index,y	; check for most recent update
   E123 5A                 1056 	decb
   E124 2A 02              1057 	bpl	1$
   E126 C6 3F              1058 	ldb	#0d63
   E128 E1 A9 00 10        1059 1$:	cmpb	run$index,y
   E12C 26 02              1060 	bne	2$
   E12E 86 40              1061 	lda	#'@		; most recent
   E130 A7 84              1062 2$:	sta	,x
                           1063 
   E132 35 16              1064 3$:	puls	d,x
   E134 39                 1065 	rts
                           1066 
                           1067 
ASxxxx Assembler V02.21  (Motorola 6809), page 28.
PHS Constant definitions
High Voltage Spectrum Screen

                           1069 	.sbttl	High Voltage Spectrum Screen
                           1070 
                           1071 	.area	SCREEN
                           1072 
   BC3A                    1073 hvh$scrn::
   BC3A 34 36              1074 	pshs	d,x,y
                           1075 
   BC3C D6 47              1076 1$:	ldb	*s$state	; check state
   BC3E 27 14              1077 	beq	3$
   BC40 96 2F              1078 	lda	*char
   BC42 81 17              1079 	cmpa	#CTRLW		; redraw screen ?
   BC44 26 06              1080 	bne	2$
   BC46 6F E4              1081 	clr	,s		; CTRLW seen
   BC48 C6 01              1082 	ldb	#1
   BC4A D7 47              1083 	stb	*s$state	; new state
   BC4C 58                 1084 2$:	aslb
   BC4D C1 08              1085 	cmpb	#5$-4$		; check for valid state
   BC4F 25 03              1086 	blo	3$
   BC51 5F                 1087 	clrb
   BC52 D7 47              1088 	stb	*s$state
   BC54 8E BC 59           1089 3$:	ldx	#4$
   BC57 6E 95              1090 	jmp	[b,x]
                           1091 
   BC59 BC 61 BC 6B BC 93  1092 4$:	.word	5$,6$,9$,10$
        BC 9D
                           1093 
   BC61 FC BF 2E           1094 5$:	ldd	r$lin4		; default option position
   BC64 BD A3 DD           1095 	jsr	init$opt
   BC67 DD 45              1096 	std	*scrn$pos
   BC69 0C 47              1097 	inc	*s$state	; next state
                           1098 
   BC6B BD A3 AF           1099 6$:	jsr	clr$scrn	; clear the screen
   BC6E BD BD AE           1100 	jsr	hst$axis	; draw the axis
                           1101 
   BC71 0D 48              1102 	tst	*o$state	; active options sequence ?
   BC73 27 1C              1103 	beq	8$		; no - skip
   BC75 86 F9              1104 	lda	#ENTER		; redo question
   BC77 BD C0 12           1105 	jsr	hst$ques
   BC7A 0D 59              1106 	tst	*s$strlen	; answer ?
   BC7C 27 13              1107 	beq	8$		; no - skip
   BC7E DC 45              1108 	ldd	*scrn$pos	; cursor position
   BC80 BD 9D 5E           1109 	jsr	fmtindex
   BC83 30 C9 00 49        1110 	leax	s$string,u	; answer string
   BC87 A6 80              1111 7$:	lda	,x+		; copy string
   BC89 2F 06              1112 	ble	8$
   BC8B A7 A0              1113 	sta	,y+
   BC8D 0C 46              1114 	inc	*scrn$pos+1	; update cursor position
   BC8F 20 F6              1115 	bra	7$
                           1116 
   BC91 0C 47              1117 8$:	inc	*s$state	; next state
                           1118 
   BC93 BD BC C5           1119 9$:	jsr	hvh$lgnd	; load up legends
   BC96 DC 45              1120 	ldd	*scrn$pos	; reload cursor position
   BC98 BD A3 CA           1121 	jsr	pos$scrn
   BC9B 0C 47              1122 	inc	*s$state	; next state
                           1123 
ASxxxx Assembler V02.21  (Motorola 6809), page 29.
PHS Constant definitions
High Voltage Spectrum Screen

   BC9D 0D 48              1124 10$:	tst	*o$state	; processing an option ?
   BC9F 27 13              1125 	beq	11$		; no  - skip
                           1126 
   BCA1 96 2F              1127 	lda	*char		; get the character
   BCA3 BD BC F1           1128 	jsr	hvh$optn	; yes - service the option
   BCA6 97 2F              1129 	sta	*char		; character used
                           1130 
   BCA8 0D 47              1131 	tst	*s$state	; exit screen ?
   BCAA 27 16              1132 	beq	12$		; yes - doit
                           1133 
   BCAC 0D 48              1134 	tst	*o$state	; processing finished ?
   BCAE 10 27 FF 8A        1135 	lbeq	1$		; yes - rescan new settup
   BCB2 20 0E              1136 	bra	12$
                           1137 
   BCB4 96 2F              1138 11$:	lda	*char
   BCB6 BD A4 81           1139 	jsr	scn$scrl	; try scrolling to a new option
   BCB9 97 2F              1140 	sta	*char
   BCBB 27 05              1141 	beq	12$
   BCBD BD C0 12           1142 	jsr	hst$ques	; try selecting an option
   BCC0 97 2F              1143 	sta	*char
                           1144 
   BCC2 35 36              1145 12$:	puls	d,x,y
   BCC4 39                 1146 	rts
                           1147 
                           1148 
                           1149 	;
                           1150 	; hvh$scrn Legends
                           1151 	;
                           1152 
   BCC5                    1153 hvh$lgnd::
   BCC5 34 16              1154 	pshs	d,x
                           1155 
   BCC7 96 42              1156 	lda	*scrn$sts+1	; channel #
   BCC9 81 1F              1157 	cmpa	#0d31		; valid LED channel ?
   BCCB 23 07              1158 	blos	1$		; yes - skip
   BCCD 81 20              1159 	cmpa	#0d32		; valid channel ?
   BCCF 22 1D              1160 	bhi	3$		; no - exit
   BCD1 4F                 1161 	clra			; set to channel 0		
   BCD2 97 42              1162 	sta	*scrn$sts+1
   BCD4 48                 1163 1$:	asla
   BCD5 8E 8C 16           1164 	ldx	#acqvtbl	; acquisition variable table
   BCD8 30 96              1165 	leax	[a,x]		; this channel's variables
   BCDA 5F                 1166 	clrb			; compute screen entry
   BCDB 6D 89 00 17        1167 	tst	hv$vscl,x
   BCDF 2A 02              1168 	bpl	2$		; autoscaling
   BCE1 CB 02              1169 	addb	#2		; scaling
   BCE3 8E BE E0           1170 2$:	ldx	#hvh$list	; now get list pointer
   BCE6 30 95              1171 	leax	[b,x]
                           1172 
   BCE8 BD A4 B4           1173 	jsr	scn$lgnd	; do legends
   BCEB BD A4 EB           1174 	jsr	scn$chnl	; and channel number
                           1175 
   BCEE 35 16              1176 3$:	puls	d,x
   BCF0 39                 1177 	rts
                           1178 
                           1179 
ASxxxx Assembler V02.21  (Motorola 6809), page 30.
PHS Constant definitions
High Voltage Spectrum Screen

                           1180 	;
                           1181 	; hvh$scrn Options
                           1182 	;
                           1183 
   BCF1                    1184 hvh$optn::
   BCF1 BD A4 0E           1185 	jsr	scn$gets	; build a response string
   BCF4 27 3A              1186 	beq	3$		; not finished
   BCF6 0D 49              1187 	tst	*s$string	; NULL string ?
   BCF8 2F 28              1188 	ble	2$		; yes - terminate option
                           1189 
   BCFA BD A3 F8           1190 	jsr	option		; get the option number
   BCFD 58                 1191 	aslb
   BCFE C1 14              1192 	cmpb	#5$-4$		; valid option ?
   BD00 24 20              1193 	bhis	2$		; no - terminate request
                           1194 
   BD02 96 42              1195 	lda	*scrn$sts+1	; get channel number
   BD04 81 1F              1196 	cmpa	#0d31		; valid channel ?
   BD06 22 1A              1197 	bhi	2$		; no - terminate option
   BD08 48                 1198 	asla
                           1199 
   BD09 10 8E BD 22        1200 	ldy	#2$		; options return address
   BD0D 34 20              1201 	pshs	y
                           1202 
   BD0F 10 8E BD 32        1203 	ldy	#4$		; jump table
   BD13 31 B5              1204 	leay	[b,y]		; get address of option routine
   BD15 34 20              1205 	pshs	y		; push as a return address
                           1206 
   BD17 30 C9 00 49        1207 	leax	s$string,u	; string pointer
                           1208 
   BD1B 10 8E 8C 16        1209 	ldy	#acqvtbl	; variables address for this channel
   BD1F 31 B6              1210 	leay	[a,y]
                           1211 
   BD21 39                 1212 1$:	rts			; do option
                           1213 
   BD22 0F 48              1214 2$:	clr	*o$state	; option completed
   BD24 86 17              1215 	lda	#SCRNBT
   BD26 C6 00              1216 	ldb	#0
   BD28 BD 9D 75           1217 	jsr	fmtdeol		; clear option question and answer
                           1218 
   BD2B DC 72              1219 	ldd	*opt$posn	; option position
   BD2D BD A3 CA           1220 	jsr	pos$scrn	; restore cursor
                           1221 
   BD30 4F                 1222 3$:	clra			; input character always used
   BD31 39                 1223 	rts
                           1224 
   BD32 BD 21              1225 4$:	.word	1$		; invalid option
   BD34 BD 46              1226 	.word	5$		; new channel
   BD36 BD 54              1227 	.word	7$		; exit screen
   BD38 BD 5C              1228 	.word	9$		; change to fixed scale
   BD3A BD 70              1229 	.word	11$		; change to auto scale
   BD3C BD 84              1230 	.word	13$		; zero				unused
   BD3E BD 85              1231 	.word	14$		; set vertical scale
   BD40 BD A1              1232 	.word	16$		; set vertical offset
   BD42 BD AC              1233 	.word	18$		; set horizontal scale		unused
   BD44 BD AD              1234 	.word	19$		; set horizontal offset		unused
                           1235 
ASxxxx Assembler V02.21  (Motorola 6809), page 31.
PHS Constant definitions
High Voltage Spectrum Screen

                           1236 	; New Channel Number
                           1237 
   BD46 BD E3 34           1238 5$:	jsr	a$d$i		; convert to an integer
   BD49 C1 1F              1239 	cmpb	#0d31		; valid ?
   BD4B 22 06              1240 	bhi	6$		; no - skip
   BD4D D7 42              1241 	stb	*scrn$sts+1	; save new channel #
   BD4F 86 02              1242 	lda	#2		; redraw legends
   BD51 97 47              1243 	sta	*s$state	
   BD53 39                 1244 6$:	rts
                           1245 
                           1246 	; Exit Screen
                           1247 
   BD54 BD A4 05           1248 7$:	jsr	ans$yes		; yes ?
   BD57 26 02              1249 	bne	8$		; no - skip
   BD59 0F 47              1250 	clr	*s$state	; just exit
   BD5B 39                 1251 8$:	rts
                           1252 
                           1253 	; Change to Fixed Scale
                           1254 
   BD5C BD A4 05           1255 9$:	jsr	ans$yes		; yes ?
   BD5F 26 0E              1256 	bne	10$		; no - skip
   BD61 A6 A9 00 17        1257 	lda	hv$vscl,y	; make fixed scale
   BD65 8A 80              1258 	ora	#0q200
   BD67 A7 A9 00 17        1259 	sta	hv$vscl,y
   BD6B 86 02              1260 	lda	#2		; redraw legends
   BD6D 97 47              1261 	sta	*s$state	
   BD6F 39                 1262 10$:	rts
                           1263 
                           1264 	; Change to Auto Scale
                           1265 
   BD70 BD A4 05           1266 11$:	jsr	ans$yes		; yes ?
   BD73 26 0E              1267 	bne	12$		; no - skip
   BD75 A6 A9 00 17        1268 	lda	hv$vscl,y	; make fixed scale
   BD79 84 7F              1269 	anda	#~0q200
   BD7B A7 A9 00 17        1270 	sta	hv$vscl,y
   BD7F 86 02              1271 	lda	#2		; redraw legends
   BD81 97 47              1272 	sta	*s$state	
   BD83 39                 1273 12$:	rts
                           1274 
                           1275 	; Zero
                           1276 
   BD84 39                 1277 13$:	rts			; unused option
                           1278 
                           1279 	; Vertical scale
                           1280 
   BD85 BD E3 34           1281 14$:	jsr	a$d$i		; convert to an integer
   BD88 C1 0F              1282 	cmpb	#0d15
   BD8A 22 14              1283 	bhi	15$
   BD8C C1 04              1284 	cmpb	#0d4
   BD8E 25 10              1285 	blo	15$
   BD90 C0 04              1286 	subb	#4		; 2^4 is 16, minimum full scale
   BD92 E7 E2              1287 	stb	,-s
   BD94 E6 A9 00 17        1288 	ldb	hv$vscl,y	; mask out scale
   BD98 C4 F0              1289 	andb	#0xF0
   BD9A EA E0              1290 	orb	,s+
   BD9C E7 A9 00 17        1291 	stb	hv$vscl,y
ASxxxx Assembler V02.21  (Motorola 6809), page 32.
PHS Constant definitions
High Voltage Spectrum Screen

   BDA0 39                 1292 15$:	rts
                           1293 	
                           1294 	; Vertical Offset
                           1295 
   BDA1 BD E3 34           1296 16$:	jsr	a$d$i		; convert to an integer
   BDA4 4D                 1297 	tsta
   BDA5 2B 04              1298 	bmi	17$
   BDA7 ED A9 00 15        1299 	std	hv$vofs,y
   BDAB 39                 1300 17$:	rts
                           1301 
                           1302 	; Horizontal Scale
                           1303 
   BDAC 39                 1304 18$:	rts			; unused option
                           1305 	
                           1306 	; Horizontal Offset
                           1307 
   BDAD 39                 1308 19$:	rts			; unused option
                           1309 
                           1310 
ASxxxx Assembler V02.21  (Motorola 6809), page 33.
PHS Constant definitions
High Voltage Histogramming Routine

                           1312 	.sbttl	High Voltage Histogramming Routine
                           1313 
                           1314 	.area	SCRNUPDT
                           1315 
                           1316 	;	Enter with channel number in b
                           1317 	;
                           1318 	;	the following stack frame is created :
                           1319 	;
                           1320 	;	8,s	u
                           1321 	;	6,s	y
                           1322 	;	4,s	x
                           1323 	;	2,s	d	(4,s)	a	(5,s)	b
                           1324 	;	0,s	scale jump address
                           1325 	;
                           1326 
                    0008   1327 	$OLDU	= 0d8
                    0006   1328 	$OLDY	= 0d6
                    0004   1329 	$OLDX	= 0d4
                    0002   1330 	$OLDD	= 0d2
                    0000   1331 	$JUMP	= 0d0
                           1332 
   E135                    1333 hvh$hst::
   E135 34 76              1334 	pshs	d,x,y,u		; save all
   E137 32 7E              1335 	leas	-2,s		; jump address
                           1336 
   E139 C1 1F              1337 	cmpb	#0d31		; LED data ?
   E13B 10 22 01 35        1338 	lbhi	13$		; no - exit
   E13F 58                 1339 	aslb
   E140 8E 8B D4           1340 	ldx	#acqbtbl	; data pointers
   E143 30 95              1341 	leax	[b,x]
   E145 10 8E 8C 16        1342 	ldy	#acqvtbl
   E149 31 B5              1343 	leay	[b,y]
                           1344 
   E14B A6 A9 00 17        1345 1$:	lda	hv$vscl,y
   E14F 10 2B 00 8C        1346 	lbmi	10$		; skip if not auto scale
                           1347 
                           1348 	; auto scaling routine
                           1349 
   E153 34 30              1350 	pshs	x,y
   E155 30 89 01 00        1351 	leax	acq$vltg,x	; voltage data
   E159 10 8E 00 40        1352 	ldy	#0d64		; histo length
   E15D CC 00 00           1353 	ldd	#0		; smallest value
   E160 10 A3 81           1354 2$:	cmpd	,x++		; find largest
   E163 24 02              1355 	bhis	3$
   E165 EC 1E              1356 	ldd	-2,x
   E167 31 3F              1357 3$:	leay	-1,y
   E169 26 F5              1358 	bne	2$
   E16B 35 30              1359 	puls	x,y
                           1360 
   E16D ED E3              1361 	std	,--s		; save largest
                           1362 
   E16F 34 30              1363 	pshs	x,y
   E171 30 89 01 00        1364 	leax	acq$vltg,x	; voltage data
   E175 10 8E 00 40        1365 	ldy	#0d64		; histo length
   E179 CC FF FF           1366 	ldd	#-1		; largest value
   E17C ED E3              1367 	std	,--s
ASxxxx Assembler V02.21  (Motorola 6809), page 34.
PHS Constant definitions
High Voltage Histogramming Routine

   E17E EC 81              1368 4$:	ldd	,x++		; find smallest greater than 0
   E180 27 07              1369 	beq	5$
   E182 10 A3 E4           1370 	cmpd	,s		; find smallest
   E185 24 02              1371 	bhis	5$
   E187 ED E4              1372 	std	,s
   E189 31 3F              1373 5$:	leay	-1,y
   E18B 26 F1              1374 	bne	4$
   E18D EC E1              1375 	ldd	,s++
   E18F 2A 03              1376 	bpl	6$
   E191 CC 00 00           1377 	ldd	#0		; if none found then use 0
   E194 35 30              1378 6$:	puls	x,y
                           1379 
   E196 ED E3              1380 	std	,--s		; save smallest
                           1381 
   E198 EC 62              1382 	ldd	2,s		; largest
   E19A A3 60              1383 	subd	0,s		; smallest
   E19C 58                 1384 	aslb			; (l-s)*2
   E19D 49                 1385 	rola
                           1386 
   E19E 6F A9 00 17        1387 	clr	hv$vscl,y	; auto scale
                           1388 
   E1A2 10 83 00 13        1389 7$:	cmpd	#0d19		; now compute scaling factor
   E1A6 23 0A              1390 	blos	8$		; 0 - 19 is allowed pulse height
   E1A8 1C FE              1391 	clc			; divide by two
   E1AA 46                 1392 	rora
   E1AB 56                 1393 	rorb
   E1AC 6C A9 00 17        1394 	inc	hv$vscl,y	; update scaling
   E1B0 20 F0              1395 	bra	7$
                           1396 
   E1B2 EC E1              1397 8$:	ldd	,s++		; smallest
   E1B4 E3 E1              1398 	addd	,s++		; smallest
   E1B6 1C FE              1399 	clc			; (l+s)/2
   E1B8 46                 1400 	rora
   E1B9 56                 1401 	rorb
   E1BA ED A9 00 15        1402 	std	hv$vofs,y	; save average of min/max
                           1403 
   E1BE 34 10              1404 	pshs	x
   E1C0 A6 A9 00 17        1405 	lda	hv$vscl,y	; get the scaling factor
   E1C4 84 0F              1406 	anda	#0x0F
   E1C6 48                 1407 	asla
   E1C7 8E E2 79           1408 	ldx	#14$
   E1CA EC 86              1409 	ldd	a,x		; 1/2 full scale
   E1CC ED E3              1410 	std	,--s
                           1411 
   E1CE EC A9 00 15        1412 	ldd	hv$vofs,y
   E1D2 A3 E1              1413 	subd	,s++		; (l+s)/2 - 1/2 full scale
   E1D4 2A 03              1414 	bpl	9$		; no negative offsets
   E1D6 CC 00 00           1415 	ldd	#0
   E1D9 ED A9 00 15        1416 9$:	std	hv$vofs,y
   E1DD 35 10              1417 	puls	x
                           1418 
                           1419 	; scale the data and plot
                           1420 
   E1DF A6 A9 00 17        1421 10$:	lda	hv$vscl,y	; get the scaling factor
   E1E3 84 0F              1422 	anda	#0x0F
   E1E5 48                 1423 	asla
ASxxxx Assembler V02.21  (Motorola 6809), page 35.
PHS Constant definitions
High Voltage Histogramming Routine

   E1E6 40                 1424 	nega
   E1E7 33 8C 33           1425 	leau	12$,pcr		; compute jump address for scaling
   E1EA 33 C6              1426 	leau	a,u
   E1EC EF 60              1427 	stu	$JUMP,s
   E1EE 33 89 01 00        1428 	leau	acq$vltg,x	; data buffer address
   E1F2 6F A9 00 10        1429 	clr	run$index,y	; clear the index
                           1430 
   E1F6 EC C1              1431 11$:	ldd	,u++		; get the data
   E1F8 A3 A9 00 15        1432 	subd	hv$vofs,y	; take off offset
   E1FC 6E F8 00           1433 	jmp	[$JUMP,s]	; do proper scaling
   E1FF 47                 1434 	asra			; / 2^15
   E200 56                 1435 	rorb
   E201 47                 1436 	asra			; / 2^14
   E202 56                 1437 	rorb
   E203 47                 1438 	asra			; / 2^13
   E204 56                 1439 	rorb
   E205 47                 1440 	asra			; / 2^12
   E206 56                 1441 	rorb
   E207 47                 1442 	asra			; / 2^11
   E208 56                 1443 	rorb
   E209 47                 1444 	asra			; / 2^10
   E20A 56                 1445 	rorb
   E20B 47                 1446 	asra			; / 2^9
   E20C 56                 1447 	rorb
   E20D 47                 1448 	asra			; / 2^8
   E20E 56                 1449 	rorb
   E20F 47                 1450 	asra			; / 2^7
   E210 56                 1451 	rorb
   E211 47                 1452 	asra			; / 2^6
   E212 56                 1453 	rorb
   E213 47                 1454 	asra			; / 2^5
   E214 56                 1455 	rorb
   E215 47                 1456 	asra			; / 2^4
   E216 56                 1457 	rorb
   E217 47                 1458 	asra			; / 2^3
   E218 56                 1459 	rorb
   E219 47                 1460 	asra			; / 2^2
   E21A 56                 1461 	rorb
   E21B 47                 1462 	asra			; / 2^1
   E21C 56                 1463 	rorb
   E21D A6 A9 00 10        1464 12$:	lda	run$index,y	; column
   E221 BD E2 9B           1465 	jsr	hvh$clmn	; plot the data
   E224 4C                 1466 	inca
   E225 A7 A9 00 10        1467 	sta	run$index,y	; next column
   E229 81 40              1468 	cmpa	#0d64		; finished
   E22B 25 C9              1469 	blo	11$		; no - loop
   E22D EE 68              1470 	ldu	$OLDU,s		; restore u
                           1471 
                           1472 	; Vertical Scale Update
                           1473 
   E22F A6 A9 00 17        1474 	lda	hv$vscl,y	; get the scaling factor
   E233 84 0F              1475 	anda	#0x0F
   E235 48                 1476 	asla
   E236 8E E2 79           1477 	ldx	#14$
   E239 EC 86              1478 	ldd	a,x		; 1/2 full scale
   E23B AE A9 00 15        1479 	ldx	hv$vofs,y	; offset
ASxxxx Assembler V02.21  (Motorola 6809), page 36.
PHS Constant definitions
High Voltage Histogramming Routine

   E23F AF E3              1480 	stx	,--s
   E241 30 8B              1481 	leax	d,x		; offset + 1/2 full scale
   E243 AF E3              1482 	stx	,--s
   E245 30 8B              1483 	leax	d,x		; offset + 2/2 full scale
   E247 86 00              1484 	lda	#SCRNTP
   E249 C6 06              1485 	ldb	#$HSTCOL-0d8
   E24B BD 9E 9F           1486 	jsr	fmt6rjint
                           1487 
   E24E AE E1              1488 	ldx	,s++
   E250 86 0A              1489 	lda	#SCRNTP+0d10
   E252 C6 06              1490 	ldb	#$HSTCOL-0d8
   E254 BD 9E 9F           1491 	jsr	fmt6rjint
                           1492 
   E257 AE E1              1493 	ldx	,s++
   E259 86 14              1494 	lda	#SCRNTP+0d20
   E25B C6 06              1495 	ldb	#$HSTCOL-0d8
   E25D BD 9E 9F           1496 	jsr	fmt6rjint
                           1497 
                           1498 	; Horizontal Scale Update
                           1499 
   E260 8E 00 40           1500 	ldx	#0d64
   E263 86 16              1501 	lda	#SCRNTP+0d22
   E265 C6 49              1502 	ldb	#$HSTCOL+$HSTWIDTH-0d5
   E267 BD 9E 9F           1503 	jsr	fmt6rjint
                           1504 
   E26A 8E 00 00           1505 	ldx	#0
   E26D 86 16              1506 	lda	#SCRNTP+0d22
   E26F C6 0E              1507 	ldb	#$HSTCOL
   E271 BD 9E C5           1508 	jsr	fmt6ljint
                           1509 
                           1510 	; finished
                           1511 
   E274 32 62              1512 13$:	leas	2,s		; pop jump address
   E276 35 76              1513 	puls	d,x,y,u		; restore all
   E278 39                 1514 	rts
                           1515 
                           1516 
   E279 00 0A 00 14 00 28  1517 14$:	.word	0d10,	0d20,	0d40,	0d80,	0d160,	0d320
        00 50 00 A0 01 40
   E285 02 80 05 00 0A 00  1518 	.word	0d640,	0d1280,	0d2560,	0d5120,	0d10240,0d20480
        14 00 28 00 50 00
                           1519 
   E291 04 00 02 00 01 00  1520 15$:	.word	0d1024,	0d512,	0d256,	0d128,	0d64
        00 80 00 40
                           1521 
                           1522 
ASxxxx Assembler V02.21  (Motorola 6809), page 37.
PHS Constant definitions
Plot Data in Column

                           1524 	.sbttl	Plot Data in Column
                           1525 
                           1526 	;  a	-	histo column for new data point
                           1527 	;  b	-	data value to plot
                           1528 
   E29B                    1529 hvh$clmn::
   E29B 34 16              1530 	pshs	d,x		; have added 0d6 to stack frame
                           1531 
   E29D AE 6E              1532 	ldx	$OLDU+0d6,s	; get original u
   E29F 30 89 03 5E        1533 	leax	fmtbuf+$HSTROW*SCRNW+$HSTCOL,x
   E2A3 30 86              1534 	leax	a,x		; top of selected column
   E2A5 86 20              1535 	lda	#(' )		; space character
   E2A7 A7 00              1536 	sta	0d0  * SCRNW,x	; clear the whole column fast !
   E2A9 A7 88 50           1537 	sta	0d1  * SCRNW,x
   E2AC A7 89 00 A0        1538 	sta	0d2  * SCRNW,x
   E2B0 A7 89 00 F0        1539 	sta	0d3  * SCRNW,x
   E2B4 A7 89 01 40        1540 	sta	0d4  * SCRNW,x
   E2B8 A7 89 01 90        1541 	sta	0d5  * SCRNW,x
   E2BC A7 89 01 E0        1542 	sta	0d6  * SCRNW,x
   E2C0 A7 89 02 30        1543 	sta	0d7  * SCRNW,x
   E2C4 A7 89 02 80        1544 	sta	0d8  * SCRNW,x
   E2C8 A7 89 02 D0        1545 	sta	0d9  * SCRNW,x
   E2CC A7 89 03 20        1546 	sta	0d10 * SCRNW,x
   E2D0 A7 89 03 70        1547 	sta	0d11 * SCRNW,x
   E2D4 A7 89 03 C0        1548 	sta	0d12 * SCRNW,x
   E2D8 A7 89 04 10        1549 	sta	0d13 * SCRNW,x
   E2DC A7 89 04 60        1550 	sta	0d14 * SCRNW,x
   E2E0 A7 89 04 B0        1551 	sta	0d15 * SCRNW,x
   E2E4 A7 89 05 00        1552 	sta	0d16 * SCRNW,x
   E2E8 A7 89 05 50        1553 	sta	0d17 * SCRNW,x
   E2EC A7 89 05 A0        1554 	sta	0d18 * SCRNW,x
   E2F0 A7 89 05 F0        1555 	sta	0d19 * SCRNW,x
                           1556 
   E2F4 C1 13              1557 	cmpb	#0d19		; check range
   E2F6 22 1D              1558 	bhi	3$		; don't plot if out of range
                           1559 
   E2F8 50                 1560 	negb			; compute data position within this column
   E2F9 CB 13              1561 	addb	#0d19
   E2FB 86 50              1562 	lda	#SCRNW
   E2FD 3D                 1563 	mul
   E2FE 30 8B              1564 	leax	d,x
   E300 86 2A              1565 	lda	#'*		; plot data point
   E302 E6 A9 00 14        1566 	ldb	hv$index,y	; check for most recent update
   E306 5A                 1567 	decb
   E307 2A 02              1568 	bpl	1$
   E309 C6 3F              1569 	ldb	#0d63
   E30B E1 A9 00 10        1570 1$:	cmpb	run$index,y
   E30F 26 02              1571 	bne	2$
   E311 86 40              1572 	lda	#'@		; most recent
   E313 A7 84              1573 2$:	sta	,x
                           1574 
   E315 35 16              1575 3$:	puls	d,x
   E317 39                 1576 	rts
                           1577 
                           1578 
ASxxxx Assembler V02.21  (Motorola 6809), page 38.
PHS Constant definitions
Histogram Axis Drawing

                           1580 	.sbttl	Histogram Axis Drawing
                           1581 
                           1582 	.area	SCREEN
                           1583 
   BDAE                    1584 hst$axis::
   BDAE 34 36              1585 	pshs	d,x,y
                           1586 
   BDB0 10 8E BD C3        1587 	ldy	#3$
   BDB4 EC A1              1588 1$:	ldd	,y++		; get row and column
   BDB6 DD 74              1589 	std	*fmtrow
   BDB8 AE A1              1590 	ldx	,y++		; get string
   BDBA 27 04              1591 	beq	2$
   BDBC AD B1              1592 	jsr	[,y++]		; do proper format routine
   BDBE 20 F4              1593 	bra	1$
                           1594 
   BDC0 35 36              1595 2$:	puls	d,x,y
   BDC2 39                 1596 	rts
                           1597 
   BDC3 00 0E              1598 3$:	.byte	$HSTROW-1,		$HSTCOL
   BDC5 BD DF 9D 9A        1599 	.word	4$,  fmthtxt
                           1600 
   BDC9 15 0E              1601 	.byte	$HSTROW+0d19+1,		$HSTCOL
   BDCB BD DF 9D 9A        1602 	.word	4$,  fmthtxt
                           1603 
   BDCF 00 0D              1604 	.byte	$HSTROW-1,		$HSTCOL-1
   BDD1 BE 21 9D EF        1605 	.word	5$,  fmtvtxt
                           1606 
   BDD5 00 4E              1607 	.byte	$HSTROW-1,		$HSTCOL+$HSTWIDTH
   BDD7 BE 21 9D EF        1608 	.word	5$,  fmtvtxt
                           1609 
   BDDB 00 00              1610 	.byte	0,			0
   BDDD 00 00              1611 	.word	0
                           1612 
   BDDF                    1613 4$:
   BDDF 2B 2D 2D 2D 2D 2D  1614 .asciz	"+-------+-------+-------+-------+-------+-------+-------+-------+"
        2D 2D 2B 2D 2D 2D
        2D 2D 2D 2D 2B 2D
        2D 2D 2D 2D 2D 2D
        2B 2D 2D 2D 2D 2D
        2D 2D 2B 2D 2D 2D
        2D 2D 2D 2D 2B 2D
        2D 2D 2D 2D 2D 2D
        2B 2D 2D 2D 2D 2D
        2D 2D 2B 2D 2D 2D
        2D 2D 2D 2D 2B 00
                           1615 
   BE21                    1616 5$:
   BE21 2B 49 49 49 49 2B  1617 .asciz	"+IIII+IIII+IIII+IIII++"
        49 49 49 49 2B 49
        49 49 49 2B 49 49
        49 49 2B 2B 00
                           1618 
                           1619 
ASxxxx Assembler V02.21  (Motorola 6809), page 39.
PHS Constant definitions
Screen Lists

                           1621 	.sbttl	Screen Lists
                           1622 
   BE38                    1623 phs$list:
   BE38 BE 40 BE 56 BE 6C  1624 	.word	phs$dauto,	phs$tauto,	phs$dscal,	phs$tscal
        BE 82
                           1625 
   BE40                    1626 phs$dauto:
   BE40 BF 04 BF 16 BF 2E  1627 	.word	n$lind,	n$lin2p,r$lin4,	r$lin5a,r$lin6
        BF 34 BF 40
   BE4A BF 46 BF 52 BF 5E  1628 	.word	n$lin7,	n$lin8,	r$lin9,	r$lin10,r$lin3,	0
        BF 64 BF 28 00 00
                           1629 
   BE56                    1630 phs$tauto:
   BE56 BF 0A BF 16 BF 2E  1631 	.word	n$lint,	n$lin2p,r$lin4,	r$lin5a,r$lin6
        BF 34 BF 40
   BE60 BF 46 BF 52 BF 5E  1632 	.word	n$lin7,	n$lin8,	r$lin9,	r$lin10,r$lin3,	0
        BF 64 BF 28 00 00
                           1633 
   BE6C                    1634 phs$dscal:
   BE6C BF 04 BF 16 BF 2E  1635 	.word	n$lind,	n$lin2p,r$lin4,	r$lin5s,r$lin6
        BF 3A BF 40
   BE76 BF 4C BF 58 BF 5E  1636 	.word	r$lin7,	r$lin8,	r$lin9,	r$lin10,r$lin3,	0
        BF 64 BF 28 00 00
                           1637 
   BE82                    1638 phs$tscal:
   BE82 BF 0A BF 16 BF 2E  1639 	.word	n$lint,	n$lin2p,r$lin4,	r$lin5s,r$lin6
        BF 3A BF 40
   BE8C BF 4C BF 58 BF 5E  1640 	.word	r$lin7,	r$lin8,	r$lin9,	r$lin10,r$lin3,	0
        BF 64 BF 28 00 00
                           1641 
                           1642 
   BE98                    1643 avg$list:
   BE98 BE A0 BE B0 BE C0  1644 	.word	avg$dauto,	avg$tauto,	avg$dscal,	avg$tscal
        BE D0
                           1645 
   BEA0                    1646 avg$dauto:
   BEA0 BF 04 BF 1C BF 2E  1647 	.word	n$lind,	n$lin2a,r$lin4,	r$lin5a
        BF 34
   BEA8 BF 46 BF 52 BF 28  1648 	.word	n$lin7,	n$lin8,	r$lin3,	0
        00 00
                           1649 
   BEB0                    1650 avg$tauto:
   BEB0 BF 0A BF 1C BF 2E  1651 	.word	n$lint,	n$lin2a,r$lin4,	r$lin5a
        BF 34
   BEB8 BF 46 BF 52 BF 28  1652 	.word	n$lin7,	n$lin8,	r$lin3,	0
        00 00
                           1653 
   BEC0                    1654 avg$dscal:
   BEC0 BF 04 BF 1C BF 2E  1655 	.word	n$lind,	n$lin2a,r$lin4,	r$lin5s
        BF 3A
   BEC8 BF 4C BF 58 BF 28  1656 	.word	r$lin7,	r$lin8,	r$lin3,	0
        00 00
                           1657 
   BED0                    1658 avg$tscal:
   BED0 BF 0A BF 1C BF 2E  1659 	.word	n$lint,	n$lin2a,r$lin4,	r$lin5s
        BF 3A
ASxxxx Assembler V02.21  (Motorola 6809), page 40.
PHS Constant definitions
Screen Lists

   BED8 BF 4C BF 58 BF 28  1660 	.word	r$lin7,	r$lin8,	r$lin3,	0
        00 00
                           1661 
                           1662 
   BEE0                    1663 hvh$list:
   BEE0 BE E4 BE F4        1664 	.word	hvh$dauto,	hvh$dscal
                           1665 
   BEE4                    1666 hvh$dauto:
   BEE4 BF 10 BF 22 BF 2E  1667 	.word	n$linh,	n$lin2h,r$lin4,	r$lin5a
        BF 34
   BEEC BF 46 BF 52 BF 28  1668 	.word	n$lin7,	n$lin8,	r$lin3,	0
        00 00
                           1669 
   BEF4                    1670 hvh$dscal:
   BEF4 BF 04 BF 22 BF 2E  1671 	.word	n$lind,	n$lin2h,r$lin4,	r$lin5s
        BF 3A
   BEFC BF 4C BF 58 BF 28  1672 	.word	r$lin7,	r$lin8,	r$lin3,	0
        00 00
                           1673 
                           1674 	;	row		column		video		option
                           1675 	;-------------------------------------------------------------
                    05FB   1676 n$lind	= .
   BF04 01 01 00 00        1677 	.byte	SCRNTP+0d1,	1,		NORMAL,		0
   BF08 BF 6A              1678 	.word	1$		; "Detector"
                    0601   1679 n$lint	= .
   BF0A 01 01 00 00        1680 	.byte	SCRNTP+0d1,	1,		NORMAL,		0
   BF0E BF 76              1681 	.word	2$		; "Temperature"
                    0607   1682 n$linh	= .
   BF10 01 01 00 00        1683 	.byte	SCRNTP+0d1,	1,		NORMAL,		0
   BF14 BF 9A              1684 	.word	5$		; "H. V."
                    060D   1685 n$lin2p	= .
   BF16 02 01 00 00        1686 	.byte	SCRNTP+0d2,	1,		NORMAL,		0
   BF1A BF 82              1687 	.word	3$		; "P.H.S."
                    0613   1688 n$lin2a	= .
   BF1C 02 01 00 00        1689 	.byte	SCRNTP+0d2,	1,		NORMAL,		0
   BF20 BF 8E              1690 	.word	4$		; "Averages"
                    0619   1691 n$lin2h	= .
   BF22 02 01 00 00        1692 	.byte	SCRNTP+0d2,	1,		NORMAL,		0
   BF26 BF A6              1693 	.word	6$		; "Updates"
                    061F   1694 r$lin3	= .
   BF28 04 01 80 01        1695 	.byte	SCRNTP+0d4,	1,		REVERSE,	1
   BF2C BF B2              1696 	.word	7$		; "Channel #"
                    0625   1697 r$lin4	= .
   BF2E 06 01 80 02        1698 	.byte	SCRNTP+0d6,	1,		REVERSE,	2
   BF32 BF BE              1699 	.word	8$		; "Exit"
                    062B   1700 r$lin5a	= .
   BF34 08 01 80 03        1701 	.byte	SCRNTP+0d8,	1,		REVERSE,	3
   BF38 BF CA              1702 	.word	9$		; "Change Mode"
                    0631   1703 r$lin5s	= .
   BF3A 08 01 80 04        1704 	.byte	SCRNTP+0d8,	1,		REVERSE,	4
   BF3E BF CA              1705 	.word	9$		; "Change Mode"
                    0637   1706 r$lin6	= .
   BF40 0C 01 80 05        1707 	.byte	SCRNTP+0d12,	1,		REVERSE,	5
   BF44 BF D6              1708 	.word	10$		; "Zero"
                    063D   1709 n$lin7	= .
   BF46 0E 01 00 00        1710 	.byte	SCRNTP+0d14,	1,		NORMAL,		0
ASxxxx Assembler V02.21  (Motorola 6809), page 41.
PHS Constant definitions
Screen Lists

   BF4A BF E2              1711 	.word	11$		; "V Scale"
                    0643   1712 r$lin7	= .
   BF4C 0E 01 80 06        1713 	.byte	SCRNTP+0d14,	1,		REVERSE,	6
   BF50 BF E2              1714 	.word	11$		; "V Scale"
                    0649   1715 n$lin8	= .
   BF52 0F 01 00 00        1716 	.byte	SCRNTP+0d15,	1,		NORMAL,		0
   BF56 BF EE              1717 	.word	12$		; "V Offset"
                    064F   1718 r$lin8	= .
   BF58 0F 01 80 07        1719 	.byte	SCRNTP+0d15,	1,		REVERSE,	7
   BF5C BF EE              1720 	.word	12$		; "V Offset"
                    0655   1721 r$lin9	= .
   BF5E 11 01 80 08        1722 	.byte	SCRNTP+0d17,	1,		REVERSE,	8
   BF62 BF FA              1723 	.word	13$		; "H Scale"
                    065B   1724 r$lin10	= .
   BF64 12 01 80 09        1725 	.byte	SCRNTP+0d18,	1,		REVERSE,	9
   BF68 C0 06              1726 	.word	14$		; "H Offset"
                           1727 
                           1728 
   BF6A 20 20 44 65 74 65  1729 1$:	.asciz	"  Detector "		; channels 0-31
        63 74 6F 72 20 00
   BF76 54 65 6D 70 65 72  1730 2$:	.asciz	"Temperature"		; channel 32
        61 74 75 72 65 00
   BF82 20 20 20 50 2E 48  1731 3$:	.asciz	"   P.H.S.  "
        2E 53 2E 20 20 00
   BF8E 20 20 41 76 65 72  1732 4$:	.asciz	"  Averages "
        61 67 65 73 20 00
   BF9A 20 20 20 48 2E 20  1733 5$:	.asciz	"   H. V.   "
        56 2E 20 20 20 00
   BFA6 20 20 55 70 64 61  1734 6$:	.asciz	"  Updates  "
        74 65 73 20 20 00
   BFB2 43 68 61 6E 6E 65  1735 7$:	.asciz	"Channel #  "		; 1
        6C 20 23 20 20 00
   BFBE 45 78 69 74 20 53  1736 8$:	.asciz	"Exit Screen"		; 2
        63 72 65 65 6E 00
   BFCA 43 68 61 6E 67 65  1737 9$:	.asciz	"Change Mode"		; 3/4
        20 4D 6F 64 65 00
   BFD6 20 20 20 20 5A 65  1738 10$:	.asciz	"    Zero   "		; 5
        72 6F 20 20 20 00
   BFE2 20 56 2E 20 53 63  1739 11$:	.asciz	" V. Scale  "		; 6
        61 6C 65 20 20 00
   BFEE 20 56 2E 20 4F 66  1740 12$:	.asciz	" V. Offset "		; 7
        66 73 65 74 20 00
   BFFA 20 48 2E 20 53 63  1741 13$:	.asciz	" H. Scale  "		; 8
        61 6C 65 20 20 00
   C006 20 48 2E 20 4F 66  1742 14$:	.asciz	" H. Offset "		; 9
        66 73 65 74 20 00
                           1743 
                           1744 
                           1745 	;
                           1746 	; xxx$scrn Questions
                           1747 	;
                           1748 
   C012                    1749 hst$ques::
   C012 81 F9              1750 	cmpa	#ENTER		; selecting ?
   C014 26 37              1751 	bne	5$		; no - exit
                           1752 
ASxxxx Assembler V02.21  (Motorola 6809), page 42.
PHS Constant definitions
Screen Lists

   C016 34 34              1753 	pshs	b,x,y
                           1754 
   C018 86 17              1755 	lda	#SCRNBT		; common question position
   C01A C6 00              1756 	ldb	#0
   C01C BD 9D 5E           1757 	jsr	fmtindex
                           1758 
   C01F 30 C9 00 5A        1759 	leax	optarray,u	; get option
   C023 D6 72              1760 	ldb	*opt$posn
   C025 E6 85              1761 	ldb	b,x
                           1762 
   C027 C1 02              1763 	cmpb	#2		; exit screen option ?
   C029 26 02              1764 	bne	1$		; no - skip
   C02B 0F 47              1765 	clr	*s$state	; immediate exit
                           1766 
   C02D 58                 1767 1$:	aslb
   C02E C1 26              1768 	cmpb	#8$-6$		; valid option ?
   C030 24 18              1769 	bhis	4$		; no - exit
   C032 8E C0 4E           1770 	ldx	#6$
   C035 30 95              1771 	leax	[b,x]
   C037 A6 80              1772 2$:	lda	,x+
   C039 27 06              1773 	beq	3$
   C03B A7 A0              1774 	sta	,y+
   C03D 0C 75              1775 	inc	*fmtcol		; next column
   C03F 20 F6              1776 	bra	2$
                           1777 
   C041 DC 74              1778 3$:	ldd	*fmtrow		; load new cursor position
   C043 BD A3 CA           1779 	jsr	pos$scrn
   C046 86 01              1780 	lda	#1		; option processing
   C048 97 48              1781 	sta	*o$state
   C04A 4F                 1782 4$:	clra			; dump character
   C04B 35 34              1783 	puls	b,x,y
   C04D 39                 1784 5$:	rts
                           1785 
                           1786 
   C04E C0 62 C0 74 C0 8B  1787 6$:	.word	7$,8$,9$,10$,11$,12$,13$,14$,15$,16$
        C0 A8 C0 CC C0 EF
        C1 0A C1 34 C1 58
        C1 84
                           1788 
   C062 49 6E 76 61 6C 69  1789 7$:	.asciz	"Invalid Selection"					; 0
        64 20 53 65 6C 65
        63 74 69 6F 6E 00
   C074 53 65 6C 65 63 74  1790 8$:	.asciz	"Select New Channel -> "				; 1
        20 4E 65 77 20 43
        68 61 6E 6E 65 6C
        20 2D 3E 20 00
   C08B 2E 2E 2E 20 45 78  1791 9$:	.asciz	"... Exitting this Screen ..."				; 2
        69 74 74 69 6E 67
        20 74 68 69 73 20
        53 63 72 65 65 6E
        20 2E 2E 2E 00
   C0A8 43 68 61 6E 67 65  1792 10$:	.asciz	"Change to Fixed Scaling (Y,N) ? -> "			; 3
        20 74 6F 20 46 69
        78 65 64 20 53 63
        61 6C 69 6E 67 20
        28 59 2C 4E 29 20
        3F 20 2D 3E 20 00
ASxxxx Assembler V02.21  (Motorola 6809), page 43.
PHS Constant definitions
Screen Lists

   C0CC 43 68 61 6E 67 65  1793 11$:	.asciz	"Change to Auto Scaling (Y,N) ? -> "			; 4
        20 74 6F 20 41 75
        74 6F 20 53 63 61
        6C 69 6E 67 20 28
        59 2C 4E 29 20 3F
        20 2D 3E 20 00
   C0EF 5A 65 72 6F 20 48  1794 12$:	.asciz	"Zero Histogram (Y,N) ? -> "				; 5
        69 73 74 6F 67 72
        61 6D 20 28 59 2C
        4E 29 20 3F 20 2D
        3E 20 00
   C10A 45 6E 74 65 72 20  1795 13$:	.asciz	"Enter Vertical Scale = 2^n (n = 4,15) -> "		; 6
        56 65 72 74 69 63
        61 6C 20 53 63 61
        6C 65 20 3D 20 32
        5E 6E 20 28 6E 20
        3D 20 34 2C 31 35
        29 20 2D 3E 20 00
   C134 45 6E 74 65 72 20  1796 14$:	.asciz	"Enter Vertical Offset (0-32767) -> "			; 7
        56 65 72 74 69 63
        61 6C 20 4F 66 66
        73 65 74 20 28 30
        2D 33 32 37 36 37
        29 20 2D 3E 20 00
   C158 45 6E 74 65 72 20  1797 15$:	.asciz	"Enter Horizontal Scale = 2^n (n = 6,10) -> "		; 8
        48 6F 72 69 7A 6F
        6E 74 61 6C 20 53
        63 61 6C 65 20 3D
        20 32 5E 6E 20 28
        6E 20 3D 20 36 2C
        31 30 29 20 2D 3E
        20 00
   C184 45 6E 74 65 72 20  1798 16$:	.asciz	"Enter Horizontal Offset (0-1023) -> "			; 9
        48 6F 72 69 7A 6F
        6E 74 61 6C 20 4F
        66 66 73 65 74 20
        28 30 2D 31 30 32
        33 29 20 2D 3E 20
        00
                           1799 
                           1800 
