

Cls:
	LoadPair z_HL,$4000
	LoadPair z_BC,$1F00
	lda #1
	tax
	tay							;For locate command in a bit!
	sta (z_HL)
	jsr CLDIR
	stz CursorX	
	stz CursorY
	rts

Locate:
		stx CursorX 
		sty CursorY
	rts
	
NewLine:
	stz CursorX	
	inc CursorY
	rts
	
	
	


PrintChar:
	
	sec
	sbc #32
	sta z_As
	phx
	phy
	PushTriple z_HL
	PushTriple z_DE
	PushTriple z_BC
		lda z_As 
		
		sta z_E
		stz z_D
		stz z_DEU
		
		ldx #3
		jsr DoXShifts		;Get Char
		
		LoadTriple z_HL,BitmapFont
		jsr AddHL_DE
		
		lda CursorX
		sta z_E
		stz z_D
		stz z_DEU
		ldx #2
		jsr DoXShifts		;Get Xpos

		ldy CursorY
CharYshiftAgain:	
		Cpy #0
		beq CharYshiftDone
		
		AddTriple z_DE,320*4	;Ypos
		dey
		bra CharYshiftAgain
		
CharYshiftDone:	
		AddTriple z_DE,$E12000		;Screen Base
		
		lda #8
		sta z_C
NextCLine:	
		PushTriple z_DE
			lda #4
			sta z_B
			lda [z_HL]
			sta z_As
			jsr IncHLU
NextCPixel:
			lda #0
			rol z_As
			rol
			asl
			asl
			asl
			rol z_As
			rol
			asl
			asl
			asl
			sta [z_DE]
			jsr IncDEU
			dec z_B
			bne NextCPixel
		PullTriple z_DE
		AddTriple z_DE,320/2
		
		dec z_C
		bne NextCLine
		inc CursorX
	PullTriple z_BC
	PullTriple z_DE
	PullTriple z_HL
	ply
	plx
	rts	

DoXShifts:
	asl z_E
	rol z_D
	rol z_DEU
	dex 
	bne DoXShifts
	rts
	
	