PASEXASM;------ ROUTINE PASEX.KCC ------
;				\
;ab BC00H			\
;		` ml 22.12.1990	\
;-------------------------------
SUTAB	EQU 0B7B0H
PV1	EQU 0F003H
WAIT	EQU 14H
ERRM	EQU 19H
AHEX	EQU 1CH
CRLF	EQU 2CH
	ORG 0BC00H
	LD HL,0
	LD B,80H
PAS02	LD A,M
	CP 7FH		;TEST PROLOG?
	INC HL
	JR Z,PAS01
	DJNZ PAS02
	JR PAS03
PAS01	LD M,0		;LOESCHEN
PAS03	LD HL,(SUTAB)
	LD (SUBALT),HL	;MERKEN SUTAB
	LD DE,SUBNEU
	LD (SUTAB),DE
	LD BC,92H	;LAENGE SUTAB
	LDIR
	LD HL,MBO
	LD (SUBNEU+2),HL
	LD HL,MBI
	LD (SUBNEU+10),HL
	JR PAS14
;-------
	DEFW 07F7FH
	DEFM 'PASTAPE'
	DEFB 1
	LD HL,(SUBALT)	;SUTAB ALT
PAS04	LD (SUTAB),HL
PAS14	LD (IX+2),0FFH	;STARTBED.
	RET
;-------
	DEFW 07F7FH
	DEFM 'PASDISK'
	DEFB 1
	LD HL,SUBNEU	;SUTAB NEU
	JR PAS04
;-----------------------
MBO	LD A,(IX+2)	;BLOCKNUMMER
	INC A
	JR Z,ISRO	;OPEN
	INC A
	LD D,3		;SCHREIBEN NORM
	JR Z,CSRO	;CLOSE
	JR PAS08
;-------
ISRO	LD L,(IX+5)
	LD H,(IX+6)	;BLOCKPUFFER
	LD BC,83F3H	;NAME
	LD E,11		;ANZAHL
PAS05	OUTI
	INC B
	INC B
	DEC E
	JR NZ,PAS05	;NAME AUSGEBEN
	LD D,11		;NAME EINTRAGEN
PAS08	INC (IX+2)	;NAECHSTER BL.
	LD L,(IX+5)
	LD H,(IX+6)
	LD BC,81F2H	;SEKTOR
	LD E,80H	;BLOCKLAENGE
PAS06	OUTI
	INC B
	INC B
	DEC E
	JR NZ,PAS06
PAS09	LD BC,80F3H	;STEUERBYTE
	OUT (C),D
PAS07	PUSH BC
	LD A,1
	CALL PV1
	DEFB WAIT
	POP BC
	IN A,(C)
	BIT 0,A		;FERTIG?
	JR NZ,PAS07
	AND A
	BIT 7,A		;FEHLER
	RET Z
	INC B
	CALL PV1
	DEFB CRLF
	IN A,(C)
	CALL PV1
	DEFB AHEX	;FEHLERNUMMER
	CALL PV1
	DEFB ERRM
	SCF		;FEHLERFLAG
	RET
;-------
CSRO	CALL PAS08
	RET C
	LD D,43H	;SCHREIBEN CLOSE
	LD (IX+5),0
	LD (IX+6),0B7H
	JR PAS09
;-----------------------
MBI	PUSH HL
	PUSH DE
	LD A,(IX+2)
	INC A		;1.Block ?
	JR Z,ISRI	;OPEN
	LD D,1		;LESEN NORM
	CALL PAS11
	JR C,PAS13	;FEHLER
	LD HL,(ANZ)
	LD DE,80H
	SBC HL,DE
	LD (ANZ),HL	;RESTLAENGE
	JR NC,PAS13
	LD (IX+2),0FFH	;ENDEBLOCK
	AND A
PAS13	POP DE
	POP HL
	RET
;-------
PAS11	CALL PAS09	;STEUERBYTE
	RET C		;FEHLER
	LD L,(IX+5)
	LD H,(IX+6)	;PUFFER
	LD BC,80F2H	;SEKTOR
	LD E,80H	;LAENGE
PAS12	INI
	INC B
	INC B
	DEC E
	JR NZ,PAS12
	INC (IX+2)	;BLOCKNUMMER
	RET
;-------
ISRI	LD HL,5CH	;QUELLE NAME
	LD BC,83F3H	;NAME
	LD E,0BH	;LAENGE
PAS10	OUTI
	INC B
	INC B
	DEC E
	JR NZ,PAS10
	LD D,9		;OPEN
	CALL PAS11
	JR C,PAS13	;FEHLER
	LD L,(IX+5)
	LD H,(IX+6)
	LD DE,11H
	ADD HL,DE
	LD E,M
	INC HL
	LD D,M		;DE=Anfadr.
	INC HL
	LD A,M
	INC HL
	LD H,M
	LD L,A		;HL=Endadr.
	AND A
	SBC HL,DE
	LD (ANZ),HL	;LAENGE
	JR PAS13
;-----------------------
ANZ	DEFW 0
SUBALT	DEFW 0		;SUTAB ALT
SUBNEU	EQU SUBALT+2
(ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ