ASxxxx Assembler V02.10  (Motorola 6809), page 1.
Pulse Height Stabilizer


                              1 	.title	Pulse Height Stabilizer
                              2 	;
                              3 	;********************************************************
                              4 	;*							*
                              5 	;*	PULSE HEIGHT STABILIZER				*
                              6 	;*							*
                              7 	;*		WRITTEN BY				*
                              8 	;*			ALAN R. BALDWIN			*
                              9 	;*			PHYSISICS DEPARTMENT		*
                             10 	;*			KENT STATE UNIVERSITY		*
                             11 	;*			KENT, OHIO  44242		*
                             12 	;*							*
                             13 	;*							*
                             14 	;*	V01.00	COMPLETED				*
                             15 	;*		   JUNE 1992				*
                             16 	;*							*
                             17 	;*							*
                             18 	;********************************************************
                             19 
                             20 
ASxxxx Assembler V02.10  (Motorola 6809), page 2.
Pulse Height Stabilizer
system definitions

                             22 	.sbttl	system definitions
                             23 
                             24 	.module	phs
                             25 
ASxxxx Assembler V02.10  (Motorola 6809), page 3.
Pulse Height Stabilizer
system definitions

                             26 	.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.10  (Motorola 6809), page 4.
Pulse Height Stabilizer
Default Direct Page

                             27 
ASxxxx Assembler V02.10  (Motorola 6809), page 5.
Pulse Height Stabilizer
Default Direct Page

                             28 	.include	/system.def/
                              1 	.sbttl	System Definitions
                              2 
                              3 	; These absolute addresses are used to access the various
                              4 	; i/o devices in the system.
                              5 
                              6 					; BYTE read/write
                    7F00      7 	sys$clk		==	0x7F00	; system clock
                              8 					; <7>	- clock ready
                              9 					; <6>	- clock interrupt enable
                    7F00     10 	sys$wait	==	0x7F00	; acquisition inhibit
                             11 					; <5>	- !(external inhibit)
                    7F00     12 	sys$id		==	0x7F00	; system code number
                             13 					; <3:0>	- communication channel
                             14 
                             15 					; BYTE read/write
                    7F01     16 	clr$clk		==	0x7F01	; clear clock interrupt / ready
                             17 
                             18 					; WORD read/write
                    7F02     19 	acq$dac		==	0x7F02	; LED driver pulse amplitude DAC
                             20 					; <11:0>
                             21 
                             22 					; BYTE read/write
                    7F04     23 	acq$slct	==	0x7F04	; acquisition select
                             24 					; <7:0>	- selection code / mode
                             25 					; <7>	- enable LED pulsing
                             26 					; <5> = 0	- enable channel
                             27 					;	<4:0>	- select 1 of the 32
                             28 					;		  input channnels
                             29 					;		  and corresponding
                             30 					;		  pulsing channels
                             31 					; <5> = 1	- enable temperature
                             32 					;	<4>	- enable pulsing
                             33 					;	<3:0>	- don't care
                             34 
                             35 					; WORD read only
                    7F06     36 	acq$wait	==	0x7F06	; acquisition inhibit
                             37 					; <15>	- external inhibit
                             38 					; WORD read only
                    7F06     39 	acq$adc		==	0x7F06	; pulse height acquisition ADC
                             40 					; <9:0>
                             41 
                             42 					; BYTE read/write
                    7F08     43 	sys$ser0	==	0x7F08	; 6850 serial port #0
                             44 
                             45 					; BYTE read/write
                    7F0A     46 	sys$ser1	==	0x7F0A	; 6850 serial port #1
                             47 
                             48 					; BYTE read/write
                    7F0C     49 	sys$ser2	==	0x7F0C	; 6850 serial port #2
                             50 
                             51 
                             52 					; BYTE read/write
                    7F20     53 	sys$led		==	0x7F20	; LED control and status registers
                             54 					; 32 LED control and status registers
                             55 					; begin at this address
ASxxxx Assembler V02.10  (Motorola 6809), page 6.
Pulse Height Stabilizer
System Definitions

                             56 					; <1>	-	green LED control
                             57 					; <0>	-	red   LED control
                             58 
ASxxxx Assembler V02.10  (Motorola 6809), page 7.
Pulse Height Stabilizer
System Definitions

                             29 	.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.10  (Motorola 6809), page 8.
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.10  (Motorola 6809), page 9.
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.10  (Motorola 6809), page 10.
PHS Constant definitions
HV-Queue Functions

                             30 	.include	/data.def/
                              1 	.sbttl	Port Data Structure
                              2 
                              3 	;  This data area provides the definitions of all
                              4 	; variables and buffers used by the terminal ports.
                              5 	;
                              6 	;  These definitions will be offsets from the user
                              7 	; stack register u.  The dp register will also be
                              8 	; loaded to allow direct access to the first 256
                              9 	; locations of the area.
                             10 
                             11 	.area	PORTDATA	(ABS,OVR)
                             12 
   0000                      13 	.org	0
                             14 
                    0000     15 portbgn	==	.
                             16 
   0000                      17 lclstk::	.blkb	2	; local user stack address
                             18 				; this allows register u
                             19 				; to be reloaded by:
                             20 				; ldu	*lclstk
                             21 
                             22 	; port I/O routine variables
                             23 
   0002                      24 ser$port::	.blkb	2	; acia address of status register
   0004                      25 		.blkb	2	; acia address of rcvr/xmtr register
                             26 	;
                             27 	; 6850 ACIA address offsets
                             28 
                    0002     29 	dlstat	==  ser$port	; data link status register (ro)
                    0002     30 	dlcsr	==  ser$port	; data link control register (wo)
                    0004     31 	dlrcv	==  ser$port+2	; receive data register (ro)
                    0004     32 	dltrn	==  ser$port+2	; transmitter data register (wo)
                             33 				; These values are offsets from
                             34 				; the port base address
                             35 				; the MC6850 address is [dlxxx,u]
                             36 
   0006                      37 bfstat::	.blkb	1	; buffers status
                    0001     38 	dl	==	1	; bit 0 - data link
                    0004     39 	scn	==	4	; bit 2 - scan
                             40 	;
                             41 	;	port link buffer pointers
                             42 	;
   0007                      43 dlcntr::	.blkb	1	; characters in buffer
   0008                      44 dlqntr::	.blkb	2	; character pointer for output
   000A                      45 dlpntr::	.blkb	2	; character pointer for input
   000C                      46 dlend::		.blkb	2	; end of buffer address
                             47 	;
                             48 	;	scan buffer pointers
                             49 	;
   000E                      50 scntr::		.blkb	1	; characters in bufffer
   000F                      51 scqntr::	.blkb	2	; character pointer for output
   0011                      52 scpntr::	.blkb	2	; character pointer for input
   0013                      53 scend::		.blkb	2	; end of buffer address
                             54 
   0015                      55 d.csr::		.blkb	1	; 6850 csr copy
ASxxxx Assembler V02.10  (Motorola 6809), page 11.
PHS Constant definitions
Port Data Structure

                             56 	;
                             57 	;	'link' protocol status
                             58 	;
   0016                      59 d.stat::	.blkb	1	; 'link' control status
                             60 	;
                             61 	;	7-	xoff'd(1)/else(0) (data from host)
                             62 	;	6-	xoff'd(1)/else(0) (data to host)
                             63 	;	0-	xon(^q)/xoff(^s) enabled(1)/disabled(0)
                             64 	;
   0017                      65 $dxonf::	.blkb	1	; 'link' flag character
                    0011     66 	$xon	==	'Q & 0x1F
                    0013     67 	$xoff	==	'S & 0x1F
                             68 
                             69 	;	$s loader variables
                             70 
   0018                      71 $scntr::	.blkb	0d1	; character counter
   0019                      72 $schksm::	.blkb	0d1	; running checksum
   001A                      73 $svalu::	.blkb	0d2	; binary value of hex
   001C                      74 $srbc::		.blkb	0d1	; running byte count
   001D                      75 $sladdr::	.blkb	0d2	; load address
                             76 
                             77 	;	list processor variables
                             78 
   001F                      79 lsbuff::	.blkb	0d9	; character buffer
   0028                      80 lstcnt::	.blkb	0d1	; chars in lsbuff
   0029                      81 lpntr::		.blkb	0d2	; pointer to chars
   002B                      82 lstat::		.blkb	0d1	; list processor status
                             83 				;	7- single character mode
                             84 				;	6- list scan
                             85 				;	5- build mode
                             86 				;	4- special single character mode
                             87 				;
   002C                      88 format::	.blkb	0d1	; integer format length
   002D                      89 gosub::		.blkb	0d2	; address of process
   002F                      90 char::		.blkb	0d1	; current character
   0030                      91 pchar::		.blkb	0d1	; previous character
   0031                      92 schflg::	.blkb	0d1	; seen character flag
                             93 				;
   0032                      94 rstat0::	.blkb	0d1	; unit status
                             95 
                             96 	;	evaln variables
                             97 
                    0006     98 	ndigit	==	6
   0033                      99 nsign::		.blkb	0d1	; sign of number
   0034                     100 number::	.blkb	ndigit	; 16-bit result / character buffer
   003A                     101 numcntr::	.blkb	1	; character counter
   003B                     102 bincntr::	.blkb	1	; character counter
                            103 
                            104 	; Ascii <--> Integer Conversion Routines
                            105 
   003C                     106 i$ndgt::	.blkb	1	; digits in conversion
   003D                     107 i$dcnt::	.blkb	1	; counter / result byte
   003E                     108 i$zero::	.blkb	1	; leading zero suppressing flag
   003F                     109 i$data::	.blkb	2	; temporary for data
                            110 
                            111 	; screen status register
ASxxxx Assembler V02.10  (Motorola 6809), page 12.
PHS Constant definitions
Port Data Structure

                            112 
   0041                     113 scrn$sts::	.blkb	2	; screen status register
                            114 	; ms byte	bit	<7>	screen active
                            115 	;		bit	<6>	clear screen flag
                            116 	;		bit	<5>	set cursor flag
                            117 	;		bit	<4>	unused
                            118 	;		bits	<3:0>	screen type
                            119 	; ls byte	bits	<7:0>	channel number
                            120 
   0043                     121 slc$optp::	.blkb	2	; select screen option position
   0045                     122 scrn$pos::	.blkb	2	; screen cursor position
                            123 
   0047                     124 s$state::	.blkb	1	; screen state
   0048                     125 o$state::	.blkb	1	; options state
                            126 
   0049                     127 s$string::	.blkb	0d16	; screen input string
   0059                     128 s$strlen::	.blkb	1	; string length
                            129 
                            130 				; screen options array
   005A                     131 optarray::	.blkb	SCRNBT-SCRNTP+1
   0072                     132 opt$posn::	.blkb	2	; option position
                            133 
                            134 	; format buffer routine variables
                            135 
   0074                     136 fmtrow::	.blkb	1	; format buffer row
   0075                     137 fmtcol::	.blkb	1	; format buffer column
   0076                     138 findex::	.blkb	2	; address of character in format buffer
   0078                     139 rflag::		.blkb	1	; normal/reverse video flag
                            140 
                            141 	; output buffer routine variables
                            142 
   0079                     143 cstate::	.blkb	1	; current state of syscin translator
   007A                     144 ostate::	.blkb	1	; current state of output buffer scanner
   007B                     145 index::		.blkb	1	; current output scanner index
   007C                     146 first::		.blkb	1	; first changed character in line
   007D                     147 count::		.blkb	1	; number of changed characters in line
   007E                     148 outz::		.blkb	1	; current screen video mode
   007F                     149 savez::		.blkb	1	; saved screen video mode
                            150 
                            151 	; temporaries
                            152 
   0080                     153 tempv1::	.blkb	2	; just some temporary variables
   0082                     154 tempv2::	.blkb	2	; for general use
   0084                     155 tempv3::	.blkb	2
   0086                     156 tempv4::	.blkb	2
                            157 
                            158 	; HV Port Queue
                            159 
   0088                     160 que$bufr::	.blkb	0d64	; 32 element queue
   00C8                     161 que$timr::	.blkb	2	; queue element time out timer
   00CA                     162 que$wait::	.blkb	2	; queue sequence wait counter
   00CC                     163 q$gosub::	.blkb	2	; dispatch address
   00CE                     164 que$inp::	.blkb	1	; input pointer
   00CF                     165 que$oup::	.blkb	1	; output pointer
   00D0                     166 que$cntr::	.blkb	1	; queued elements counter
   00D1                     167 que$chnl::	.blkb	1	; current channel for this process
ASxxxx Assembler V02.10  (Motorola 6809), page 13.
PHS Constant definitions
Port Data Structure

                            168 
                            169 	; HV4032A sequencer variables
                            170 
   00D2                     171 hvc$gosub::	.blkb	2	; return address
   00D4                     172 hvc$pntr::	.blkb	2	; string pointer
   00D6                     173 hvc$strng::	.blkb	0d16	; string buffer
   00E6                     174 hvc$cntr::	.blkb	1	; counter
   00E7                     175 hvc$loop::	.blkb	1	; loop counter
   00E8                     176 hvc$char::	.blkb	1	; last sent character
   00E9                     177 hvc$csts::	.blkb	1	; channel readout status
   00EA                     178 hvc$fseq::	.blkb	1	; hvc failing channel scanner state
   00EB                     179 hvc$fchn::	.blkb	1	; hvc failing channel
   00EC                     180 hvc$sseq::	.blkb	1	; hvc status scanner state
                            181 
                            182 
   0100                     183 	.org	0d256
                            184 
   0100                     185 scbuf::		.blkb	0d256	; scan buffer area
                    0100    186 	sclen	==	0d256
                    0020    187 	scmpty	==	0d32
                    00C0    188 	scfull	==	0d192
                    00E0    189 	scvful	==	0d224
                            190 
   0200                     191 dlbuf::		.blkb	0d256	; host link character buffer
                    0100    192 	dllen	==	0d256	; 256 bytes
                    0020    193 	dlmpty	==	0d32
                    0080    194 	dlfull	==	0d128
                    00C0    195 	dlvful	==	0d192
                            196 
                    0300    197 bufrend ==	.
                            198 
                    0300    199 bufralloc ==	bufrend - portbgn
                            200 
                    0780    201 	scrnsize	=	(SCRNBT-SCRNTP+1)*SCRNW
                            202 
   0300                     203 fmtbuf::	.blkb	scrnsize	; format buffer allocation
   0A80                     204 outbuf::	.blkb	scrnsize	; output buffer allocation
                            205 
                    1200    206 portend	==	.
                            207 
                    1200    208 portalloc ==	portend - portbgn
                            209 
ASxxxx Assembler V02.10  (Motorola 6809), page 14.
PHS Constant definitions
Port Data Structure

                             31 
                             32 
                             33 	.radix	o		; octal constants
                             34 
                             35 ;  6809 data and program space
                             36 
                    0000     37 	$xtrn0	==	0	; 4096 bytes allocated
                    0004     38 	$xtrn1	==	4	; for optional functions
                    0008     39 	$xtrn2	==	10	; which may be down loaded
                    000C     40 	$xtrn3	==	14	; using $s1 / $s9 commands
                    0010     41 	$xtrn4	==	20
                    0014     42 	$xtrn5	==	24
                    0018     43 	$xtrn6	==	30
                    001C     44 	$xtrn7	==	34
                    0020     45 	$xtrn8	==	40
                    0024     46 	$xtrn9	==	44
                             47 
                    0F00     48 	$xtend	==	007400		; optional functions	(3.75k)
                             49 
                             50 ;	workpg	==	007400		; PHSMON workpage	(0.25k)
                             51 
                    1000     52 	bufsav	==	010000		; buffers area		(27.5k)
                             53 
                    7F00     54 	ioblok	==	077400		; i/o register block	(0.25k)
                             55 
                    7EFE     56 	stack	==	ioblok-2	; top of stack area	(0.25k)
                             57 
                    8000     58 	pgmsav	==	100000		; program space		(32.0k)
                             59 
                    FFB0     60 	irqvec	==	177660		; vector table
                             61 
                             62 
ASxxxx Assembler V02.10  (Motorola 6809), page 15.
PHS Constant definitions
Areas

                             64 	.sbttl	Areas
                             65 
                             66 	.area	BUFSAV		; buffers
   1000                      67 port0:	.blkb	portalloc
   2200                      68 port1:	.blkb	portalloc
   3400                      69 port2:	.blkb	bufralloc
                             70 
   3700                      71 usrstk:	.blkb	0d2		; current user stack
                             72 
   3702                      73 exrsrvd::	.blkb	0d2	; vector addresses
   3704                      74 exswi3::	.blkb	0d2
   3706                      75 exswi2::	.blkb	0d2
   3708                      76 exfirq::	.blkb	0d2
   370A                      77 exirq::		.blkb	0d2
   370C                      78 exswi::		.blkb	0d2
   370E                      79 exnmi::		.blkb	0d2
                             80 
                             81 	.area	PGMSAV		; program
   8000 00 00                82 chksm0:	.word	0		; rom checksum
   8002 FC 7F 06             83 clradc:	ldd	acq$adc		; clear adc
   8005 3B                   84 undfnd:	rti			; non-existent routines
                             85 
                             86 	.area	IRQVEC
                             87 
   FFB0 80 05 37 02          88 irqtbl:	.word	undfnd,	exrsrvd	; reserved	(unused)
   FFB4 80 56 37 04          89 	.word	debugp,	exswi3	; swi3
   FFB8 80 05 37 06          90 	.word	undfnd,	exswi2	; swi2		(unused)
   FFBC 80 02 37 08          91 	.word	clradc,	exfirq	; firq vector
   FFC0 81 D4 37 0A          92 	.word	clocki,	exirq	; irq  vector
   FFC4 80 05 37 0C          93 	.word	undfnd,	exswi	; swi		(unused)
   FFC8 80 05 37 0E          94 	.word	undfnd,	exnmi	; nmi		(unused)
   FFCC 00 00 00 00          95 	.word	0,	0	; end of table
                             96 
   FFD0 6E 9D 37 2E          97 1$:	jmp	[exrsrvd,pcr]	; use loaded vectors
   FFD4 6E 9D 37 2C          98 2$:	jmp	[exswi3,pcr]
   FFD8 6E 9D 37 2A          99 3$:	jmp	[exswi2,pcr]
   FFDC 6E 9D 37 28         100 4$:	jmp	[exfirq,pcr]
   FFE0 6E 9D 37 26         101 5$:	jmp	[exirq,pcr]
   FFE4 6E 9D 37 24         102 6$:	jmp	[exswi,pcr]
   FFE8 6E 9D 37 22         103 7$:	jmp	[exnmi,pcr]
   FFEC 6E 8D 81 05         104 8$:	jmp	pwrup,pcr
                            105 
   FFF0 FF D0               106 	.word	1$	; reserved	(unused)
   FFF2 FF D4               107 	.word	2$	; swi3
   FFF4 FF D8               108 	.word	3$	; swi2
   FFF6 FF DC               109 	.word	4$	; firq vector
   FFF8 FF E0               110 	.word	5$	; irq  vector
   FFFA FF E4               111 	.word	6$	; swi		(unused)
   FFFC FF E8               112 	.word	7$	; nmi		(unused)
   FFFE FF EC               113 	.word	8$	; power up entry point
                            114 
                            115 
ASxxxx Assembler V02.10  (Motorola 6809), page 16.
PHS Constant definitions
Copyright Notice

                            117 	.sbttl	Copyright Notice
                            118 
                            119 	.area	PGMSAV
                            120 
                            121 	.radix	o
                            122 
                    0006    123 cpyrit:	phs$cr	=	.
   8006 0D 0A               124 	.byte	15,12
   8008 50 48 53 20 20 20   125 	.ascii	/PHS   0000  V01.01/
        30 30 30 30 20 20
        56 30 31 2E 30 31
   801A 0D 0A               126 	.byte	15,12
                    0016    127 	phs$id	=	.-phs$cr	; length of version
   801C 43 6F 70 79 72 69   128 	.ascii	/Copyright 1992/
        67 68 74 20 31 39
        39 32
   802A 0D 0A               129 	.byte	15,12
   802C 4B 65 6E 74 20 53   130 	.ascii	/Kent State University/
        74 61 74 65 20 55
        6E 69 76 65 72 73
        69 74 79
   8041 0D 0A               131 	.byte	15,12
   8043 4B 65 6E 74 2C 20   132 	.ascii	/Kent, Ohio  44242/
        4F 68 69 6F 20 20
        34 34 32 34 32
   8054 0D 0A               133 	.byte	15,12
                    0050    134 	phs$cr	=	.-phs$cr	; length of notice
                            135 
                            136 
                            137 
                            138 
ASxxxx Assembler V02.10  (Motorola 6809), page 17.
PHS Constant definitions
Debug Printer

                            140 	.sbttl	Debug Printer
                            141 
                            142 	.area	BUFSAV
                            143 
   3710                     144 debugr:	.blkb	0d1		; debugger flag
                            145 
                            146 	.area	PGMSAV
                            147 
   8056 A6 80               148 debugp:	lda	,x+		; get character
   8058 27 07               149 	beq	1$
   805A 2B 0F               150 	bmi	2$
   805C BD 82 E9            151 	jsr	plcbuf		; dump character
   805F 20 F5               152 	bra	debugp
                            153 
   8061 86 0D               154 1$:	lda	#0q15		; <CR>
   8063 BD 82 E9            155 	jsr	plcbuf
   8066 86 0A               156 	lda	#0q12		; <LF>
   8068 BD 82 E9            157 	jsr	plcbuf
   806B 3B                  158 2$:	rti
                            159 
ASxxxx Assembler V02.10  (Motorola 6809), page 18.
PHS Constant definitions
rom checksum verification

                            161 	.sbttl	rom checksum verification
                            162 
                            163 	.radix	o
                            164 
                            165 	;
                            166 	;  enter via	ldu	#1$
                            167 	;		jmp	verrom
                            168 	;	1$:	.word	start address
                            169 	;		.word	last address+1
                            170 	;		.word	checksum location
                            171 	;		.word	error code
                            172 	;  returns here ---
                            173 	;
   806C AE C1               174 verrom:	ldx	,u++		; start address
   806E 4F                  175 	clra			; init sum
   806F 5F                  176 	clrb
   8070 EB 80               177 1$:	addb	,x+		; build sum
   8072 89 00               178 	adca	#0
   8074 AC C4               179 	cmpx	,u		; finished ?
   8076 26 F8               180 	bne	1$		; loop until all summed
   8078 33 42               181 	leau	2,u
   807A AE C4               182 	ldx	,u
   807C E0 84               183 	subb	,x		; take out checksum itself
   807E 82 00               184 	sbca	#0
   8080 E0 01               185 	subb	1,x
   8082 82 00               186 	sbca	#0
   8084 E3 84               187 	addd	,x		; this should give '0'
   8086 26 40               188 	bne	verror		; no - have an error
   8088 6E 44               189 	jmp	4,u		; return
                            190 
ASxxxx Assembler V02.10  (Motorola 6809), page 19.
PHS Constant definitions
ram verify routine

                            192 	.sbttl	ram verify routine
                            193 	;
                            194 	;  enter via	ldu	#1$
                            195 	;		jmp	verram
                            196 	;	1$:	.word	start address
                            197 	;		.word	last address+1
                            198 	;		.word	error code
                            199 	;  returns here ---
                            200 	;
   808A AE C1               201 verram:	ldx	,u++		; first location
   808C 4F                  202 	clra
   808D A7 80               203 1$:	sta	,x+		; incrementing pattern
   808F 4C                  204 	inca
   8090 26 01               205 	bne	2$
   8092 4C                  206 	inca
   8093 AC C4               207 2$:	cmpx	,u		; finished settup ?
   8095 26 F6               208 	bne	1$		; no - loop
   8097 AE 5E               209 	ldx	-2,u		; first location
   8099 4F                  210 	clra
   809A A1 80               211 3$:	cmpa	,x+
   809C 26 2A               212 	bne	verror		; bad - error
   809E 4C                  213 	inca
   809F 26 01               214 	bne	4$
   80A1 4C                  215 	inca
   80A2 AC C4               216 4$:	cmpx	,u		; finished checking ?
   80A4 26 F4               217 	bne	3$		; no - loop
                            218 
   80A6 AE 5E               219 	ldx	-2,u		; first address
   80A8 4F                  220 	clra
   80A9 43                  221 5$:	coma
   80AA A7 80               222 	sta	,x+		; complement of incrementing pattern
   80AC 43                  223 	coma
   80AD 4C                  224 	inca
   80AE 26 01               225 	bne	6$
   80B0 4C                  226 	inca
   80B1 AC C4               227 6$:	cmpx	,u		; finished settup ?
   80B3 26 F4               228 	bne	5$		; no - loop
   80B5 AE 5E               229 	ldx	-2,u		; first location
   80B7 4F                  230 	clra
   80B8 43                  231 7$:	coma
   80B9 A1 80               232 	cmpa	,x+
   80BB 26 0B               233 	bne	verror		; bad - error
   80BD 43                  234 	coma
   80BE 4C                  235 	inca
   80BF 26 01               236 	bne	8$
   80C1 4C                  237 	inca
   80C2 AC C4               238 8$:	cmpx	,u		; finished checking ?
   80C4 26 F2               239 	bne	7$		; no - loop
   80C6 6E 44               240 	jmp	4,u		; finished
                            241 
ASxxxx Assembler V02.10  (Motorola 6809), page 20.
PHS Constant definitions
verify error routine

                            243 	.sbttl	verify error routine
                            244 
   80C8 C6 0A               245 verror:	ldb	#0d10		; 10. flashes
   80CA A6 42               246 1$:	lda	2,u		; error code byte
   80CC 8E 7F 20            247 	ldx	#sys$led	; LED address
   80CF A7 80               248 2$:	sta	,x+
   80D1 8C 7F 40            249 	cmpx	#sys$led+0d32
   80D4 26 F9               250 	bne	2$
   80D6 8E 9E 58            251 	ldx	#-0d25000	; .1 seconds @ 2mHZ
   80D9 30 01               252 3$:	leax	1,x
   80DB 26 FC               253 	bne	3$
   80DD A6 43               254 	lda	3,u		; error code byte
   80DF 8E 7F 20            255 	ldx	#sys$led	; LED address
   80E2 A7 80               256 4$:	sta	,x+
   80E4 8C 7F 40            257 	cmpx	#sys$led+0d32
   80E7 26 F9               258 	bne	4$
   80E9 8E 9E 58            259 	ldx	#-0d25000
   80EC 30 01               260 5$:	leax	1,x
   80EE 26 FC               261 	bne	5$
   80F0 5A                  262 	decb
   80F1 2E D7               263 	bgt	1$		; loop for 10. flashes
   80F3 6E 44               264 	jmp	4,u		; and return
                            265 
ASxxxx Assembler V02.10  (Motorola 6809), page 21.
PHS Constant definitions
6809 startup

                            267 	.sbttl	6809 startup
                            268 
                            269 	.area	PGMSAV
                            270 	.radix	o
                            271 
   80F5 1A 50               272 pwrup:	orcc	#120		; disable interrupts
                            273 
                            274 ;  verify rom integrity
   80F7 CE 80 FD            275 	ldu	#1$
   80FA 7E 80 6C            276 	jmp	verrom
   80FD 80 00               277 1$:	.word	pgmsav		; first address
   80FF 00 00               278 	.word	000000		; last address+1
   8101 80 00               279 	.word	chksm0		; location of checksum word
   8103 01 03               280 	.byte	1,3		; error code
                            281 
                            282 ;  verify ram integrity
   8105 CE 81 0B            283 	ldu	#2$
   8108 7E 80 8A            284 	jmp	verram
   810B 0F 00               285 2$:	.word	$xtend		; first address after user space
   810D 7E FE               286 	.word	stack		; last address+1
   810F 02 03               287 	.byte	2,3		; error code
                            288 
                            289 ;  clear all ram data
   8111 CC 00 00            290 	ldd	#0		; set all ram to zero
   8114 10 CE 0F 00         291 	lds	#$xtend		; after user space
   8118 ED E1               292 3$:	std	,s++
   811A 11 8C 7E FE         293 	cmps	#stack
   811E 26 F8               294 	bne	3$
                            295 
                            296 ;  set interrupt table
   8120 8E FF B0            297 	ldx	#irqtbl		; table pointer
   8123 EC 81               298 4$:	ldd	,x++		; get vector entry
   8125 27 04               299 	beq	5$
   8127 ED 91               300 	std	[,x++]		; place in vector table
   8129 20 F8               301 	bra	4$		; loop
   812B                     302 5$:
                            303 
                            304 ;  set stack pointer
                            305 
   812B 10 CE 7E FE         306 	lds	#stack		; set stack pointer
                            307 
                            308 ;  initialize i/o
                            309 
   812F CC 00 00            310 	ldd	#0
   8132 FD 7F 02            311 	std	acq$dac		; clear dac
   8135 7F 7F 04            312 	clr	acq$slct	; clear select register
   8138 C6 18               313 	ldb	#0d24		; wait for conversion
   813A 5A                  314 6$:	decb
   813B 2E FD               315 	bgt	6$
   813D 7D 7F 06            316 	tst	acq$adc		; clear adc
                            317 
                            318 ;  initialize LCL port
                            319 
   8140 CE 10 00            320 	ldu	#port0		; pointer to port0
   8143 1F 30               321 	tfr	u,d
   8145 1F 8B               322 	tfr	a,dp		; load direct page
ASxxxx Assembler V02.10  (Motorola 6809), page 22.
PHS Constant definitions
6809 startup

   8147 DD 00               323 	std	*lclstk		; and save in direct page
   8149 86 01               324 	lda	#1		; enable xon/xoff
   814B 97 16               325 	sta	*d.stat
   814D CC 00 00            326 	ldd	#0
   8150 BD 8B 83            327 	jsr	ini$6850	; initialize port
                            328 
                            329 ;  initialize CTL port
                            330 
   8153 CE 22 00            331 	ldu	#port1		; pointer to port1
   8156 1F 30               332 	tfr	u,d
   8158 1F 8B               333 	tfr	a,dp		; load direct page
   815A DD 00               334 	std	*lclstk		; and save in direct page
   815C 86 01               335 	lda	#1		; enable xon/xoff
   815E 97 16               336 	sta	*d.stat
   8160 CC 00 01            337 	ldd	#1
   8163 BD 8B 83            338 	jsr	ini$6850	; initialize port
                            339 
                            340 ;  initialize HVC port
                            341 
   8166 CE 34 00            342 	ldu	#port2		; pointer to port2
   8169 1F 30               343 	tfr	u,d
   816B 1F 8B               344 	tfr	a,dp		; load direct page
   816D DD 00               345 	std	*lclstk		; and save in direct page
   816F 86 00               346 	lda	#0		; disable xon/xoff
   8171 97 16               347 	sta	*d.stat
   8173 CC 00 02            348 	ldd	#2
   8176 BD 8B 83            349 	jsr	ini$6850	; initialize port
                            350 
                            351 ;  initialize LED's
                            352 
   8179 8E 7F 20            353 	ldx	#sys$led	; clear the LED indicators
   817C 86 20               354 	lda	#0d32
   817E C6 03               355 	ldb	#0x03
   8180 E7 80               356 7$:	stb	,x+
   8182 4A                  357 	deca
   8183 2E FB               358 	bgt	7$
                            359 
                            360 ;  Initialize default values for acquisition
                            361 
   8185 BD 90 AD            362 	jsr	phs$init
                            363 
                            364 ;  enable clock interrupt
                            365 
   8188 7F 7F 01            366 	clr	clr$clk		; clear pending clock interrupt
   818B 86 40               367 	lda	#0x40		; set clock interrupt enable
   818D B7 7F 00            368 	sta	sys$clk
                            369 
                            370 ;  startup LCL port
                            371 
   8190 CE 10 00            372 	ldu	#port0		; pointer to port0
   8193 1F 30               373 	tfr	u,d
   8195 1F 8B               374 	tfr	a,dp		; load direct page
   8197 FD 37 00            375 	std	usrstk		; and save user stack
   819A 96 32               376 	lda	*rstat0
   819C 8A 80               377 	ora	#0q200		; unit enabled by default
   819E 97 32               378 	sta	*rstat0
ASxxxx Assembler V02.10  (Motorola 6809), page 23.
PHS Constant definitions
6809 startup

   81A0 97 41               379 	sta	*scrn$sts
                            380 
   81A2 1C AF               381 	andcc	#257		; now allow interrupts
   81A4 BD A0 BF            382 	jsr	sel$scrn	; go startup screen
                            383 
ASxxxx Assembler V02.10  (Motorola 6809), page 24.
PHS Constant definitions
main routine

                            385 	.sbttl	main routine
                            386 
   81A7 1A 50               387 main:	orcc	#120		; disable interrupts
   81A9 10 CE 7E FE         388 	lds	#stack		; reset stack pointer
   81AD 1C AF               389 	andcc	#257		; now allow interrupts
                            390 
   81AF CC 10 00            391 	ldd	#port0		; pointer to port0
   81B2 8D 07               392 	bsr	1$
   81B4 CC 22 00            393 	ldd	#port1		; pointer to port1
   81B7 8D 02               394 	bsr	1$
                            395 
   81B9 20 EC               396 	bra	main		; keep going
                            397 
   81BB 1F 03               398 1$:	tfr	d,u
   81BD 1F 8B               399 	tfr	a,dp		; load direct page
   81BF FD 37 00            400 	std	usrstk		; and save user stack
                            401 
   81C2 BD 9C E2            402 	jsr	syscin		; get character from scan buffer
   81C5 0D 2F               403 	tst	*char		; if none - skip
   81C7 27 0A               404 	beq	2$
                            405 
   81C9 BD A0 BF            406 	jsr	sel$scrn	; go to screen selector
                            407 
   81CC 0D 2F               408 	tst	*char		; if none - skip
   81CE 27 03               409 	beq	2$
   81D0 BD 83 6F            410 	jsr	listpr		; enter list processor
                            411 
   81D3 39                  412 2$:	rts
                            413 
                            414 
ASxxxx Assembler V02.10  (Motorola 6809), page 25.
PHS Constant definitions
clock and serial ports interrupt routine

                            416 	.sbttl	clock and serial ports interrupt routine
                            417 
                            418 	.area	BUFSAV
                            419 
   3711                     420 timflg::	.blkb	0d1	; timing flag
                            421 
                            422 
                            423 	.area	PGMSAV
                            424 
                            425 	;  interrupt by 'irq'
                            426 
   81D4 1A 50               427 clocki:	orcc	#120		; stop other interrupts
                            428 
   81D6 CE 10 00            429 	ldu	#port0
   81D9 BD 81 FC            430 	jsr	dlchck
   81DC CE 22 00            431 	ldu	#port1
   81DF BD 81 FC            432 	jsr	dlchck
   81E2 CE 34 00            433 	ldu	#port2
   81E5 BD 81 FC            434 	jsr	dlchck
                            435 
   81E8 7D 7F 00            436 	tst	sys$clk		; clock interrupt ?
   81EB 2A 0E               437 	bpl	2$		; no - skip
                            438 
   81ED 7A 37 11            439 	dec	timflg		; update timing flag
   81F0 2E 03               440 	bgt	1$
   81F2 7F 37 11            441 	clr	timflg
   81F5 7F 7F 01            442 1$:	clr	clr$clk		; clear clock latch
                            443 
   81F8 BD D6 19            444 	jsr	upd$scrn	; update screens
                            445 
   81FB 3B                  446 2$:	rti
                            447 
                            448 
ASxxxx Assembler V02.10  (Motorola 6809), page 26.
PHS Constant definitions
Host 'Data Link' checks

                            450 	.sbttl	Host 'Data Link' checks
                            451 
                            452 	; index register u must point to the port area
                            453 
   81FC 1F 30               454 dlchck:	tfr	u,d		; setup direct page
   81FE 1F 8B               455 	tfr	a,dp
                            456 
   8200 96 06               457 1$:	lda	*bfstat
   8202 85 04               458 	bita	#scn		; scan buffer need data ?
   8204 26 13               459 	bne	3$		; if not - skip
                            460 
   8206 96 16               461 2$:	lda	*d.stat
   8208 85 01               462 	bita	#1		; xon/xoff enabled ?
   820A 27 0D               463 	beq	3$		; if not - skip
   820C 4D                  464 	tsta			; xoff'd ?
   820D 2A 0A               465 	bpl	3$		; no - skip
   820F 84 7F               466 	anda	#177		; clear xoff'd
   8211 97 16               467 	sta	*d.stat
   8213 C6 11               468 	ldb	#$xon		; get 'xon' character
   8215 D7 17               469 	stb	*$dxonf		; place character for xmtr to see
   8217 20 12               470 	bra	5$
                            471 
   8219 96 17               472 3$:	lda	*$dxonf		; special ?
   821B 26 0E               473 	bne	5$		; yes - skip
   821D 96 07               474 	lda	*dlcntr		; any characters ?
   821F 27 14               475 	beq	6$		; no - skip
   8221 96 16               476 4$:	lda	*d.stat
   8223 85 01               477 	bita	#1		; xon/xoff enabled ?
   8225 27 04               478 	beq	5$		; no - skip
   8227 85 40               479 	bita	#100		; xoff'd ?
   8229 26 0A               480 	bne	6$		; yes - skip
   822B 96 15               481 5$:	lda	*d.csr		; enable xmtr
   822D 8A 20               482 	ora	#0x20
   822F 97 15               483 	sta	*d.csr
   8231 A7 D9 00 02         484 	sta	[dlcsr,u]	; enable xmtr
   8235                     485 6$:				; fall through to dlrint
                            486 
ASxxxx Assembler V02.10  (Motorola 6809), page 27.
PHS Constant definitions
host data link receiver interrupt handler

                            488 	.sbttl	host data link receiver interrupt handler
                            489 
                            490 	; index register u must point to the port area
                            491 
   8235 A6 D9 00 02         492 dlrint:	lda	[dlstat,u]	; data ?
   8239 85 01               493 	bita	#1
   823B 10 27 00 62         494 	lbeq	6$		; no - skip
                            495 
   823F E6 D9 00 04         496 	ldb	[dlrcv,u]	; get data
   8243 C4 7F               497 	andb	#0x7F		; 7-bit ascii
                            498 
   8245 96 16               499 	lda	*d.stat
   8247 85 01               500 	bita	#1		; xon/xoff enabled ?
   8249 27 14               501 	beq	2$		; if not - skip
                            502 				;  check for xon/xoff characters
   824B C1 11               503 	cmpb	#$xon		; 'xon' ?
   824D 26 06               504 	bne	1$		; if not - skip
   824F 84 BF               505 	anda	#277		; clear xoff
   8251 97 16               506 	sta	*d.stat
   8253 20 4C               507 	bra	6$		; exit
                            508 
   8255 C1 13               509 1$:	cmpb	#$xoff		; 'xoff' ?
   8257 26 06               510 	bne	2$		; if not - skip
   8259 8A 40               511 	ora	#100		; set xoff
   825B 97 16               512 	sta	*d.stat
   825D 20 42               513 	bra	6$		; exit
                            514 
   825F 9E 11               515 2$:	ldx	*scpntr		; get pointer
   8261 E7 80               516 	stb	,x+		; place character
   8263 9C 13               517 	cmpx	*scend		; at end of buffer ?
   8265 26 04               518 	bne	3$		; if not - skip
   8267 30 C9 01 00         519 	leax	scbuf,u		; reset pointer
   826B 9F 11               520 3$:	stx	*scpntr		; save new pointer
   826D 96 0E               521 	lda	*scntr		; get count
   826F 4C                  522 	inca			; update count
   8270 97 0E               523 	sta	*scntr		; save count
                            524 
   8272 81 C0               525 	cmpa	#scfull		; full ?
   8274 25 2B               526 	bcs	6$		; if not - skip
   8276 96 06               527 	lda	*bfstat
   8278 8A 04               528 	ora	#scn
   827A 97 06               529 	sta	*bfstat		; say full
   827C 96 16               530 	lda	*d.stat
   827E 85 01               531 	bita	#1		; xon/xoff enabled ?
   8280 27 1F               532 	beq	6$		; if not - exit
   8282 4D                  533 	tsta			; already xoff'd ?
   8283 2A 06               534 	bpl	4$		; if not - skip
   8285 D6 0F               535 	ldb	*scntr+1	; get count
   8287 C4 07               536 	andb	#7		; after 8'th character do another xoff
   8289 26 16               537 	bne	6$		; exit
                            538 
   828B 8A 80               539 4$:	ora	#200		; xoff'd
   828D 97 16               540 	sta	*d.stat
   828F C6 13               541 	ldb	#$xoff		; get 'xoff' character
   8291 A6 D9 00 02         542 	lda	[dlstat,u]	; output ready ?
   8295 85 02               543 	bita	#2
ASxxxx Assembler V02.10  (Motorola 6809), page 28.
PHS Constant definitions
host data link receiver interrupt handler

   8297 27 06               544 	beq	5$		; no - exit
   8299 E7 D9 00 04         545 	stb	[dltrn,u]	; transmit data
   829D 20 02               546 	bra	6$
                            547 
   829F D7 17               548 5$:	stb	*$dxonf		; place character for xmtr to see
   82A1                     549 6$:				; fall through to dltint
                            550 
ASxxxx Assembler V02.10  (Motorola 6809), page 29.
PHS Constant definitions
host data link transmitter interrupt handler

                            552 	.sbttl	host data link transmitter interrupt handler
                            553 
                            554 	; index register u must point to the port area
                            555 
   82A1 A6 D9 00 02         556 dltint:	lda	[dlstat,u]	; output ready ?
   82A5 85 02               557 	bita	#2
   82A7 27 3F               558 	beq	8$		; no - exit
                            559 
   82A9 D6 17               560 	ldb	*$dxonf		; special ?
   82AB 26 35               561 	bne	7$		; yes - skip
   82AD 96 16               562 1$:	lda	*d.stat
   82AF 85 01               563 	bita	#1		; xon/xoff enabled ?
   82B1 27 04               564 	beq	2$		; no - skip
   82B3 85 40               565 	bita	#100		; xoff'd ?
   82B5 26 04               566 	bne	3$		; yes - exit
   82B7 D6 07               567 2$:	ldb	*dlcntr		; get character count
   82B9 26 0C               568 	bne	4$		; if characters left - skip
   82BB 96 15               569 3$:	lda	*d.csr		; disable xmtr interrupts
   82BD 84 DF               570 	anda	#~0x20
   82BF 97 15               571 	sta	*d.csr
   82C1 A7 D9 00 02         572 	sta	[dlcsr,u]	; terminate transfers
   82C5 20 21               573 	bra	8$		; finished
                            574 
   82C7 5A                  575 4$:	decb			; one less character
   82C8 D7 07               576 	stb	*dlcntr		; save count
   82CA C1 20               577 	cmpb	#dlmpty		; buffer emptying ?
   82CC 24 06               578 	bcc	5$		; if not - skip
   82CE 96 06               579 	lda	*bfstat
   82D0 84 FE               580 	anda	#~dl
   82D2 97 06               581 	sta	*bfstat		; else say - need data
   82D4 9E 08               582 5$:	ldx	*dlqntr		; get pointer to character
   82D6 E6 80               583 	ldb	,x+		; get character
   82D8 9C 0C               584 	cmpx	*dlend		; at end of buffer ?
   82DA 26 04               585 	bne	6$		; if not - skip
   82DC 30 C9 02 00         586 	leax	dlbuf,u		; reset pointer
   82E0 9F 08               587 6$:	stx	*dlqntr		; save new pointer
   82E2 E7 D9 00 04         588 7$:	stb	[dltrn,u]	; transmit data
   82E6 0F 17               589 	clr	*$dxonf		; clear special
   82E8 39                  590 8$:	rts			; finished
                            591 
ASxxxx Assembler V02.10  (Motorola 6809), page 30.
PHS Constant definitions
place data in data link buffer

                            593 	.sbttl	place data in data link buffer
                            594 
                            595 	; index register u must point to the port area
                            596 
   82E9 34 04               597 plcbuf:	pshs	b
                            598 
   82EB D6 06               599 1$:	ldb	*bfstat
   82ED C5 01               600 	bitb	#dl		; buffer full ?
   82EF 26 FA               601 	bne	1$		; yes - loop
                            602 
   82F1 35 04               603 	puls	b
                            604 
   82F3                     605 tt_out::
   82F3 34 17               606 	pshs	cc,d,x
   82F5 1A 50               607 	orcc	#120		; hold interrupts
   82F7 9E 0A               608 	ldx	*dlpntr		; get pointer
   82F9 A7 80               609 	sta	,x+		; save character
   82FB 0C 07               610 	inc	*dlcntr		; update counter
   82FD 9C 0C               611 	cmpx	*dlend		; at end of buffer ?
   82FF 26 04               612 	bne	1$		; if not - skip
   8301 30 C9 02 00         613 	leax	dlbuf,u		; reset pointer
   8305 9F 0A               614 1$:	stx	*dlpntr		; save new pointer
   8307 D6 07               615 	ldb	*dlcntr		; get count
   8309 C1 80               616 	cmpb	#dlfull		; buffer full ?
   830B 25 06               617 	bcs	2$		; if not - branch
   830D D6 06               618 	ldb	*bfstat
   830F CA 01               619 	orb	#dl
   8311 D7 06               620 	stb	*bfstat		; set full
                            621 
   8313 A6 61               622 2$:	lda	1,s		; get character and
   8315 8D 36               623 	bsr	hvc_oup		; send to monitoring port
                            624 
   8317 35 17               625 	puls	cc,d,x
   8319 39                  626 	rts			; finished
                            627 
ASxxxx Assembler V02.10  (Motorola 6809), page 31.
PHS Constant definitions
get character from scan buffer

                            629 	.sbttl	get character from scan buffer
                            630 
                            631 	; index register u must point to the port area
                            632 
   831A                     633 tt_inp::
   831A 96 0E               634 	lda	*scntr		; any characters ?
   831C 97 2F               635 	sta	*char
   831E 26 01               636 	bne	1$		; yes - skip
   8320 39                  637 	rts
                            638 
   8321 34 15               639 1$:	pshs	cc,b,x
   8323 1A 50               640 	orcc	#120		; hold interrupts
   8325 9E 0F               641 	ldx	*scqntr		; get pointer
   8327 A6 80               642 	lda	,x+		; get character
   8329 97 2F               643 	sta	*char		; save character
   832B 9C 13               644 	cmpx	*scend		; at end of buffer ?
   832D 26 04               645 	bne	2$		; if not skip
   832F 30 C9 01 00         646 	leax	scbuf,u		; reset pointer
   8333 9F 0F               647 2$:	stx	*scqntr		; save pointer
   8335 96 0E               648 	lda	*scntr		; update count
   8337 4A                  649 	deca
   8338 97 0E               650 	sta	*scntr
   833A 81 20               651 	cmpa	#scmpty		; empty ?
   833C 24 06               652 	bcc	3$		; if not - skip
   833E 96 06               653 	lda	*bfstat
   8340 84 FB               654 	anda	#~scn
   8342 97 06               655 	sta	*bfstat		; say empty
                            656 
   8344 96 2F               657 3$:	lda	*char		; get character and
   8346 8D 0B               658 	bsr	hvc_inp		; send to monitoring port
                            659 
   8348 35 15               660 	puls	cc,b,x
   834A 96 2F               661 	lda	*char		; return character
   834C 39                  662 	rts			; finished
                            663 
                            664 
   834D                     665 hvc_oup:
   834D BE 37 14            666 	ldx	.$ipoup		; monitoring port specified ?
   8350 26 07               667 	bne	hvc_mon
   8352 39                  668 	rts
                            669 
   8353                     670 hvc_inp:
   8353 BE 37 12            671 	ldx	.$ipinp		; monitoring port specified ?
   8356 26 01               672 	bne	hvc_mon
   8358 39                  673 	rts
                            674 
   8359                     675 hvc_mon:
   8359 11 83 34 00         676 	cmpu	#port2		; HVC port ?
   835D 26 0F               677 	bne	1$
                            678 
   835F 34 4E               679 	pshs	d,dp,u
   8361 1F 10               680 	tfr	x,d		; LCL/CTL port
   8363 1F 03               681 	tfr	d,u
   8365 1F 8B               682 	tfr	a,dp
   8367 A6 E4               683 	lda	,s		; send the HVC char
   8369 BD 82 F3            684 	jsr	tt_out		; to LCL/CTL port
ASxxxx Assembler V02.10  (Motorola 6809), page 32.
PHS Constant definitions
get character from scan buffer

   836C 35 4E               685 	puls	d,dp,u
                            686 
   836E 39                  687 1$:	rts
                            688 
ASxxxx Assembler V02.10  (Motorola 6809), page 33.
PHS Constant definitions
list processor

                            690 	.sbttl	list processor
                            691 
                            692 	;
                            693 	; 1.	if in single char mode, then:
                            694 	;		clear single char mode
                            695 	;		if not in special mode, then:
                            696 	;			scan for control characters, if found:
                            697 	;				clear gosub
                            698 	;				end
                            699 	;		do gosub (if defined)
                            700 	;		if character used - end
                            701 	;		else go to 2.
                            702 
   836F 96 2B               703 listpr:	lda	*lstat		; get status
   8371 2A 26               704 	bpl	list.d		; not in single - skip
   8373 84 7F               705 	anda	#177		; clear single mode
   8375 97 2B               706 	sta	*lstat		; save status
   8377 85 10               707 	bita	#20		; special character mode ?
   8379 27 08               708 	beq	1$		; not special mode - skip
   837B 84 EF               709 	anda	#357		; clear special
   837D 97 2B               710 	sta	*lstat		; and save
   837F 96 2F               711 	lda	*char		; get any character
   8381 20 0D               712 	bra	list.a		; and go
   8383 96 2F               713 1$:	lda	*char		; get character
   8385 81 20               714 	cmpa	#40		; a control ?
   8387 24 07               715 	bcc	list.a		; if not - skip
   8389 8E 00 00            716 	ldx	#0		; else clear gosub
   838C 9F 2D               717 	stx	*gosub
   838E 20 08               718 	bra	list.b
   8390 9E 2D               719 list.a:	ldx	*gosub		; get process address
   8392 27 04               720 	beq	list.b		; if undefined - skip
   8394 AD 84               721 	jsr	,x		; do it
   8396 24 01               722 	bcc	list.d		; character not used
   8398 39                  723 list.b:	rts			; finished
                            724 
                            725 	; 2.	do command scanner
                            726 	;	if command is found - finished
                            727 
   8399 BD 84 98            728 list.d:	jsr	cmdscn		; scan for commands
   839C 25 04               729 	bcs	list.e		; command found - done
   839E 96 32               730 	lda	*rstat0		; are we running
   83A0 2B 01               731 	bmi	list.f		; if so - skip ahead
   83A2 39                  732 list.e:	rts			; finished
                            733 
                            734 	; 3.	check scan mode, if set then:
                            735 	;		if char is (+) then:
                            736 	;			clear scan
                            737 	;			set build
                            738 	;			reset list buffer
                            739 	;			end
                            740 
   83A3 96 2B               741 list.f:	lda	*lstat
   83A5 85 40               742 	bita	#100		; in scan mode ?
   83A7 27 17               743 	beq	list.j		; if not - skip
   83A9 D6 2F               744 	ldb	*char		; get character
   83AB C1 2B               745 	cmpb	#'+		; is it a (+)  ?
ASxxxx Assembler V02.10  (Motorola 6809), page 34.
PHS Constant definitions
list processor

   83AD 26 10               746 	bne	list.g		; if not - skip out
   83AF 84 BF               747 	anda	#277		; else clear scan mode
   83B1 8A 20               748 	ora	#40		; set build
   83B3 97 2B               749 	sta	*lstat		; save new status
   83B5 0F 31               750 	clr	*schflg		; clear seen flag
   83B7 0F 28               751 	clr	*lstcnt		; reset buffer
   83B9 30 C9 00 1F         752 	leax	lsbuff,u
   83BD 9F 29               753 	stx	*lpntr
   83BF 39                  754 list.g:	rts			; finished
                            755 
                            756 	; 4.	check build, if not set then:
                            757 	;		reset buffer
                            758 	;		if char is (0-9) or (-)
                            759 	;		   or free format   then:
                            760 	;			set build
                            761 	;			put char in buffer
                            762 	;			goto lcheck
                            763 	;		   else: set scan
                            764 	;			 go scan
                            765 
   83C0 96 2B               766 list.j:	lda	*lstat
   83C2 85 20               767 	bita	#40		; building ?
   83C4 26 28               768 	bne	list.o		; if so - skip
   83C6 0F 31               769 	clr	*schflg		; clear seen flag
   83C8 0F 28               770 	clr	*lstcnt		; reset buffer
   83CA 30 C9 00 1F         771 	leax	lsbuff,u
   83CE 9F 29               772 	stx	*lpntr
   83D0 D6 2C               773 	ldb	*format		; in free format ?
   83D2 27 0E               774 	beq	list.k		; if so - set up build
   83D4 D6 2F               775 	ldb	*char		; get character
   83D6 C1 2D               776 	cmpb	#'-		; is it a (-) ?
   83D8 27 08               777 	beq	list.k		; if so - skip
   83DA C1 30               778 	cmpb	#'0		; bcd character ?
   83DC 25 0A               779 	bcs	list.l		; <0 - skip
   83DE C1 39               780 	cmpb	#'9		; >9 ?
   83E0 22 06               781 	bhi	list.l		; not a number - skip
   83E2 8A 20               782 list.k:	ora	#40		; set build
   83E4 97 2B               783 	sta	*lstat		; save status
   83E6 20 06               784 	bra	list.o		; now process this character
   83E8 8A 40               785 list.l:	ora	#100		; set scan
   83EA 97 2B               786 	sta	*lstat		; save status
   83EC 20 B5               787 	bra	list.f		; go scan
                            788 
                            789 	; 5.	build is set
                            790 	;		put character in buffer
                            791 	;		check bufffer
                            792 
   83EE 96 2C               793 list.o:	lda	*format		; check for free format
   83F0 27 19               794 	beq	list.q		; if so - skip
   83F2 96 2F               795 	lda	*char		; get character
   83F4 81 20               796 	cmpa	#40		; any controls ?
   83F6 24 64               797 	bcc	list.x		; if not  skip
   83F8 0F 28               798 list.p:	clr	*lstcnt		; reset buffer
   83FA 0F 31               799 	clr	*schflg		; seen character flag
   83FC 30 C9 00 1F         800 	leax	lsbuff,u
   8400 9F 29               801 	stx	*lpntr
ASxxxx Assembler V02.10  (Motorola 6809), page 35.
PHS Constant definitions
list processor

   8402 96 2B               802 	lda	*lstat		; set status for scan
   8404 84 0F               803 	anda	#17		; save lower for ?
   8406 8A 40               804 	ora	#100		; scanning
   8408 97 2B               805 	sta	*lstat
   840A 39                  806 	rts			; finished
                            807 
   840B 96 31               808 list.q:	lda	*schflg		; seen a char ?
   840D 26 24               809 	bne	list.u		; if so - skip
   840F 96 2F               810 	lda	*char		; else scan this character
   8411 81 2D               811 	cmpa	#'-		; a - sign ?
   8413 27 15               812 	beq	list.r		; if so - save it
   8415 81 2B               813 	cmpa	#'+		; a + sign ?
   8417 27 10               814 	beq	list.t		; strip +'s
   8419 81 20               815 	cmpa	#40		; space ?
   841B 27 0C               816 	beq	list.t		; strip spaces
   841D 81 30               817 	cmpa	#'0		; only want numerals
   841F 25 D7               818 	bcs	list.p
   8421 81 3A               819 	cmpa	#':
   8423 24 D3               820 	bcc	list.p
   8425 8D 03               821 	bsr	list.r		; save character
   8427 0C 31               822 list.s:	inc	*schflg		; character seen
   8429 39                  823 list.t:	rts			; finished
                            824 
   842A 9E 29               825 list.r:	ldx	*lpntr		; get pointer
   842C A7 80               826 	sta	,x+		; save character
   842E 9F 29               827 	stx	*lpntr
   8430 0C 28               828 	inc	*lstcnt		; one more character
   8432 39                  829 	rts			; and return
                            830 
   8433 96 2F               831 list.u:	lda	*char		; get character
   8435 81 2D               832 	cmpa	#'-		; a - sign ?
   8437 27 1D               833 	beq	list.w		; if so - skip
   8439 81 2B               834 	cmpa	#'+		; a + sign ?
   843B 27 19               835 	beq	list.w		; if so - skip
   843D 81 30               836 	cmpa	#'0		; want only numerals
   843F 25 15               837 	bcs	list.w
   8441 81 3A               838 	cmpa	#':
   8443 24 11               839 	bcc	list.w
   8445 9E 29               840 	ldx	*lpntr		; get pointer
   8447 A7 84               841 	sta	,x		; save character
   8449 96 28               842 	lda	*lstcnt		; at end of buffer ?
   844B 81 08               843 	cmpa	#0d8
   844D 27 06               844 	beq	list.v		; if so - skip update
   844F 30 01               845 	leax	1,x		; else update pointer
   8451 9F 29               846 	stx	*lpntr
   8453 0C 28               847 	inc	*lstcnt		; update counter
   8455 39                  848 list.v:	rts			; finshed
   8456 8D 26               849 list.w:	bsr	lche.a		; go evaluate and process
   8458 0F 31               850 	clr	*schflg		; clear seen flag
   845A 20 AF               851 	bra	list.q		; rescan last character
                            852 
   845C 81 2D               853 list.x:	cmpa	#'-		; save only +,-,spaces
   845E 27 10               854 	beq	list.y		; and numerals
   8460 81 2B               855 	cmpa	#'+
   8462 27 0C               856 	beq	list.y
   8464 81 20               857 	cmpa	#40
ASxxxx Assembler V02.10  (Motorola 6809), page 36.
PHS Constant definitions
list processor

   8466 27 08               858 	beq	list.y
   8468 81 30               859 	cmpa	#'0
   846A 25 23               860 	bcs	lche.b
   846C 81 3A               861 	cmpa	#':
   846E 24 1F               862 	bcc	lche.b
                            863 
   8470 9E 29               864 list.y:	ldx	*lpntr		; get pointer
   8472 A7 80               865 	sta	,x+		; save character
   8474 9F 29               866 	stx	*lpntr
   8476 0C 28               867 	inc	*lstcnt		; update count
                            868 
                            869 
   8478 96 28               870 lcheck:	lda	*lstcnt		; get count
   847A 91 2C               871 	cmpa	*format		; enough characters ?
   847C 26 19               872 	bne	lche.c		; if not - skip
   847E BD 85 29            873 lche.a:	jsr	evaln		; go evaluate data
   8481 0F 28               874 	clr	*lstcnt		; clear buffer
   8483 30 C9 00 1F         875 	leax	lsbuff,u
   8487 9F 29               876 	stx	*lpntr
   8489 9E 2D               877 	ldx	*gosub		; get process
   848B 27 0A               878 	beq	lche.c		; if undefined - skip
   848D 6E 84               879 	jmp	,x		; else do process
                            880 
   848F 0F 28               881 lche.b:	clr	*lstcnt		; clear buffer
   8491 30 C9 00 1F         882 	leax	lsbuff,u
   8495 9F 29               883 	stx	*lpntr
   8497 39                  884 lche.c:	rts			; finished
                            885 
ASxxxx Assembler V02.10  (Motorola 6809), page 37.
PHS Constant definitions
command scanner

                            887 	.sbttl	command scanner
                            888 
   8498 D6 2F               889 cmdscn:	ldb	*char		; get character
   849A 96 30               890 	lda	*pchar		; get previous character
   849C D7 30               891 	stb	*pchar		; save new character
   849E 81 24               892 	cmpa	#'$		; old a ($) ?
   84A0 26 50               893 	bne	5$		; if not - skip
   84A2 96 2B               894 	lda	*lstat
   84A4 84 0F               895 	anda	#~360
   84A6 97 2B               896 	sta	*lstat		; all new list control
   84A8 C1 61               897 	cmpb	#141		; allow lower case commands
   84AA 25 02               898 	bcs	1$		; upper case - skip
   84AC C0 20               899 	subb	#40		; make lower into upper
   84AE C0 41               900 1$:	subb	#'A		; A=0,Z=31
   84B0 C1 14               901 	cmpb	#'U-'A		; U ?
   84B2 27 0B               902 	beq	2$		; yes - skip
   84B4 96 32               903 	lda	*rstat0		; running ?
   84B6 2A 3A               904 	bpl	5$		; if not - skip
   84B8 5D                  905 	tstb			; A-Z ?
   84B9 2B 0D               906 	bmi	3$		; not an internal command
   84BB C1 1A               907 	cmpb	#32		; not A-Z ?
   84BD 24 09               908 	bcc	3$		; not an internal command
   84BF 8E 84 F5            909 2$:	ldx	#cmdtbl		; table pointer
   84C2 58                  910 	aslb			; offset into table
   84C3 AD 95               911 	jsr	[b,x]		; do command
   84C5 1A 01               912 	sec			; found command
   84C7 39                  913 	rts			; finished
                            914 
   84C8 D6 2F               915 3$:	ldb	*char		; check if user function
   84CA C0 30               916 	subb	#'0		; make bcd
   84CC 2B 1E               917 	bmi	4$		; if not - bad command
   84CE C1 09               918 	cmpb	#'9-'0		; must be a digit
   84D0 22 1A               919 	bhi	4$		; if not - bad command
   84D2 58                  920 	aslb
   84D3 58                  921 	aslb
   84D4 8E 00 00            922 	ldx	#$xtrn0
   84D7 30 85               923 	leax	b,x		; add offset into entry table
   84D9 EC 84               924 	ldd	,x		; a function there ?
   84DB 27 0F               925 	beq	4$		; no - bad command
   84DD A3 02               926 	subd	2,x		; verify entry
   84DF 10 83 5A A5         927 	cmpd	#0x5AA5		; check code
   84E3 26 07               928 	bne	4$		; invalid - bad command
   84E5 AD 94               929 	jsr	[,x]		; and goto user function
   84E7 1A 01               930 	sec			; found command
   84E9 39                  931 	rts			; finished
                            932 
                            933 ;  bad command service
                    04EA    934 badcom=.
   84EA 32 62               935 	leas	2,s		; pop return
   84EC BD 85 9D            936 4$:	jsr	errgos		; indicate error
   84EF 1A 01               937 	sec			; bad command
   84F1 39                  938 	rts			; finished
   84F2 1C FE               939 5$:	clc			; no command
   84F4 39                  940 	rts			; finished
                            941 
                            942 
ASxxxx Assembler V02.10  (Motorola 6809), page 38.
PHS Constant definitions
command scanner

                            943 	;command jump address table
                            944 
   84F5 84 EA               945 cmdtbl:	.word	badcom ;.$a
   84F7 84 EA               946 	.word	badcom ;.$b
   84F9 85 C2               947 	.word	.$c
   84FB 85 CB               948 	.word	.$d
   84FD 85 DD               949 	.word	.$e
   84FF 84 EA               950 	.word	badcom ;.$f
   8501 84 EA               951 	.word	badcom ;.$g
   8503 86 0A               952 	.word	.$h
   8505 86 3C               953 	.word	.$i
   8507 86 61               954 	.word	.$j
   8509 84 EA               955 	.word	badcom ;.$k
   850B 86 7A               956 	.word	.$l
   850D 86 D4               957 	.word	.$m
   850F 87 F7               958 	.word	.$n
   8511 84 EA               959 	.word	badcom ;.$o
   8513 88 0F               960 	.word	.$p
   8515 84 EA               961 	.word	badcom ;.$q
   8517 88 6E               962 	.word	.$r
   8519 88 A8               963 	.word	.$s
   851B 89 52               964 	.word	.$t
   851D 8A EC               965 	.word	.$u
   851F 8B 33               966 	.word	.$v
   8521 84 EA               967 	.word	badcom ;.$w
   8523 84 EA               968 	.word	badcom ;.$x
   8525 84 EA               969 	.word	badcom ;.$y
   8527 8B 3C               970 	.word	.$z
                            971 
ASxxxx Assembler V02.10  (Motorola 6809), page 39.
PHS Constant definitions
evaluate number routine

                            973 	.sbttl	evaluate number routine
                            974 
   8529 0F 33               975 evaln:	clr	*nsign		; clear sign
   852B 0F 3B               976 	clr	*bincntr	; initialize counter
   852D 31 C9 00 33         977 	leay	nsign,u		; point to variables
   8531 C6 06               978 	ldb	#ndigit		; maximum number of digits
   8533 D7 3A               979 	stb	*numcntr
   8535 6F A0               980 1$:	clr	,y+		; clear ndigit bytes
   8537 5A                  981 	decb
   8538 26 FB               982 	bne	1$		; loop until all cleared
   853A 9E 29               983 	ldx	*lpntr		; string pointer
   853C E6 82               984 2$:	ldb	,-x		; get character
   853E C1 2D               985 	cmpb	#'-		; a (-) ?
   8540 26 06               986 	bne	3$		; if not - skip
   8542 86 FF               987 	lda	#377		; sign is negative
   8544 97 33               988 	sta	*nsign
   8546 20 14               989 	bra	5$		; skip ahead
   8548 0D 3A               990 3$:	tst	*numcntr	; got enough ?
   854A 27 17               991 	beq	7$		; if so - skip
   854C C1 20               992 	cmpb	#40		; a space ?
   854E 27 0C               993 	beq	5$		; if so - skip
   8550 C1 2B               994 	cmpb	#'+		; a '+' ?
   8552 27 08               995 	beq	5$		; if so - skip
   8554 C0 30               996 	subb	#'0		; make bcd
   8556 2B 04               997 	bmi	4$		; if not -  skip
   8558 C1 09               998 	cmpb	#0d9		; must be a digit
   855A 23 01               999 	bls	6$		; if so - skip
   855C                    1000 4$:				; error !
   855C 5F                 1001 5$:	clrb
   855D E7 A2              1002 6$:	stb	,-y		; save character
   855F 0A 3A              1003 	dec	*numcntr	; update counters
   8561 0C 3B              1004 	inc	*bincntr
   8563 0A 28              1005 7$:	dec	*lstcnt		; any more ?
   8565 2E D5              1006 	bgt	2$		; loop until done
                           1007 
                           1008 
ASxxxx Assembler V02.10  (Motorola 6809), page 40.
PHS Constant definitions
bcd to binary conversion

                           1010 	.sbttl	bcd to binary conversion
                           1011 
   8567 CC 00 00           1012 bcdbin:	ldd	#0		; init result
   856A 20 0A              1013 	bra	2$		; go to entry
   856C 58                 1014 1$:	aslb			; *2
   856D 49                 1015 	rola
   856E ED E3              1016 	std	,--s		; save
   8570 58                 1017 	aslb			; *8
   8571 49                 1018 	rola
   8572 58                 1019 	aslb
   8573 49                 1020 	rola
   8574 E3 E1              1021 	addd	,s++		; *2+*8 -> *10
   8576 EB A0              1022 2$:	addb	,y+		; add in digit
   8578 89 00              1023 	adca	#0
   857A 0A 3B              1024 	dec	*bincntr	; end ?
   857C 26 EE              1025 	bne	1$
                           1026 
                           1027 ;  now use sign
   857E 0D 33              1028 	tst	*nsign		; negative ?
   8580 27 05              1029 	beq	3$		; if positive - skip
   8582 43                 1030 	coma
   8583 53                 1031 	comb
   8584 C3 00 01           1032 	addd	#1
   8587 DD 34              1033 3$:	std	*number		; save result
   8589 39                 1034 	rts			; finished
                           1035 
ASxxxx Assembler V02.10  (Motorola 6809), page 41.
PHS Constant definitions
next character transfer routines

                           1037 	.sbttl	next character transfer routines
                           1038 
   858A 96 2B              1039 nxtspc:	lda	*lstat
   858C 8A 10              1040 	ora	#20
   858E 97 2B              1041 	sta	*lstat		; re-enable special character mode
                           1042 
   8590 96 2B              1043 nxtchr:	lda	*lstat
   8592 8A 80              1044 	ora	#200
   8594 97 2B              1045 	sta	*lstat		; re-enable character mode
                           1046 
   8596 1A 01              1047 	sec			; character used
                           1048 
   8598 AE E1              1049 nxtgos:	ldx	,s++		; next entry
   859A 9F 2D              1050 	stx	*gosub
   859C 39                 1051 	rts			; finished
                           1052 
   859D                    1053 errgos:
   859D 8E 00 00           1054 endgos:	ldx	#0		; no entry
   85A0 9F 2D              1055 	stx	*gosub
   85A2 39                 1056 	rts			; finished
                           1057 
                           1058 ;  table driven dispatcher
                           1059 
   85A3                    1060 $dispatch:
   85A3 81 61              1061 	cmpa	#141		; allow lower case options
   85A5 25 06              1062 	bcs	1$		; skip if upper
   85A7 81 7B              1063 	cmpa	#173
   85A9 24 02              1064 	bcc	1$		; not lower - skip
   85AB 80 20              1065 	suba	#40		; make upper
   85AD AE E1              1066 1$:	ldx	,s++		; table address
   85AF 1C FE              1067 2$:	clc			; character unused if exits
   85B1 6D 84              1068 	tst	,x		; end of table ?
   85B3 2B 0A              1069 	bmi	3$		; terminate scan and do service
   85B5 27 E6              1070 	beq	endgos		; end of service
   85B7 A1 84              1071 	cmpa	,x		; match table entry ?
   85B9 27 04              1072 	beq	3$		; yes - exit
   85BB 30 03              1073 	leax	3,x		; update table pointer
   85BD 20 F0              1074 	bra	2$		; and loop
                           1075 
   85BF 6E 98 01           1076 3$:	jmp	[1,x]		; go to service routine
                           1077 
                           1078 
ASxxxx Assembler V02.10  (Motorola 6809), page 42.
PHS Constant definitions
$c command

                           1080 	.sbttl	$c command
                           1081 
                           1082 	; Calibrate a channel
                           1083 
   85C2 BD 85 98           1084 .$c:	jsr	nxtgos
   85C5 96 35              1085 	lda	*number+1	; channel number
   85C7 BD 8C BD           1086 	jsr	phs$cal		; do a calibration
   85CA 39                 1087 	rts
                           1088 
                           1089 	.sbttl	$d command
                           1090 
                           1091 	; Set a channel
                           1092 
   85CB BD 85 98           1093 .$d:	jsr	nxtgos
   85CE DC 34              1094 	ldd	*number
   85D0 DD 80              1095 	std	*tempv1
                           1096 
   85D2 BD 85 98           1097 	jsr	nxtgos
   85D5 96 81              1098 	lda	*tempv1+1	; channel number
   85D7 9E 34              1099 	ldx	*number		; and DAC set value
   85D9 BD 8C 93           1100 	jsr	phs$set		; do a setup
   85DC 39                 1101 	rts
                           1102 
                           1103 
ASxxxx Assembler V02.10  (Motorola 6809), page 43.
PHS Constant definitions
$e command

                           1105 	.sbttl	$e command
                           1106 
                           1107 	;  $e controller communication setup
                           1108 
   85DD BD 85 90           1109 .$e:	jsr	nxtchr		; come back with character
                           1110 
   85E0 BD 85 A3           1111 	jsr	$dispatch	; go to service routine
   85E3 34                 1112 	.byte	'4
   85E4 85 ED              1113 	.word	1$
   85E6 35                 1114 	.byte	'5
   85E7 85 F5              1115 	.word	2$
   85E9 58                 1116 	.byte	'X
   85EA 85 FD              1117 	.word	3$
   85EC 00                 1118 	.byte	0		; end of table
                           1119 
                           1120 
   85ED 96 16              1121 1$:	lda	*d.stat
   85EF 8A 01              1122 	ora	#1
   85F1 97 16              1123 	sta	*d.stat		; enable xon/xoff 'link'
   85F3 20 E8              1124 	bra	.$e
   85F5 96 16              1125 2$:	lda	*d.stat
   85F7 84 FE              1126 	anda	#~1
   85F9 97 16              1127 	sta	*d.stat		; disable xon/xoff 'link'
   85FB 20 E0              1128 	bra	.$e
                           1129 
                           1130 	; This undocumented $e function sets
                           1131 	; the debugging flags.
                           1132 	;
                           1133 	; $ex - loads new debugging flags
                           1134 
   85FD 1A 01              1135 3$:	sec			; character used
   85FF BD 85 98           1136 	jsr	nxtgos		; come back with data
   8602 D6 35              1137 	ldb	*number+1	; low order
   8604 F7 37 10           1138 	stb	debugr		; new 'debug' flags
   8607 7E 85 9D           1139 	jmp	endgos
                           1140 
                           1141 
ASxxxx Assembler V02.10  (Motorola 6809), page 44.
PHS Constant definitions
.$h command

                           1143 	.sbttl	.$h command
                           1144 
                           1145 	; Direct link to the HVC port
                           1146 
   860A EF E3              1147 .$h:	stu	,--s		; save current port #
   860C FF 37 12           1148 	stu	.$ipinp		; setup input monitoring
                           1149 
                           1150 	; Transfer LCL / CTL port characters to the HVC port
                           1151 
   860F EC E4              1152 1$:	ldd	,s		; current user
   8611 1F 03              1153 	tfr	d,u
   8613 1F 8B              1154 	tfr	a,dp
   8615 BD 83 1A           1155 	jsr	tt_inp
   8618 27 F5              1156 	beq	1$
                           1157 
   861A 81 1B              1158 	cmpa	#0q33		; check for escape
   861C 27 10              1159 	beq	2$		; 'ESC'
                           1160 
   861E 34 02              1161 	pshs	a
                           1162 
   8620 CC 34 00           1163 	ldd	#port2
   8623 1F 03              1164 	tfr	d,u
   8625 1F 8B              1165 	tfr	a,dp
                           1166 
   8627 35 02              1167 	puls	a
   8629 BD 82 F3           1168 	jsr	tt_out		; send character
                           1169 
   862C 20 E1              1170 	bra	1$
                           1171 
   862E CC 00 00           1172 2$:	ldd	#0		; clear monitoring
   8631 FD 37 12           1173 	std	.$ipinp
   8634 FD 37 14           1174 	std	.$ipoup
   8637 32 62              1175 	leas	2,s
   8639 7E 85 9D           1176 	jmp	endgos
                           1177 
                           1178 
ASxxxx Assembler V02.10  (Motorola 6809), page 45.
PHS Constant definitions
.$i command

                           1180 	.sbttl	.$i command
                           1181 
                           1182 	.area	BUFSAV
                           1183 
   3712                    1184 .$ipinp:
   3712                    1185 	.blkb	2		; input  monitoring port
   3714                    1186 .$ipoup:
   3714                    1187 	.blkb	2		; output monitoring port
                           1188 
                           1189 
                           1190 	.area	PGMSAV
                           1191 
                           1192 	; Monitor HVC Port
                           1193 
   863C BD 85 90           1194 .$i:	jsr	nxtchr		; come back with character
                           1195 
   863F BD 85 A3           1196 	jsr	$dispatch	; go to service routine
   8642 43                 1197 	.byte	'C
   8643 86 4C              1198 	.word	.$ic
   8645 49                 1199 	.byte	'I
   8646 86 57              1200 	.word	.$ii
   8648 4F                 1201 	.byte	'O
   8649 86 5C              1202 	.word	.$io
   864B 00                 1203 	.byte	0		; end of table
                           1204 
                           1205 
   864C CC 00 00           1206 .$ic:	ldd	#0		; clear port monitoring
   864F FD 37 12           1207 	std	.$ipinp
   8652 FD 37 14           1208 	std	.$ipoup
   8655 20 E5              1209 	bra	.$i
                           1210 
   8657 FF 37 12           1211 .$ii:	stu	.$ipinp		; input port monitor
   865A 20 E0              1212 	bra	.$i
                           1213 
   865C FF 37 14           1214 .$io:	stu	.$ipoup		; output port monitor
   865F 20 DB              1215 	bra	.$i
                           1216 
                           1217 
                           1218 	.sbttl	.$j command
                           1219 
                           1220 	; Empty the hvc queue
                           1221 
   8661 34 49              1222 .$j:	pshs	cc,dp,u
   8663 1A 50              1223 	orcc	#0q120		; hold interrupts
   8665 CC 34 00           1224 	ldd	#port2
   8668 1F 03              1225 	tfr	d,u
   866A 1F 8B              1226 	tfr	a,dp
   866C 0F D0              1227 	clr	*que$cntr	; clear queue variables
   866E 0F CE              1228 	clr	*que$inp
   8670 0F CF              1229 	clr	*que$oup
   8672 CC 00 00           1230 	ldd	#0
   8675 DD CC              1231 	std	*q$gosub
   8677 35 49              1232 	puls	cc,dp,u
   8679 39                 1233 	rts	
                           1234 
ASxxxx Assembler V02.10  (Motorola 6809), page 46.
PHS Constant definitions
.$l command

                           1236 	.sbttl	.$l command
                           1237 
                           1238 	; Set the acquisition LED status
                           1239 
   867A BD 85 90           1240 .$l:	jsr	nxtchr
                           1241 
   867D BD 85 A3           1242 	jsr	$dispatch
   8680 41                 1243 	.byte	'A
   8681 86 90              1244 	.word	.$la
   8683 48                 1245 	.byte	'H
   8684 86 99              1246 	.word	.$lh
   8686 46                 1247 	.byte	'F
   8687 86 A2              1248 	.word	.$lf
   8689 53                 1249 	.byte	'S
   868A 86 AB              1250 	.word	.$ls
   868C 43                 1251 	.byte	'C
   868D 86 B4              1252 	.word	.$lc
   868F 00                 1253 	.byte	0
                           1254 
   8690 1A 01              1255 .$la:	sec
   8692 BD 85 98           1256 	jsr	nxtgos		; .$la
   8695 C6 08              1257 	ldb	#$ACTIVE
   8697 20 2B              1258 	bra	.$lahfs
                           1259 
   8699 1A 01              1260 .$lh:	sec
   869B BD 85 98           1261 	jsr	nxtgos		; .$lh
   869E C6 04              1262 	ldb	#$HOLD
   86A0 20 22              1263 	bra	.$lahfs
                           1264 
   86A2 1A 01              1265 .$lf:	sec
   86A4 BD 85 98           1266 	jsr	nxtgos		; .$lf
   86A7 C6 02              1267 	ldb	#$FAILED
   86A9 20 19              1268 	bra	.$lahfs
                           1269 
   86AB 1A 01              1270 .$ls:	sec
   86AD BD 85 98           1271 	jsr	nxtgos		; .$ls
   86B0 C6 01              1272 	ldb	#$SCAN
   86B2 20 10              1273 	bra	.$lahfs
                           1274 
   86B4 1A 01              1275 .$lc:	sec
   86B6 BD 85 98           1276 	jsr	nxtgos		; .$lo
   86B9 96 35              1277 	lda	*number+1	; get the variable address pointer
   86BB C6 00              1278 	ldb	#$STOP
   86BD BD 8C 58           1279 	jsr	chng$sts	; change the status
   86C0 BD 8C 73           1280 	jsr	wait$sts
   86C3 39                 1281 	rts
                           1282 
   86C4                    1283 .$lahfs:
   86C4 E7 E2              1284 	stb	,-s		; save update
   86C6 96 35              1285 	lda	*number+1
   86C8 BD 8C 7D           1286 	jsr	rd$sts		; get the status
   86CB E8 E0              1287 	eorb	,s+		; update status
   86CD BD 8C 58           1288 	jsr	chng$sts	; change the status
   86D0 BD 8C 73           1289 	jsr	wait$sts
   86D3 39                 1290 	rts
                           1291 
ASxxxx Assembler V02.10  (Motorola 6809), page 47.
PHS Constant definitions
.$l command

                           1292 
ASxxxx Assembler V02.10  (Motorola 6809), page 48.
PHS Constant definitions
$m command - MONDEB-09

                           1294 	.sbttl	$m command - MONDEB-09
                           1295 
                           1296 	; This monitor may not be invoked by more than
                           1297 	; one port simultaneously
                           1298 
                           1299 	.area	BUFSAV
                           1300 
   3716                    1301 uixsav:	.blkb	2		; index register u saved for i/o
                           1302 
                           1303 	.area	PGMSAV
                           1304 
   86D4 BD 85 90           1305 .$m:	jsr	nxtchr		; come back with character
                           1306 
   86D7 BD 85 A3           1307 	jsr	$dispatch	; go to service routine
   86DA 41                 1308 	.byte	'A
   86DB 86 E4              1309 	.word	.$ma
   86DD 52                 1310 	.byte	'R
   86DE 86 EA              1311 	.word	.$mr
   86E0 FF                 1312 	.byte	-1
   86E1 86 EA              1313 	.word	.$mr
   86E3 00                 1314 	.byte	0		; end of table
                           1315 
                           1316 
   86E4 CC 00 00           1317 .$ma:	ldd	#0		; abort active state
   86E7 FD 37 16           1318 	std	uixsav
                           1319 
   86EA FC 37 16           1320 .$mr:	ldd	uixsav		; active ?
   86ED 26 25              1321 	bne	1$		; yes - exit
   86EF FF 37 16           1322 	stu	uixsav		; save index register u
   86F2 CC E5 C8           1323 	ldd	#typswi
   86F5 FD 37 0C           1324 	std	exswi		; swi interrupt vector
   86F8 CC 87 84           1325 	ldd	#phsidta
   86FB FD 0F E8           1326 	std	conin
   86FE FD 0F EC           1327 	std	altin
   8701 CC 87 AE           1328 	ldd	#phsodta
   8704 FD 0F EA           1329 	std	conout
   8707 FD 0F EE           1330 	std	altout
   870A BD E4 C3           1331 	jsr	mond09		; start up MONDEB - 09
   870D CC 00 00           1332 	ldd	#0
   8710 FD 37 16           1333 	std	uixsav		; inactive
   8713 39                 1334 	rts
                           1335 
   8714 10 83 10 00        1336 1$:	cmpd	#port0		; port 0 using ?
   8718 26 05              1337 	bne	2$		; no - skip
   871A 8E 87 32           1338 	ldx	#5$		; note
   871D 20 09              1339 	bra	3$
                           1340 
   871F 10 83 22 00        1341 2$:	cmpd	#port1		; port 1 using ?
   8723 26 BF              1342 	bne	.$ma		; no - then initialize
   8725 8E 87 5B           1343 	ldx	#6$		; note
                           1344 
   8728 A6 80              1345 3$:	lda	,x+
   872A 27 05              1346 	beq	4$
   872C BD 82 E9           1347 	jsr	plcbuf		; send help
   872F 20 F7              1348 	bra	3$
                           1349 
ASxxxx Assembler V02.10  (Motorola 6809), page 49.
PHS Constant definitions
$m command - MONDEB-09

   8731 39                 1350 4$:	rts
                           1351 
   8732 0D 0A              1352 5$:	.byte	0q015,0q012
   8734 4D 4F 4E 44 45 42  1353 	.ascii	"MONDEB-09 is active on the LCL Port."
        2D 30 39 20 69 73
        20 61 63 74 69 76
        65 20 6F 6E 20 74
        68 65 20 4C 43 4C
        20 50 6F 72 74 2E
   8758 0D 0A 00           1354 	.byte	0q015,0q012,0
                           1355 
   875B 0D 0A              1356 6$:	.byte	0q015,0q012
   875D 4D 4F 4E 44 45 42  1357 	.ascii	"MONDEB-09 is active on the CTL Port."
        2D 30 39 20 69 73
        20 61 63 74 69 76
        65 20 6F 6E 20 74
        68 65 20 43 54 4C
        20 50 6F 72 74 2E
   8781 0D 0A 00           1358 	.byte	0q015,0q012,0
                           1359 
                           1360 
                           1361 
ASxxxx Assembler V02.10  (Motorola 6809), page 50.
PHS Constant definitions
PHS I/O Drivers

                           1363 	.sbttl	PHS I/O Drivers
                           1364 
                           1365 	;********************************************************
                           1366 	;*      default PHS i/o drivers
                           1367 	;********************************************************
                           1368 
                           1369 	;* phsidta - return console input character
                           1370 	;* output: c=0 if no data ready, c=1 a=character
                           1371 
   8784                    1372 phsidta:
   8784 1C EF              1373 	andcc	#357		; enable 'irq' to allow characters
   8786 34 4C              1374 	pshs	b,dp,u		; save these
                           1375 
   8788 8D 3F              1376 	bsr	prtscn		; scan other port
                           1377 
   878A FC 37 16           1378 	ldd	uixsav		; access correct port
   878D 10 27 FA 16        1379 	lbeq	main		; this should never happen
   8791 1F 03              1380 	tfr	d,u
   8793 1F 8B              1381 	tfr	a,dp
                           1382 
   8795 BD 83 1A           1383 	jsr	tt_inp		; check for a character
   8798 26 05              1384 	bne	3$		; yes - skip
                           1385 
   879A 35 4C              1386 	puls	b,dp,u		; restore these
   879C 1C FE              1387 	clc			; no character
   879E 39                 1388 	rts			; return to caller
                           1389 
   879F 81 61              1390 3$:	cmpa	#0o141		; translate lower to upper
   87A1 25 06              1391 	bcs	4$
   87A3 81 7B              1392 	cmpa	#0o173
   87A5 24 02              1393 	bcc	4$
   87A7 80 20              1394 	suba	#0o40
   87A9 35 4C              1395 4$:	puls	b,dp,u		; restore these
   87AB 1A 01              1396 	sec
   87AD 39                 1397 	rts
                           1398 
                           1399 	;* phsodta - output character to console device
                           1400 	;* input: a=character to send
                           1401 	;* all registers transparent
                           1402 
   87AE                    1403 phsodta:
   87AE 1C EF              1404 	andcc	#357		; enable 'irq' to allow characters
   87B0 34 4E              1405 	pshs	d,dp,u		; save these
   87B2 34 02              1406 	pshs	a
                           1407 
   87B4 8D 13              1408 	bsr	prtscn		; scan other port
                           1409 
   87B6 FC 37 16           1410 	ldd	uixsav		; access correct port
   87B9 10 27 F9 EA        1411 	lbeq	main		; this should never happen
   87BD 1F 03              1412 	tfr	d,u
   87BF 1F 8B              1413 	tfr	a,dp
                           1414 
   87C1 35 02              1415 	puls	a		; plcbuf requires character in a
   87C3 BD 82 E9           1416 	jsr	plcbuf		; send the character
                           1417 
   87C6 35 4E              1418 	puls	d,dp,u		; restore these
ASxxxx Assembler V02.10  (Motorola 6809), page 51.
PHS Constant definitions
PHS I/O Drivers

   87C8 39                 1419 	rts
                           1420 
                           1421 	; Alternate Port Scanner
                           1422 
   87C9 34 7E              1423 prtscn:	pshs	d,dp,x,y,u
   87CB CC 10 00           1424 	ldd	#port0		; pointer to port0
   87CE 8D 08              1425 	bsr	1$
   87D0 CC 22 00           1426 	ldd	#port1		; pointer to port1
   87D3 8D 03              1427 	bsr	1$
   87D5 35 7E              1428 	puls	d,dp,x,y,u
   87D7 39                 1429 	rts
                           1430 
   87D8 10 B3 37 16        1431 1$:	cmpd	uixsav		; only allow other port
   87DC 27 18              1432 	beq	2$
   87DE 1F 03              1433 	tfr	d,u
   87E0 1F 8B              1434 	tfr	a,dp		; load direct page
   87E2 FD 37 00           1435 	std	usrstk		; and save user stack
                           1436 
   87E5 BD 9C E2           1437 	jsr	syscin		; get character from scan buffer
   87E8 0D 2F              1438 	tst	*char		; if none - skip
   87EA 27 0A              1439 	beq	2$
                           1440 
   87EC BD A0 BF           1441 	jsr	sel$scrn	; go to screen selector
                           1442 
   87EF 0D 2F              1443 	tst	*char		; if none - skip
   87F1 27 03              1444 	beq	2$
   87F3 BD 83 6F           1445 	jsr	listpr		; enter list processor
                           1446 
   87F6 39                 1447 2$:	rts
                           1448 
                           1449 
ASxxxx Assembler V02.10  (Motorola 6809), page 52.
PHS Constant definitions
$n command

                           1451 	.sbttl	$n command
                           1452 
   87F7 BD 85 98           1453 .$n:	jsr	nxtgos		; wait for
                           1454 
   87FA DC 34              1455 	ldd	*number
   87FC 34 01              1456 	pshs	cc
   87FE 1A 50              1457 	orcc	#0q120
   8800 96 41              1458 	lda	*scrn$sts	; mask in new screen
   8802 84 F0              1459 	anda	#~0x0F
   8804 34 04 AB E0        1460 	aba
   8808 97 41              1461 	sta	*scrn$sts
   880A 0F 47              1462 	clr	*s$state
   880C 35 01              1463 	puls	cc
   880E 39                 1464 1$:	rts
                           1465 
                           1466 
ASxxxx Assembler V02.10  (Motorola 6809), page 53.
PHS Constant definitions
$p command

                           1468 	.sbttl	$p command
                           1469 
   880F BD 85 98           1470 .$p:	jsr	nxtgos
   8812 DC 34              1471 	ldd	*number		; channel number
   8814 DD 80              1472 	std	*tempv1
                           1473 
   8816 BD 85 98           1474 	jsr	nxtgos
   8819 DC 34              1475 	ldd	*number		; 10% response voltage change
   881B DD 82              1476 	std	*tempv2
                           1477 
   881D BD 85 98           1478 	jsr	nxtgos
   8820 DC 34              1479 	ldd	*number		; update change threshold voltage
   8822 DD 84              1480 	std	*tempv3
                           1481 
   8824 BD 85 98           1482 	jsr	nxtgos
   8827 DC 34              1483 	ldd	*number		; maximum single step voltage change
   8829 DD 86              1484 	std	*tempv4
                           1485 
   882B DC 80              1486 	ldd	*tempv1
   882D 10 83 00 1F        1487 	cmpd	#0d31		; valid channel
   8831 22 38              1488 	bhi	1$		; no - exit
   8833 8E 8C 16           1489 	ldx	#acqvtbl
   8836 58                 1490 	aslb
   8837 30 95              1491 	leax	[b,x]
   8839 DC 82              1492 	ldd	*tempv2
   883B 10 83 00 32        1493 	cmpd	#0d50		; valid 10% response change ?
   883F 22 2A              1494 	bhi	1$		; no - exit
   8841 86 1E              1495 	lda	#<(0d65535/0d50)
   8843 3D                 1496 	mul
   8844 ED E3              1497 	std	,--s
   8846 D6 83              1498 	ldb	*tempv2+1
   8848 86 05              1499 	lda	#>(0d65535/0d50)
   884A 3D                 1500 	mul
   884B 1E 89              1501 	exg	a,b
   884D E3 E1              1502 	addd	,s++
   884F A7 89 00 20        1503 	sta	dlta$vlt,x
   8853 DC 84              1504 	ldd	*tempv3
   8855 10 83 00 FF        1505 	cmpd	#0d255		; valid update change ?
   8859 22 10              1506 	bhi	1$		; no - exit
   885B E7 89 00 1E        1507 	stb	dlta$min,x
   885F DC 86              1508 	ldd	*tempv4
   8861 10 83 00 FF        1509 	cmpd	#0d255		; valid maximum single step voltage change ?
   8865 22 04              1510 	bhi	1$		; no - exit
   8867 E7 89 00 1F        1511 	stb	dlta$err,x
                           1512 
   886B 7E 85 9D           1513 1$:	jmp	endgos
                           1514 
                           1515 
ASxxxx Assembler V02.10  (Motorola 6809), page 54.
PHS Constant definitions
$r command

                           1517 	.sbttl	$r command
                           1518 
   886E 0F 2C              1519 .$r:	clr	*format		; set for free format
                           1520 
   8870 BD 85 90           1521 1$:	jsr	nxtchr		; wait for next
                           1522 
   8873 BD 85 A3           1523 	jsr	$dispatch	; go to service routine
   8876 56                 1524 	.byte	'V
   8877 88 7F              1525 	.word	2$		; version select
   8879 43                 1526 	.byte	'C
   887A 88 83              1527 	.word	3$		; copyright select
   887C FF                 1528 	.byte	-1
   887D 88 95              1529 	.word	6$		; end dispatch
                           1530 
   887F 86 16              1531 2$:	lda	#phs$id		; phs$id version #
   8881 20 02              1532 	bra	4$
                           1533 
   8883 86 50              1534 3$:	lda	#phs$cr		; phs$cr version # / copyright 
                           1535 
   8885 97 34              1536 4$:	sta	*number
   8887 8E 80 06           1537 	ldx	#cpyrit		; version string
   888A A6 80              1538 5$:	lda	,x+		; get character
   888C BD 82 E9           1539 	jsr	plcbuf		; send character
   888F 0A 34              1540 	dec	*number		; more ?
   8891 2E F7              1541 	bgt	5$		; yes - loop
   8893 20 DB              1542 	bra	1$
                           1543 
   8895 80 30              1544 6$:	suba	#'0		; make bcd
   8897 25 0A              1545 	bcs	7$		; if not - skip
   8899 81 09              1546 	cmpa	#0d9		; bcd ?
   889B 22 06              1547 	bhi	7$		; if not - skip
   889D 97 2C              1548 	sta	*format		; save new format
   889F 1A 01              1549 	sec			; character used
   88A1 20 02              1550 	bra	8$
   88A3 1C FE              1551 7$:	clc			; character not used
   88A5 7E 85 9D           1552 8$:	jmp	endgos		; don't come back
                           1553 
                           1554 
ASxxxx Assembler V02.10  (Motorola 6809), page 55.
PHS Constant definitions
$s command

                           1556 	.sbttl	$s command
                           1557 
   88A8 BD 85 90           1558 .$s:	jsr	nxtchr		; get character
                           1559 
   88AB BD 85 A3           1560 	jsr	$dispatch
   88AE 31                 1561 	.byte	'1
   88AF 88 B7              1562 	.word	1$
   88B1 39                 1563 	.byte	'9
   88B2 88 B7              1564 	.word	1$
   88B4 FF                 1565 	.byte	-1
   88B5 85 9D              1566 	.word	endgos
                           1567 
                           1568 
   88B7 4F                 1569 1$:	clra
   88B8 97 19              1570 	sta	*$schksm	; clear checksum
                           1571 
   88BA 86 02              1572 	lda	#2
   88BC 97 18              1573 	sta	*$scntr		; for rbc
   88BE BD 85 90           1574 2$:	jsr	nxtchr
   88C1 8D 69              1575 	bsr	$sghex		; convert hex to binary
   88C3 10 25 FC D6        1576 	lbcs	errgos		; note input error
   88C7 0A 18              1577 	dec	*$scntr
   88C9 2E F3              1578 	bgt	2$
   88CB D7 1C              1579 	stb	*$srbc		; save byte count
   88CD DB 19              1580 	addb	*$schksm	; update checksum
   88CF D7 19              1581 	stb	*$schksm
                           1582 
   88D1 86 04              1583 	lda	#4
   88D3 97 18              1584 	sta	*$scntr		; for address
   88D5 BD 85 90           1585 3$:	jsr	nxtchr
   88D8 8D 52              1586 	bsr	$sghex		; convert hex to binary
   88DA 10 25 FC BF        1587 	lbcs	errgos		; note input error
   88DE 0A 18              1588 	dec	*$scntr
   88E0 2E F3              1589 	bgt	3$
   88E2 DD 1D              1590 	std	*$sladdr	; save load address
   88E4 34 04 AB E0        1591 	aba
   88E8 9B 19              1592 	adda	*$schksm	; update checksum
   88EA 97 19              1593 	sta	*$schksm
   88EC 0A 1C              1594 	dec	*$srbc
   88EE 0A 1C              1595 	dec	*$srbc
                           1596 
   88F0 0A 1C              1597 4$:	dec	*$srbc		; more data ?
   88F2 2F 1D              1598 	ble	6$		; no skip to checksum
                           1599 
   88F4 86 02              1600 	lda	#2
   88F6 97 18              1601 	sta	*$scntr		; for data bytes
   88F8 BD 85 90           1602 5$:	jsr	nxtchr
   88FB 8D 2F              1603 	bsr	$sghex		; convert hex to binary
   88FD 10 25 FC 9C        1604 	lbcs	errgos		; note input error
   8901 0A 18              1605 	dec	*$scntr
   8903 2E F3              1606 	bgt	5$
                           1607 
   8905 9E 1D              1608 	ldx	*$sladdr	; load data
   8907 E7 80              1609 	stb	,x+
   8909 9F 1D              1610 	stx	*$sladdr	; save address
   890B DB 19              1611 	addb	*$schksm	; update checksum
ASxxxx Assembler V02.10  (Motorola 6809), page 56.
PHS Constant definitions
$s command

   890D D7 19              1612 	stb	*$schksm
   890F 20 DF              1613 	bra	4$
                           1614 
   8911 86 02              1615 6$:	lda	#2
   8913 97 18              1616 	sta	*$scntr		; for checksum byte
   8915 BD 85 90           1617 7$:	jsr	nxtchr
   8918 8D 12              1618 	bsr	$sghex		; convert hex to binary
   891A 10 25 FC 7F        1619 	lbcs	errgos		; note input error
   891E 0A 18              1620 	dec	*$scntr
   8920 2E F3              1621 	bgt	7$
                           1622 
   8922 DB 19              1623 	addb	*$schksm	; verify checksum
   8924 5C                 1624 	incb
   8925 10 27 FC 74        1625 	lbeq	endgos		; good data
   8929 16 FC 71           1626 	lbra	errgos		; note checksum error
                           1627 
ASxxxx Assembler V02.10  (Motorola 6809), page 57.
PHS Constant definitions
Input Hex to Binary Conversion

                           1629 	.sbttl	Input Hex to Binary Conversion
                           1630 
   892C 96 2F              1631 $sghex:	lda	*char		; get character
   892E 80 30              1632 	suba	#'0		; convert to binary
   8930 2B 1D              1633 	bmi	2$		; error - skip
   8932 81 09              1634 	cmpa	#'9-'0
   8934 23 06              1635 	blos	1$		; 0-9 skip
   8936 80 07              1636 	suba	#7
   8938 81 0F              1637 	cmpa	#0d15
   893A 22 13              1638 	bhi	2$		; error - skip
   893C 34 02              1639 1$:	pshs	a		; save value
   893E DC 1A              1640 	ldd	*$svalu		; update value
   8940 58                 1641 	aslb
   8941 49                 1642 	rola
   8942 58                 1643 	aslb
   8943 49                 1644 	rola
   8944 58                 1645 	aslb
   8945 49                 1646 	rola
   8946 58                 1647 	aslb
   8947 49                 1648 	rola
   8948 EA E0              1649 	orb	,s+		; or in new nibble
   894A DD 1A              1650 	std	*$svalu		; save result
   894C 1C FE              1651 	clc
   894E 39                 1652 	rts			; good return
   894F 1A 01              1653 2$:	sec
   8951 39                 1654 	rts			; error on input
                           1655 
                           1656 
ASxxxx Assembler V02.10  (Motorola 6809), page 58.
PHS Constant definitions
.$T -- Test routines

                           1658 	.sbttl	.$T -- Test routines
                           1659 
                           1660 	.area	BUFSAV
                           1661 
   3718                    1662 acqopt:		.blkb	1	; acquisition options
   3719                    1663 ledpnl:		.blkb	2	; LED sequencer data
   371B                    1664 slctchan:	.blkb	1	; selected channel
   371C                    1665 dacval:		.blkb	2	; DAC value
                           1666 
                           1667 	.area	PGMSAV
                           1668 
                           1669 	; Various test routines are here
                           1670 
   8952 7C 37 24           1671 .$t:	inc	upd$inh		; inhibit acquisition
   8955 BD 92 4D           1672 	jsr	abrt$upd	; abort firq entry
                           1673 
   8958 CC 00 00           1674 	ldd	#0
   895B FD 37 19           1675 	std	ledpnl		; zero number
                           1676 
   895E BD 85 8A           1677 	jsr	nxtspc		; get character
                           1678 				; special mode is used
                           1679 				; so that acquisition always
                           1680 				; gets re-enabled
                           1681 
   8961 BD 85 A3           1682 	jsr	$dispatch
   8964 41                 1683 	.byte	'A	; acquisition (no LED pulsing)
   8965 89 8F              1684 	.word	.$ta
   8967 42                 1685 	.byte	'B	; acquisition (with LED pulsing)
   8968 89 96              1686 	.word	.$tb
   896A 43                 1687 	.byte	'C	; ramping DAC and acquisition (no LED pulsing)
   896B 89 B0              1688 	.word	.$tc
   896D 44                 1689 	.byte	'D	; ramping DAC and acquisition (with LED pulsing)
   896E 89 B7              1690 	.word	.$td
   8970 45                 1691 	.byte	'E	; 16 level DAC and acquisition (with LED pulsing)
   8971 89 EA              1692 	.word	.$te
   8973 46                 1693 	.byte	'F	; Selected LED pulsing with acquisition
   8974 8A 13              1694 	.word	.$tf
   8976 47                 1695 	.byte	'G	; Selected LED pulsing / DAC amplitude and acquisition
   8977 8A 41              1696 	.word	.$tg
   8979 48                 1697 	.byte	'H	; Temperature sensor (no pulsing)
   897A 8A 73              1698 	.word	.$th
   897C 49                 1699 	.byte	'I	; Temperature sensor (with pulsing)
   897D 8A 7A              1700 	.word	.$ti
   897F FF                 1701 	.byte	-1	; exit with re-enable
   8980 89 82              1702 	.word	.$texit
                           1703 
   8982                    1704 .$texit:
   8982 CC 00 00           1705 	ldd	#0		; clear DAC
   8985 BD 8A C7           1706 	jsr	dacseq
   8988 7F 37 25           1707 	clr	upd$seq		; restart acquisition cleanly
   898B 7F 37 24           1708 	clr	upd$inh		; now enable acquisition
   898E 39                 1709 	rts
                           1710 
                           1711 
                           1712 	; infinite loop on acquisition sequencer
                           1713 	; (looping through all selector channels)
ASxxxx Assembler V02.10  (Motorola 6809), page 59.
PHS Constant definitions
.$T -- Test routines

                           1714 	; (no LED pulsing)
                           1715 
   898F 86 00              1716 .$ta:	lda	#0		; LED pulsing off
   8991 B7 37 18           1717 	sta	acqopt
   8994 20 05              1718 	bra	.$tab
                           1719 
                           1720 	; infinite loop on acquisition sequencer
                           1721 	; (looping through all selector channels)
                           1722 	; (with LED pulsing)
                           1723 
   8996 86 80              1724 .$tb:	lda	#0q200		; LED pulsing on
   8998 B7 37 18           1725 	sta	acqopt
                           1726 
   899B FC 37 19           1727 .$tab:	ldd	ledpnl		; use LED counter
   899E BD 8A 94           1728 	jsr	acqseq		; do a sequence
   89A1 BD 8A A9           1729 	jsr	ledseq
   89A4 BD 83 1A           1730 	jsr	tt_inp		; check for escape
   89A7 27 F2              1731 	beq	.$tab
   89A9 81 1B              1732 	cmpa	#0q33		; 'ESC'
   89AB 26 EE              1733 	bne	.$tab
   89AD 7E 89 82           1734 	jmp	.$texit
                           1735 
                           1736 
                           1737 	; infinite loop on acquisition sequencer
                           1738 	; (looping through all selector channels)
                           1739 	; (with ramping dac and no LED pulsing)
                           1740 
   89B0 86 00              1741 .$tc:	lda	#0		; LED pulsing off
   89B2 B7 37 18           1742 	sta	acqopt
   89B5 20 05              1743 	bra	.$tcd
                           1744 
                           1745 	; infinite loop on acquisition sequencer
                           1746 	; (looping through all selector channels)
                           1747 	; (with ramping dac and  LED pulsing)
                           1748 
   89B7 86 80              1749 .$td:	lda	#0q200		; LED pulsing on
   89B9 B7 37 18           1750 	sta	acqopt
                           1751 
   89BC                    1752 .$tcd:
   89BC CC F0 00           1753 	ldd	#-0d4096
   89BF FD 7F 02           1754 2$:	std	acq$dac		; sequence DAC
   89C2 BD 8A 94           1755 	jsr	acqseq		; do sequence
   89C5 BD 8A A9           1756 	jsr	ledseq
   89C8 C3 00 01           1757 	addd	#1
   89CB 2B F2              1758 	bmi	2$
                           1759 
   89CD CC 0F FF           1760 	ldd	#0d4095
   89D0 FD 7F 02           1761 3$:	std	acq$dac		; sequence DAC
   89D3 BD 8A 94           1762 	jsr	acqseq		; do sequence
   89D6 BD 8A A9           1763 	jsr	ledseq
   89D9 83 00 01           1764 	subd	#1
   89DC 2A F2              1765 	bpl	3$
                           1766 
   89DE BD 83 1A           1767 	jsr	tt_inp		; check for escape
   89E1 27 D9              1768 	beq	.$tcd
   89E3 81 1B              1769 	cmpa	#0q33		; 'ESC'
ASxxxx Assembler V02.10  (Motorola 6809), page 60.
PHS Constant definitions
.$T -- Test routines

   89E5 26 D5              1770 	bne	.$tcd
   89E7 7E 89 82           1771 	jmp	.$texit
                           1772 
                           1773 
                           1774 	; infinite loop on acquisition sequencer
                           1775 	; (looping through all selector channels)
                           1776 	; (with 16 level dac and LED pulsing)
                           1777 
   89EA 86 80              1778 .$te:	lda	#0q200		; LED pulsing on
   89EC B7 37 18           1779 	sta	acqopt
                           1780 
   89EF FC 37 19           1781 1$:	ldd	ledpnl		; use LED counter
   89F2 4F                 1782 	clra
   89F3 57                 1783 	asrb
   89F4 57                 1784 	asrb
   89F5 57                 1785 	asrb
   89F6 57                 1786 	asrb
   89F7 C4 0F              1787 	andb	#0x0F
   89F9 1E 89              1788 	exg	a,b
   89FB BD 8A C7           1789 	jsr	dacseq
   89FE FC 37 19           1790 	ldd	ledpnl
   8A01 BD 8A 94           1791 	jsr	acqseq		; do sequence
   8A04 BD 8A A9           1792 	jsr	ledseq
                           1793 
   8A07 BD 83 1A           1794 	jsr	tt_inp		; check for escape
   8A0A 27 E3              1795 	beq	1$
   8A0C 81 1B              1796 	cmpa	#0q33		; 'ESC'
   8A0E 26 DF              1797 	bne	1$
   8A10 7E 89 82           1798 	jmp	.$texit
                           1799 
                           1800 
                           1801 	; infinite loop on acquisition sequencer
                           1802 	; (using specified selector channel)
                           1803 	; (with 0, 10, 30, and 90 ma. LED pulsing)
                           1804 
   8A13 1A 01              1805 .$tf:	sec			; character used
   8A15 BD 85 98           1806 	jsr	nxtgos		; wait for selector channel
                           1807 
   8A18 86 80              1808 	lda	#0q200		; pulsing on
   8A1A B7 37 18           1809 	sta	acqopt
                           1810 
   8A1D FC 37 19           1811 1$:	ldd	ledpnl		; use LED panel counter
   8A20 57                 1812 	asrb
   8A21 57                 1813 	asrb
   8A22 57                 1814 	asrb
   8A23 C4 0E              1815 	andb	#0x0E
   8A25 8E 8A DC           1816 	ldx	#pulse
   8A28 EC 85              1817 	ldd	b,x
   8A2A BD 8A C7           1818 	jsr	dacseq
                           1819 
   8A2D D6 35              1820 	ldb	*number+1	; select LED channel
   8A2F BD 8A 94           1821 	jsr	acqseq		; do a sequence
   8A32 BD 8A A9           1822 	jsr	ledseq
                           1823 
   8A35 BD 83 1A           1824 	jsr	tt_inp		; check for escape
   8A38 27 E3              1825 	beq	1$
ASxxxx Assembler V02.10  (Motorola 6809), page 61.
PHS Constant definitions
.$T -- Test routines

   8A3A 81 1B              1826 	cmpa	#0q33		; 'ESC'
   8A3C 26 DF              1827 	bne	1$
   8A3E 7E 89 82           1828 	jmp	.$texit
                           1829 
                           1830 
                           1831 	; infinite loop on acquisition sequencer
                           1832 	; (using specified selector channel)
                           1833 	; (using specified DAC value)
                           1834 
   8A41 1A 01              1835 .$tg:	sec			; character used
   8A43 BD 85 98           1836 	jsr	nxtgos		; wait for selector channel
   8A46 D6 35              1837 	ldb	*number+1	; save select channel
   8A48 F7 37 1B           1838 	stb	slctchan
   8A4B BD 85 98           1839 	jsr	nxtgos		; wait for selector channel
   8A4E DC 34              1840 	ldd	*number		; save DAC Value
   8A50 FD 37 1C           1841 	std	dacval
                           1842 
   8A53 86 80              1843 	lda	#0q200		; pulsing on
   8A55 B7 37 18           1844 	sta	acqopt
                           1845 
   8A58 FC 37 1C           1846 1$:	ldd	dacval		; load DAC value
   8A5B BD 8A C7           1847 	jsr	dacseq
                           1848 
   8A5E F6 37 1B           1849 	ldb	slctchan	; select LED channel
   8A61 BD 8A 94           1850 	jsr	acqseq		; do a sequence
   8A64 BD 8A A9           1851 	jsr	ledseq
                           1852 
   8A67 BD 83 1A           1853 	jsr	tt_inp		; check for escape
   8A6A 27 EC              1854 	beq	1$
   8A6C 81 1B              1855 	cmpa	#0q33		; 'ESC'
   8A6E 26 E8              1856 	bne	1$
   8A70 7E 89 82           1857 	jmp	.$texit
                           1858 
                           1859 
                           1860 	; infinite loop on temperature sensor
                           1861 	; (no pulsing)
                           1862 
   8A73 86 20              1863 .$th:	lda	#0q40
   8A75 B7 37 18           1864 	sta	acqopt
   8A78 20 05              1865 	bra	.$thi
                           1866 
                           1867 	; infinite loop on temperature sensor
                           1868 	; (with pulsing)
                           1869 
   8A7A 86 30              1870 .$ti:	lda	#0q060
   8A7C B7 37 18           1871 	sta	acqopt
                           1872 
   8A7F CC 00 00           1873 .$thi:	ldd	#0
   8A82 BD 8A 94           1874 	jsr	acqseq		; do a sequence
   8A85 BD 8A A9           1875 	jsr	ledseq
                           1876 
   8A88 BD 83 1A           1877 	jsr	tt_inp		; check for escape
   8A8B 27 F2              1878 	beq	.$thi
   8A8D 81 1B              1879 	cmpa	#0q33		; 'ESC'
   8A8F 26 EE              1880 	bne	.$thi
   8A91 7E 89 82           1881 	jmp	.$texit
ASxxxx Assembler V02.10  (Motorola 6809), page 62.
PHS Constant definitions
.$T -- Test routines

                           1882 
                           1883 
   8A94 34 16              1884 acqseq:	pshs	d,x		; save
                           1885 
   8A96 C4 1F              1886 	andb	#0q037		; mask for select
   8A98 FA 37 18           1887 	orb	acqopt		; enable options
   8A9B F7 7F 04           1888 	stb	acq$slct	; start sequence
                           1889 
   8A9E 86 18              1890 	lda	#0d24
   8AA0 4A                 1891 1$:	deca
   8AA1 26 FD              1892 	bne	1$
                           1893 
   8AA3 FC 7F 06           1894 	ldd	acq$adc		; read adc to clear 'firq'
                           1895 
   8AA6 35 16              1896 	puls	d,x		; restore
   8AA8 39                 1897 	rts
                           1898 
   8AA9 34 16              1899 ledseq:	pshs	d,x		; save
                           1900 
   8AAB FC 37 19           1901 	ldd	ledpnl		; play with the panel LEDs
   8AAE C3 00 01           1902 	addd	#1
   8AB1 FD 37 19           1903 	std	ledpnl
   8AB4 1F 89              1904 	tfr	a,b
                           1905 
   8AB6 8E 7F 20           1906 	ldx	#sys$led
   8AB9 84 1F              1907 	anda	#0x1F
                           1908 
   8ABB 57                 1909 	asrb
   8ABC 57                 1910 	asrb
   8ABD 57                 1911 	asrb
   8ABE 57                 1912 	asrb
   8ABF 57                 1913 	asrb
   8AC0 C4 03              1914 	andb	#0x03
   8AC2 E7 86              1915 	stb	a,x
                           1916 
   8AC4 35 16              1917 	puls	d,x		; restore
   8AC6 39                 1918 	rts
                           1919 
   8AC7 10 B3 7F 02        1920 dacseq:	cmpd	acq$dac
   8ACB 27 0E              1921 	beq	2$
   8ACD FD 7F 02           1922 	std	acq$dac
                           1923 
   8AD0 34 10              1924 	pshs	x
   8AD2 8E 00 FA           1925 	ldx	#0d250		; set up for 1 ms. wait
   8AD5 30 1F              1926 1$:	leax	-1,x
   8AD7 26 FC              1927 	bne	1$
   8AD9 35 10              1928 	puls	x
                           1929 
   8ADB 39                 1930 2$:	rts
                           1931 
                           1932 
                           1933 	; The DAC is 12-bit (0 - 4095)
                           1934 
   8ADC 00 00              1935 pulse:	.word	0d0		; LED drive = 0 ma.
   8ADE 01 90              1936 	.word	0d400		; LED drive = 10 ma.
   8AE0 04 B0              1937 	.word	0d1200		; LED drive = 30 ma.
ASxxxx Assembler V02.10  (Motorola 6809), page 63.
PHS Constant definitions
.$T -- Test routines

   8AE2 0E 10              1938 	.word	0d3600		; LED drive = 90 ma.
   8AE4 0E 10              1939 	.word	0d3600		; LED drive = 90 ma.
   8AE6 04 B0              1940 	.word	0d1200		; LED drive = 30 ma.
   8AE8 01 90              1941 	.word	0d400		; LED drive = 10 ma.
   8AEA 00 00              1942 	.word	0d0		; LED drive = 0 ma.
                           1943 
                           1944 
ASxxxx Assembler V02.10  (Motorola 6809), page 64.
PHS Constant definitions
$u command

                           1946 	.sbttl	$u command
                           1947 
   8AEC BD 85 90           1948 .$u:	jsr	nxtchr		; wait for next character
                           1949 
   8AEF 81 61              1950 	cmpa	#141		; convert lower case to upper case
   8AF1 25 06              1951 	bcs	1$
   8AF3 81 7B              1952 	cmpa	#173
   8AF5 24 02              1953 	bcc	1$
   8AF7 80 20              1954 	suba	#40
   8AF9 80 30              1955 1$:	suba	#'0		; require 0-9 or A-F
   8AFB 2B 27              1956 	bmi	3$
   8AFD 81 09              1957 	cmpa	#'9-'0
   8AFF 23 0A              1958 	blos	2$
   8B01 81 11              1959 	cmpa	#'A-'0
   8B03 25 1F              1960 	blo	3$
   8B05 80 07              1961 	suba	#'A-'0-0d10
   8B07 81 0F              1962 	cmpa	#0x0F
   8B09 22 19              1963 	bhi	3$
   8B0B F6 7F 00           1964 2$:	ldb	sys$id		; compare with system id
   8B0E C4 0F              1965 	andb	#0x0F
   8B10 34 04 A1 E0        1966 	cba
   8B14 26 0E              1967 	bne	3$
   8B16 96 32              1968 	lda	*rstat0
   8B18 8A 80              1969 	ora	#0q200
   8B1A 97 32              1970 	sta	*rstat0		; unit enabled
   8B1C 86 80              1971 	lda	#0q200
   8B1E 97 41              1972 	sta	*scrn$sts	; screen enabled
   8B20 0F 47              1973 	clr	*s$state	; redraw screen
   8B22 20 0A              1974 	bra	4$
   8B24 96 32              1975 3$:	lda	*rstat0
   8B26 84 7F              1976 	anda	#~0q200		; unit disabled
   8B28 97 32              1977 	sta	*rstat0
   8B2A 86 00              1978 	lda	#0q000		; screen disabled
   8B2C 97 41              1979 	sta	*scrn$sts
   8B2E 1A 01              1980 4$:	sec			; character used
   8B30 7E 85 9D           1981 	jmp	endgos		; don't come back
                           1982 
                           1983 
ASxxxx Assembler V02.10  (Motorola 6809), page 65.
PHS Constant definitions
$v command

                           1985 	.sbttl	$v command
                           1986 
   8B33 96 41              1987 .$v:	lda	*scrn$sts	; reverse screen flag
   8B35 88 80              1988 	eora	#0q200
   8B37 97 41              1989 	sta	*scrn$sts
   8B39 7E 85 9D           1990 	jmp	endgos
                           1991 
                           1992 
                           1993 	.sbttl	$z command
                           1994 
   8B3C                    1995 .$z:
   8B3C 10 8E 8B 5E        1996 	ldy	#5$
                           1997 
   8B40 AE A1              1998 1$:	ldx	,y++
   8B42 27 19              1999 	beq	4$
                           2000 
   8B44 A6 80              2001 2$:	lda	,x+
   8B46 27 05              2002 	beq	3$
   8B48 BD 82 E9           2003 	jsr	plcbuf		; send character
   8B4B 20 F7              2004 	bra	2$
   8B4D 86 0D              2005 3$:	lda	#0q015
   8B4F BD 82 E9           2006 	jsr	plcbuf
   8B52 86 0A              2007 	lda	#0q012
   8B54 BD 82 E9           2008 	jsr	plcbuf
   8B57 6D 84              2009 	tst	,x		; end of text ?
   8B59 2A E9              2010 	bpl	2$
   8B5B 20 E3              2011 	bra	1$
                           2012 
   8B5D 39                 2013 4$:	rts
                           2014 
   8B5E 8B 68              2015 5$:	.word	6$
   8B60 CE 66 D1 79 D3 CD  2016 	.word	phs$int1,	phs$int2,	phs$int3,	0
        00 00
                           2017 
   8B68 00                 2018 6$:	.asciz	""
   8B69 50 2E 48 2E 53 2E  2019 	.asciz	"P.H.S. Internal Routines"
        20 49 6E 74 65 72
        6E 61 6C 20 52 6F
        75 74 69 6E 65 73
        00
   8B82 80                 2020 	.byte	0q200
                           2021 
