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

	
	
PrintChar:	;PrintChar A1
    pushAll
	mflo t0
	push t0
	mfhi t0
	push t0
	
		subiu a1,32		;No Characters below 32
	
		li t7,UserRam
		
		la t5,0xA0100000+320*2*8*2	;Screen Base+2 lines
		  
		lbu t8,CursorX(t7)
		li t3,16			;Bytes per Char
		multu t3,t8		;t8=XPos
		mflo t3
		add t5,t5,t3
		addiu t8,1
		sb t8,CursorX(t7)	;Move across 1
		  
		lbu t8,CursorY(t7)
		li t3,320*2*8		;Bytes per line+Char
		multu t3,t8		;A1=Ypos
		mflo t3
		add t5,t5,t3
		  
		la t6,MyFont 	;Font Address
    
		li t2,8			;Height in lines
	
		sll a1,7 		;8*8*2 (2 bytes per pixel) 
		addu t6,a1 		;add to font base

PrintChar_NextLine:	
		li t1,8			;Width in pixels
PrintChar_NextByte:
		lh t4,0(t6) 	;Get 16 bits from font
		addiu t6,2
		sh t4,0(t5) 	;Store 16 bits to screen
		addiu t5,2
	
		subiu t1,1 		;Repeat for next char
		bnez t1,PrintChar_NextByte
		nop
	  
		addiu t5,(320-8)*2 ;Move down 1 line
      
		subiu t2,1 		;Repeat for next line
		bnez t2,PrintChar_NextLine
		nop
	pop t0
	mthi t0
	pop t0
	mtlo t0
	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
	