Trap 4 Write Block to File

Help Contents Traps - die System-Schnittstelle Trap 4 Write Block to File
Trap 3 Read Block from File Trap 5 Formatierte Ausgabe auf dem Standard-Output

Trap 4 Write Block to File

Mit diesem Trap kann ein Speicherblock auf eine Datei oder auf den Standard-Output (Standard-Erroroutput) geschrieben werden.

Parameter:

1. Filedeskriptor der Datei

2. Adresse der zu schreibenden Daten im Speicher

3. Anzahl der maximal zu schreibenden Bytes

In R1 wird die Anzahl der wirklich geschriebenen Bytes oder eine negative Zahl im Fehlerfall zurückgeliefert.

Beispiel:

.data
Buffer:	.space	500
Par:	;Filedeskriptor, Adr. des Puffers, Byteanzahl
	.space	4
	.word	Buffer
	.word	500

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

Example:

Reference:

Trap 3 Read Block from File Trap 5 Formatierte Ausgabe auf dem Standard-Output