ASxxxx Assembler V02.21  (Motorola 6809), page 1.
MONDEB - 09


                              1 	.title	MONDEB - 09
                              2 
                              3 	;	*********************************************************
                              4 	;	*							*
                              5 	;	*	MONDEB - 09  -  a monitor/debugger		*
                              6 	;	*		for the 6809  microprocessor		*
                              7 	;	*							*
                              8 	;	*********************************************************
                              9 	;
                             10 	; author:	Don Peters	(6800 version)
                             11 	; date:		April 1977
                             12 	;
                             13 	; modified for the 6809
                             14 	; by:		Alan R. Baldwin
                             15 	; date:		Nov 1988	
                             16 	;
                             17 	; modified for PHS: May 1992
                             18 	;
                             19 	;	  This 6809 monitor/debugger does not use the
                             20 	;	direct page addressing mode.  Thus the user
                             21 	;	program has complete control of the page
                             22 	;	assignment and may use the monitor routines
                             23 	;	without concern for variable locations.
                             24 	;
                             25 	;	  To add user functions to MONDEB - 09
                             26 	;
                             27 	;	1) add your commands to the end of command list #1
                             28 	;	2) add the command entry points to the jump table
                             29 	;	3) append any local command lists after MONDEB's
                             30 	;	4) provide an external initialization routine to
                             31 	;		set up the console (and/or alternate)
                             32 	;		ports and any other start up processing.
                             33 	;	   MONDEB will call 'userinit' if inituser = 1.
                             34 	;
                             35 
                             36 	.module	phsmon
                             37 
                             38 
ASxxxx Assembler V02.21  (Motorola 6809), page 2.
MONDEB - 09
MONDEB - 09 working variables

                             40 	.sbttl	MONDEB - 09 working variables
                             41 
                             42 	.radix	d
                             43 
                             44 	.area	WORKPG	(REL,CON)
                             45 
   0F00                      46 workpg:	.blkb	256-(endpg-mstack)
                             47 			; main stack storage
   0F55                      48 mstack:	.blkb	12	; stack storage for rti instruction
                             49 
   0F61                      50 ttybuf:	.blkb	72	; start of input line buffer
   0FA9                      51 ttyend:	.blkb	1	; end of input line buffer
   0FAA                      52 bufbeg:	.blkb	2	; input line start of buffer
   0FAC                      53 bufend:	.blkb	2	; input line end of buffer
                             54 
   0FAE                      55 comadr:	.blkb	2	; address of beginning of command lists
   0FB0                      56 synptr:	.blkb	2	; input line character pointer for good syntax
   0FB2                      57 linptr:	.blkb	2	; input line character pointer (content =>
                             58 			; content of synptr)
   0FB4                      59 bolflg:	.blkb	1	; "beginning of line flg"
   0FB5                      60 delim:	.blkb	1	; characters permitted as valid command/modifier
                             61 			; delimiter
   0FB6                      62 ibcode:	.blkb	1	; input base (1=hex, 2=dec, 3=oct)
   0FB7                      63 dbcode:	.blkb	1	; display base (1=hex, 2=dec, 3=oct, 4=bin)
   0FB8                      64 dbnbr:	.blkb	1	; display base number (e.g., 16,10,8, or 2)
   0FB9                      65 nbrhi:	.blkb	1	; most significant byte of scanned number
   0FBA                      66 nbrlo:	.blkb	1	; least significant byte of scanned number
   0FBB                      67 ranglo:	.blkb	2	; range lower limit picked up by gtrang
   0FBD                      68 ranghi:	.blkb	2	; range upper limit picked up by gtrang
   0FBF                      69 verfrm:	.blkb	2	; beginning address of range to verify
   0FC1                      70 verto:	.blkb	2	; ending address of range to checksum verify
   0FC3                      71 chksum:	.blkb	1	; checksum of range given in the verify command
   0FC4                      72 brkadr: .blkb	2	; address of inserted breakpoint
   0FC6                      73 brkins:	.blkb	1	; instruction which should be there normally
   0FC7                      74 inpflg:	.blkb	1	; alternate input flag
   0FC8                      75 outflg:	.blkb	1	; alternate output flag
   0FC9                      76 outadr:	.blkb	2	; alternate address that the output chars go to
   0FCB                      77 hdxflg:	.blkb	1	; half-duplex terminal flag (if non-zero, no echo)
   0FCC                      78 cplcnt:	.blkb	1	; "characters per line" count
   0FCD                      79 cplmax:	.blkb	1	; "characters per line" maximum
                             80 
                             81 	; temporary (locally used) variables
                             82 
   0FCE                      83 temp1:	.blkb	2	; in: main
   0FD0                      84 temp2:	.blkb	2	; in: main
   0FD2                      85 temp3:	.blkb	2	; in: main
   0FD4                      86 temp4:	.blkb	2	; in: main
   0FD6                      87 temp5:	.blkb	2	; in: main
   0FD8                      88 temp6:	.blkb	2	; in: main
                             89 
   0FDA                      90 nummat:	.blkb	1	; used in command
   0FDB                      91 lisnum:	.blkb	1	; used in command
   0FDC                      92 comnum:	.blkb	1	; used in command
   0FDD                      93 lisptr:	.blkb	2	; used in command
   0FDF                      94 decdig:	.blkb	1	; decimal digit being built
   0FE0                      95 numbhi:	.blkb	1	; used by outnum
ASxxxx Assembler V02.21  (Motorola 6809), page 3.
MONDEB - 09
MONDEB - 09 working variables

   0FE1                      96 numblo:	.blkb	1	; used by outnum
   0FE2                      97 nbr2x:	.blkb	2	; used by number
   0FE4                      98 timcon:	.blkb	2	; delay time constant
   0FE6                      99 bytect:	.blkb	1	; record byte count used in load command
   0FE7                     100 cksm:	.blkb	1	; record checksum used in load command
                            101 
   0FE8                     102 conin:	.blkb	2	; address of console input routine
   0FEA                     103 conout:	.blkb	2	; address of console output routine
   0FEC                     104 altin:	.blkb	2	; address of alternate input routine
   0FEE                     105 altout:	.blkb	2	; address of alternate output routine
                            106 
   0FF0                     107 .rsrvd:	.blkb	2	; reserved vector
   0FF2                     108 .swi3:	.blkb	2	; swi3 vector
   0FF4                     109 .swi2:	.blkb	2	; swi2 vector
   0FF6                     110 .firq:	.blkb	2	; firq vector
   0FF8                     111 .irq:	.blkb	2	; irq vector
   0FFA                     112 .swi:	.blkb	2	; swi vector
   0FFC                     113 .nmi:	.blkb	2	; nmi vector
   0FFE                     114 spsave:	.blkb	2	; saved stack pointer
   1000                     115 endpg:
                            116 
                            117 	; convenient equivalences for local variables
                            118 
                    00CE    119 memadr	=	temp1	; display, set, search, test
                    00D0    120 strnum	=	temp2	; fndstr
                    00D1    121 eoschr	=	temp2+1	; fndstr
                            122 
                            123 	; for "search" command
                            124 
                    00D0    125 bytptr	=	temp2
                    00D2    126 nbytes	=	temp3
                    00D3    127 nbrmat	=	temp3+1
                    00D4    128 bytstr	=	temp4
                            129 
                            130 	; other constants
                            131 
                    000D    132 cr	=	13	; carriage return
                    000A    133 lf	=	10	; line feed
                            134 
                            135 
ASxxxx Assembler V02.21  (Motorola 6809), page 4.
MONDEB - 09
MOND09 Startup

                            137 	.sbttl	MOND09 Startup
                            138 
                            139 	.area	MONDEB	(REL,CON)
                            140 
   E4C3 34 7F               141 mond09:	pshs	u,y,x,dp,b,a,cc	; pseudo swi
   E4C5 10 FF 0F FE         142 	sts	spsave		; save the pointer
   E4C9 10 CE 0F 55         143 	lds	#mstack		; initialize the stack pointer
   E4CD BD EF 31            144 	jsr	inital		; initialize variables
   E4D0 BD EF C4            145 	jsr	docrlf		; advance to a clean line
   E4D3 8E EF E0            146 	ldx	#msghed		; get address of header
   E4D6 BD EF 65            147 	jsr	outstr		; type it
   E4D9 8E 0F 60            148 	ldx	#ttybuf-1	; get address of terminal input buffer
   E4DC BF 0F AA            149 	stx	bufbeg		; save it
   E4DF 8E 0F A9            150 	ldx	#ttyend		; define end of input buffer
   E4E2 BF 0F AC            151 	stx	bufend		; 72 char capacity, incl cr
   E4E5 86 03               152 	lda	#3		; delimiter class definition
   E4E7 B7 0F B5            153 	sta 	delim		; space or comma (code 3)
   E4EA 20 0F               154 	bra	promp1
                            155 
                            156 	; prepare to get a new command
                            157 
   E4EC BD EF C4            158 prompt:	jsr	docrlf	; type cr-lf
   E4EF 7C 0F B4            159 	inc	bolflg	; set 'beginning of line' flag
   E4F2 BE 0F B0            160 	ldx 	synptr	; point to current character
   E4F5 A6 84               161 	lda	,x	; get it
   E4F7 81 3B               162 	cmpa	#';	; semicolon?
   E4F9 27 1A               163 	beq	getcmd	; continue scan if it is, 
                            164 			; skipping the prompt
   E4FB 8E EF F0            165 promp1:	ldx	#msgprm	; type prompt
   E4FE BD EF 65            166 	jsr	outstr
   E501 BD EE C5            167 	jsr	getlin	; get line of input
   E504 C1 03               168 	cmpb	#3	; abort line on a control-c
   E506 27 E4               169 	beq	prompt
                            170 
   E508 BE 0F AA            171 	ldx	bufbeg	; set syntax scanning pointer
   E50B BF 0F B0            172 	stx	synptr	; to beginning of buffer/line
   E50E A6 01               173 	lda	1,x	; get first char
   E510 BD EB B5            174 	jsr	tsteol	; reprompt on an empty line
   E513 27 D7               175 	beq	prompt	; (first char = cr,lf,or ;)
                            176 
ASxxxx Assembler V02.21  (Motorola 6809), page 5.
MONDEB - 09
Get Command

                            178 	.sbttl	Get Command
                            179 
   E515 86 01               180 getcmd:	lda	#1	; use list 1 when matching
   E517 BD EA F1            181 	jsr	comand	; now go for a match
   E51A 27 D0               182 	beq	prompt	; reprompt if just a cr was typed
   E51C 2E 20               183 	bgt	jmpcmd	; good command if positive	
                            184 
   E51E BE 0F AA            185 badsyn: ldx	bufbeg	; get start of line
                            186 
   E521 BC 0F B2            187 1$:	cpx	linptr	; space over to the error in syntax
   E524 27 07               188 	beq	2$	; at error ?
   E526 BD ED 05            189 	jsr 	outsp	; output a space
   E529 30 01               190 	inx		; no, move on
   E52B 20 F4               191 	bra	1$
                            192 
                            193 	; the 'extra' char '1' is compensated for by the prompt
                            194 	; char on the preceeding line
                            195 
   E52D 86 5E               196 2$:	lda	#'^	; at error - get an up-arrow
   E52F BD EF 88            197 	jsr	outchr	; print it
   E532 BD EF C4            198 	jsr	docrlf
   E535 20 C4               199 	bra	promp1	; ignore any succeeding packed
                            200 			; commands
                            201 
                            202 	; *******
                            203 	; *there should be no more characters on the input line
                            204 	;	(except delimiters)
                            205 
   E537 BD EB 93            206 nomore:	jsr	skpdlm
   E53A 25 B0               207 	bcs	prompt	; if carry bit set, end of line
                            208 			; (normal)
   E53C 20 E0               209 	bra	badsyn	; there is something there but shouldn't be
                            210 
ASxxxx Assembler V02.21  (Motorola 6809), page 6.
MONDEB - 09
Command Dispatcher

                            212 	.sbttl	Command Dispatcher
                            213 
                            214 	; ******
                            215 	; execute a computed 'goto' to the proper command
                            216 
   E53E 48                  217 jmpcmd:	asla		; multiply command by 2
   E53F 8E E5 42            218 	ldx	#1$-2
   E542 6E 96               219 	jmp	[a,x]	; jump to designated command
                            220 
   E544 E6 2E               221 1$:	.word	break
   E546 E5 F2               222 	.word	contin
   E548 E9 6D               223 	.word	compar
   E54A E6 0B               224 	.word	copy
   E54C E6 DD               225 	.word	displa
   E54E E6 A5               226 	.word	dbase
   E550 EA A0               227 	.word	delay
   E552 E9 96               228 	.word	dump
   E554 E5 E4               229 	.word	goto
   E556 EA B8               230 	.word	help
   E558 E6 8D               231 	.word	ibase
   E55A EA 1B               232 	.word	load
   E55C E5 7C               233 	.word	reg
   E55E E7 48               234 	.word	set
   E560 E8 43               235 	.word	search
   E562 E8 D6               236 	.word	test
   E564 E7 F8               237 	.word	verify
   E566 E5 FC               238 	.word	cli
   E568 E6 06               239 	.word	clf
   E56A E5 F7               240 	.word	sei
   E56C E6 01               241 	.word	sef
   E56E E9 52               242 	.word	xirq
   E570 E9 49               243 	.word	xfirq
   E572 E9 64               244 	.word	xnmi
   E574 E9 2E               245 	.word	xrsrvd
   E576 E9 5B               246 	.word	xswi
   E578 E9 40               247 	.word	xswi2
   E57A E9 37               248 	.word	xswi3
                            249 
ASxxxx Assembler V02.21  (Motorola 6809), page 7.
MONDEB - 09
REG - display registers

                            251 	.sbttl	REG - display registers
                            252 
   E57C                     253 reg:			; print stack stored swi data
   E57C BE 0F FE            254 disreg:	ldx	spsave	; get saved stack pointer
   E57F 7F 0F DC            255 	clr	comnum	; start at beginning of the
                            256 			; register name list
   E582 8D 25               257 	bsr	1$	; type condition codes
   E584 8D 23               258 	bsr	1$	; type acca
   E586 8D 21               259 	bsr	1$	; type accb
   E588 8D 1F               260 	bsr	1$	; type dp
   E58A BD EF C4            261 	jsr	docrlf	; advance to a clean line
   E58D 8D 22               262 	bsr	2$	; type index reg x
   E58F 8D 20               263 	bsr	2$	; type index reg y
   E591 8D 1E               264 	bsr	2$	; type index reg u
   E593 BD EF C4            265 	jsr	docrlf	; advance to a clean line
   E596 30 17               266 	leax	-9,x	; back to d
   E598 8D 17               267 	bsr	2$	; type d
   E59A 30 07               268 	leax	7,x	; back to pc
   E59C 8D 13               269 	bsr	2$	; type program counter
                            270 
                            271 	; type the stack pointer location
                            272 
   E59E 8D 19               273 	bsr	3$	; type stack pointer id
   E5A0 8E 0F FE            274 	ldx	#spsave
   E5A3 BD ED 19            275 	jsr	out2by	; type the value
   E5A6 7E E5 37            276 	jmp	nomore
                            277 
                            278 	; output content of a 1 byte register
                            279 
   E5A9 8D 0E               280 1$:	bsr	3$
   E5AB BD ED 11            281 	jsr	out1by
   E5AE 30 01               282 	inx
   E5B0 39                  283 	rts
                            284 
                            285 	; output content of a 2 byte register
                            286 
   E5B1 8D 06               287 2$:	bsr	3$
   E5B3 BD ED 19            288 	jsr	out2by
   E5B6 30 02               289 	leax	2,x	; skip to next word in stack
   E5B8 39                  290 	rts
                            291 
                            292 	; misc setup for register display
                            293 
   E5B9 BD ED 05            294 3$:	jsr	outsp	; output a space
   E5BC 7C 0F DC            295 	inc	comnum	; skip to next register name
   E5BF 86 05               296 	lda	#5	; register name is in list 5
   E5C1 BD EB 5B            297 	jsr	typcmd	; type it
   E5C4 BD ED 0B            298 	jsr	outeq	; type an '='
   E5C7 39                  299 	rts
                            300 
ASxxxx Assembler V02.21  (Motorola 6809), page 8.
MONDEB - 09
Software Interrupt Entry Point

                            302 	.sbttl	Software Interrupt Entry Point
                            303 
   E5C8 10 FF 0F FE         304 typswi:	sts	spsave
   E5CC 8E EF F2            305 	ldx	#msgswi
   E5CF BD EF 65            306 	jsr	outstr
                            307 
                            308 	; decrement pc so it points to 'swi' instruction
                            309 
   E5D2 BE 0F FE            310 	ldx	spsave
   E5D5 EC 0A               311 	ldd	10,x
   E5D7 83 00 01            312 	subd	#1
   E5DA 10 B3 0F C4         313 	cmpd	brkadr	; a break point ?
   E5DE 26 9C               314 	bne	disreg	; no - allow to pass
   E5E0 ED 0A               315 	std	10,x	; backup PC
   E5E2 20 98               316 	bra	disreg	; go display registers
                            317 
                            318 	.sbttl	GOTO - Go To Memory Address
                            319 
   E5E4 BD EC 6B            320 goto:	jsr	mnumber	; get destination
   E5E7 27 09               321 	beq	contin	; if none, just continue
   E5E9 FC 0F B9            322 	ldd	nbrhi
   E5EC 10 FE 0F FE         323 	lds	spsave	; place new PC
   E5F0 ED 6A               324 	std	10,s	; fall through to Continue
                            325 
                            326 	.sbttl	Continue - Continue From a 'SWI'
                            327 
   E5F2 10 FE 0F FE         328 contin:	lds	spsave	; in case sp was modified via set
   E5F6 3B                  329 	rti		; command
                            330 
                            331 	.sbttl	SEI - Set Interrupt Mask
                            332 
   E5F7 1A 10               333 sei:	orcc	#0b00010000
   E5F9 7E E5 37            334 	jmp	nomore
                            335 
                            336 	.sbttl	CLI - Clear Interrupt Mask
                            337 
   E5FC 1C EF               338 cli:	andcc	#~0b00010000
   E5FE 7E E5 37            339 	jmp	nomore
                            340 
                            341 	.sbttl	SEF - Set Fast Interrupt Mask
                            342 
   E601 1A 40               343 sef:	orcc	#0b01000000
   E603 7E E5 37            344 	jmp	nomore
                            345 
                            346 	.sbttl	CLF - Clear Fast Interrupt Mask
                            347 
   E606 1C BF               348 clf:	andcc	#~0b01000000
   E608 7E E5 37            349 	jmp	nomore
                            350 
ASxxxx Assembler V02.21  (Motorola 6809), page 9.
MONDEB - 09
COPY - Copy From One Location To Another

                            352 	.sbttl	COPY - Copy From One Location To Another
                            353 
   E60B BD EC 20            354 copy:	jsr	gtrang	; get source range into ranglo &
                            355 			; ranghi
   E60E 10 2F FF 0C         356 	lble	badsyn	; error if no source
   E612 BD EC 6B            357 	jsr	mnumber	; get destination
   E615 10 2F FF 05         358 	lble	badsyn	; error if no destination
   E619 BE 0F BB            359 	ldx	ranglo	; get source address pointer
   E61C FE 0F B9            360 	ldu	nbrhi	; get destination address pointer
   E61F A6 84               361 	lda	,x	; get byte from source
   E621 A7 C0               362 1$:	sta	,u+	; save byte in destination
   E623 BC 0F BD            363 	cpx	ranghi	; compare to end of input range
   E626 10 27 FF 0D         364 	lbeq	nomore	; done if equal
   E62A A6 80               365 	lda	,x+	; get byte from source
   E62C 20 F3               366 	bra	1$	; loop for next byte
                            367 
ASxxxx Assembler V02.21  (Motorola 6809), page 10.
MONDEB - 09
BREAK - Set Breakpoint at Specified Address

                            369 	.sbttl	BREAK - Set Breakpoint at Specified Address
                            370 
   E62E BD EC 6B            371 break:	jsr	mnumber	; get breakpoint location
   E631 2B 31               372 	bmi	3$	; if not numeric, look for '?'
   E633 27 1F               373 	beq	2$	; if no modifier, remove old breakpoint
   E635 BE 0F C4            374 	ldx	brkadr	; get current break address
   E638 A6 84               375 	lda	,x	; and the char there
   E63A 81 3F               376 	cmpa	#0x3f	; compare to 'swi'
   E63C 26 05               377 	bne	1$	; equal?
   E63E B6 0F C6            378 	lda	brkins	; yes, restore the old instruction
   E641 A7 84               379 	sta	,x	; restore it
                            380 
   E643 BE 0F B9            381 1$:	ldx	nbrhi	; get new breakpoint
   E646 BF 0F C4            382 	stx	brkadr	; save it
   E649 A6 84               383 	lda	,x	; get instruction stored there
   E64B B7 0F C6            384 	sta	brkins	; save it
   E64E 86 3F               385 	lda	#0x3f	; get code for software interrupt
   E650 A7 84               386 	sta	,x	; put it at breakpoint
   E652 20 36               387 	bra	5$	; all done
                            388 
   E654 BE 0F C4            389 2$:	ldx	brkadr	; get address of break
   E657 A6 84               390 	lda	,x	; get inst. there
   E659 81 3F               391 	cmpa	#0x3f	; swi?
   E65B 26 2D               392 	bne	5$	; if not, return & prompt
   E65D B6 0F C6            393 	lda	brkins	; was a swi - get previous inst.
   E660 A7 84               394 	sta	,x	; & restore it
   E662 20 26               395 	bra	5$
                            396 
   E664 86 04               397 3$:	lda 	#4
   E666 BD EA F1            398 	jsr	comand	; scan for it
   E669 10 2F FE B1         399 	lble	badsyn	; bad syntax if not '?'
   E66D BE 0F C4            400 	ldx	brkadr	; it is, get break address
   E670 A6 84               401 	lda	,x	; get instruction there
   E672 81 3F               402 	cmpa	#0x3f	; is it a 'swi'?
   E674 27 08               403 	beq	4$	; if yes, say so
   E676 8E F0 04            404 	ldx	#msgnbr	; get that message
   E679 BD EF 65            405 	jsr	outstr	; say it
   E67C 20 0C               406 	bra	5$
                            407 
   E67E 8E F0 0C            408 4$:	ldx	#msgbat	; get that message
   E681 BD EF 65            409 	jsr	outstr	; say it
   E684 8E 0F C4            410 	ldx	#brkadr	; get break address
   E687 BD ED 19            411 	jsr	out2by	; type it
   E68A 7E E5 37            412 5$:	jmp	nomore
                            413 
ASxxxx Assembler V02.21  (Motorola 6809), page 11.
MONDEB - 09
IBASE - Set Input Base

                            415 	.sbttl	IBASE - Set Input Base
                            416 
   E68D 86 03               417 ibase:	lda	#3	; look for hex,dec,or oct in list #3
   E68F BD EA F1            418 	jsr	comand
   E692 2B 0A               419 	bmi	2$	; unrecognizable base, try'?'
   E694 2E 02               420 	bgt	1$
   E696 86 01               421 	lda	#1	; no base given - default to hex
   E698 B7 0F B6            422 1$:	sta	ibcode	; save base code
   E69B 7E E5 37            423 	jmp	nomore
                            424 
   E69E B6 0F B6            425 2$:	lda	ibcode	; get ib code in case its needed
   E6A1 34 02               426 	pshs	a	; save it on stack temporarily
   E6A3 20 22               427 	bra	ibdbq
                            428 
                            429 	.sbttl	DBASE - Set Display Base
                            430 
   E6A5 86 03               431 dbase:	lda	#3	; look for hex,dec,oct, or bin in list #3
   E6A7 BD EA F1            432 	jsr	comand
   E6AA 2B 16               433 	bmi	3$	; unrecognizable base, try '?'
   E6AC 2E 02               434 	bgt	1$
   E6AE 86 01               435 	lda	#1	; no base given - default to hex
   E6B0 B7 0F B7            436 1$:	sta	dbcode
   E6B3 8E E6 BD            437 	ldx	#2$-1	; get numeric base from table
   E6B6 A6 86               438 	lda	a,x
   E6B8 B7 0F B8            439 	sta	dbnbr	; save it
   E6BB 7E E5 37            440 	jmp	nomore	; done
                            441 
   E6BE 10                  442 2$:	.byte	16	; display base table
   E6BF 0A                  443 	.byte	10
   E6C0 08                  444 	.byte	8
   E6C1 02                  445 	.byte	2
                            446 
   E6C2 B6 0F B7            447 3$:	lda	dbcode	; get db code in case its needed
   E6C5 34 02               448 	pshs a		; save it on stack temporarily
                            449 
   E6C7 86 04               450 ibdbq:	lda	#4	; look for '?' in list #4
   E6C9 BD EA F1            451 	jsr	comand	
   E6CC 35 04               452 	puls b		; retrieve input base/display base code
   E6CE 10 2F FE 4C         453 	lble	badsyn	; error if the 'something' was not a '?'
   E6D2 86 03               454 	lda	#3	; base code is in list 3
   E6D4 F7 0F DC            455 	stb	comnum	; store base code
   E6D7 BD EB 5B            456 	jsr	typcmd	; type out base
   E6DA 7E E5 37            457 	jmp	nomore
                            458 
ASxxxx Assembler V02.21  (Motorola 6809), page 12.
MONDEB - 09
Display - Display Memory Data

                            460 	.sbttl	Display - Display Memory Data
                            461 
   E6DD BD EC 20            462 displa:	jsr	gtrang	; get memory display range
   E6E0 10 2F FE 3A         463 	lble	badsyn	; address is required
   E6E4 BE 0F BB            464 	ldx	ranglo	; initialize address pointer
   E6E7 BF 0F CE            465 	stx	memadr
                            466 
   E6EA 86 06               467 	lda	#6	; search list 6 for
   E6EC BD EA F1            468 	jsr	comand	; display modifiers 'data' or 'used'
   E6EF 10 2B FE 2B         469 	lbmi	badsyn	; any other modifier is illegal
   E6F3 4A                  470 	deca		; adj display modifier code so that:
   E6F4 B7 0F DC            471 	sta	comnum	; -1=addr & data, 0=data, 1=used
   E6F7 5F                  472 	clrb		; init 'data values per line' counter
   E6F8 5C                  473 	incb
   E6F9 8E 0F CE            474 1$:	ldx	#memadr
   E6FC 7D 0F DC            475 	tst	comnum	; which display option?
   E6FF 2B 2B               476 	bmi	6$	; if 'address & data', go there
   E701 5A                  477 	decb		; count data values per line
   E702 26 0C               478 	bne	2$	; if count not up, skip address output
   E704 BD EF C4            479 	jsr	docrlf	; get to line beginning
   E707 BD ED 19            480 	jsr	out2by	; output address
   E70A BD ED 05            481 	jsr	outsp	; and a space
   E70D F6 0F B8            482 	ldb	dbnbr	; reset line counter
                            483 
   E710 BE 0F CE            484 2$:	ldx	memadr	; point to data at that address
   E713 7D 0F DC            485 	tst	comnum	; want 'data' option?
   E716 2E 05               486 	bgt	3$	; if not, go to 'used' code
                            487 
   E718 BD ED 05            488 	jsr	outsp	; output preceedng space
   E71B 20 1A               489 	bra 	7$
                            490 
   E71D A6 84               491 3$:	lda	,x	; get the data
   E71F 26 04               492 	bne 	4$
   E721 86 2E               493 	lda	#'.	; its zero, get a '.'
   E723 20 02               494 	bra 	5$
                            495 
   E725 86 2B               496 4$:	lda	#'+	; its non-zero, get a '+'
   E727 BD EF 88            497 5$:	jsr	outchr	; output the '.' or '+'
   E72A 20 0E               498 	bra	8$
                            499 
   E72C BD ED 05            500 6$:	jsr	outsp	; output a preceeding space
   E72F BD ED 19            501 	jsr	out2by	; type address
   E732 BD ED 0B            502 	jsr	outeq	; type	'='
   E735 AE 84               503 	ldx	,x	; get content
   E737 BD ED 11            504 7$:	jsr	out1by	; type it
   E73A BC 0F BD            505 8$:	cpx	ranghi	; are we done
   E73D 10 27 FD F6         506 	lbeq	nomore	; if yes, back to prompt
   E741 30 01               507 	inx		; no, inc memory address
   E743 BF 0F CE            508 	stx	memadr	; save it
   E746 20 B1               509 	bra	1$
                            510 
ASxxxx Assembler V02.21  (Motorola 6809), page 13.
MONDEB - 09
SET - Set Memory Locations

                            512 	.sbttl	SET - Set Memory Locations
                            513 
   E748 BD EC 20            514 set:	jsr	gtrang	; get memory location/range
   E74B 2B 58               515 	bmi	5$	; if not an address, look for a
                            516 			; register name
   E74D 10 27 FD CD         517 	lbeq	badsyn	; an address modifier is required
                            518 
                            519 	; range of address specified?
                            520 
   E751 BE 0F BB            521 	ldx	ranglo
   E754 BC 0F BD            522 	cpx	ranghi
   E757 27 17               523 	beq	2$	; if single address, set up
                            524 			; addresses individually
                            525 
                            526 	; set a range of addresses to a single value
                            527 
   E759 BD EC 6B            528 	jsr	mnumber	; get that value
   E75C 10 2F FD BE         529 	lble	badsyn	; its	required
   E760 B6 0F BA            530 	lda	nbrlo	; put it in acca
   E763 A7 84               531 1$:	sta	,x	; store it in destination
   E765 BC 0F BD            532 	cpx	ranghi	; end of range hit?
   E768 10 27 FD CB         533 	lbeq	nomore	; if yes, all done
   E76C 30 01               534 	inx		; no, on to next address in range
   E76E 20 F3               535 	bra	1$	; loop to see it
                            536 
                            537 	; set addresses up individually
                            538 
   E770 BF 0F CE            539 2$:	stx	memadr	; save memory loc
   E773 BD EC 6B            540 3$:	jsr	mnumber	; get data to put there
   E776 27 0E               541 	beq	4$	; end of line?
   E778 10 2D FD A2         542 	lblt	badsyn	; abort if bad syntax
   E77C B6 0F BA            543 	lda	nbrlo	; load data byte
   E77F BE 0F CE            544 	ldx	memadr	; load address
   E782 A7 80               545 	sta	,x+	; store data
   E784 20 EA               546 	bra	2$
                            547 
   E786 BE 0F B0            548 4$:	ldx	synptr	; point to end of line
   E789 A6 84               549 	lda	,x	; get char there
   E78B 81 0A               550 	cmpa	#lf	; line feed?
   E78D 10 26 FD A6         551 	lbne	nomore	; if not,back to prompt
   E791 8E 0F CE            552 	ldx	#memadr	; yes, get next address to be set
   E794 BD ED 19            553 	jsr	out2by	; type it
   E797 BD ED 05            554 	jsr	outsp	; and a space
   E79A BD EE C5            555 	jsr	getlin	; get a new line
   E79D BE 0F AA            556 	ldx	bufbeg	; get buffer beginning
   E7A0 BF 0F B0            557 	stx	synptr	; equate it to syntax scan pointer
   E7A3 20 CE               558 	bra	3$	; go pick up data
                            559 
                            560 	; look for (register name, register value) pairs
                            561 
   E7A5 86 05               562 5$:	lda	#5	
   E7A7 BD EA F1            563 	jsr	comand	; pick up a register name
   E7AA 10 2B FD 70         564 	lbmi	badsyn	; error if unrecognizable
   E7AE 10 27 FD 85         565 	lbeq	nomore	; done if end of line
   E7B2 34 02               566 	pshs a		; save register name(number)
   E7B4 BD EC 6B            567 	jsr	mnumber	; get new register value
ASxxxx Assembler V02.21  (Motorola 6809), page 14.
MONDEB - 09
SET - Set Memory Locations

   E7B7 35 02               568 	puls a		; restore register name(number)
   E7B9 10 2F FD 61         569 	lble	badsyn	; got good register value?
   E7BD 4A                  570 	deca
   E7BE CE E7 CF            571 	ldu	#6$
   E7C1 A6 C6               572 	lda	a,u
   E7C3 33 C6               573 	leau	a,u
   E7C5 BE 0F FE            574 	ldx	spsave	; yes, point to top of stack
   E7C8 FC 0F B9            575 	ldd	nbrhi	; get register value
   E7CB AD C4               576 	jsr	,u	; go to function
   E7CD 20 D6               577 	bra	5$	; and loop
                            578 
   E7CF 0A                  579 6$:	.byte	7$-6$
   E7D0 0D                  580 	.byte	8$-6$
   E7D1 10                  581 	.byte	9$-6$
   E7D2 13                  582 	.byte	10$-6$
   E7D3 16                  583 	.byte	11$-6$
   E7D4 19                  584 	.byte	12$-6$
   E7D5 1C                  585 	.byte	13$-6$
   E7D6 1F                  586 	.byte	14$-6$
   E7D7 22                  587 	.byte	15$-6$
   E7D8 25                  588 	.byte	16$-6$
                            589 
   E7D9 E7 84               590 7$:	stb	,x	; condition codes
   E7DB 39                  591 	rts
                            592 
   E7DC E7 01               593 8$:	stb	1,x	; acca
   E7DE 39                  594 	rts
                            595 
   E7DF E7 02               596 9$:	stb	2,x	; accb
   E7E1 39                  597 	rts
                            598 
   E7E2 E7 03               599 10$:	stb	3,x	; dp
   E7E4 39                  600 	rts
                            601 
   E7E5 ED 04               602 11$:	std	4,x	; ix
   E7E7 39                  603 	rts
                            604 
   E7E8 ED 06               605 12$:	std	6,x	; iy
   E7EA 39                  606 	rts
                            607 
   E7EB ED 08               608 13$:	std	8,x	; iu
   E7ED 39                  609 	rts
                            610 
   E7EE ED 01               611 14$:	std	1,x	; d
   E7F0 39                  612 	rts
                            613 
   E7F1 ED 0A               614 15$:	std	10,x	; pc
   E7F3 39                  615 	rts
                            616 
   E7F4 FD 0F FE            617 16$:	std	spsave	; sp
   E7F7 39                  618 	rts
                            619 
ASxxxx Assembler V02.21  (Motorola 6809), page 15.
MONDEB - 09
Checksum Verify a Block of Memory

                            621 	.sbttl	Checksum Verify a Block of Memory
                            622 
   E7F8 BD EC 20            623 verify:	jsr	gtrang	; get a number range
   E7FB 27 1D               624 	beq	1$	; no modifier means check what we have
   E7FD 10 2B FD 1D         625 	lbmi	badsyn	; anything else is illegal
                            626 
   E801 BE 0F BB            627 	ldx	ranglo	; good range given,
   E804 BF 0F BF            628 	stx	verfrm	; transfer it to checksum addresses
   E807 BE 0F BD            629 	ldx	ranghi
   E80A BF 0F C1            630 	stx	verto
                            631 
   E80D 8D 23               632 	bsr	cksum	; compute checksum
   E80F B7 0F C3            633 	sta	chksum	; save it
   E812 8E 0F C3            634 	ldx	#chksum	; type the checksum
   E815 BD ED 11            635 	jsr	out1by
   E818 20 15               636 	bra	3$
                            637 
   E81A 8D 16               638 1$:	bsr	cksum	; compute checksum
   E81C B1 0F C3            639 	cmpa 	chksum	; same as stored checksum?
   E81F 26 08               640 	bne 	2$
                            641 
   E821 8E F0 13            642 	ldx	#msgver	; they verify - say so
   E824 BD EF 65            643 	jsr	outstr
   E827 20 06               644 	bra	3$
                            645 
   E829 8E F0 16            646 2$:	ldx	#msgnve	; they don't - say so
   E82C BD EF 65            647 	jsr	outstr
   E82F 7E E5 37            648 3$:	jmp	nomore
                            649 
                            650 	; compute the checksum from addresses verfrm to verto
                            651 	; return the checksum in acca
                            652 
   E832 4F                  653 cksum:	clra		; init checksum to zero
   E833 BE 0F BF            654 	ldx	verfrm	; get first address
   E836 30 1F               655 	dex		; init to one less
   E838 30 01               656 1$:	inx		; start of checksum loop
   E83A AB 84               657 	adda	,x	; update checksum in acca with
                            658 			; byte pointed to
   E83C BC 0F C1            659 	cpx	verto	; hit end of range?
   E83F 26 F7               660 	bne	1$	; if not, loop back
   E841 43                  661 	coma		; complement the sum
   E842 39                  662 	rts		; return with it
                            663 
                            664 
ASxxxx Assembler V02.21  (Motorola 6809), page 16.
MONDEB - 09
Search Memory for Byte String

                            666 	.sbttl	Search Memory for Byte String
                            667 
                            668 	; global variables used
                            669 	;  linptr - input line character pointer
                            670 	;  lisptr - command list character pointer
                            671 	;  ranglo - 'search from' address
                            672 	;  ranghi - 'search to' address
                            673 	;
                            674 	; local variables used
                            675 	;  memadr - starting memory address where a match
                            676 	;		occurred
                            677 	;  bytptr - address pointer used to fill bytstr and
                            678 	;		substr buffers
                            679 	;  nbytes - number of bytes in byte string
                            680 	;  nbrmat - number of chars that match so far in the
                            681 	;		matching process
                            682 	;  bytstr - starting address of 6 character byte sring
                            683 	;		buffer
                            684 	;
                            685 	; the search string occupies temp4, temp5, & temp6
                            686 	;		(6 bytes max)
                            687 
   E843 BD EC 20            688 search:	jsr	gtrang	; get search range
   E846 10 2F FC D4         689 	lble	badsyn	; abort if no pair
   E84A 8E 0F D4            690 	ldx	#bytstr	; get start of byte string
                            691 			; to search for
   E84D BF 0F D0            692 	stx	bytptr	; set pointer to it
   E850 7F 0F D2            693 	clr	nbytes	; zero # of bytes in byte string
                            694 
   E853 BD EC 6B            695 1$:	jsr	mnumber	; get a byte string
   E856 27 1D               696 	beq	2$	; begin search if eol
   E858 10 2D FC C2         697 	lblt	badsyn	
                            698 			; good byte, add it to string
   E85C 7C 0F D2            699 	inc	nbytes	; count this  byte
   E85F B6 0F D2            700 	lda	nbytes	; don't accept over 6 bytes
   E862 81 06               701 	cmpa	#6
   E864 10 2E FC B6         702 	lbgt	badsyn
   E868 B6 0F BA            703 	lda	nbrlo	; get (low order) byte
   E86B BE 0F D0            704 	ldx	bytptr	; get byte pointer
   E86E A7 80               705 	sta	,x+	; save byte, bump pointer
   E870 BF 0F D0            706 	stx	bytptr	; save it
   E873 20 DE               707 	bra 	1$
                            708 
   E875 7D 0F D2            709 2$:	tst	nbytes	; is # of bytes to look for >0
   E878 10 27 FC A2         710 	lbeq	badsyn	; if not,bad syntax
   E87C BE 0F BB            711 	ldx	ranglo	; initialize memory pointer
   E87F 30 1F               712 	dex
   E881 BF 0F B2            713 	stx	linptr
                            714 
   E884 8E 0F D3            715 3$:	ldx  #bytstr-1	; initialize byte pointer
   E887 BF 0F DD            716 	stx	lisptr
   E88A 7F 0F D3            717 	clr	nbrmat	; set 'number of bytes that
                            718 			; matched' to zero
   E88D BD ED D3            719 	jsr	getlst	; get byte from byte string
                            720 
   E890 BD ED C5            721 4$:	jsr	mgetchr	; get byte from memory range
ASxxxx Assembler V02.21  (Motorola 6809), page 17.
MONDEB - 09
Search Memory for Byte String

   E893 34 04 A1 E0         722 	cba		; compare memory & byte string
                            723 			; characters
   E897 27 09               724 	beq	5$	; if no match, test for range end
   E899 BC 0F BD            725 	cpx	ranghi	; have we reached the range
                            726 			; search upper limit?
   E89C 10 27 FC 97         727 	lbeq	nomore	; yes, go prompt for next command
   E8A0 20 EE               728 	bra	4$
                            729 
   E8A2 BF 0F CE            730 5$:	stx	memadr	; match achieved - save address of match
   E8A5 7C 0F D3            731 6$:	inc	nbrmat	; bump number matched
   E8A8 B6 0F D3            732 	lda	nbrmat	
   E8AB B1 0F D2            733 	cmpa	nbytes	; have all characters matched?
   E8AE 27 1B               734 	beq	8$	; if so, match achieved
                            735 
   E8B0 BD ED D3            736 	jsr	getlst	; haven't matched all yet, go get next pair
   E8B3 BD ED C5            737 	jsr	mgetchr	; even if past 'search to' address
   E8B6 34 04 A1 E0         738 	cba
   E8BA 27 E9               739 	beq	6$
                            740 
   E8BC BE 0F CE            741 7$:	ldx	memadr	; mismatch on some byte past the first one
                            742 
   E8BF BC 0F BD            743 	cpx	ranghi	; this test handles special case
   E8C2 10 27 FC 71         744 	lbeq	nomore	; of a match on range end
   E8C6 BF 0F B2            745 	stx	linptr
   E8C9 20 B9               746 	bra 	3$	; go reset the byte string pointer
                            747 
                            748 
   E8CB 8E 0F CE            749 8$:	ldx	#memadr	; match on byte string achieved,
   E8CE BD ED 19            750 	jsr	out2by	; type out memory address
   E8D1 BD ED 05            751 	jsr	outsp	; and a space
   E8D4 20 E6               752 	bra 	7$
                            753 
ASxxxx Assembler V02.21  (Motorola 6809), page 18.
MONDEB - 09
Test Ram

                            755 	.sbttl	Test Ram
                            756 
   E8D6 BD EC 20            757 test:	jsr	gtrang	; get an address range
   E8D9 10 2F FC 41         758 	lble	badsyn	; abort if no pair
   E8DD FE 0F BB            759 	ldu	ranglo	; ranglo holds starting address of range
                            760 			; ranghi holds ending address of range
   E8E0 A6 C4               761 1$:	lda	,u	; get byte stored at test location
   E8E2 34 02               762 	pshs	a	; save it
   E8E4 6F C4               763 	clr	,u	; zero the location
   E8E6 6D C4               764 	tst	,u	; test it
   E8E8 27 05               765 	beq	2$	; ok if = zero
   E8EA 8E F0 26            766 	ldx	#msgccl	; can't clear location
   E8ED 20 1D               767 	bra	4$
                            768 
   E8EF 6A C4               769 2$:	dec	,u	; set location to $ff
   E8F1 86 FF               770 	lda	#0xff
   E8F3 A1 C4               771 	cmpa	,u	; did it get set to $ff?
   E8F5 27 05               772 	beq	3$
   E8F7 8E F0 32            773 	ldx	#msgcso	; can't set location to one's
   E8FA 20 10               774 	bra 	4$
                            775 
   E8FC 35 02               776 3$:	puls	a
   E8FE A7 C4               777 	sta	,u	; restore previous content
   E900 11 B3 0F BD         778 	cmpu	ranghi	; hit end of test range?
   E904 10 27 FC 2F         779 	lbeq	nomore	; yes, all done
   E908 33 41               780 	leau	1,u	; no, move to test next location
   E90A 20 D4               781 	bra	1$
                            782 
   E90C BF 0F D2            783 4$:	stx	temp3	; save error message temporarily
   E90F 8E 0F D4            784 	ldx	#temp4
   E912 EF 84               785 	stu	,x
   E914 BD ED 19            786 	jsr	out2by	; type out bad address
   E917 BD ED 0B            787 	jsr	outeq	; and equal sign
   E91A BE 0F D4            788 	ldx	temp4
   E91D BD ED 11            789 	jsr	out1by	; its content
   E920 BD ED 05            790 	jsr	outsp	; a space
   E923 BE 0F D2            791 	ldx	temp3
   E926 BD EF 65            792 	jsr	outstr	; and the type of error
   E929 BD EF C4            793 	jsr	docrlf	
   E92C 20 CE               794 	bra	3$
                            795 
ASxxxx Assembler V02.21  (Motorola 6809), page 19.
MONDEB - 09
vector settup commands

                            797 	.sbttl	vector settup commands
                            798 
                            799 	; rsrvd - set up rsvd pointer
                            800 
   E92E BD EC 60            801 xrsrvd:	jsr	numinx	; get pointer in ix
   E931 BF 0F F0            802 	stx	.rsrvd	; save it
   E934 7E E5 37            803 	jmp	nomore
                            804 
                            805 	; swi3 - set up swi3 pointer
                            806 
   E937 BD EC 60            807 xswi3:	jsr	numinx	; get pointer in ix
   E93A BF 0F F2            808 	stx	.swi3	; save it
   E93D 7E E5 37            809 	jmp	nomore
                            810 
                            811 	; swi2 - set up swi2 pointer
                            812 
   E940 BD EC 60            813 xswi2:	jsr	numinx	; get pointer in ix
   E943 BF 0F F4            814 	stx	.swi2	; save it
   E946 7E E5 37            815 	jmp	nomore
                            816 
                            817 	; firq - set up interrupt pointer
                            818 
   E949 BD EC 60            819 xfirq:	jsr	numinx	; get pointer in ix
   E94C BF 0F F6            820 	stx	.firq	; save it
   E94F 7E E5 37            821 	jmp	nomore
                            822 
                            823 	; irq - set up interrupt pointer
                            824 
   E952 BD EC 60            825 xirq:	jsr	numinx	; get pointer in ix
   E955 BF 0F F8            826 	stx	.irq	; save it
   E958 7E E5 37            827 	jmp	nomore
                            828 
                            829 	; swi - set up swi pointer
                            830 
   E95B BD EC 60            831 xswi:	jsr	numinx	; get pointer in ix
   E95E BF 0F FA            832 	stx	.swi	; save it
   E961 7E E5 37            833 	jmp	nomore
                            834 
                            835 	; nmi - set up non-maskable interrupt pointer
                            836 
   E964 BD EC 60            837 xnmi:	jsr 	numinx	; get ponter in ix
   E967 BF 0F FC            838 	stx	.nmi	; save it
   E96A 7E E5 37            839 	jmp	nomore
                            840 
ASxxxx Assembler V02.21  (Motorola 6809), page 20.
MONDEB - 09
compare numbers

                            842 	.sbttl	compare numbers
                            843 
                            844 	; compare - output sum & difference of two input numbers
                            845 
   E96D BD EC 60            846 compar:	jsr	numinx	; get first number
   E970 BF 0F BB            847 	stx	ranglo	; put it in ranglo
   E973 BD EC 60            848 	jsr	numinx	; get second number
   E976 BF 0F B9            849 	stx	nbrhi	; save it in nbrhi
                            850 
                            851 	; compute and output the sum
                            852 
   E979 BD EC 06            853 	jsr	sumnum	; compute sum
   E97C 8E F0 44            854 	ldx	#msgsis	;get its title
   E97F 8D 0B               855 	bsr	1$	; output title & sum
                            856 
   E981 BD EC 13            857 	jsr	difnum	; compute difference
   E984 8E F0 4C            858 	ldx	#msgdis	; get its title
   E987 8D 03               859 	bsr	1$	; output title & diff
                            860 
   E989 7E E5 37            861 	jmp	nomore
                            862 
                            863 	; compute and output the result
                            864 
   E98C BD EF 65            865 1$:	jsr	outstr	; output it
   E98F 8E 0F BD            866 	ldx	#ranghi	; get result
   E992 BD ED 19            867 	jsr	out2by	; display result
   E995 39                  868 	rts
                            869 
ASxxxx Assembler V02.21  (Motorola 6809), page 21.
MONDEB - 09
dump memory in S1-S9 format

                            871 	.sbttl	dump memory in S1-S9 format
                            872 
                            873 	; *****
                            874 	; dump - dump portion of memory in S1-S9 format
                            875 	;
                            876 	; get address range: start in ranglo (2 bytes), end in
                            877 	;		ranghi (2bytes)
                            878 	; if no address range is given, use whatever is n
                            879 	;		ranlo & ranghi
                            880 
   E996 BD EC 20            881 dump:	jsr	gtrang
   E999 7F 0F D6            882 	clr	temp5	; initialize to dump to terminal
                            883 
   E99C 86 02               884 1$:	lda	#2	; look for a 'TO' modifier
   E99E BD EA F1            885 	jsr	comand
   E9A1 27 13               886 	beq	2$
   E9A3 10 2F FB 77         887 	lble	badsyn	; error if bad syntax
   E9A7 81 01               888 	cmpa	#1	; TO ?
   E9A9 26 F1               889 	bne	1$	; go look for another modifier
                            890 
   E9AB BD EC 60            891 	jsr	numinx	; get 'TO' address
   E9AE BF 0F C9            892 	stx	outadr	; save it
   E9B1 7C 0F D6            893 	inc	temp5	; remember this
   E9B4 20 E6               894 	bra	1$	; go look for another modifier
                            895 
   E9B6 7D 0F D6            896 2$:	tst	temp5
   E9B9 27 03               897 	beq	3$
   E9BB 7C 0F C8            898 	inc	outflg	; set flag for proper output device
                            899 
   E9BE FC 0F BD            900 3$:	ldd	ranghi	; compute # of bytes to output
   E9C1 B3 0F BB            901 	subd	ranglo	; subtract lo bytes
   E9C4 10 83 00 10         902 	cmpd	#16	; diff 0-15.
   E9C8 25 02               903 	bcs	5$	
   E9CA C6 0F               904 4$:	ldb	#15
                            905 
                            906 	; to get frame count, add 1
                            907 	; (diff of 0 implies 1 output) + # of data bytes
                            908 	; + 2 addr bytes + 1 checksum byte
                            909 
   E9CC CB 04               910 5$:	addb	#4
   E9CE F7 0F D2            911 	stb	temp3	; temp3 is the frame count
   E9D1 C0 03               912 	subb	#3
   E9D3 F7 0F D4            913 	stb	temp4	; temp4 is the record byte count
                            914 
   E9D6 8E F0 56            915 	ldx	#msgs1	; output a 'S1' header data record
   E9D9 BD EF 65            916 	jsr	outstr
   E9DC 5F                  917 	clrb		; zero checksum
                            918 
   E9DD 8E 0F D2            919 	ldx	#temp3	; punch frame count
   E9E0 8D 33               920 	bsr	7$
                            921 
   E9E2 8E 0F BB            922 	ldx	#ranglo	; punch address
   E9E5 8D 2E               923 	bsr	7$
   E9E7 8D 2C               924 	bsr	7$
                            925 
   E9E9 BE 0F BB            926 	ldx	ranglo	; load memory pointer
ASxxxx Assembler V02.21  (Motorola 6809), page 22.
MONDEB - 09
dump memory in S1-S9 format

   E9EC 8D 27               927 6$:	bsr	7$	; output data byte
   E9EE 7A 0F D4            928 	dec	temp4	; dec byte count
   E9F1 26 F9               929 	bne	6$
   E9F3 BF 0F BB            930 	stx	ranglo	; save memory pointer
                            931 
   E9F6 53                  932 	comb		; complement checksum
   E9F7 34 04               933 	pshs	b	; put it on stack
   E9F9 1F 41               934 	tfr	s,x	; let ix point to it
   E9FB 8D 18               935 	bsr	7$	; output checksum
   E9FD 35 04               936 	puls	b	; pull it off stack
   E9FF BE 0F BB            937 	ldx	ranglo	; restore memory pointer
   EA02 30 1F               938 	dex
   EA04 BC 0F BD            939 	cpx	ranghi 	; hit end of range?
   EA07 26 B5               940 	bne	3$
                            941 
   EA09 8E F0 5D            942 	ldx	#msgs9	; yes, output an 'S9' record
   EA0C BD EF 65            943 	jsr	outstr
   EA0F 7F 0F C8            944 	clr	outflg	; set to terminal output
   EA12 7E E5 37            945 	jmp 	nomore
                            946 
   EA15 BD ED 11            947 7$:	jsr	out1by	; output a byte pointed to by ix as
   EA18 EB 80               948 	addb	,x+	; 2 hex characters, update checksum
   EA1A 39                  949 	rts
                            950 
                            951 
ASxxxx Assembler V02.21  (Motorola 6809), page 23.
MONDEB - 09
Load S1-S9 format Data

                            953 	.sbttl	Load S1-S9 format Data
                            954 
   EA1B BD EF 75            955 load:	jsr	inpchr	; get a char
   EA1E 81 53               956 	cmpa	#'S	; is it an S ?
   EA20 26 F9               957 	bne	load
                            958 
   EA22 BD EF 75            959 	jsr	inpchr	; got an 'S', examine next character
   EA25 81 39               960 	cmpa	#'9	; done if its a '9'
   EA27 27 2D               961 	beq	3$
                            962 
   EA29 81 31               963 	cmpa	#'1	; is it a '1'?
   EA2B 26 EE               964 	bne	load	; if not, look for next 'S'
                            965 
   EA2D 7F 0F E7            966 	clr	cksm	; clear checksum
                            967 
   EA30 BD EA 6A            968 	jsr	5$	; read record byte count
   EA33 80 02               969 	suba	#2
   EA35 B7 0F E6            970 	sta	bytect	; save count minus 2 address bytes
                            971 
   EA38 8D 22               972 	bsr	4$	; build address
                            973 
   EA3A 8D 2E               974 1$:	bsr	5$	; read a data byte into acca
   EA3C 7A 0F E6            975 	dec	bytect	; count it
   EA3F 27 04               976 	beq	2$	; if done with record, check checksum
   EA41 A7 80               977 	sta	,x+	; not done, store byte in memory
   EA43 20 F5               978 	bra	1$	; on to next memory address
                            979 
   EA45 7C 0F E7            980 2$:	inc 	cksm	; test checksum by adding 1
   EA48 27 D1               981 	beq	load	; if ok, result should be zero
                            982 
   EA4A 8E F0 16            983 	ldx	#msgnve	; record checksum error
   EA4D BD EF 65            984 	jsr	outstr
   EA50 8E 0F CE            985 	ldx	#temp1	; get record address of it
   EA53 BD ED 19            986 	jsr	out2by	; type it too
   EA56 7F 0F C7            987 3$:	clr	inpflg	; reset flag to normal terminal input
   EA59 7E E5 37            988 	jmp 	nomore
                            989 
   EA5C 8D 0C               990 4$:	bsr	5$	; build address
   EA5E B7 0F CE            991 	sta	temp1
   EA61 8D 07               992 	bsr	5$
   EA63 B7 0F CF            993 	sta	temp1+1
   EA66 BE 0F CE            994 	ldx	temp1
   EA69 39                  995 	rts
                            996 
   EA6A 8D 17               997 5$:	bsr	6$	; get left hex digit
   EA6C 48                  998 	asla		; move to hi 4 bits
   EA6D 48                  999 	asla
   EA6E 48                 1000 	asla
   EA6F 48                 1001 	asla
   EA70 1F 89 4D           1002 	tab		; save it in acca
   EA73 8D 0E              1003 	bsr	6$	; get right hex digit
   EA75 34 04 AB E0        1004 	aba		; combine then in acca
   EA79 1F 89 4D           1005 	tab		; update the checksum
   EA7C FB 0F E7           1006 	addb	cksm
   EA7F F7 0F E7           1007 	stb	cksm
   EA82 39                 1008 	rts
ASxxxx Assembler V02.21  (Motorola 6809), page 24.
MONDEB - 09
Load S1-S9 format Data

                           1009 
   EA83 BD EF 75           1010 6$:	jsr	inpchr	; input a hex char & convert to internal form
   EA86 80 30              1011 	suba	#'0
   EA88 2B 0F              1012 	bmi	8$	; not hex if below ascii '1'
   EA8A 81 09              1013 	cmpa	#'9-'0
   EA8C 2F 0A              1014 	ble	7$	; ok if ascii '9' or less
   EA8E 81 11              1015 	cmpa	#'A-'0	; below ascii 'A'?
   EA90 2B 07              1016 	bmi	8$	; error if it is
   EA92 81 16              1017 	cmpa	#'F-'0	; over ascii 'F'?
   EA94 2E 03              1018 	bgt	8$	; error if it is
   EA96 80 07              1019 	suba	#7	; conv ascii A-F to hex A-F
   EA98 39                 1020 7$:	rts
                           1021 
   EA99 8E F0 6D           1022 8$:	ldx	#msgcnh	; error - char not hex, say so
   EA9C BD EF 65           1023 	jsr	outstr
   EA9F 39                 1024 	rts
                           1025 
ASxxxx Assembler V02.21  (Motorola 6809), page 25.
MONDEB - 09
Delay Function

                           1027 	.sbttl	Delay Function
                           1028 
                           1029 	; *****
                           1030 	; delay - delay specified # of milliseconds
                           1031 
   EAA0 BD EC 60           1032 delay:	jsr	numinx	; get delay time
   EAA3 8D 03              1033 	bsr	timdel
   EAA5 7E E5 37           1034 	jmp	nomore
                           1035 
                           1036 	; *****
                           1037 	; time delay subroutine
                           1038 	; ix is input as the # of milliseconds to delay
                           1039 	; adj timcon so (7*timcon*cycle time=1 ms)
                           1040 
   EAA8 34 06              1041 timdel:	pshs	d
   EAAA FC 0F E4           1042 1$:	ldd	timcon
                           1043 
   EAAD 83 00 01           1044 2$:	subd	#1	; a 7 cycle loop
   EAB0 26 FB              1045 	bne	2$
                           1046 
   EAB2 30 1F              1047 	dex		; decrement millisecond counter
   EAB4 26 F4              1048 	bne	1$
   EAB6 35 86              1049 	puls	d,pc
                           1050 
ASxxxx Assembler V02.21  (Motorola 6809), page 26.
MONDEB - 09
Help List

                           1052 	.sbttl	Help List
                           1053 
   EAB8 BD EF C4           1054 help:	jsr	docrlf	; next line
   EABB 8E ED DE           1055 	ldx	#comlst	; command list
                           1056 
   EABE C6 04              1057 1$:	ldb	#4	; commands per line
   EAC0 F7 0F CE           1058 	stb	temp1
                           1059 
   EAC3 C6 0C              1060 2$:	ldb	#12	; positions per command
                           1061 			; must be larger than longest command
   EAC5 A6 80              1062 3$:	lda	,x+	; get character
   EAC7 81 0D              1063 	cmpa	#cr	; <cr> is end of command
   EAC9 27 06              1064 	beq	4$
   EACB BD EF 88           1065 	jsr	outchr	; print command character
   EACE 5A                 1066 	decb
   EACF 26 F4              1067 	bne	3$
                           1068 
   EAD1 A6 84              1069 4$:	lda	,x	; get character
   EAD3 81 0A              1070 	cmpa	#lf	; <lf> is end of list
   EAD5 27 14              1071 	beq	6$	; finished
   EAD7 7A 0F CE           1072 	dec	temp1	; per line done ?
   EADA 26 05              1073 	bne	5$	; no - skip
                           1074 
   EADC BD EF C4           1075 	jsr	docrlf	; next line
   EADF 20 DD              1076 	bra	1$
                           1077 
   EAE1 86 20              1078 5$:	lda	#' 	; space
   EAE3 BD EF 88           1079 	jsr	outchr
   EAE6 5A                 1080 	decb
   EAE7 26 F8              1081 	bne	5$
   EAE9 20 D8              1082 	bra	2$
                           1083 
   EAEB BD EF C4           1084 6$:	jsr	docrlf	; next line
   EAEE 7E E5 37           1085 	jmp	nomore
                           1086 
ASxxxx Assembler V02.21  (Motorola 6809), page 27.
MONDEB - 09
Command Lists

                           1088 	.sbttl	Command Lists
                           1089 
                           1090 	;================================================
                           1091 	;
                           1092 	; c o m m a n d   l i s t   s c a n n i n g 
                           1093 	;    r o u t i n e
                           1094 	;
                           1095 	; this routine seeks a match of the characters pointed
                           1096 	; at by the input line scanning pointer to one of the
                           1097 	; commands in a list specified by acca.
                           1098 	; the result of the scan for a match is returned in
                           1099 	; acca as follows:
                           1100 	;
                           1101 	;	acca=-1: the match was unsuccessful. the syntax
                           1102 	;		 pointer (synptr) was not updated
                           1103 	;			(advanced).
                           1104 	;
                           1105 	;	acca= 0: the match was unsuccessful since there
                           1106 	;			were
                           1107 	;		  no more characters, i.e., the end of
                           1108 	;			the
                           1109 	;		line was reached.
                           1110 	;
                           1111 	;	acca=+n: successful match. the syntax pointer
                           1112 	;			was updated
                           1113 	;		 to the first character following the 
                           1114 	;		  command
                           1115 	;		  delimiter.  acca holds the number of
                           1116 	;		      the
                           1117 	;		  command matched.
                           1118 	; global variables for external communication
                           1119 	; synptr - good syntax input line char pointer
                           1120 	; linptr - input line character pointer
                           1121 	; delim - class of permissible command delimiters
                           1122 	;
                           1123 	; temporary 2 byte internal variables
                           1124 	; lisptr - command list character pointer
                           1125 	;
                           1126 	; temporary 1 byte internal variables
                           1127 	; nummat - number of characters that successfully match
                           1128 	; lisnum - # of list within which a match will be sought
                           1129 	; comnum - command number matched
                           1130 	;
                           1131 	; constants used
                           1132 	; cr - carriage return
                           1133 	; lf - line feed
                           1134 	;
                           1135 	; a, b & ix are not preserved
                           1136 
   EAF1 B7 0F DB           1137 comand:	sta	lisnum	; save list # to match within
   EAF4 BD EB 93           1138 	jsr	skpdlm	; test if we are at the end of the line
   EAF7 24 02              1139 	bcc	1$
   EAF9 4F                 1140 	clra
   EAFA 39                 1141 	rts
                           1142 
                           1143 	; initialize the command list pointer to one less than
ASxxxx Assembler V02.21  (Motorola 6809), page 28.
MONDEB - 09
Command Lists

                           1144 	; 		the beginning of the command lists
                           1145 
   EAFB BE 0F AE           1146 1$:	ldx	comadr	; entry point
                           1147 
                           1148 	; move to the beginning of the desired command list
                           1149 
   EAFE B6 0F DB           1150 	lda	lisnum	; search for 'string' # lisnum
   EB01 C6 0A              1151 	ldb	#lf	; use lf as a 'string' terminator
   EB03 8D 75              1152 	bsr	fndstr
   EB05 BF 0F DD           1153 	stx	lisptr
                           1154 
                           1155 	; the list pointer, lisptr, now points to one less than
                           1156 	; the first character
                           1157 	; of the first command in the desired list
                           1158 
   EB08 7F 0F DC           1159 	clr	comnum
                           1160 
                           1161 	; reset input line pointer to: 1) beginning of line, or
                           1162 	; to 2) point where last successful scan terminated
                           1163 
   EB0B 7C 0F DC           1164 2$:	inc	comnum	; initialize the command # to 1
   EB0E BE 0F B0           1165 	ldx	synptr
   EB11 BF 0F B2           1166 	stx	linptr
   EB14 7F 0F DA           1167 	clr	nummat	; clear number of characters
                           1168 			; matched
   EB17 BD ED C5           1169 3$:	jsr	mgetchr	; get input line char in accb
   EB1A BD EB C0           1170 	jsr	tstdlm	; test for a delimiter
   EB1D 26 16              1171 	bne	4$	; success (found delimiter)
   EB1F BD ED D3           1172 	jsr	getlst	; get command list char in acca
   EB22 81 0A              1173 	cmpa	#lf	; has end of command list been reached ?
   EB24 27 19              1174 	beq	5$	; if so, potential match failure
   EB26 81 0D              1175 	cmpa	#cr	; has end of command been reached ?
   EB28 27 15              1176 	beq	5$	; if so, potential match failure
   EB2A 34 04 A1 E0        1177 	cba		; compare the two characters
   EB2E 26 1B              1178 	bne	6$	; match not possible on this command
   EB30 7C 0F DA           1179 	inc	nummat	; they match, compare the succeeding characters
   EB33 20 E2              1180 	bra	3$	; inc number of characters matched
                           1181 
   EB35 BE 0F B2           1182 4$:	ldx	linptr	; successful match
   EB38 BF 0F B0           1183 	stx	synptr	; update good syntax pointer
   EB3B B6 0F DC           1184 	lda	comnum	; return command number
   EB3E 39                 1185 	rts
                           1186 
                           1187 	; no match
                           1188 
   EB3F 7D 0F DA           1189 5$:	tst	nummat	; did at least one match?
   EB42 27 07              1190 	beq	6$	; to next command if none matched
   EB44 BD EB C0           1191 	jsr	tstdlm	; at least one matched - test for delimiter
   EB47 26 EC              1192 	bne	4$	; if a delimiter, match has been achieved
   EB49 A6 84              1193 	lda	,x	; retrieve last character
                           1194 
                           1195 	; illegal delimiter
                           1196 	; move to next command within list
                           1197 
   EB4B 81 0A              1198 6$:	cmpa	#lf	; end of this list?
   EB4D 27 09              1199 	beq	7$	; if so, nothing on list matched
ASxxxx Assembler V02.21  (Motorola 6809), page 29.
MONDEB - 09
Command Lists

   EB4F 81 0D              1200 	cmpa	#cr	; is it a cr?
   EB51 27 B8              1201 	beq	2$	; yes, next command
   EB53 BD ED D3           1202 	jsr	getlst	; get next command list character
   EB56 20 F3              1203 	bra	6$	; no, get to end of command
                           1204 
   EB58 4F                 1205 7$:	clra	; match failure
   EB59 4A                 1206 	deca	; no match possible within this list
   EB5A 39                 1207 	rts
                           1208 
ASxxxx Assembler V02.21  (Motorola 6809), page 30.
MONDEB - 09
Typeout Command

                           1210 	.sbttl	Typeout Command
                           1211 
                           1212 	;====================================
                           1213 	; this routine types out command number "comnum"
                           1214 	; the list is specified in acca
                           1215 	; accb & ix are preserved
                           1216 
   EB5B 34 14              1217 typcmd:	pshs	b,x
   EB5D 8E ED DD           1218 	ldx  #comlst-1	; move to head of command lists
   EB60 C6 0A              1219 	ldb	#lf	; and list terminator
   EB62 8D 16              1220 	bsr	fndstr	; go to head of desired list
   EB64 B6 0F DC           1221 	lda	comnum	; get command number
   EB67 C6 0D              1222 	ldb	#cr	; get command terminator
   EB69 8D 0F              1223 	bsr	fndstr	; go to head of desired command
                           1224 
   EB6B 30 01              1225 1$:	inx		; move to next character
   EB6D A6 84              1226 	lda	,x	; get a command character
   EB6F 81 0D              1227 	cmpa	#cr	; is it a command terminator?
   EB71 27 05              1228 	beq	2$	; if so, return
   EB73 BD EF 88           1229 	jsr	outchr	; no, type it
   EB76 20 F3              1230 	bra	1$
                           1231 
   EB78 35 94              1232 2$:	puls	b,x,pc
                           1233 
ASxxxx Assembler V02.21  (Motorola 6809), page 31.
MONDEB - 09
Find string

                           1235 	.sbttl	Find string
                           1236 
                           1237 	;======================================
                           1238 	; move to beginning of desired string number (in acca)
                           1239 	; each string is terminated by an end of string
                           1240 	;   character (in accb)
                           1241 	; the index register is assumed initialized pointing to
                           1242 	; one less than the first character of the first string
                           1243 	; acca, accb & ix are not preserved
                           1244 	; local variables
                           1245 	; strnum - string # to find
                           1246 	; eoschr - "end of string" character
                           1247 
   EB7A B7 0F D0           1248 fndstr:	sta	strnum	; save string number
   EB7D F7 0F D1           1249 	stb	eoschr	; save terminator
   EB80 5F                 1250 	clrb
   EB81 5C                 1251 1$:	incb		; string 1 is the first string
   EB82 F1 0F D0           1252 	cmpb	strnum	; is this the right string?
   EB85 27 0B              1253 	beq	3$	; if so, done
                           1254 
                           1255 	; no, swallow up characters until an end of string char is hit
                           1256 
   EB87 30 01              1257 2$:	inx		; bump pointer to next one
   EB89 A6 84              1258 	lda	,x	; get char pointed at
   EB8B B1 0F D1           1259 	cmpa	eoschr	; end of string hit?
   EB8E 27 F1              1260 	beq	1$	; if it is, bump the string counter
   EB90 20 F5              1261 	bra	2$	; no, move on to next char
   EB92 39                 1262 3$:	rts		; ix set properly, return
                           1263 
ASxxxx Assembler V02.21  (Motorola 6809), page 32.
MONDEB - 09
Skip Leading Delimiters

                           1265 	.sbttl	Skip Leading Delimiters
                           1266 
                           1267 	;=================================================
                           1268 	; skip leading delimiters
                           1269 	; this routine should be called prior to scanning for
                           1270 	; any information
                           1271 	; on the input line
                           1272 	; the current character is ignored if the scannng
                           1273 	; pointer is at the beginning of a line. if not, the
                           1274 	; scanning pointer skips over spaces and commas
                           1275 	; until an end of line or non-delimiter is found.
                           1276 	; the carry bit is set if and end of line is encountered.
                           1277 
                           1278 	; acca, accb, & ix are not preserved
                           1279 
   EB93 1C FE              1280 skpdlm:	clc
   EB95 7D 0F B4           1281 	tst	bolflg	; at beginning of line?
   EB98 2E 0C              1282 	bgt	2$
                           1283 
                           1284 	; look at current input character
                           1285 
   EB9A BE 0F B0           1286 1$:	ldx	synptr	; get pointer to it
   EB9D A6 84              1287 	lda	,x	; get char
   EB9F 8D 14              1288 	bsr	tsteol	; test for end of line
   EBA1 26 03              1289 	bne	2$
   EBA3 1A 01              1290 	sec		; yes, end hit, set carry
   EBA5 39                 1291 	rts
                           1292 
                           1293 	; "peek" at next char in line
                           1294 
   EBA6 E6 01              1295 2$:	ldb	1,x	; get it
   EBA8 8D 16              1296 	bsr	tstdlm	; see if its a delimiter
   EBAA 26 01              1297 	bne	3$
   EBAC 39                 1298 	rts		; if not, return
                           1299 
                           1300 	; next char is a delimiter
                           1301 
   EBAD BD ED C5           1302 3$:	jsr	mgetchr	; move to next char in input line
   EBB0 BF 0F B0           1303 	stx	synptr	; update syntax pointer
   EBB3 20 E5              1304 	bra	1$	; go test for end of line
                           1305 
                           1306 
ASxxxx Assembler V02.21  (Motorola 6809), page 33.
MONDEB - 09
Test for End-of-Line Character

                           1308 	.sbttl	Test for End-of-Line Character
                           1309 
                           1310 	;============================================
                           1311 	; test for end-of-line character
                           1312 	; z bit of cc reg set if char in acca is a terminator
                           1313 	; acca, accb, & ix are preserved
                           1314 
   EBB5 81 0D              1315 tsteol:	cmpa	#cr	; carriage return?
   EBB7 27 06              1316 	beq	1$
   EBB9 81 0A              1317 	cmpa	#lf	; line feed? (continued lines)
   EBBB 27 02              1318 	beq	1$
   EBBD 81 3B              1319 	cmpa	#';	; for several commands on one line
   EBBF 39                 1320 1$:	rts
                           1321 
                           1322 	.sbttl	Test for Delimeter
                           1323 
                           1324 	;===============================================
                           1325 	; check the character n accb aganst the delimiter(s) 
                           1326 	; specified by variable delim
                           1327 	; accb & ix are preserved
                           1328 	; acca is set to 0 if accb is not a delimiter, to 1
                           1329 	; if it is
                           1330 	;  if delim=1, space s delimiter
                           1331 	;  if delim=2, comma is delimiter
                           1332 	;  if delim=3, space or comma is delimiter
                           1333 	;  if delim=4, any non-alphanumeric is a delimiter
                           1334 	; test for end-of-line (logical or physical)
                           1335 
   EBC0 34 04              1336 tstdlm:	pshs b
   EBC2 1F 98 5D           1337 	tba
   EBC5 8D EE              1338 	bsr	tsteol
   EBC7 35 04              1339 	puls b
   EBC9 27 35              1340 	beq	5$
                           1341 
   EBCB B6 0F B5           1342 	lda	delim
   EBCE 81 01              1343 	cmpa	#1
   EBD0 26 06              1344 	bne	1$
   EBD2 C1 20              1345 	cmpb	#' 	; want a space - is it?
   EBD4 26 2D              1346 	bne	6$
   EBD6 20 28              1347 	bra	5$
                           1348 
   EBD8 81 02              1349 1$:	cmpa	#2
   EBDA 26 06              1350 	bne	3$
   EBDC C1 2C              1351 2$:	cmpb	#',	; want a comma - is it?
   EBDE 26 23              1352 	bne	6$
   EBE0 20 1E              1353 	bra	5$
   EBE2 81 03              1354 3$:	cmpa	#3
   EBE4 26 06              1355 	bne	4$
   EBE6 C1 20              1356 	cmpb	#' 	; want either, is it a space?
   EBE8 27 16              1357 	beq	5$
   EBEA 20 F0              1358 	bra	2$	; or a comma?
                           1359 
   EBEC 81 04              1360 4$:	cmpa	#4
   EBEE 26 15              1361 	bne	7$	; error if delm not 1-4
   EBF0 C1 30              1362 	cmpb	#'0	; test if char is 0-9 inclusive
   EBF2 2D 0C              1363 	blt	5$
ASxxxx Assembler V02.21  (Motorola 6809), page 34.
MONDEB - 09
Test for Delimeter

   EBF4 C1 39              1364 	cmpb	#'9
   EBF6 2F 0B              1365 	ble	6$
                           1366 
   EBF8 C1 41              1367 	cmpb	#'A	; test if char is A to Z inclusive
   EBFA 2D 04              1368 	blt	5$
   EBFC C1 5A              1369 	cmpb	#'Z
   EBFE 2F 03              1370 	ble	6$	; over Z - its a delimiter
                           1371 
   EC00 86 01              1372 5$:	lda	#1	; char in accb is a delimiter
   EC02 39                 1373 	rts
                           1374 
   EC03 4F                 1375 6$:	clra		; char in accb is not a delimiter
   EC04 39                 1376 	rts
                           1377 			; error in specifying delimiter class
   EC05 3F                 1378 7$:	swi		; have monitor type out pertinent
                           1379 			; statistics
                           1380 
ASxxxx Assembler V02.21  (Motorola 6809), page 35.
MONDEB - 09
Sum Two Numbers

                           1382 	.sbttl	Sum Two Numbers
                           1383 
                           1384 	;================================================
                           1385 	; add the 2 byte number stored in (ranglo,ranglo+1) to 
                           1386 	; the number stored in (nbrhi,nbrlo) and put the result
                           1387 	; in (ranghi,ranghi+1)
                           1388 
   EC06 34 06              1389 sumnum:	pshs	d	; add lo order bytes
   EC08 FC 0F BB           1390 	ldd	ranglo
   EC0B F3 0F B9           1391 	addd	nbrhi
   EC0E FD 0F BD           1392 	std	ranghi
   EC11 35 86              1393 	puls	d,pc
                           1394 
                           1395 	.sbttl	Subtract Two Numbers
                           1396 
                           1397 	;====================================================
                           1398 	; subtract the 2 byte number stored in (nbrhi,nbrlo)
                           1399 	; from the two byte number stored in (ranglo,ranglo+1)
                           1400 	; and put the result in (ranghi,ranghi+1)
                           1401 	; accb & ix are preserved
                           1402 	; acca is altered
                           1403 
   EC13 34 06              1404 difnum:	pshs	d	; subtract lo order bytes
   EC15 FC 0F BB           1405 	ldd	ranglo
   EC18 B3 0F B9           1406 	subd	nbrhi
   EC1B FD 0F BD           1407 	std	ranghi
   EC1E 35 86              1408 	puls	d,pc
                           1409 
ASxxxx Assembler V02.21  (Motorola 6809), page 36.
MONDEB - 09
Get Range

                           1411 	.sbttl	Get Range
                           1412 
                           1413 	;===================================================
                           1414 	; this routine scans the input line for a pair of numbers
                           1415 	; representing an address range. a colon separating the
                           1416 	; pair implies "thru", while an "!" implies "thru the
                           1417 	; following"
                           1418 	; e.g., 100:105 is equivalent to 100!5
                           1419 	; a single number implies a range of 1
                           1420 	; on return (ranglo,ranglo+1) holds the range start, and
                           1421 	; (ranghi,ranghi+1) holds the range end
                           1422 	; acca, accb, & ix are not preserved
                           1423 
   EC20 8D 49              1424 gtrang:	bsr	mnumber	; pick up first number
   EC22 2E 03              1425 	bgt	1$
   EC24 2D 09              1426 	blt	2$
   EC26 39                 1427 	rts		; nothing more on input line
                           1428 
                           1429 
   EC27 BE 0F B9           1430 1$:	ldx	nbrhi	; good single number
   EC2A BF 0F BB           1431 	stx	ranglo	; transfer it to ranglo
   EC2D 20 0D              1432 	bra	3$	; and to ranghi
                           1433 
                           1434 	; bad number, but is it bad due to a ":" or "!" delimiter?
                           1435 	; get the terminator for the first number
                           1436 
   EC2F BE 0F B2           1437 2$:	ldx	linptr
   EC32 A6 84              1438 	lda	,x
   EC34 81 3A              1439 	cmpa	#':	; was it a colon?
   EC36 26 0C              1440 	bne	4$	; if not, go test for "!"
   EC38 8D 1A              1441 	bsr	8$	; was ":", process first number &
                           1442 			; get next one
   EC3A 2F 0E              1443 	ble	5$	; illegal if end of line or non-numeric
                           1444 
   EC3C BE 0F B9           1445 3$:	ldx	nbrhi	; transfer second number to ranghi
   EC3F BF 0F BD           1446 	stx	ranghi
   EC42 20 0D              1447 	bra	7$
                           1448 
   EC44 81 21              1449 4$:	cmpa	#'!	; was delimiter a "!"?
   EC46 27 03              1450 	beq	6$	; if yes, get 2nd number
   EC48 4F                 1451 	clra		; illegal delimiter, return
   EC49 4A                 1452 	deca
   EC4A 39                 1453 5$:	rts
                           1454 
   EC4B 8D 07              1455 6$:	bsr	8$	; was "!", process first number &
                           1456 			; get next one
   EC4D 2F FB              1457 	ble	5$
   EC4F 8D B5              1458 	bsr	sumnum	; compute range end, put into ranghi
                           1459 
   EC51 86 01              1460 7$:	lda	#1	; successful exit
   EC53 39                 1461 	rts
                           1462 
                           1463 	; update syntax pointer, move first number to ranglo,
                           1464 	; & get 2nd number
                           1465 
   EC54 BF 0F B0           1466 8$:	stx	synptr	; update syntax pointer
ASxxxx Assembler V02.21  (Motorola 6809), page 37.
MONDEB - 09
Get Range

   EC57 BE 0F B9           1467 	ldx	nbrhi	; get first number of the pair
   EC5A BF 0F BB           1468 	stx	ranglo	; save it in "low range" value
   EC5D 8D 0C              1469 	bsr	mnumber	; pick up the second number of the pair
   EC5F 39                 1470 	rts
                           1471 
ASxxxx Assembler V02.21  (Motorola 6809), page 38.
MONDEB - 09
Get number in IX

                           1473 	.sbttl	Get number in IX
                           1474 
                           1475 	;====================================================
                           1476 	; get a 2 byte number & return it in the index register
                           1477 
   EC60 8D 09              1478 numinx:	bsr	mnumber
   EC62 2E 03              1479 	bgt	1$
   EC64 7E E5 1E           1480 	jmp	badsyn
   EC67 BE 0F B9           1481 1$:	ldx	nbrhi
   EC6A 39                 1482 	rts
                           1483 
ASxxxx Assembler V02.21  (Motorola 6809), page 39.
MONDEB - 09
Scan For a Number

                           1485 	.sbttl	Scan For a Number
                           1486 
                           1487 	;==================================================
                           1488 	; scan for a number
                           1489 	; return the most significant byte in nbrhi
                           1490 	; and the least significant byte in nbrlo
                           1491 	; the result of the scan for a number is returned in
                           1492 	; acca as follows:
                           1493 	;
                           1494 	;	acca=-1: the match was unsuccessful. the syntax
                           1495 	;		pointer (synptr) was not updated.
                           1496 	;
                           1497 	;	acca= 0: the scan was unsuccessful since there
                           1498 	;		were no more characters. (i.e., the end
                           1499 	;		of the line was encountered.)
                           1500 	;
                           1501 	;	acca=+1: the scan was successful. the syntax
                           1502 	;		pointer was updated to the first character
                           1503 	;		following the command.
                           1504 	;
                           1505 	; ix is preserved
                           1506 	; global variables for external communication
                           1507 	; nbrhi - number hi byte
                           1508 	; nbrlo - number lo byte
                           1509 	; ibcode - input base code
                           1510 	; dbcode - display base code
                           1511 	;
                           1512 	; local variables
                           1513 	; nbr2x - used in decimal conversion
                           1514 	; initialize both bytes to zero
                           1515 
   EC6B 34 10              1516 mnumber:pshs	x	; save ix
   EC6D 7F 0F B9           1517 	clr	nbrhi
   EC70 7F 0F BA           1518 	clr	nbrlo
   EC73 BE 0F B0           1519 	ldx	synptr	; initialize the line scanning pointer
   EC76 BF 0F B2           1520 	stx	linptr
   EC79 BD EB 93           1521 	jsr	skpdlm	; are we at end of line?
   EC7C 24 03              1522 	bcc	1$
   EC7E 4F                 1523 	clra		; yes, zero acca
   EC7F 35 90              1524 	puls	x,pc
                           1525 
   EC81 BD ED C5           1526 1$:	jsr	mgetchr	; get a character from the input
                           1527 			; line into accb
   EC84 BD EB C0           1528 	jsr	tstdlm	; test for a delimiter
   EC87 26 5B              1529 	bne	6$	; good delimiter if acca is non-zero
   EC89 C0 30              1530 	subb	#'0	; subtract ascii 0
   EC8B 2B 63              1531 	bmi	8$	; error if less
                           1532 
   EC8D B6 0F B6           1533 	lda	ibcode	; determine input base & go to right routine
   EC90 81 01              1534 	cmpa	#1	; hex code ?
   EC92 27 08              1535 	beq	2$
                           1536 
   EC94 81 02              1537 	cmpa	#2	; decimal code ?
   EC96 27 1E              1538 	beq	4$
                           1539 
   EC98 81 03              1540 	cmpa	#3	; octal code ?
ASxxxx Assembler V02.21  (Motorola 6809), page 40.
MONDEB - 09
Scan For a Number

   EC9A 27 38              1541 	beq	5$
                           1542 
                           1543 	; hex input processing
                           1544 
   EC9C C1 09              1545 2$:	cmpb	#'9-'0	; default an illegal input base to hex
   EC9E 2F 0A              1546 	ble	3$	; if 9 or less
   ECA0 C1 11              1547 	cmpb	#'A-'0
   ECA2 2B 4C              1548 	bmi	8$	; not hex if < A
   ECA4 C1 16              1549 	cmpb	#'F-'0
   ECA6 2E 48              1550 	bgt	8$	; not hex if > F
   ECA8 C0 07              1551 	subb	#7	; move A-F above 0-9
                           1552 
   ECAA 8D 48              1553 3$:	bsr	9$	; shift lo & hi bytes left 4 bits
   ECAC 8D 46              1554 	bsr	9$
   ECAE FA 0F BA           1555 	orb	nbrlo
   ECB1 F7 0F BA           1556 	stb	nbrlo
   ECB4 20 CB              1557 	bra	1$
                           1558 
                           1559 	; decimal input
                           1560 
   ECB6 C1 09              1561 4$:	cmpb	#9
   ECB8 2E 36              1562 	bgt	8$	; not decimal if > 9
                           1563 
                           1564 	; multiply saved value by 10 & add in new digit
                           1565 
   ECBA 8D 40              1566 	bsr	10$	; multiply current number by 2 to get 2x value
   ECBC BE 0F B9           1567 	ldx	nbrhi	; save this *2 number temporarily
   ECBF BF 0F E2           1568 	stx	nbr2x
   ECC2 8D 30              1569 	bsr	9$	; multiply this # by 4 to get 8x value
   ECC4 4F                 1570 	clra		; new digit <a,b>
   ECC5 F3 0F E2           1571 	addd	nbr2x	; note that 10x=2x+8x
   ECC8 25 26              1572 	bcs	8$	; carry out of ms byte is an error
   ECCA F3 0F B9           1573 	addd	nbrhi
   ECCD 25 21              1574 	bcs	8$	; carry out of ms byte is an error
   ECCF FD 0F B9           1575 	std	nbrhi	; save result
   ECD2 20 AD              1576 	bra	1$
                           1577 
                           1578 	; octal input
                           1579 
   ECD4 C1 07              1580 5$:	cmpb	#7
   ECD6 2E 18              1581 	bgt	8$	; not octal if > 7
   ECD8 8D 1A              1582 	bsr	9$	; shift hi & lo bytes 3 places left
   ECDA 8D 20              1583 	bsr	10$	; carry out of hibyte is illegal
   ECDC FA 0F BA           1584 	orb	nbrlo	; add in new digit
   ECDF F7 0F BA           1585 	stb	nbrlo
   ECE2 20 9D              1586 	bra	1$
                           1587 
   ECE4 BE 0F B2           1588 6$:	ldx	linptr	; good number - scan was successful
   ECE7 BF 0F B0           1589 	stx	synptr	; update good syntax line pointer
   ECEA 86 01              1590 	lda	#1	; set "good scan" flag
   ECEC 35 90              1591 	puls	x,pc
                           1592 
   ECEE 32 62              1593 7$:	leas	2,s
   ECF0 4F                 1594 8$:	clra		; conversion error - scan was unsuccessful
   ECF1 4A                 1595 	deca
   ECF2 35 90              1596 	puls	x,pc
ASxxxx Assembler V02.21  (Motorola 6809), page 41.
MONDEB - 09
Scan For a Number

                           1597 
   ECF4 78 0F BA           1598 9$:	asl	nbrlo	; shift a two byte number left one position
   ECF7 79 0F B9           1599 	rol	nbrhi
   ECFA 25 F2              1600 	bcs	7$
   ECFC 78 0F BA           1601 10$:	asl	nbrlo	; shift a two byte number left one position
   ECFF 79 0F B9           1602 	rol	nbrhi
   ED02 25 EA              1603 	bcs	7$
   ED04 39                 1604 	rts
                           1605 
ASxxxx Assembler V02.21  (Motorola 6809), page 42.
MONDEB - 09
General Output Routines

                           1607 	.sbttl	General Output Routines
                           1608 
                           1609 	;===========================================
                           1610 	; output a space
                           1611 
   ED05 86 20              1612 outsp:	lda	#' 
   ED07 BD EF 88           1613 	jsr	outchr
   ED0A 39                 1614 	rts
                           1615 
                           1616 	;===========================================
                           1617 	; output an "=" sign
                           1618 
   ED0B 86 3D              1619 outeq:	lda	#'=
   ED0D BD EF 88           1620 	jsr	outchr
   ED10 39                 1621 	rts
                           1622 
                           1623 	;==========================================
                           1624 	; output a 1 byte number
                           1625 
   ED11 34 06              1626 out1by:	pshs	d
   ED13 C6 01              1627 	ldb	#1
   ED15 8D 0A              1628 	bsr	outnum
   ED17 35 86              1629 	puls	d,pc
                           1630 
                           1631 	;==========================================
                           1632 	; output a 2 byte number
                           1633 
   ED19 34 06              1634 out2by:	pshs	d
   ED1B C6 02              1635 	ldb	#2
   ED1D 8D 02              1636 	bsr	outnum
   ED1F 35 86              1637 	puls	d,pc
                           1638 
                           1639 	;==========================================
                           1640 	; display the number pointed at by the address in the
                           1641 	; index register and output it according to the base
                           1642 	; specified in "dbcode"
                           1643 	; leading zeros are included
                           1644 	; acca & ix are preserved
                           1645 	; accb is input as the number of bytes comprising the
                           1646 	; number.
                           1647 	; global variables for external communication
                           1648 	; ibcode - input base code
                           1649 	; dbcode - display base code
                           1650 	;
                           1651 	; local variables
                           1652 	; decdig - decimal digit being built
                           1653 	; numbhi - hi byte of number being output
                           1654 	; numblo - lo byte of number being output
                           1655 
   ED21 34 16              1656 outnum:	pshs	d,x	; save these
   ED23 AE 84              1657 	ldx	,x	; get the two bytes at that address
   ED25 BF 0F E0           1658 	stx	numbhi	; put them in a scratch area for processing
   ED28 B6 0F B7           1659 	lda	dbcode	; get display base
                           1660 
   ED2B 81 01              1661 	cmpa	#1
   ED2D 27 0C              1662 	beq	1$
ASxxxx Assembler V02.21  (Motorola 6809), page 43.
MONDEB - 09
General Output Routines

   ED2F 81 02              1663 	cmpa	#2
   ED31 27 1C              1664 	beq	4$
   ED33 81 03              1665 	cmpa	#3
   ED35 27 52              1666 	beq	11$
   ED37 81 04              1667 	cmpa	#4
   ED39 27 6C              1668 	beq	14$
                           1669 
                           1670 	; output a hex number
                           1671 
   ED3B 58                 1672 1$:	aslb		; 1 byte=2 chars, 2 bytes=4 chars
   ED3C 8D 77              1673 2$:	bsr	16$	; get next 4 bits
   ED3E 8D 75              1674 	bsr	16$
                           1675 
   ED40 84 0F              1676 	anda	#0x0f	; extract 4 bits
   ED42 81 09              1677 	cmpa	#9
   ED44 2F 02              1678 	ble	3$
   ED46 8B 07              1679 	adda	#7	; convert 10:15 to A-F
                           1680 
   ED48 8D 75              1681 3$:	bsr	18$
   ED4A 5A                 1682 	decb
   ED4B 26 EF              1683 	bne	2$
   ED4D 35 96              1684 	puls	d,x,pc	; restore registers & return
                           1685 
                           1686 	; output a decimal number
                           1687 
   ED4F 5A                 1688 4$:	decb		; test # of bytes to output
   ED50 27 08              1689 	beq	5$
   ED52 8E ED 7F           1690 	ldx	#9$	; initialize for output of a 2 byte number
   ED55 FC 0F E0           1691 	ldd	numbhi
   ED58 20 07              1692 	bra	6$
                           1693 
   ED5A 8E ED 83           1694 5$:	ldx	#10$	; initialize for output of a 1 byte number
   ED5D 4F                 1695 	clra
   ED5E F6 0F E0           1696 	ldb	numbhi
   ED61 7F 0F DF           1697 6$:	clr	decdig	; clear the digit to output
   ED64 A3 84              1698 7$:	subd	,x	; subtract the power of 10 conversion constant
   ED66 25 05              1699 	bcs	8$	; test for borrow (carry)
   ED68 7C 0F DF           1700 	inc	decdig	; no borrow yet - nc digit being built
   ED6B 20 F7              1701 	bra	7$	; repeat loop
                           1702 
                           1703 	; building of digit to output is complete - print it
                           1704 
   ED6D 34 02              1705 8$:	pshs	a	; save lo byte of number being output
   ED6F B6 0F DF           1706 	lda	decdig	; get digit
   ED72 8D 4B              1707 	bsr	18$	; print it
   ED74 35 02              1708 	puls	a	; restore lo byte
                           1709 
   ED76 E3 81              1710 	addd	,x++	; borrow generated - cancel last subtraction
   ED78 8C ED 89           1711 	cpx	#9$+10	; are we thru with units conversion?
   ED7B 26 E4              1712 	bne	6$	; if not, back to get next digit
   ED7D 35 96              1713 	puls	d,x,pc	; if yes, restore registers & return
                           1714 
                           1715 	; decimal output conversion constants
                           1716 
   ED7F 27 10              1717 9$:	.word	10000
   ED81 03 E8              1718 	.word	1000
ASxxxx Assembler V02.21  (Motorola 6809), page 44.
MONDEB - 09
General Output Routines

   ED83 00 64              1719 10$:	.word	100
   ED85 00 0A              1720 	.word	10
   ED87 00 01              1721 	.word	1
                           1722 
                           1723 	; output an octal number
                           1724 
   ED89 58                 1725 11$:	aslb		; first approximation of # of
   ED8A 4F                 1726 	clra		; digits to output
   ED8B C1 02              1727 	cmpb	#2
   ED8D 2E 06              1728 	bgt	12$
   ED8F 8D 24              1729 	bsr	16$	; 1 byte - get first 2 bits
   ED91 8D 2C              1730 	bsr	18$
   ED93 20 05              1731 	bra	13$	; go output last 2 digits
                           1732 
   ED95 8D 20              1733 12$:	bsr	17$	; two byte # - output hi order bit/digit
   ED97 8D 26              1734 	bsr	18$
   ED99 5C                 1735 	incb		; 5 more digits to go
                           1736 
   ED9A 8D 19              1737 13$:	bsr	16$	; get next 3 bits
   ED9C 8D 19              1738 	bsr	17$
   ED9E 84 07              1739 	anda	#7	; extract 3 bits
   EDA0 8D 1D              1740 	bsr	18$
   EDA2 5A                 1741 	decb		; count this digit
   EDA3 26 F5              1742 	bne	13$	; are we done?
   EDA5 35 96              1743 	puls	d,x,pc	; if yes, restore registers & return
                           1744 
   EDA7 58                 1745 14$:	aslb	; output a binary number
   EDA8 58                 1746 	aslb
   EDA9 58                 1747 	aslb
   EDAA 8D 0B              1748 15$:	bsr	17$	; get next bit
   EDAC 84 01              1749 	anda	#1	; extract the bit
   EDAE 8D 0F              1750 	bsr	18$	; output it
   EDB0 5A                 1751 	decb		; count it
   EDB1 26 F7              1752 	bne	15$	; are we done?
   EDB3 35 96              1753 	puls	d,x,pc	; if yes, restore registers & return
                           1754 
   EDB5 8D 00              1755 16$:	bsr	17$	; left shift 2 bits
                           1756 
   EDB7 78 0F E1           1757 17$:	asl	numblo	; left shift the 3 byte number 1 bit
   EDBA 79 0F E0           1758 	rol	numbhi
   EDBD 49                 1759 	rola
   EDBE 39                 1760 	rts
                           1761 
   EDBF 8B 30              1762 18$:	adda	#'0	; convert to a numeric ascii digit & output it
   EDC1 BD EF 88           1763 	jsr	outchr
   EDC4 39                 1764 	rts
                           1765 
ASxxxx Assembler V02.21  (Motorola 6809), page 45.
MONDEB - 09
Get Character Routines

                           1767 	.sbttl	Get Character Routines
                           1768 
                           1769 	;=================================================
                           1770 	; this routine gets the next character from the input
                           1771 	; line buffer
                           1772 	; acca is preserved
                           1773 	; accb is loaded with the character
                           1774 	; ix is incremented and left pointing to the character
                           1775 	; returned
                           1776 
   EDC5                    1777 mgetchr:
   EDC5 BE 0F B2           1778 	ldx	linptr
   EDC8 30 01              1779 	inx
   EDCA E6 84              1780 	ldb	,x
   EDCC BF 0F B2           1781 	stx	linptr
   EDCF 7F 0F B4           1782 	clr	bolflg	; set flag to not at "beginning of line"
   EDD2 39                 1783 	rts
                           1784 
                           1785 	;==================================================
                           1786 	; this routine gets the next character in the command
                           1787 	; lists
                           1788 	; acca is the character retrieved
                           1789 	; accb is preserved
                           1790 	; ix is incremented & left pointing to the character returned
                           1791 
   EDD3 BE 0F DD           1792 getlst:	ldx	lisptr	; get current list pointer
   EDD6 30 01              1793 	inx		; move pointer to next character
   EDD8 A6 84              1794 	lda	,x	; get character pointed at
   EDDA BF 0F DD           1795 	stx	lisptr	; save pointer
   EDDD 39                 1796 	rts		; and return
                           1797 
ASxxxx Assembler V02.21  (Motorola 6809), page 46.
MONDEB - 09
Command Lists

                           1799 	.sbttl	Command Lists
                           1800 
                           1801 	;=====================================================
                           1802 	; command lists
                           1803 	;  a carriage return signifies end-of-command
                           1804 	;  a line feed signifies end-of-command-list
                           1805 	; list 1 - major commands
                           1806 
   EDDE 42 52 45 41 4B     1807 comlst:	.ascii	/BREAK/		; set breakpoint (swi code)
   EDE3 0D                 1808 	.byte	cr
   EDE4 43 4F 4E 54 49 4E  1809 	.ascii	/CONTINUE/	; continue from "swi"
        55 45
   EDEC 0D                 1810 	.byte	cr
   EDED 43 4F 4D 50 41 52  1811 	.ascii	/COMPARE/	; print sum & difference of 2 numbers
        45
   EDF4 0D                 1812 	.byte	cr
   EDF5 43 4F 50 59        1813 	.ascii	/COPY/		; copy from one location to another
   EDF9 0D                 1814 	.byte	cr
   EDFA 44 49 53 50 4C 41  1815 	.ascii	/DISPLAY/	; display memory data
        59
   EE01 0D                 1816 	.byte	cr
   EE02 44 42 41 53 45     1817 	.ascii	/DBASE/		; set display base
   EE07 0D                 1818 	.byte	cr
   EE08 44 45 4C 41 59     1819 	.ascii	/DELAY/		; delay specified # of bytes
   EE0D 0D                 1820 	.byte	cr
   EE0E 44 55 4D 50        1821 	.ascii	/DUMP/		; dump memory in mikbug or image format
   EE12 0D                 1822 	.byte	cr
   EE13 47 4F 54 4F        1823 	.ascii	/GOTO/		; go to memory address
   EE17 0D                 1824 	.byte	cr
   EE18 48 45 4C 50        1825 	.ascii	/HELP/		; help listing
   EE1C 0D                 1826 	.byte	cr
   EE1D 49 42 41 53 45     1827 	.ascii	/IBASE/		; set input base
   EE22 0D                 1828 	.byte	cr
   EE23 4C 4F 41 44        1829 	.ascii	/LOAD/		; load mikbug tape
   EE27 0D                 1830 	.byte	cr
   EE28 52 45 47           1831 	.ascii	/REG/		; display registers
   EE2B 0D                 1832 	.byte	cr
   EE2C 53 45 54           1833 	.ascii	/SET/		; set memory data
   EE2F 0D                 1834 	.byte	cr
   EE30 53 45 41 52 43 48  1835 	.ascii	/SEARCH/	; search memory for a byte string
   EE36 0D                 1836 	.byte	cr
   EE37 54 45 53 54        1837 	.ascii	/TEST/		; test a range of memory
   EE3B 0D                 1838 	.byte	cr
   EE3C 56 45 52 49 46 59  1839 	.ascii	/VERIFY/	; verify that memory content is unchanged
   EE42 0D                 1840 	.byte	cr
   EE43 43 4C 49           1841 	.ascii	/CLI/		; clear interrupt mask
   EE46 0D                 1842 	.byte	cr
   EE47 43 4C 46           1843 	.ascii	/CLF/		; clear fast interrupt mask
   EE4A 0D                 1844 	.byte	cr
   EE4B 53 45 49           1845 	.ascii	/SEI/		; set interrupt mask
   EE4E 0D                 1846 	.byte	cr
   EE4F 53 45 46           1847 	.ascii	/SEF/		; set fast interrupt mask
   EE52 0D                 1848 	.byte	cr
   EE53 49 52 51           1849 	.ascii	/IRQ/		; set interrupt pointer
   EE56 0D                 1850 	.byte	cr
   EE57 46 49 52 51        1851 	.ascii	/FIRQ/		; set fast interrupt pointer
ASxxxx Assembler V02.21  (Motorola 6809), page 47.
MONDEB - 09
Command Lists

   EE5B 0D                 1852 	.byte	cr
   EE5C 4E 4D 49           1853 	.ascii	/NMI/		; set non-maskable interrupt pointer
   EE5F 0D                 1854 	.byte	cr
   EE60 52 53 52 56 44     1855 	.ascii	/RSRVD/		; set reserved interrupt pointer
   EE65 0D                 1856 	.byte	cr
   EE66 53 57 49           1857 	.ascii	/SWI/		; set software interrupt pointer
   EE69 0D                 1858 	.byte	cr
   EE6A 53 57 49 32        1859 	.ascii	/SWI2/		; set swi2 interrupt pointer
   EE6E 0D                 1860 	.byte	cr
   EE6F 53 57 49 33        1861 	.ascii	/SWI3/		; set swi3 interrupt pointer
   EE73 0D                 1862 	.byte	cr
   EE74 0A                 1863 	.byte	lf		; end of list 1
                           1864 
                           1865 	; list 2 - modifier to dump
                           1866 
   EE75 54 4F              1867 	.ascii	/TO/		; destination
   EE77 0D                 1868 	.byte	cr
   EE78 0A                 1869 	.byte	lf		; end of list 2
                           1870 
                           1871 	; list 3 - number base specifiers
                           1872 
   EE79 48 45 58           1873 	.ascii	/HEX/		; base 16
   EE7C 0D                 1874 	.byte	cr
   EE7D 44 45 43           1875 	.ascii	/DEC/		; base 10
   EE80 0D                 1876 	.byte	cr
   EE81 4F 43 54           1877 	.ascii	/OCT/		; base 8
   EE84 0D                 1878 	.byte	cr
   EE85 42 49 4E           1879 	.ascii	/BIN/		; base 2
   EE88 0D                 1880 	.byte	cr
   EE89 0A                 1881 	.byte	lf		; end of list 3
                           1882 
                           1883 	; list 4 - information request
                           1884 
   EE8A 3F                 1885 	.ascii	/?/
   EE8B 0D                 1886 	.byte	cr
   EE8C 0A                 1887 	.byte	lf		; end of list 4
                           1888 
                           1889 	; list 5 - register names
                           1890 
   EE8D 2E 43 43           1891 	.ascii	/.CC/
   EE90 0D                 1892 	.byte	cr
   EE91 2E 41              1893 	.ascii	/.A/
   EE93 0D                 1894 	.byte	cr
   EE94 2E 42              1895 	.ascii	/.B/
   EE96 0D                 1896 	.byte	cr
   EE97 2E 44 50           1897 	.ascii	/.DP/
   EE9A 0D                 1898 	.byte	cr
   EE9B 2E 49 58           1899 	.ascii	/.IX/
   EE9E 0D                 1900 	.byte	cr
   EE9F 2E 49 59           1901 	.ascii	/.IY/
   EEA2 0D                 1902 	.byte	cr
   EEA3 2E 49 55           1903 	.ascii	/.IU/
   EEA6 0D                 1904 	.byte	cr
   EEA7 2E 41 42           1905 	.ascii	/.AB/
   EEAA 0D                 1906 	.byte	cr
   EEAB 2E 50 43           1907 	.ascii	/.PC/
ASxxxx Assembler V02.21  (Motorola 6809), page 48.
MONDEB - 09
Command Lists

   EEAE 0D                 1908 	.byte	cr
   EEAF 2E 53 50           1909 	.ascii	/.SP/
   EEB2 0D                 1910 	.byte	cr
   EEB3 0A                 1911 	.byte	lf		; end of list 5
                           1912 
                           1913 	; list 6 - modifiers to "display"
                           1914 
   EEB4 44 41 54 41        1915 	.ascii	/DATA/
   EEB8 0D                 1916 	.byte	cr
   EEB9 55 53 45 44        1917 	.ascii	/USED/
   EEBD 0D                 1918 	.byte	cr
   EEBE 0A                 1919 	.byte	lf		; end of list 6
                           1920 
                           1921 	; list 7 - modifier to "load"
                           1922 
   EEBF 46 52 4F 4D        1923 	.ascii	/FROM/		; source
   EEC3 0D                 1924 	.byte	cr
   EEC4 0A                 1925 	.byte	lf		; end of list 7
                           1926 
                           1927 
ASxxxx Assembler V02.21  (Motorola 6809), page 49.
MONDEB - 09
Get a line

                           1929 	.sbttl	Get a line
                           1930 
                           1931 	;=======================================================
                           1932 	;
                           1933 	; this routine constructs a line of input by getting all
                           1934 	; input characters up to and including a carriage return
                           1935 	; (which then designates "end of line").
                           1936 	; typing rubout will delete the previous character
                           1937 	; typing control-c will abort the line
                           1938 	; typing control-z will use the previous line
                           1939 	; the input line is stored beginning at the address
                           1940 	; stored in bufbeg and ending at the address stored
                           1941 	; in bufend
                           1942 	; acca, accb, & ix are not preserved
                           1943 	;
                           1944 	; global variables
                           1945 	; bufbeg - input line start of buffer
                           1946 	; bufend - input line end of buffer
                           1947 	;
                           1948 	; local constants
                           1949 
   EEC5 BE 0F AA           1950 getlin:	ldx	bufbeg	; set pointer to one less than
                           1951 			; the beginning of the line buffer
   EEC8 5F                 1952 	clrb		; accb holds last input char
   EEC9 BC 0F AC           1953 1$:	cpx	bufend	; check current line end against buffer end
   EECC 26 09              1954 	bne	2$
                           1955 
                           1956 	; line too long - abort it as if a control-c had been typed
                           1957 
   EECE 8E EF FB           1958 	ldx	#msgltl	; get message
   EED1 BD EF 65           1959 	jsr	outstr	; output it
   EED4 C6 03              1960 	ldb	#3	; put ctl-c in accb
   EED6 39                 1961 	rts
                           1962 
   EED7 BD EF 75           1963 2$:	jsr	inpchr	; get a character (returned in acca)
   EEDA 84 7F              1964 	anda	#0x7f	; drop parity bit
                           1965 
                           1966 	; control-z copies from present position to previous end of line
                           1967 
   EEDC 81 1A              1968 	cmpa	#26	; is char a control-z?
   EEDE 26 04              1969 	bne	3$
   EEE0 BD EF C4           1970 	jsr	docrlf	; yes, type cr-lf
   EEE3 39                 1971 	rts
                           1972 
   EEE4 81 0D              1973 3$:	cmpa	#13	; is char a cr?
   EEE6 27 04              1974 	beq	4$
   EEE8 81 0A              1975 	cmpa	#10	; or a lf?
   EEEA 26 0D              1976 	bne	6$
   EEEC 30 01              1977 4$:	inx
   EEEE A7 84              1978 	sta	,x	; yes, store the terminator
   EEF0 7D 0F CB           1979 	tst	hdxflg	; test for half-duplex terminal
   EEF3 26 03              1980 	bne	5$
   EEF5 BD EF C4           1981 	jsr	docrlf	; type cr-lf
   EEF8 39                 1982 5$:	rts		; now return
                           1983 
   EEF9 81 03              1984 6$:	cmpa	#3	; is char a control-c?
ASxxxx Assembler V02.21  (Motorola 6809), page 50.
MONDEB - 09
Get a line

   EEFB 26 09              1985 	bne	7$	; no
   EEFD 1F 89 4D           1986 	tab		; return ctl-c in accb
   EF00 86 5E              1987 	lda	#'^	; echo an up-arrow
   EF02 BD EF 88           1988 	jsr	outchr
   EF05 39                 1989 	rts
                           1990 
   EF06 81 7F              1991 7$:	cmpa	#127	; no, is it delete?
   EF08 27 11              1992 	beq	10$	; yes - delete character
   EF0A 30 01              1993 	inx		; not a delete, so advance to next char
   EF0C A7 84              1994 	sta	,x	; store it in inplin
   EF0E 1F 89 4D           1995 	tab		; last character in b
   EF11 7D 0F CB           1996 	tst	hdxflg	; check half duplex
   EF14 26 03              1997 	bne	9$	; yes - skip
   EF16 BD EF 88           1998 	jsr	outchr	; echo character
   EF19 20 AE              1999 9$:	bra	1$	; get another
                           2000 
                           2001 	; current character is a delete
                           2002 	; test line length - if its zero, ignore this delete
                           2003 	; since we can't delete prior to first char in input line
                           2004 
   EF1B BC 0F AA           2005 10$:	cpx	bufbeg
   EF1E 27 A9              2006 	beq	1$
   EF20 34 10              2007 	pshs	x
   EF22 8E EF 2D           2008 	ldx	#11$	; delete character on screen
   EF25 8D 3E              2009 	bsr	outstr
   EF27 35 10              2010 	puls	x
   EF29 E6 82              2011 	ldb	,-x	; last character
   EF2B 20 9C              2012 	bra	1$
                           2013 
   EF2D 08 20 08 04        2014 11$:	.byte  8,32,8,4	; BS, SPACE, BS, EOT
                           2015 
                           2016 
                           2017 	;====================================================
                           2018 	; initialization routine
                           2019 
   EF31 86 01              2020 inital:	lda	#1
   EF33 B7 0F B6           2021 	sta	ibcode	; set input base to hex
   EF36 B7 0F B7           2022 	sta	dbcode	; set display base to hex
                           2023 
                           2024 	; set up display base number
                           2025 
   EF39 86 10              2026 	lda	#16
   EF3B B7 0F B8           2027 	sta	dbnbr
                           2028 
                           2029 	; max # of characters per line
                           2030 
   EF3E 86 48              2031 	lda	#72
   EF40 B7 0F CD           2032 	sta	cplmax
   EF43 7F 0F C7           2033 	clr	inpflg	; default input from terminal
   EF46 7F 0F C8           2034 	clr	outflg	; default output to terminal
   EF49 7F 0F CB           2035 	clr	hdxflg	; clear	half-duplex flag
                           2036 
                           2037 	; set up swi interrupt address pointer
                           2038 
   EF4C 8E E5 C8           2039 	ldx	#typswi	; type "swi" & do "reg" command
   EF4F BF 0F FA           2040 	stx	.swi
ASxxxx Assembler V02.21  (Motorola 6809), page 51.
MONDEB - 09
Get a line

                           2041 
                           2042 	; clear breakpoint address
                           2043 
   EF52 CC FF FE           2044 	ldd	#0xfffe	; normal systems have rom here
   EF55 FD 0F C4           2045 	std	brkadr
                           2046 
                           2047 	; initialize to mondeb's command lists
                           2048 
   EF58 8E ED DD           2049 	ldx	#comlst-1
   EF5B BF 0F AE           2050 	stx	comadr
                           2051 
                           2052 	; time constant for a .5 microsecond clock
                           2053 
   EF5E CC 01 1D           2054 	ldd	#285
   EF61 FD 0F E4           2055 	std	timcon
                           2056 
   EF64 39                 2057 	rts
                           2058 
                           2059 	;===================================================
                           2060 	; output a character string which begins at the address
                           2061 	; in the index register
                           2062 	; acca & accb are preserved
                           2063 	; ix is left pointing to the string terminator
                           2064 
   EF65 34 02              2065 outstr:	pshs	a
   EF67 A6 84              2066 1$:	lda	,x	; get char pointed to
   EF69 81 04              2067 	cmpa	#4	; is it a string terminator?
   EF6B 27 06              2068 	beq	2$	; done if it is
   EF6D 8D 19              2069 	bsr	outchr	; isn't, output it
   EF6F 30 01              2070 	inx		; on to next char
   EF71 20 F4              2071 	bra	1$
   EF73 35 82              2072 2$:	puls	a,pc
                           2073 
                           2074 	;=====================================================
                           2075 	; input a character
                           2076 
   EF75 7D 0F C7           2077 inpchr:	tst	inpflg	; console ?
   EF78 26 07              2078 	bne	2$
                           2079 
   EF7A AD 9F 0F E8        2080 1$:	jsr	[conin]	; tst for a character
   EF7E 24 FA              2081 	bcc	1$	; none - loop until there is
   EF80 39                 2082 	rts
                           2083 
   EF81 AD 9F 0F EC        2084 2$:	jsr	[altin]	; tst for a character
   EF85 24 FA              2085 	bcc	2$	; none - loop until there is
   EF87 39                 2086 	rts
                           2087 
                           2088 	;======================================================
                           2089 	; output the character in acca to the desired output
                           2090 	; device/location
                           2091 	; if outflg = 0, output is to terminal
                           2092 	; if outflg # 0, output is to address in outadr
                           2093 	;    & this address is then incremented
                           2094 
   EF88 34 16              2095 outchr:	pshs	d,x	; save d and x
   EF8A F6 0F C8           2096 	ldb	outflg	; test output destination flag
ASxxxx Assembler V02.21  (Motorola 6809), page 52.
MONDEB - 09
Get a line

   EF8D 5A                 2097 	decb
   EF8E 2F 0A              2098 	ble	1$	; skip this code if terminal output
                           2099 
                           2100 	; output to something other than terminal
                           2101 
   EF90 BE 0F C9           2102 	ldx	outadr	; get output char destination addr
   EF93 A7 80              2103 	sta	,x+	; save char in memory
   EF95 BF 0F C9           2104 	stx	outadr	; update output address
   EF98 35 96              2105 	puls	d,x,pc
                           2106 
   EF9A 81 0A              2107 1$:	cmpa	#lf	; ignore line feeds
   EF9C 26 02              2108 	bne	2$
   EF9E 35 96              2109 	puls	d,x,pc
                           2110 
   EFA0 81 0D              2111 2$:	cmpa	#cr	; test for carriage return
   EFA2 26 04              2112 	bne	3$
   EFA4 8D 1E              2113 	bsr	docrlf
   EFA6 35 96              2114 	puls	d,x,pc
                           2115 
   EFA8 F6 0F CC           2116 3$:	ldb	cplcnt	; get "chars per line" count
   EFAB F1 0F CD           2117 	cmpb	cplmax
   EFAE 2C 0B              2118 	bge	4$	; send cr-lf if greater
                           2119 
                           2120 	; less than max, but also send cr-lf if 10 from end and
                           2121 	; printing a space
                           2122 
   EFB0 CB 0A              2123 	addb	#10
   EFB2 F1 0F CD           2124 	cmpb	cplmax
   EFB5 2D 06              2125 	blt	5$
   EFB7 81 20              2126 	cmpa	#' 	; near end, test if about to print a space
   EFB9 26 02              2127 	bne	5$
                           2128 
                           2129 	; terminal line full or nearly full - interject a cr-lf
                           2130 
   EFBB 8D 07              2131 4$:	bsr	docrlf
   EFBD 7C 0F CC           2132 5$:	inc	cplcnt	; bump counter
   EFC0 8D 11              2133 	bsr	chrout	; send it to acia1
   EFC2 35 96              2134 	puls	d,x,pc
                           2135 
                           2136 	;======================================================
                           2137 	; send a carriage return-line feed to the terminal
                           2138 
   EFC4 34 06              2139 docrlf:	pshs	d
   EFC6 86 0D              2140 	lda	#cr
   EFC8 8D 09              2141 	bsr	chrout
   EFCA 86 0A              2142 	lda	#lf
   EFCC 8D 05              2143 	bsr	chrout
   EFCE 7F 0F CC           2144 	clr	cplcnt	; zero "chars/line" count
   EFD1 35 86              2145 	puls	d,pc
                           2146 
                           2147 	;======================================================
                           2148 	; send char in acca
                           2149 
   EFD3 7D 0F C8           2150 chrout:	tst	outflg	; check destination
   EFD6 26 04              2151 	bne	1$
   EFD8 6E 9F 0F EA        2152 	jmp  [conout]	; output a character
ASxxxx Assembler V02.21  (Motorola 6809), page 53.
MONDEB - 09
Get a line

   EFDC 6E 9F 0F EE        2153 1$:	jmp  [altout]
                           2154 
                           2155 	;======================================================
                           2156 	; misc text
                           2157 
   EFE0 4D 4F 4E 44 45 42  2158 msghed:	.ascii	/MONDEB-09 1.00/
        2D 30 39 20 31 2E
        30 30
   EFEE 0D 04              2159 	.byte	cr,4
   EFF0 2A 04              2160 msgprm:	.byte	'*,4
   EFF2 0D 0A              2161 msgswi:	.byte	cr,lf
   EFF4 73 77 69 3A        2162 	.ascii	/swi:/
   EFF8 0D 0A 04           2163 	.byte	cr,lf,4
   EFFB 74 6F 6F 20 6C 6F  2164 msgltl:	.ascii	/too long/
        6E 67
   F003 04                 2165 	.byte	4
   F004 6E 6F 74 20 73 65  2166 msgnbr:	.ascii	/not set/
        74
   F00B 04                 2167 	.byte	4
   F00C 73 65 74 20 40 20  2168 msgbat:	.ascii	/set @ /
   F012 04                 2169 	.byte	4
   F013 6F 6B              2170 msgver:	.ascii	/ok/
   F015 04                 2171 	.byte	4
   F016 63 68 65 63 6B 73  2172 msgnve:	.ascii	/checksum error /
        75 6D 20 65 72 72
        6F 72 20
   F025 04                 2173 	.byte	4
   F026 63 61 6E 27 74 20  2174 msgccl:	.ascii	/can't clear/
        63 6C 65 61 72
   F031 04                 2175 	.byte	4
   F032 63 61 6E 27 74 20  2176 msgcso:	.ascii	/can't set to ones/
        73 65 74 20 74 6F
        20 6F 6E 65 73
   F043 04                 2177 	.byte	4
   F044 73 75 6D 20 69 73  2178 msgsis:	.ascii	/sum is /
        20
   F04B 04                 2179 	.byte	4
   F04C 2C 20 64 69 66 20  2180 msgdis:	.ascii	/, dif is /
        69 73 20
   F055 04                 2181 	.byte	4
   F056 0D 0A 00 00 53 31  2182 msgs1:	.byte	cr,lf,0,0,'S,'1,4
        04
   F05D 0D 0A 00           2183 msgs9:	.byte	cr,lf,0
   F060 53 39 30 33 30 30  2184 	.ascii	/S9030000FC/
        30 30 46 43
   F06A 0D 0A 04           2185 	.byte	cr,lf,4
   F06D 63 68 61 72 20 6E  2186 msgcnh:	.ascii	/char not hex/
        6F 74 20 68 65 78
   F079 0D 04              2187 	.byte	cr,4
                           2188 
