home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
assemblr
/
library
/
lib4a86
/
lib
/
env.lib
< prev
next >
Wrap
Text File
|
1992-02-13
|
7KB
|
584 lines
#IF !LIB4A86
#ELSE
#IF !INTERN_LIB4A86_S
INTERN_LIB4A86_S EQU 01
JMP START
#ENDIF
#ENDIF
USELOKALENV EQU 0
USECALLERENV EQU 1
USECOMMANDENV EQU 2
LOKALENVSEG DW 0
CALLERENVSEG DW 0
COMMANDENVSEG DW 0
E001 DW 0
U000 DB USELOKALENV
SETENVVAR:
CALL INTERN_TESTENV
PUSH BX,CX,DX
MOV AL,'='
CALL INTERN_UPCASESTRING
JC >L1
L8:
STC
JZ >L1
XOR AL,AL
MOV CL,ES:[DI]
XOR CH,CH
JCXZ >L0
PUSH DI
INC DI
REPNE SCASB
POP DI
JZ L8
L0:
CALL INTERN_DELETEENTRY
MOV AL,0
IF NC INC AL
CMP B ES:[DI],0
JNE >L0
OR AL,AL
JMP >L1
L0:
CALL INTERN_SETENTRY
L1:
POP DX,CX,BX
RET
P1 EQU [BP-512XD]
P2 EQU [BP-256XD]
SEARCHENVSTR:
MOV B ES:[DI],0
CALL INTERN_TESTENV
PUSH BX,CX
PUSH DS,SI
PUSH ES,DI
PUSH BP
MOV BP,SP
SUB SP,514XD
MOV ES,SS
MOV DS,SS
CALL ENVCOUNT
V1:
PUSH AX
LEA DI,P1
CALL ENVSTR
LEA SI,P1
LEA DI,P2
CALL ENVPARSE
JC >L9
LODSB
LDS BX,[BP+6]
CMP AL,[BX]
JNE >L7
INC BX
MOV CL,AL
XOR CH,CH
L2:
MOV AL,SS:[SI]
INC SI
CMP AL,[BX]
JNE >L7
INC BX
LOOP L2
JMP >G1
L7:
MOV DS,SS
POP AX
DEC AX
JNZ V1
STC
JMP >L9
G1:
MOV DS,SS
LEA SI,P2
LES DI,[BP+2]
LODSB
XOR AH,AH
STOSB
MOV CX,AX
REP MOVSB
CLC
L9:
MOV SP,BP
POP BP
POP DI,ES
POP SI,DS
POP CX,BX
RET
ENVPARSE:
MOV AX,'='
MOV ES:[DI],AH
CALL PARSESTR
CMP B ES:[DI],0
CLC
IF E STC
RET
ENVSTR:
MOV B ES:[DI],0
CALL INTERN_TESTENV
PUSH CX,DS,SI,ES,DI
OR AL,AL
IF Z INC AL
PUSH AX
CALL INTERN_GETENVSTART
POP AX
MOV AH,AL
XOR AL,AL
L0:
DEC AH
JZ >L1
REPNE SCASB
CMP ES:[DI],AL
JNZ L0
POP DI,ES
JMP >L9
L1:
MOV DS,ES
MOV SI,DI
POP DI,ES
CALL INTERN_UEBERTRAGEEINTRAG
L9:
POP SI,DS,CX
RET
GETENVDATA:
CALL INTERN_TESTENV
PUSH DI,ES
CALL INTERN_GETENVSTART
PUSH CX
L0:
REPNE SCASB
CMP ES:[DI],AL
JNZ L0
INC DI
CMP W ES:[DI],01
JNE >L1
INC DI,3
REPNE SCASB
L1:
POP AX
MOV BX,DI
MOV CX,AX
SUB CX,DI
POP ES,DI
RET
ENVCOUNT:
CALL INTERN_TESTENV
PUSH ES,DI,CX
MOV AX,CS:E001
CALL INTERN_COUNTENTRYS
POP CX,DI,ES
RET
USEDENVSEG?:
CALL INTERN_INITENVROUTINES
MOV AL,CS:U000
CMP CS:E001,0FFFFH
CLC
IF E STC
RET
USEOTHERENV:
CALL INTERN_INITENVROUTINES
PUSH DS,BX
MOV DS,CS
MOV BX,LOKALENVSEG
CMP AL,USELOKALENV
JZ >L2
MOV BX,CALLERENVSEG
CMP AL,USECALLERENV
JZ >L2
MOV BX,COMMANDENVSEG
CMP AL,USECOMMANDENV
JNE >L8
L2:
CMP BX,0FFFFH
JE >L8
MOV E001,BX
MOV U000 ,AL
CLC
JMP >L9
L8:
STC
L9:
POP BX,DS
RET
FREELOKALENV:
CALL INTERN_INITENVROUTINES
MOV AX,CS:LOKALENVSEG
CMP AX,0FFFFH
STC
JE >L1
PUSH ES
MOV ES,AX
MOV AH,049H
INT 021H
POP ES
JC >L1
MOV CS:LOKALENVSEG,0FFFFH
CMP CS:U000 ,USELOKALENV
CLC
JNZ >L1
MOV CS:E001,0FFFFH
L1:
RET
#IF !INTERN_UPCASE_S
INTERN_UPCASE_S EQU 01
UPCASE:
CMP AL,'ü'
IF E MOV AL,'Ü'
CMP AL,'ö'
IF E MOV AL,'Ö'
CMP AL,'ä'
IF E MOV AL,'Ä'
CMP AL,'a'
JB >L1
CMP AL,'z'
JA >L1
SUB AL,' '
L1:
RET
#ENDIF
#IF !INTERN_PARSESTR_S
INTERN_PARSESTR_S EQU 01
PARSESTR:
PUSH SI,DI,CX,BX
CLD
XOR CH,CH
MOV ES:[DI],CH
MOV CL,[SI]
JCXZ >L9
PUSH ES,DI
MOV ES,DS
MOV DI,SI
INC DI
MOV BX,SI
REPNE SCASB
MOV SI,DI
POP DI,ES
JNE >L9
XOR AH,AH
MOV AL,[BX]
SUB AX,CX
SUB [BX],CL
DEC B[BX]
MOV AX,CX
STOSB
REP MOVSB
L9:
POP BX,CX,DI,SI
RET
#ENDIF
#IF !INTERN_DOSSTRTOSTR_S
INTERN_DOSSTRTOSTR_S EQU 01
DOSSTRTOSTR:
PUSH SI
CLD
XOR AH,AH
PUSH DI
INC DI
L0:
CMP [SI],AL
JE >L2
MOVSB
INC AH
JNZ L0
DEC AH
L2:
POP DI
MOV ES:[DI],AH
POP SI
RET
#ENDIF
GETCALLERNAME:
MOV AX,CS:CALLERENVSEG
JMP >L1
GETPROGNAME:
MOV AX,ES:LOKALENVSEG
L1:
PUSH AX
CALL INTERN_INITENVROUTINES
POP AX
MOV B ES:[DI],0
CMP AX,0FFFFH
JNE INTERN_GETPROGNAME
STC
RET
V0 DB 0
INITENVROUTINES:
MOV CS:V0,0
JMP SHORT INTERN_INITENVROUTINES
INTERN_GETPROGNAME:
PUSH CX,DS,SI,ES,DI
PUSH BP
MOV BP,SP
CALL INTERN_COUNTENTRYS
CMP W ES:[DI],01H
JE >L1
XOR AX,AX
JMP >L9
L1:
INC DI,2
MOV DS,ES
MOV SI,DI
LES DI,[BP+2]
CALL INTERN_UEBERTRAGEEINTRAG
L9:
MOV SP,BP
POP BP
POP DI,ES,SI,DS,CX
RET
INTERN_INITENVROUTINES:
CLD
CMP CS:V0,0
JNE >L9
PUSH DS
PUSH AX
PUSH BX
PUSH DI
PUSH ES
PUSH DS
MOV DS,CS
MOV V0,01H
MOV AH,062H
INT 021H
MOV AX,BX
CALL INTERN_CHECKENV
MOV LOKALENVSEG,AX
MOV E001,AX
MOV DS,BX
MOV AX,[016H]
MOV DS,CS
CALL INTERN_CHECKENV
MOV CALLERENVSEG,AX
PUSH ES,BX
MOV AH,052H
INT 021H
MOV ES,ES:[BX-2]
MOV AX,ES
ADD AX,ES:[03H]
INC AX,2
POP BX,ES
CALL INTERN_CHECKENV
MOV COMMANDENVSEG,AX
MOV V0,0FFH
POP DS
POP ES
POP DI
POP BX
POP AX
POP DS
L9:
RET
INTERN_DELETEENTRY:
PUSH ES,DI,DS,SI
CALL INTERN_GETENVSTART
MOV DL,[SI]
XOR DH,DH
OR DL,DL
JZ >L8
INC SI
L0:
MOV BX,DI
PUSH CX
PUSH SI
MOV CX,DX
REPE CMPSB
POP SI
POP CX
JNE >L01
CMP B ES:[DI],'='
JE >L1
L01:
MOV DI,BX
REPNE SCASB
CMP ES:[DI],AL
JNE L0
L8:
STC
JMP >L9
L1:
MOV DI,BX
REPNE SCASB
MOV SI,DI
MOV DS,ES
MOV DI,BX
OR BX,BX
IF Z DEC SI
REP MOVSB
L9:
POP SI,DS,DI,ES
RET
INTERN_SETENTRY:
PUSH SI,DS,DI,ES
CALL GETENVDATA
MOV AL,[SI]
ADD AL,ES:[DI]
INC AX
INC AX
XOR AH,AH
CMP CX,AX
JB >L8
MOV CX,BX
MOV BX,AX
MOV ES,CS:E001
XOR DI,DI
XOR AL,AL
L0:
REPNE SCASB
CMP ES:[DI],AL
JNE L0
CMP DI,01
JNZ >L1
DEC DI
DEC BX
INC CX
L1:
PUSH DI,SI
PUSH DS
MOV DS,ES
MOV SI,DI
ADD SI,CX
DEC SI
ADD DI,BX
ADD DI,CX
DEC DI
STD
REP MOVSB
CLD
POP DS
POP SI,DI
MOV CL,[SI]
INC SI
REP MOVSB
MOV ES:B[DI],'='
INC DI
POP DS
POP SI
MOV CL,[SI]
INC SI
REP MOVSB
STOSB
CLC
PUSH SI
PUSH DS
JMP >L1
L8:
STC
L1:
POP ES,DI,DS,SI
RET
INTERN_UPCASESTRING:
PUSH DS,SI,CX,BX
XOR BX,BX
MOV AH,AL
LODSB
OR AL,AL
JZ >L9
MOV CL,AL
XOR CH,CH
L0:
LODSB
CALL UPCASE
MOV [SI-1],AL
CMP AH,AL
IF E INC BL
OR AL,AL
IF E INC BH
LOOP L0
L9:
MOV AX,BX
POP BX,CX,SI,DS
RET
INTERN_CHECKENV:
PUSH DS,BX
MOV DS,AX
MOV BX,[02CH]
DEC BX
MOV DS,BX
CMP W[03],0
JE >L8
CMP B[0H],'M'
JE >L1
CMP B[0H],'Z'
JNE >L8
L1:
INC BX
CMP AX,[01H]
MOV AX,BX
JE >L9
L8:
MOV AX,0FFFFH
L9:
POP BX,DS
RET
INTERN_TESTENV:
CALL INTERN_INITENVROUTINES
CMP CS:E001,0FFFFH
JNE RET
STC
ADD SP,2
RET
INTERN_COUNTENTRYS:
PUSH DX
CALL INTERN_GETENVSTART1
CMP ES:[DI],AX
JZ >L1
MOV DX,AX
L0:
REPNE SCASB
INC DX
CMP ES:[DI],AL
JNZ L0
L1:
INC DI
MOV AX,DX
POP DX
RET
INTERN_UEBERTRAGEEINTRAG:
MOV AL,0
CALL DOSSTRTOSTR
OR AH,AH
RET
INTERN_GETENVSTART:
MOV AX,CS:E001
INTERN_GETENVSTART1:
PUSH AX
DEC AX
MOV ES,AX
MOV DI,ES:[03]
POP ES
MOV CL,4
SHL DI,CL
MOV CX,DI
XOR AX,AX
MOV DI,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