*
* Echo.asm ---- Test BUFFALO I/O for FOX11 board
*               with Wytec Phantom Monitor,(c)2003, EVBplus.com
* 		Written By Wayne Chu
*
*     Function:	Reads keyboard input and output it to PC's CRT screen.
*		works like a typewriter.
*
*		When a BUFFALO output routine is called by user program,
*		the PC's CRT will switch to a new output screen to display
*		the characters. It will	restore the debugger screen when the
*		program is stopped.

*		After user program is stopped by esc key, it must be 
*		re-started from the beginning in order to show the new 
*		output screen.

* 		All EVB/EVBU BUFFALO I/O routines are located at $0FA0-$0FCF
*		in stead of $FFA0-$FFCF.
*
*
STACK:  	equ     $FF
*
        	org     $0800	; EVBplus2 board I/O routines
rs485_recv:     rmb     3	; enables RS485 recv mode
rs485_xmit:     rmb     3	; enables RS485 xmit mode
get_date:       rmb     3	; gets current date from PC
get_time:       rmb     3	; gets current time from PC
outstrg00:	rmb	3	; outputs a string terminated by 0 
lcd_ini:	rmb	3	; initializes the 16x2 LCD module
lcd_line1:	rmb	3	; displays 16 char on the first line
lcd_line2:	rmb	3	; displays 16 char on the second line
sel_inst:	rmb	3	; selects instruction before writing LCD module 
sel_data:	rmb	3	; selects data before writing the LCD module
wrt_pulse:	rmb	3	; generates a write pulse to the LCD module
seven_segment:  rmb	3	; convert Accu A to segment pattern, bit 7= DP
*
*
                org     $0FA0	; BUFFALO I/O routines are duplicated here
upcase:         rmb     3
wchek:          rmb     3
dchek:          rmb     3
init_sci:       rmb     3
input:          rmb     3
output:         rmb     3
outlhlf:        rmb     3
outrhlf:        rmb     3
outa:           rmb     3
out1byt:        rmb     3
out1bsp:        rmb     3
out2bsp:        rmb     3
outcrlf:        rmb     3
outstrg:        rmb     3
outstrg0:	rmb	3
inchar:         rmb     3


	org	$F000
start:  lds	#STACK
	cli			; always enable interrupt globely
*
        ldx     #HELLO		; output a message
	jsr	outstrg
        jsr     outcrlf
        
next:   jsr     inchar          ; return accu a with keybopard input
*				; and echo back to the monitor
        jmp     next

HELLO:  fcc     "Hello, please try this typewriter:"
	fcb	4		; the end character of the message

	org	$FFFE
	fdb	start
	end
*	


