4PCX090 ASM;-------------------------------
;
;Saveroutine f}r DEP Version 2.1
;	(mit Fehlertexten)
;
;Adresse:	0000 00B3H
;
;FSAVE2.ASM	` ml 06.08.93
;-------------------------------
ARGN	EQU	0B781H
ARG1	EQU	ARGN+1
ARG2	EQU	ARGN+3
PV1	EQU	0F003H
WAIT	EQU	14H
INLIN	EQU	17H
ERRM	EQU	19H
AHEX	EQU	1CH
OSTR	EQU	23H
OCHR	EQU	24H
;--------------------------
	ORG	200H
	DW	7F7FH
	DB	'FSAVE'
	DB	1
	LD	A,(ARGN)
	CP	2
	JR	C,ERROR	; < 2 Arg.
	CALL	PV1
	DB	OSTR
	DB	'Name :',0
	CALL	PV1
	DB	INLIN
	LD	HL,17
	ADD	HL,DE	;Ende Name
FSAVE	LD	E,12	;L{nge
	LD	BC,8EF3H
NAMOUT:	OUTD
	DEC	E
	JR	NZ,NAMOUT
	LD	BC,80F2H;Datenpuffer
CLEAR:	OUT	(C),E	;l|schen
	INC	B
	JR	NZ,CLEAR
	LD	HL,ARGN
	LD	DE,0B0BH;open/Anzahl
	LD	BC,91F2H;Daten
SCHR:	OUTI
	INC	B
	INC	B
	DEC	E
	JR	NZ,SCHR
	LD	BC,80F3H;n{chsten Block
	OUT	(C),D
NRDY:	PUSH	BC
	LD	A,1
	CALL	PV1
	DB	WAIT
	POP	BC
	IN	A,(C)	;fertig?
	BIT	0,A
	JR	NZ,NRDY
	BIT	7,A
	JR	Z,WROK	;kein Fehler
ERR:	LD	BC,83F1H
	IN	A,(C)
	CP	20H	;DEP ab 2.0?
	JR	NZ,ERRTX;ja
	LD	BC,81F3H
	IN	A,(C)	;Fehlernummer
	CALL	PV1
	DB	AHEX
ERROR:	CALL	PV1
	DB	ERRM
	RET
ERRTX:	LD	B,0	;Fehlertext
ERRT1:	IN	A,(C)
	RET	Z	;00-Ende
	INC	B
	CALL	PV1
	DB	OCHR
	JR	ERRT1
WROK:	LD	BC,81F2H
	BIT	3,D
	JR	Z,N3
	LD	HL,(ARG1);AAdr.
N3:	PUSH	HL
	LD	DE,(ARG2);Endadresse
	AND	A
	SBC	HL,DE
	POP	HL
	LD	BC,81F2H
	LD	DE,0380H
	JR	C,SCHR	;weiter
	LD	BC,80F3H
	LD	A,43H	;close
	OUT	(C),A
NEND:	PUSH	BC
	LD	A,1
	CALL	PV1
	DB	WAIT
	POP	BC
	IN	A,(C)
	BIT	0,A	;fertig?
	JR	NZ,NEND
	BIT	7,A
	RET	Z
	JR	ERR	;Fehler
;
SAVE	LD	A,(FEBENEN)
	CP	0
	JR	Z,SAVE1
	CP	1
	JR	NZ,END
	CALL	SAVE2
SAV1	LD	A,40
	CALL	0F003H
	DB	14H
	CALL	SAVE3
END	RET
SAVE1	CALL	ARG
	LD	HL,7FFFH
	LD	A,(HL)
	PUSH	AF
	LD	A,5
	LD	(HL),A
	LD	(0B782H),HL
	LD	HL,ENPIC
	LD	DE,ENNAME
	LD	BC,3H
	LDIR
	LD	A,22H
	OUT	84H,A
	LD	HL,FNAME
	CALL	FSAVE
	CALL	RNAME
	POP	AF
	LD	(7FFFH),A
	RET
RNAME	LD	HL,ENPCX
	LD	DE,ENNAME
	LD	BC,3H
	LDIR
	RET
ARG	LD	A,2
	LD	(0B781H),A
	LD	HL,8000H
	LD	(0B782H),HL
	LD	HL,0A800H
	LD	(0B784H),HL
	RET
SAVE2	CALL	ARG
	LD	HL,ENHIF
	LD	DE,ENNAME
	LD	BC,3H
	LDIR
	LD	A,20H
	OUT	84H,A
	LD	HL,FNAME
	CALL	FSAVE
	CALL	RNAME
	RET
SAVE3	CALL	ARG
	LD	HL,ENHIP
	LD	DE,ENNAME
	LD	BC,3H
	LDIR
	LD	A,22H
	OUT	84H,A
	LD	HL,FNAME
	CALL	FSAVE
	CALL	RNAME
	RET
	DW	1A02H
TEXT1	DB	'F1 Bild anzeigen',0
	DW	1B02H
TEXT2	DB	'F2 Bild speichern',0
	DW	1C02H
TEXT3	DB	'F3 Directory',0
	DW	1D02H
TEXT4	DB	8DH,' Bild laden',0
	DW	1E02H
TEXT5	DB	'? Hilfe',0
	DW	1A16H
TEXT6	DB	'F4',0;Koordinaten
	DW	1B16H
TEXT7	DB	'F5 Show',0
	DW	1C16H
TEXT8	DB	'F6 Info',0
	DW	1D16H
TEXT9	DB	'F7 Ende',0
	DW	1E16H
TEXT10	DB	'SPACE markieren',0
	DW	7F7FH
	DB	'PCX',1
	JP	MENU
INMENU	CALL	DIR
	CALL	BLIAUS
	CALL	INFENST
	CALL	BILD0
	CALL	AUFENST
	CALL	COLOR
	CALL	NORMCLS
	CALL	BILD1
	CALL	AUFENST
	CALL	COLOR
	CALL	NORMCLS
	CALL	SCH1
	CALL	STRICH
	CALL	DANZIN
	CALL	INV
	LD	A,0
	LD	(BILDDA),A
	RET
STRICH	LD	HL,0
	LD	(0B782H),HL
	LD	HL,3CH
	LD	(0B784H),HL
	LD	(0B788H),HL
	LD	HL,13FH
	LD	(0B786H),HL
	LD	A,7CH
	LD	(0B7D6H),A
	CALL	0F003H
	DB	3EH
	RET
SCH1	LD	DE,(TEXT1-2)
	LD	HL,TEXT1
	CALL	SCHRITT
	LD	DE,(TEXT2-2)
	LD	HL,TEXT2
	CALL	SCHRITT
	LD	DE,(TEXT3-2)
	LD	HL,TEXT3
	CALL	SCHRITT
	LD	DE,(TEXT4-2)
	LD	HL,TEXT4
	CALL	SCHRITT
	LD	DE,(TEXT5-2)
	LD	HL,TEXT5
	CALL	SCHRITT
	LD	DE,(TEXT6-2)
	LD	HL,TEXT6
	CALL	SCHRITT
	LD	DE,(TEXT7-2)
	LD	HL,TEXT7
	CALL	SCHRITT
	LD	DE,(TEXT8-2)
	LD	HL,TEXT8
	CALL	SCHRITT
	LD	DE,(TEXT9-2)
	LD	HL,TEXT9
	CALL	SCHRITT
	LD	DE,(TEXT10-2)
	LD	HL,TEXT10
	CALL	SCHRITT
	RET
H1	DB	'[[[[[[[[[[[[[[[',0
	DB	'[             [',0
	DB	'[ D  Drive    [',0
	DB	'[ U  User     [',0
	DB	'[ I  invers   [',0
	DB	'[ R  rotieren [',0
	DB	'[             [',0
	DB	'[[[[[[[[[[[[[[[',0
HILFE	LD	DE,90DH
	LD	HL,H1
	LD	B,8
HILFE1	PUSH	DE
	CALL	SCHRITT
	POP	DE
	INC	D
	DJNZ	HILFE1
	CALL	TAST
	CALL	DANZ
	CALL	INV
	JP	MENU1
I1	DB	'[[[[[[[[[[[[[[[[[',0
	DB	'[               [',0
	DB	'[ 4PCXSHOW V0.9 [',0
	DB	'[  ` Januar 94  [',0
	DB	'[   by HOJOE    [',0
	DB	'[               [',0
	DB	'[[[[[[[[[[[[[[[[[',0
INFO	LD	DE,90DH
	LD	HL,I1
	LD	B,7
INFO1	PUSH	DE
	CALL	SCHRITT
	POP	DE
	INC	D
	DJNZ	INFO1
	CALL	TAST
	CALL	DANZ
	CALL	INV
	JP	MENU1
F71	DB 'Das Programm ist Shareware.'
	DB	0
	DB 'Es kann und soll weitergege'
	DB 'ben werden.',0
	DB 'Wenn das Programm Ihnen '
	DB 'gefallen sollte',0
	DB 'schicken Sie mir einfach 5,'
	DB '-DM und IHRE',0
	DB 'Adresse.',0
	DB 'Meine Adresse lautet:',0
	DB '  ',0
	DB '  Holger J',7CH,'dicke',0
	DB '  E.-Th',7BH,'lmann-Str. 31'
	DB	0
	DB '  99869 Uelleben',0D,0
F7E	LD	DE,101H
	LD	HL,F71
	LD	B,0AH
F7E1	PUSH	DE
	CALL	SCHRITT
	POP	DE
	INC	D
	DJNZ	F7E1
	CALL	TAST
	RET
SCHRITT	LD	(0B7A0H),DE
SCH2	CALL	0F003H
	DB	45H
	RET
DNAME	DB	'12345678'
DNAME1	DB	'123  '
	DW	0
DOK	DB	0
DZEIGER	DW	0
DZ1	DW	0
DIRUEB2	DB	0
DIRUEB	DB	0
DIRUEB1	DW	0
ZOBEN	CALL	AUFENST
	CALL	COWE
	LD	HL,1823H
	LD	A,8BH
	CALL	ZOUT
	RET
ZUNTEN	CALL	AUFENST
	CALL	COWE
	LD	HL,1823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,(DZ1)
	LD	A,(IY+0CH)
	CP	0A0H
	JP	Z,DRO
	JP	NZ,DWE
DWEITER	LD	HL,(DZ1)
	INC	HL
	LD	DE,DNAME
	LD	BC,0BH
	LDIR
	LD	(DZ1),HL
	LD	HL,DNAME
	CALL	SCH2
	RET
DGE	CALL	COGE
	JP	DWEITER
DRO	CALL	CORO
	JP	DWEITER
DWE	CALL	COWE
	JP	DWEITER
COGE	LD	A,31H
	LD	(0B7A3H),A
	RET
CORO	LD	A,11H
	LD	(0B7A3H),A
	RET
COWE	LD	A,39H
	LD	(0B7A3H),A
	RET
COLOR	LD	A,(COLORV)
	LD	L,A
	LD	A,(COLORH)
	LD	E,A
	CALL	0F003H
	DB	0FH
	RET
FENDAT	DW	0
	DW	2028H
	DW	0
	DW	3900H
	DW	0E260H
INFENS1	LD	HL,FENDAT
	LD	BC,0AH
	LDIR
	RET
INFENS2	LD	DE,0B99CH
	CALL	INFENS1
	LD	DE,0B9A6H
	CALL	INFENS1
	LD	A,17H
	LD	(0B9A9H),A
	RET
INFENST	CALL	INFENS2
	CALL	AUFENST
	CALL	DIRFAU
	CALL	INFENS2
	RET
AUFENST	LD	A,0
AUFEN1	CALL	0F003H
	DB	3DH
	RET
DIRFAU	LD	A,1
	CALL	AUFEN1
	RET
NORMCLS	CALL	0F003H
	DB	23H
	DB	0CH
	DB	0
	RET
BLIAUS	IN	A,89H
	RES	7,A
	OUT	89H,A
	RET
BILD0	LD	A,28H
	JP	BLOUT
BILD0H	LD	A,30H
	JP	BLOUT
BILD0HP	LD	A,32H
	JP	BLOUT
BILD1	LD	A,2DH
	JP	BLOUT
BLOUT	OUT	84H,A
	LD	(IX+1),A
	RET
BILD1P	LD	A,2FH
	OUT	84H,A
	LD	(IX+1),A
	RET
DRIVE4	LD	A,0
	LD	BC,83F1H
	OUT	(C),A
	LD	A,50
	CALL	0F003H
	DB	14H
	LD	BC,83F1H
	IN	A,(C)
	CP	0
	RET
DRIVE	CALL	DRIVE4
	JP	Z,MEN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