* LCDPRNT.H
* Kam K. Leang and Walter Barnum    4/6/98
*
* Designed for the Motorola MC68HC11E2 chip BotBoard
*-----------------------------------------------------------------------------
* This header file is a printing function.  The print function prints ASCII
* characters that are located in the reserved RAM location $0000-->$000F.
* This function will start at $0000 and send the Hex number located in the
* RAM location to the data bus of the LCD. The data bus, number of locations
* in RAM to print, and the control bus are equated to variables at the start
* which allows this function to be tailored to other ports or even another
* Motorola chip.

*-----------------------------------------------------------------------------
LCVPRNT EQU     $05             ;Delcare the Loop Control Variable for the
				;print function.  This variable controls the
				;the number of characters to print to the
				;screen (i.e. RAMTOP-->?).  The max that
				;LCVPRNT should be is $0F which is 16
                                ;characters.
RAMTOP  EQU     $00             ;Define the start of the RAM for the print
				;function.

*-----------------------------Subroutine--------------------------------------
lcdprnt EQU	*		;Equate start of print function to this
				;location
        LDX     #$0101          ;Clear the display
	STX	DATABUS
        LDAA    #$00            ;Enable the clear function
	STAA	CTLBUS
        JSR     delay           ;Jump to delay to buy some time
	LDY	#$0000		;Load $0000 into Y index.  This sets up the
				;the increment variable for the print function
				;as it increments and prints the chacters
				;from the RAM
loop_prnt1:
	LDAA	#$03		;Set LCD control enable to High
	STAA	CTLBUS
	LDAA	RAMTOP,Y	;Load the value from $RAMTOP+0 into ACCA
	STAA	DATABUS		;Send data from ACCA to data bus.  The first
				;time through, the data is stored in RAMTOP,
				;and each time through, the location gets
				;incremented by one until it reaches the last
				;RAM location, which can be 16 characters
				;as defined by the loop control variable
				;LCVPRNT

	LDAA	#$02		;Enable the data sent to data bus
	STAA	CTLBUS
        JSR     delay           ;Jump to subroutine delay to buy some time
	INY			;Increment the stack pointer.
	CPY	#LCVPRNT	;Compare Y with loop control variable
	BNE	loop_prnt1	;Branch to loop1_prnt1 if not equal to zero
	RTS			;Return from subroutine.

*-----------------------------------------------------------------------------
