*
* Lcd1.asm ---- 16X2 LCD sample program for FOX11 board
*		with BUFFALO monitor, (c)2003, EVBplus.com
*		Written by Wayne Chu
*
*     Function:	This is the simplest way to displays a message on a 
*		16X2 LCD display module. The cursor is off. 
*		If more controls to display are needed, see the LCD2.asm

TEN_MS:		equ	2500
STACK:		equ	$8FFF

; The following 3 routines are included in BUFFALO monitor ver. 3.47
	org     $FF70
lcd_ini:	rmb	3	; initializes 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

	org	$D000
	jmp	start
*
delay_10ms:
	pshx
	ldx     #TEN_MS		; 2500 x 8 = 20,000 cycles = 10ms
del1:	dex			; 3 cycles
	nop			; 2 cycle
	bne	del1		; 3 cycles
	pulx
       	rts
*
start:  lds	#STACK
   	jsr	delay_10ms	; delay 20ms during power up
    	jsr	delay_10ms

    	jsr	lcd_ini		; initialize LCD

back:	ldx    	#MSG1		; MSG1 for line1, x points to MSG1
        jsr	lcd_line1
*
    	ldx    	#MSG2		; MSG2 for line2, x points to MSG2
        jsr	lcd_line2
     	swi                     ; go back to BUFFALO monitor
     	
MSG1:   FCC     "  FOX11 TRAINER "
MSG2:   FCC     "(C)2002, EVBPLUS"
       	end

