	.Z80
	ENTRY RCVFIL

RCVFIL:	JP START

;--------------- Konstanten und Variablen ---------

RTS	EQU 1		;REQUEST TO SEND CHARACTER
EOF	EQU 1AH		;END OF FILE MARKER
BDOS	EQU 5		;BDOS EINSPRUNG
FBASE	EQU 6		;FDOS BASIS ADRESSE
SIOBC	EQU 6		;SIO-B CONTROL PORT
SIOBD	EQU 4		;SIO-B DATA PORT

SIOREG:	DB 11011000B	;RESET
	DB 1,00000000B	;NO INTERRUPTS
	DB 3,11000001B	;RCV 8 BIT/CHAR 
	DB 4,11000100B	;x64 CLOCK, 1 STOP BIT
	DB 5,01101010B	;NO DTR, TSM 8 BIT/CHAR, TRANSMIT ENABLE, RTS
SIOLEN	EQU $-SIOREG

SIOMSG: DB 0DH,0AH
	DB 'SIO-B (Ports 04/06) set to 9600 Bd, '
	DB '8 Bit/Char, 1 StopBit, No Parity, DTR, RTS'
	DB 0DH,0AH,0AH,'$'

;--------------- PROGRAMM-ANFANG ------------------
		
START:	
	LD HL,SIOREG	;SIO-B INIT.
	LD B,SIOLEN
	LD C,SIOBC
	OTIR
	LD DE,SIOMSG
	CALL PRINT

	LD B,16
MLOOP:	
	LD A,'A'
	OUT (SIOBD),A

LABBEL:	IN A,(SIOBC)
	BIT 2,A
	JR Z,LABBEL

	DJNZ MLOOP

	LD A,EOF
	OUT (SIOBD),A

	DB 0FFH
	JP 0

PRINT:	LD C,9		;STRING OUTPUT AUF CONSOLE
	CALL BDOS
	RET

	END
