home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
assemblr
/
library
/
lib4a86
/
lib
/
dosio.lib
< prev
next >
Wrap
Text File
|
1992-02-15
|
2KB
|
195 lines
#IF !LIB4A86
#ELSE
#IF !INTERN_LIB4A86_S
INTERN_LIB4A86_S EQU 01
JMP START
#ENDIF
#ENDIF
STDIN EQU 0
STDOUT EQU 1
STDERR EQU 2
STDAUX EQU 3
STDPRINT EQU 4
INPUTHANDLE DW STDIN
OUTPUTHANDLE DW STDOUT
DOSCHECKSTDIN:
MOV BX, CS:INPUTHANDLE
JMP >L1
DOSCHECKSTDOUT:
MOV BX,CS:OUTPUTHANDLE
L1:
DOSCHECKHANDLE:
MOV AX,04400H
INT 021H
JC >L8
TEST DL,080H
L8:
RET
DOSSETHANDLEMODE:
PUSH BX,CX,DX
MOV CL,AL
CALL DOSCHECKHANDLE
JC >L8
OR CL,CL
JZ >L1
OR DL,020H
JMP >L2
L1:
AND DL,NOT 020H
L2:
XOR DH,DH
MOV AX,04401H
INT 021H
L8:
POP DX,CX,BX
RET
DOSCHECKOUTPUT:
PUSH BX,DX
MOV BX,CS:OUTPUTHANDLE
MOV AX,04400H
INT 021H
JC >L8
MOV AL,0FFH
TEST DX,080H
JZ >L1
MOV AX,04407H
INT 021H
L1:
OR AL,AL
L8:
POP DX,BX
RET
DOSCHECKINPUT:
PUSH BX,DX,ES
MOV BX,CS:INPUTHANDLE
MOV AX,04406H
INT 021H
JC >L8
OR AL,AL
JNZ >L8
CALL DOSCHECKHANDLE
JC >L8
TEST DL,080H
JZ >L8
TEST DL,01H
JZ >L8
MOV AH,052H
INT 021H
CMP W ES:[BX-4],0
L8:
POP ES,DX,BX
RET
DOSREADSTR:
PUSH DX,BX
XOR CH,CH
LEA DX,[SI+1]
MOV B[SI],CH
JCXZ >L8
MOV BX,CS:INPUTHANDLE
MOV AH,03FH
INT 021H
JC >L8
MOV BX,SI
ADD BX,AX
CMP B[BX],0AH
IF E DEC AX
CMP B[BX-1],0DH
IF E DEC AX
MOV B[SI],AL
CMP AL,CL
CLC
L8:
POP BX,DX
RET
DOSWRITELNSTR:
MOV AL,01H
JMP >L1
DOSWRITESTR:
MOV AL,0
L1:
PUSH DX,CX,BX,SI
CLD
OR AL,AL
LODSB
MOV AH,0
MOV CX,AX
IF NZ ADD CX,2
OR CX,CX
JZ >L8
MOV DX,SI
ADD SI,AX
MOV AX,LF BY CR
XCHG W[SI],AX
PUSH AX
MOV BX,CS:OUTPUTHANDLE
MOV AH,040H
INT 021H
POP DX
MOV W[SI],DX
JC >L8
CMP AX,CX
L8:
POP SI,BX,CX,DX
RET
DOSREADCHAR:
PUSH DX
MOV AL,0
MOV DX,OFFSET DOSREADSTR
JMP >L1
DOSWRITECHAR:
PUSH DX
MOV DX,OFFSET DOSWRITESTR
JMP >L1
DOSWRITELNCHAR:
PUSH DX
MOV DX,OFFSET DOSWRITELNSTR
L1:
PUSH DS,SI,CX
PUSH BP
MOV BP,SP
MOV AH,01
XCHG AH,AL
PUSH AX
MOV DS,SS
MOV SI,SP
MOV CL,AL
CALL DX
JC >L8
MOV AL,B[SI+1]
L8:
MOV SP,BP
POP BP
POP CX,SI,DS
POP DX
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