AS11, an absolute assembler for Motorola MCU's, version 1.2e

                        *
                        * Tutor1.asm -- Tutorial program 1 for FOX11 board
                        *               with Wytec Phantom Monitor, (c)2003, EVBplus.com
                        *		Written By Wayne Chu
                        *
                        *     Function:	This program sums up 4 numbers and store the sum
                        *		at the RAM locations \sum (0 and 1), its average at
                        *		the RAM locations \average (2 and 3).
                        *
                        *     Instructions: 
                        *		1. Use P command to enter the addresses to be 
                        *		   monitored, such as p \sum, \average.
                        *		2. Use B command to set breakpoints at addresses
                        *		   \next and \finish, such as B \next, B \finish. 
                        *	*******	For your convenience, we did above 2 steps for you
                        *
                        *		3. Enter G \start command to run the program
                        *		   until it stops at a breakpoint address, then enter
                        *		   G command to run and until it stops at another
                        *		   breakpoint address. Repeat the G command until it
                        *		   stops at \finish.
                        *		   when it stops at each breakpoint address, you can
                        *		   watch the values at the locations \sum and \average.
                        *
                        * 		You can also verify the result using the F7 math
                        *		function key at each stop.
                        *
                        *
0040                    sum:	 equ	$40
0050                    average: equ	$50
00ff                    STACK:   equ    $ff		; stack at top of data ram
                        *
                        
f000                            org     $F000           ; program code starts here
f000 8e 00 ff           start:	lds	#STACK
f003 ce 00 00           	ldx	#0
f006                    clr_more:
f006 6f 00              	clr	0,x		; clear RAM locations $0-$7F
f008 08                 	inx
f009 8c 00 80           	cpx	#$80
f00c 26 f8              	bne	clr_more
                        
f00e 0e                 	cli			; enable interrupt globely
                        
f00f 18 ce 00 00        begin:	ldy	#0
f013 ce f0 2c           	ldx	#DATA
f016 e6 00              next:	ldab	0,x		; get data
f018 27 09              	beq	done		; done when reaching the end of data
f01a 18 3a                      aby			; add data and store in register y
f01c 18 df 40           	sty	sum
f01f 08                 	inx			; get next data
f020 7e f0 16           	jmp	next
                        
f023 18 8f              done:	xgdy			; exchange register y with register D
f025 04                 	lsrd			; right shift the 16 bit register D
                        *				; 0 is shifted into bit 15,
                        *				; this equals the reister D / 2
f026 04                 	lsrd			; divided by 2 again
f027 dd 50              	std	average		; store the average 
f029 7e f0 29           finish:	jmp	finish
                        *
f02c 10 55 aa 96 00     DATA:	fcb	$10,$55,$aa,$96,0
                        *
fffe                    	org	$FFFE
fffe f0 00              	fdb	start
                        	end
                        *	
                        

Executed: Sat Dec 31 02:27:57 2005
Total cycles: 70, Total bytes: 51
Total errors: 0, Total warnings: 0
