Cls:
	li t7,UserRam
  
	li t8,0
	sb t8,CursorX(t7)
	sb t8,CursorY(t7)
	
	jr ra
	nop


PrintChar:	;PrintChar A1
    pushAll
		subiu a1,32			;No Characters below 32
	
		li t0,UserRam		
		lbu t1,CursorX(t0)	;Xpos in chars
		nop					;Load delay Slot
		sll t1,3 		;*8
		
		lbu t2,CursorY(t0)	;Ypos in chars
		nop					;Load delay Slot
		sll t2,3 		;*8

		lui t4,0x1F80 	;IO_BASE
		
		;Byte 0: GPU Command
		li t3,0xA0000000	;A0=Send image to Framebuffer
		sw t3,0x1810(t4) 	;GP0 Cpmmand Port 0x1F801810

		;Byte 1: XY Pos - 0xYYYYXXXX 
		sll t3,t2,16 		;0xYYYY----
		addu t3,t1 			;0x----XXXX
		sw t3,0x1810(t4) 	;GP0 Cpmmand Port 0x1F801810

		;Byte 2: Width/Height - 0xHHHHWWWW
		li t3,0x00080008 	;8x8 Char
		sw t3,0x1810(t4) 	;GP0 Cpmmand Port 0x1F801810
	
		la t2,MyFont  		;Font Source
		sll a1,7 			;8*8*2=128 bytes per char
		addu a1,t2 ; A3 = Texture RAM Font Offset
			
		li t1,(8*8/2)-1 	;Bytes to send (8x8 - 2 pixels per byte, but 2 pixels per send)
		
		;Byte 3+: Pixel Data 0x22221111
SendFontData:
		lw t2,0(a1) 			;Get 2 pixels
		addiu a1,4  			;Move to next word
		sw t2,0x1810(t4) 		;send pixel Data - 0x22221111	Pixel 1 and 2 data
		bnez t1,SendFontData 
		subiu t1,1 				;Decrease loop counter (Delay Slot)
	  
		lbu t1,CursorX(t0)		;Get Xpos
		nop						;Load delay Slot
		addiu t1,1
		sb t1,CursorX(t0)		;Move across 1 char
 	popAll
	jr ra
	nop
 
 
 
 
PrintString:				;Print String A0
	pushAll		
DrawChars:		
		lbu a1,0(a0) 	;Load a character
		addiu a0,1 		;Move to next Char
		
		li t0,255		;Compare to 255
		beq t0,a1,PrintString_Done	;Done?
		nop
		
		jal PrintChar	;Show Character A0 to the screen
		nop
		
		j DrawChars		;Repeat
		nop
PrintString_Done:	
	popAll				
	jr ra				;Return
	nop
	
NewLine:
	Push t8
	Push t7
		li t7,UserRam
	
		lbu t8,CursorY(t7)
		nop						;Load delay Slot
		addiu t8,1
		sb t8,CursorY(t7)		;Move Down
	
		li t8,0
		sb t8,CursorX(t7)		;Zero Xpos
	pop t7
	pop t8
	jr ra
	nop
	