Trap 5 Formatierte Ausgabe auf dem Standard-Output

Help Contents Traps - die System-Schnittstelle Trap 5 Formatierte Ausgabe auf dem Standard-Output
Trap 4 Write Block to File Instruktionsausführung mit Forwarding und Stalls

Trap 5 Formatierte Ausgabe auf dem Standard-Output

Diese Funktion entspricht der C-Bibliotheksfunktion printf(). Ein String wird zunächst mit definierten Werten und Formaten zusammengestellt und anschliessend am Standard-Output ausgegeben.

Parameter:

1. Formatstring wie bei der C-Funktion printf()

2.... Argumente entsprechend dem Formatstring

In R1 wird die Anzahl der ausgegebenen Bytes oder eine negative Zahl im Fehlerfall retourniert.

Beispiel:

.data
FormatStr:	.asciiz	"Pi=%f, N=%d\n"
	.align	2
Par:	;Adr. des Formatstrings, Werte
	.word	FormatStr
	.double	3.141592654
	.word	17

	.text
	;...
	lhi	r14,Par>>16		; Obere 16-Bit
	addui	r14,r14,Par&0xffff	; Untere 16-Bit
	trap	5

Example:

Reference:

Trap 4 Write Block to File Instruktionsausführung mit Forwarding und Stalls