;**************************************************************************
;Name:		Robot Library
;Version:	0.1b
;Author:	Dan Kohn
;Date of Mod):	Dec 8, 2005
;
;IO Table:
;
;PortA		PA7	Output / Sonar Init
;		PA6	OC2 / RIGHT Motor (PWM for servo)
;		PA5	OC3 / LEFT Motor (PWM for servo)
;		PA4
;		PA3	OC5 / USED FOR TRACE - BUFFALO
;		PA2
;		PA1	IC2 / Sonar Echo 
;		PA0
;
;PortE		PE7
;		PE6
;		PE5
;		PE4
;		PE3	Line Track 3
;		PE2	Line Track 2
;		PE1	Line Track 1
;		PE0
;
;PortD		PD5	Ground
;		PD4	Clock
;		PD3	Data
;		PD2	
;**************************************************************************

		ORG $2000
		
		include Hc11.inc	;definds all HC11 Registers 

	JMP MAIN




;Barcode Equates
BARCODE 	RMB  1
out1bsp 	equ $ffbe
Outcrlf 	equ $ffc4


MAIN    Ldx   #DDRD
        LDAA  #$04
        Staa  0,X
        LDaa  #$44
        LDX   #SPCR
        STAA  0,X
        LDAB  #$03
Poll
        Ldx   #Spsr
        TST   0,x
        bpl   Poll
        ldaa  SPDR
        psha
;        decb
 ;       BNE   Poll
                          
        pula              ; getting rid of the carrage return  char
;        pula              ; getting rid of the line feed  char
 ;       pula              ; putting the number of barcode into a
;        deca              ; converting the barcode from keyboard scan code
        staa Barcode      ; for the pc 102 keyboard
        ldx  #Barcode      ;

        JSR Out1bsP
        JSR Outcrlf
        JMP poll

       
