PTFLOADASM;PTFLOAD 0200
;-----------------
;
;Zeichenbildtabelle .PTB
;von Diskette laden
;
;			` ml 18.02.91
;------------------------------------
ARGN	EQU 0B781H
ARG9	EQU 0B792H
ARG10	EQU 0B794H
CURSO	EQU 0B7A0H
CCTL0	EQU 0B7A6H
PV1	EQU 0F003H
CRT	EQU 00H
KBD	EQU 04H
WAIT	EQU 14H
ERRM	EQU 19H
AHEX	EQU 1CH
OSTR	EQU 23H
CRLF	EQU 2CH
DABR	EQU 32H
;-------
	ORG 0200H
	DEFW 7F7FH
	DEFM 'PTFLOAD'
	DEFB 1
	LD A,(ARGN)
	CP 2
	JR C,ERRIN	;< 2 Arg.
	CP 4
	JR NC,ERRIN	;> 3 Arg.
	LD A,3
	AND L
	LD HL,CCTL0
	SLA A
	ADD L
	LD L,A
	LD (ARG9),HL	;Adr. CCTL
	LD A,0FH
	CP E
	JR NZ,L01	;nicht 'F'
	LD H,B
	LD L,C		;HL=Adr.
	LD A,(ARGN)
	CP 3
	JR Z,L02
ERRIN	JP ERROR
L01	LD HL,0BC00H	;'A'
	LD A,0AH
	CP E
	JR Z,L02
	LD HL,0BE00H	;'B'
	LD A,0BH
	CP E
	JR NZ,ERRIN	;Platz falsch
L02	LD (ARG10),HL	;Adresse
	CALL PV1
	DEFB OSTR
	DEFB 0DH
	DEFM 'NAME :'
	DEFB 0
NAM1	LD HL,(CURSO)
NAM	CALL PV1
	DEFB KBD
	CP 1		;CLR
	JR Z,ANZ
	CP 3		;BRK
	JP Z,END
	CP 8
	JR C,NAM	; < 8
	CP 0AH
	JR C,ANZ	; < 10 (CUU,CUD)
	CP 0DH
	JR Z,ENTER
	CP 1AH
	JR Z,ANZ	;INS
	CP 1FH
	JR C,NAM	; < 1FH (DEL)
ANZ	CALL PV1
	DEFB CRT
	LD A,(CURSO)
	CP 6
	JR C,MA2
	CP 0EH
	JR C,NAM1
MA2	LD (CURSO),HL
	JR NAM
ENTER	LD DE,(CURSO)
	LD E,6
	CALL PV1
	DEFB DABR	;HL=Adr v. Name
	LD A,0EH
	LD (CURSO),A	;Spalte
	CALL PV1
	DEFB OSTR
	DEFM '.PTB '
	DEFB 0
	LD E,0CH	;Anzahl
	LD BC,82F3H	;Portadr.
NAMOUT	LD A,M		;Name
	OUT (C),A
	INC HL
	INC B
	DEC E
	JR NZ,NAMOUT
	LD A,9
	LD B,80H
	OUT (C),A
NRDY	PUSH BC
	LD A,1
	CALL PV1
	DEFB WAIT
	POP BC
	IN A,(C)
	BIT 0,A
	JR NZ,NRDY	;nicht fertig
	BIT 7,A
	JR NZ,ERR	;Fehler
	LD BC,90F2H	;Portadr.
	IN A,(C)
	CP 2
	JR NZ,ERROR	;nicht 2 Arg.
	INC B
	IN E,(C)
	INC B
	IN D,(C)	;DE=Anf-Adr.
	INC B
	IN L,(C)
	INC B
	IN H,(C)	;HL=End-Adr.
	AND A
	SBC HL,DE	;Anzahl Bytes
	LD DE,(ARG10)	;Adresse
	ADD HL,DE
	EX DE,HL	;DE=End-Adr.
NBLOCK	LD A,1
	LD BC,80F3H	;Portadr. Daten
	OUT (C),A
DNRDY	PUSH BC
	LD A,1
	CALL PV1
	DEFB WAIT
	POP BC
	IN A,(C)
	BIT 0,A
	JR NZ,DNRDY
	BIT 7,A
	JR Z,NERR
ERR	LD BC,81F3H	;Portadr. Fehler
	IN A,(C)
	CALL PV1
	DEFB AHEX
ERROR	CALL PV1
	DEFB ERRM
	RET
NERR	DEC C
BLW	INI		;Daten --> (HL)
	INC B
	INC B
	PUSH HL
	SBC HL,DE
	POP HL
	JR NC,L12	;wenn ENDE
	LD A,B
	AND A
	JR NZ,BLW	;80H Byte
	JR NBLOCK	;neuen Block
L12	LD HL,(ARG9)
	LD DE,(ARG10)
	LD M,E
	INC HL
	LD M,D
END	CALL PV1
	DEFB CRLF
	RET
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ