home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
assemblr
/
library
/
lib4a86
/
lib
/
textio.lib
< prev
Wrap
Text File
|
1992-02-22
|
6KB
|
499 lines
#IF !LIB4A86
#ELSE
#IF !INTERN_LIB4A86_S
INTERN_LIB4A86_S EQU 01
JMP START
#ENDIF
#ENDIF
DATEITABELLE STRUC [BX]
_HANDLE DW ?
_GROESSE DW ?
_ZEIGER DW ?
_ENDE DW ?
_OFFSET DW ?
_SEGMENT DW ?
_STATUS DB ?
_NAME DB ?
DB 041H DUP ?
ENDS
O000 EQU OFFSET _NAME
GESCHLOSSEN EQU 0FFH
LESEN EQU 000H
SCHREIBEN EQU 001H
EOF_KZ EQU 0FFH
DISKVOLL EQU 0FFH
FALSCHER_MODE EQU 0FEH
CR EQU 0DH
LF EQU 0AH
CTRL_Z EQU 1AH
S000 DW 0
USECONTROLZ DW 0FFH
WRITE_MODUS EQU 002H
READ_MODUS EQU 000H
FILEMODE DB 00H
CREATEFILEATTR DW 0
CREATEFILEBUFFERED:
MOV AH,03CH
JMP >L1
CREATENEWFILEBUFFERED:
MOV AH,05BH
L1:
PUSH DX,CX,SI
CMP _STATUS,GESCHLOSSEN
JE >L1
MOV AH,FALSCHER_MODE
STC
JMP >L9
L1:
CLD
PUSH AX
CALL INTERN_KONVERTNAME1
MOV CX,CS:CREATEFILEATTR
AND CX, 027H
POP AX
INT 021H
JC >L9
MOV CL,SCHREIBEN
CALL INTERN_FUELLETABELLE
CLC
L9:
POP SI,CX,DX
RET
RESETFILEBUFFERED:
MOV AL,READ_MODUS
JMP >L1
REWRITEFILEBUFFERED:
MOV AL,WRITE_MODUS
L1:
MOV AH,CS:FILEMODE
AND AH,11110000XB
OR AL,AH
PUSH SI,DX
CMP _STATUS,GESCHLOSSEN
JE >L1
MOV AH,FALSCHER_MODE
JMP >L8
L1:
CLD
PUSH AX
CALL INTERN_KONVERTNAME1
MOV AH,03DH
INT 021H
POP DX
JC >L8
MOV CL,SCHREIBEN
TEST DL,WRITE_MODUS
JNZ >L1
MOV CL,LESEN
L1:
CALL INTERN_FUELLETABELLE
CLC
JMP >L9
L8:
STC
L9:
POP DX,SI
RET
V0 DB 0
APPENDFILEBUFFERED:
PUSH BX,CX,DX
CMP _STATUS,GESCHLOSSEN
JE >L1
MOV AH,FALSCHER_MODE
JMP >L8
L1:
CALL REWRITEFILEBUFFERED
JC >L8
MOV BX,AX
MOV AL,02
XOR CX,CX
XOR DX,DX
MOV AH,042H
INT 021H
JC >L8
OR AX,DX
JZ >L90
CMP CS:USECONTROLZ,0
JE >L90
MOV AL,2
XOR DX,DX
DEC DX
MOV CX,DX
MOV AH,042H
INT 021H
JC >L8
PUSH DS
MOV DS,CS
MOV DX,OFFSET V0
MOV AH,03FH
MOV CX,01
INT 021H
POP DS
JC >L8
OR AX,AX
JZ >L90
CMP CS:V0,CTRL_Z
JNE >L90
XOR DX,DX
NOT DX
MOV CX,DX
MOV AH,042H
INT 021H
JC >L8
L90:
MOV AX,BX
CLC
JMP >L9
L8:
STC
L9:
POP DX,CX,BX
RET
V3 DB 0
READFILEBUFFERED:
PUSH CX
MOV CS:V3,1
JMP >L1
READLNFILEBUFFERED:
PUSH CX
MOV CX,0FFH
MOV CS:V3,CH
L1:
PUSH BP,DX,DS,ES,SI
CMP _STATUS,LESEN
JE >L1
MOV AH,FALSCHER_MODE
JMP >L80
L1:
CLD
PUSH DI
XOR AL,AL
STOSB
XOR CH,CH
MOV SI,_OFFSET
MOV BP,_ZEIGER
ADD SI,BP
MOV DX,_ENDE
MOV CS:S000,DS
MOV DS,_SEGMENT
L0:
CMP BP,DX
JB >L1
PUSH BX,CX,DX
PUSH DS
MOV DS,CS:S000
MOV AH,03FH
MOV CX,_GROESSE
MOV DX,_OFFSET
MOV BX,_HANDLE
POP DS
INT 021H
POP DX,CX,BX
IF C JMP >L8
PUSH DS
MOV DS,CS:S000
MOV _ENDE,AX
MOV DX,AX
MOV BP,_GROESSE
INC BP
OR AX,AX
JE >L7
XOR BP,BP
MOV _ZEIGER,BP
MOV SI,_OFFSET
POP DS
JMP >L1
L80: JMP >L80
L1:
LODSB
INC BP
CMP CS:V3,0
JNE >L2
CMP AL,CR
JNE >L1
CMP B[SI],LF
JNE >L9
INC BP
INC SI
JMP >L9
L1:
CMP AL,LF
JNE >L2
CMP B[SI],CR
JNE >L9
INC BP
INC SI
JMP >L9
L2:
CMP CS:USECONTROLZ,0
JE >L1
CMP AL,CTRL_Z
JE >L71
L1:
STOSB
LOOP L0
JMP >L9
L7:
POP DS
L71:
MOV AH,EOF_KZ
JMP >L8
L9:
XOR AH,AH
MOV AL,0FFH
POP DI
CALL INTERN_KORRIGIERETABELLE
CLC
JMP >L9
L8:
POP DI
MOV AL,0FFH
CALL INTERN_KORRIGIERETABELLE
L80:
STC
L9:
POP SI,ES,DS,DX,BP
POP CX
RET
C1 DB 0
C2 DB CR,LF,0H
WRITEFILEBUFFERED:
XOR AX,AX
MOV CS:C1,AL
JMP >L1
WRITELNFILEBUFFERED:
MOV AL,1
MOV CS:C1,AL
L1:
PUSH BP,CX,DX,SI,DI,ES
CMP _STATUS,SCHREIBEN
JE >L1
MOV AH,FALSCHER_MODE
JMP >L8
L1:
CLD
MOV ES,_SEGMENT
MOV DI,_OFFSET
MOV BP,_ZEIGER
MOV DX,_GROESSE
CMP BP,DX
IF A XOR BP,BP
ADD DI,BP
XOR CX,CX
MOV CL,[SI]
OR CL,CL
JE >L2
INC SI
L0:
CMP BP,DX
JB >L1
MOV _ZEIGER,BP
CALL FLUSHFILEBUFFER
JC >L8
MOV DI,_OFFSET
MOV BP,_ZEIGER
L1:
MOVSB
INC BP
LOOP L0
L2:
MOV AL,CS:C1
OR AL,AL
JE >L7
MOV CX,2
MOV SI,OFFSET C2
L0:
CMP BP,DX
JB >L1
MOV _ZEIGER,BP
CALL FLUSHFILEBUFFER
JC >L8
MOV DI,_OFFSET
MOV BP,_ZEIGER
L1:
MOV AL,CS:[SI]
INC SI
STOSB
INC BP
LOOP L0
L7:
MOV _ZEIGER,BP
XOR AH,AH
L9:
CLC
JMP >L1
L8:
STC
L1:
POP ES,DI,SI,DX,CX,BP
RET
FLUSHFILEBUFFER:
PUSH DX,CX,DS,ES
CMP _STATUS,SCHREIBEN
JE >L1
MOV AH,FALSCHER_MODE
JMP >L8
L1:
CLD
MOV CX,_ZEIGER
OR CX,CX
JE >L9
CMP CX,_GROESSE
JA >L9
MOV DX,_OFFSET
MOV ES,_SEGMENT
PUSH BX
MOV BX,_HANDLE
PUSH DS
MOV DS,ES
MOV AH,040H
INT 021H
POP DS
JC >L1
PUSH BX,CX
MOV AH,030H
INT 021H
XCHG AH,AL
CMP AX,031EH
POP CX,BX
CMC
JNC >L1
MOV AH,068H
INT 021H
L1:
IF NC MOV AX,CX
POP BX
JC >L8
OR AX,AX
JE >L6
XOR AX,AX
MOV _ZEIGER,AX
MOV _ENDE,AX
JMP >L9
L6:
MOV AH,EOF_KZ
L8:
STC
JMP >L1
L9:
CLC
L1:
POP ES,DS,CX,DX
RET
V1 DB 1, CTRL_Z
V2 DW 0
CLOSEFILEBUFFERED:
CMP _STATUS,GESCHLOSSEN
JNE >L1
MOV AH,FALSCHER_MODE
STC
RET
L1:
CMP _STATUS,LESEN
JNE >L1
PUSH CX
CALL INTERN_CLOSEFILEBUFFERED
POP CX
RET
L1:
PUSH CX
MOV CS:V0,0
CMP CS:USECONTROLZ,0
JE >L1
PUSH DS,SI
MOV DS,CS
MOV SI,OFFSET V1
CALL WRITEFILEBUFFERED
POP SI,DS
JNC >L1
MOV CS:V2,AX
L1:
CALL FLUSHFILEBUFFER
JNC >L1
CMP CS:V2,0
IF E MOV CS:V2,AX
L1:
CALL INTERN_CLOSEFILEBUFFERED
JC >L9
MOV AX,CS:V2
OR AX,AX
IF NZ STC
L9:
POP CX
RET
INTERN_KONVERTNAME1:
CMP _GROESSE,0FFF0H
IF A MOV _GROESSE,0FFF0H
INTERN_KONVERTNAME:
PUSH SI,AX
MOV SI,BX
ADD SI,O000
XOR AX,AX
LODSB
MOV DX,SI
ADD SI,AX
MOV [SI],AH
POP AX,SI
RET
INTERN_FUELLETABELLE:
PUSH AX
MOV _HANDLE,AX
MOV AX,_GROESSE
MOV _ENDE,AX
INC AX
MOV _ZEIGER,AX
MOV _STATUS,CL
POP AX
RET
INTERN_KORRIGIERETABELLE:
MOV DS,CS:S000
MOV _ZEIGER,BP
SUB AL,CL
STOSB
DEC DI
RET
INTERN_CLOSEFILEBUFFERED:
PUSH BX
MOV BX,_HANDLE
MOV AH,03EH
INT 021H
POP BX
PUSH AX
PUSHF
MOV CL,0FFH
XOR AX,AX
CALL INTERN_FUELLETABELLE
POPF
POP AX
RET
#IF !INTERN_CMARK0
INTERN_CMARK0 EQU 01H
INTERN_CMARK1:
PUSH BP
MOV BP,SP
MOV BX,06H
SUB CH,[BP+SI]
SUB AH,[BX+SI]
DEC SP
DEC CX
INC DX
XOR AL,041H
CMP B[02820H],DH
INC BX
SUB W[BX+SI],SP
INC DX
CS AND B[BP+DI+043H],DL
DEC AX
INC BP
DEC BP
DEC BP
INC BP
PUSH DX
AND B[BP+SI],CH
SUB CH,[BP+SI]
POP DX
MOV SP,BP
POP BP
RET
#ENDIF