RAMDISKASM;------------------------------------
;
;RAMDISK-Ladeprogramm (von Diskette)
;
;			` ml 04.05.92
;------------------------------------
ARGN	EQU	0B781H
ARG1	EQU	0B782H
WINON	EQU	0B79CH
WINLG	EQU	0B79EH
CURSO	EQU	0B7A0H
COLOR	EQU	0B7A3H
PV1	EQU	0F003H
CRT	EQU	00H
WAIT	EQU	14H
ERRM	EQU	19H
HLDE	EQU	1BH
AHEX	EQU	1CH
OSTR	EQU	23H
;-------
	ORG	0BA00H
CLS:	LD	(WINON),HL
	EX	DE,HL
	LD	(WINLG),HL
	LD	(COLOR),A
	LD	A,0CH
	CALL	PV1
	DEFB	CRT
	RET
NAME:	DEFM	'RAMDISK .OVR'
START:	LD	HL,0
	LD	DE,2028H
	LD	A,4
	CALL	CLS
	LD	HL,0202H
	LD	DE,1124H
	LD	A,30H
	CALL	CLS
	LD	HL,0C03H
	LD	(CURSO),HL
	CALL	PV1
	DEFB	OSTR
	DEFM	'R. N}tzmann'
	DEFB	0AH
	DEFB	0DH
	DEFM	'   M.-Leistner-Str. 38'
	DEFB	0AH
	DEFB	0DH
	DEFM	'   O-2003 Friedland'
	DEFB	0
	LD	HL,0404H
	LD	DE,0920H
	LD	A,3AH
	CALL	CLS
	LD	HL,0300H
	LD	(CURSO),HL
	CALL	PV1
	DEFB	OSTR
	DEFM	' RAMDISK'
	DEFB	0DH
	DEFB	0AH
	DEFB	0AH
	DEFM	' RAMDOS + Diskette'
	DEFB	0
	LD	HL,1500H
	LD	DE,0B28H
	LD	A,3CH
	CALL	CLS
	CALL	PV1
	DEFB	OSTR
	DEFM	'  Programm wird von'
	DEFM	' Diskette geladen'
	DEFB	0DH
	DEFB	0AH
	DEFB	0AH
	DEFB	0
	LD	HL,NAME
	LD	E,12	;Anzahl
	LD	BC,82F3H;Portadr.
NAMOUT	LD	A,M	;Name
	CALL	PV1
	DEFB	CRT
	OUT	(C),A
	INC	HL
	INC	B
	DEC	E
	JR	NZ,NAMOUT
	LD	A,9
	LD	B,80H
	OUT	(C),A
	CALL	PV1
	DEFB	OSTR
	DEFM	'   '
	DEFB	0
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	02H
	JR	NZ,ERROR;<>  2 Argumente
	INC	B
	IN	L,(C)
	INC	B
	IN	H,(C)	;HL=Anf-Adr.
	INC	B
	IN	E,(C)
	INC	B
	IN	D,(C)	;DE=End-Adr.
	CALL	PV1
	DEFB	HLDE
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	;F2
BLW	INI		;Daten --> (HL)
	INC	B	;B wie vorher
	INC	B	;B+1
	PUSH	HL
	SBC	HL,DE
	POP	HL
	JR	NC,END	;wenn ENDE
	LD	A,B
	AND	A
	JR	NZ,BLW	;80H Byte
	JR	NBLOCK	;neuen Block
END:	LD	HL,0
	LD	DE,2028H
	LD	A,39H
	CALL	CLS
	JP	1400H	;Start RAMDISK
