R32V2020 Write Character to Screen Example

From Land Boards Wiki
Jump to navigation Jump to search
; initializing and loading of first character
	ads	r5,r0,r0	; init r5 to start of screen character memory
	ads	r8,r0,r0	; clear the character (not necessary since screen is byte memory)
	lil	r8,0x0048	; Pass character to print (ASCII 'H') in r8
	ads	r9,r7,r1	; Save PC (plus 1) into r9 - putChar will increment to skip the bra
	bra	putChar		; Call putChar routine

; putChar routine
putChar:
	spb	r8		; write character to peripheral bus
	ads	r5,r5,r1	; Go to the next character position	
	ads	r7,r9,r1	; return to calling routine (r9 is the calling address)