home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
assemblr
/
library
/
lib4a86
/
lib
/
strings.lib
< prev
next >
Wrap
Text File
|
1992-02-15
|
6KB
|
545 lines
#IF !LIB4A86
#ELSE
#IF !INTERN_LIB4A86_S
INTERN_LIB4A86_S EQU 01
JMP START
#ENDIF
#ENDIF
DELETESTR MACRO
XOR AL,AL
XCHG [SI],AL
#EM
MAKESTR MACRO
PUSH DI
CLD
XOR CH,CH
MOV ES:[DI],CL
INC DI
REP STOSB
POP DI
#EM
CHARTOSTR MACRO
MOV B[SI],1
MOV B[SI+1],AL
#EM
STRTOCHAR MACRO
CMP B[SI],1
STC
JNZ >M1
MOV AL,B[SI+1]
M1:
#EM
LENGTH MACRO
MOV CL,[SI]
XOR CH,CH
OR CX,CX
#EM
#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
LOWCASE:
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
ADD AL,' '
L1:
RET
UPSTR:
MOV AX,OFFSET UPCASE
JMP >L1
LOWSTR:
MOV AX,OFFSET LOWCASE
L1:
PUSH BX
MOV BX,AX
CALL INTERN_KONVERTSTRING
POP BX
RET
NOTPOSCHAR:
MOV AH,01
JMP >L1
POSCHAR:
MOV AH,0
L1:
PUSH DI,CX,BX
CLD
MOV CL,ES:[DI]
INC DI
XOR CH,CH
JCXZ >L8
MOV BX,CX
OR AH,AH
JZ >L2
REPE SCASB
JNE >L1
JMP >L8
L2:
REPNE SCASB
JE >L1
JCXZ >L8
L1:
SUB BX,CX
MOV AX,BX
OR AX,AX
JMP >L9
L8:
XOR AX,AX
L9:
POP BX,CX,DI
RET
INSERTCHAR:
PUSH DS,SI
PUSH BP
MOV BP,SP
XCHG AH,AL
PUSH AX
MOV B [BP-2],01
MOV SI,SP
MOV DS,SS
CALL INSERTSTR
MOV SP,BP
POP BP
POP SI,DS
RET
S001 EQU [BP+2]
S002 EQU [BP+4]
S003 EQU [BP+6]
S004 EQU [BP+8]
INSERTSTR:
PUSH CX,BX,ES,DI,DS,SI
PUSH BP
MOV BP,SP
MOV AH,0
MOV CH,0
MOV BH,0
OR AL,AL
IF E INC AL
CMP B[SI],AH
JE >L9
MOV CL,ES:[DI]
INC CL
STC
JZ >L9
CMP AL,CL
IF A MOV AL,CL
DEC CL
MOV BL,B[SI]
PUSH CX
ADD CL,BL
POP CX
JC >L9
ADD ES:[DI],BL
LDS SI,S003
ADD SI,CX
MOV DI,SI
ADD DI,BX
SUB CX,AX
INC CX
STD
REP MOVSB
LDS SI,S001
MOV CL,BL
ADD SI,CX
REP MOVSB
CLD
CLC
L9:
MOV SP,BP
POP BP
POP SI,DS,DI,ES,BX,CX
RET
DELCHARS:
PUSH CX,DX,DI,SI
CLD
MOV AH,AL
LODSB
MOV CL,AL
XOR CH,CH
JCXZ >L9
XOR DX,DX
MOV DI,SI
L0:
LODSB
MOV [DI],AL
INC DI
CMP AL,AH
JNE >L1
INC DX
DEC DI
L1:
LOOP L0
POP SI
SUB [SI],DL
MOV AL,DL
PUSH SI
L9:
MOV AH,0
POP SI
POP DI,DX,CX
RET
STRIPCHARS:
PUSH ES,CX,DI,SI
CLD
MOV AH,AL
LODSB
OR AL,AL
JZ >L9
MOV CL,AL
XOR CH,CH
DEC CL
JZ >L21
INC SI
MOV DI,SI
MOV ES,DS
L0:
LODSB
CMP AL,AH
JNE >L1
CMP [SI-2],AH
JNZ >L1
INC CH
JMP >L2
L1:
STOSB
L2:
DEC CL
JNZ L0
L21:
POP SI
SUB [SI],CH
MOV AL,CH
XOR AH,AH
PUSH SI
L9:
MOV AH,0
POP SI
POP DI,CX,ES
RET
DELCHAR:
MOV AH,01
DELSTR:
PUSH SI,DI,ES,CX,BX
CLD
OR AL,AL
IF E INC AL
OR AH,AH
JE >L9
XOR CH,CH
MOV CL,[SI]
JCXZ >L91
CMP AL,CL
JA >L91
MOV BX,AX
PUSH CX
XOR AH,AH
SUB CX,AX
CMP BH,CL
POP CX
JB >L1
DEC B[SI]
JMP >L91
L1:
MOV AL,CL
SUB AL,BH
MOV [SI],AL
MOV ES,DS
MOV DI,SI
XOR AH,AH
MOV AL,BL
ADD DI,AX
ADD AL,BH
ADD SI,AX
SUB CX,AX
INC CX
REP MOVSB
L91:
CLC
L9:
POP BX,CX,ES,DI,SI
RET
CONCATSTR:
PUSH SI,DI,CX
CLD
MOV AH,0
MOV CH,AH
MOV AL,ES:[DI]
MOV CL,[SI]
JCXZ >L9
PUSH AX
ADD AX,CX
SUB AX,255XD
IF NS SUB CX,AX
POP AX
JCXZ >L9
ADD ES:[DI],CL
ADD DI,AX
CMPSB
JMP >L91
MOVESTR:
PUSH SI,DI,CX
CLD
XOR CH,CH
MOV CL,[SI]
INC CX
L91:
REP MOVSB
L9:
POP CX,DI,SI
RET
SUBSTR:
PUSH SI,DI,CX
CLD
MOV CH,AH
MOV CL,[SI]
XOR AH,AH
MOV B ES:[DI],AH
OR AL,AL
IF E INC AL
OR CH,CH
JE L9
CMP AL,CL
JA L9
ADD SI,AX
SUB CL,AL
INC CL
CMP CH,CL
IF B MOV CL,CH
XOR CH,CH
MOV AL,CL
STOSB
JMP L91
#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
STRTODOSSTR:
PUSH CX,DI,SI
CLD
XOR CH,CH
MOV CL,[SI]
INC SI
JCXZ >L1
REP MOVSB
L1:
STOSB
POP SI,DI,CX
RET
#IF !INTERN_DOSSTRTOSTR_S
DOSSTRTOSTR:
INTERN_DOSSTRTOSTR_S EQU 01
PUSH SI
CLD
XOR AH,AH
PUSH DI
INC DI
L0:
CMP [SI],AL
JE >L2
MOVSB
INC AH
JNZ L0
MOV AH,255XD
L2:
POP DI
MOV ES:[DI],AH
POP SI
RET
#ENDIF
TRANSLATECHARS:
PUSH DI,CX
XOR BX,BX
XOR CH,CH
MOV CL,ES:[DI]
JCXZ >L9
INC DI
L1:
SCASB
JNE >L2
MOV ES:[DI-1],AH
INC BL
L2:
LOOP L1
L9:
POP CX,DI
RET
POSSTR:
PUSH DI,SI,CX,DX
CLD
MOV CL,[SI]
XOR CH,CH
MOV DL,ES:[DI]
XOR DH,DH
SUB DX,CX
JB >L90
XOR AX,AX
JCXZ >L9
INC AX
INC DX
INC SI
L0:
INC DI
PUSH CX,SI,DI
REPZ CMPSB
POP DI,SI,CX
JZ >L9
INC AX
DEC DX
JNZ L0
L90:
XOR AX,AX
L9:
POP DX,CX,SI,DI
RET
COMPARESTR:
PUSH DI,SI,CX
CLD
MOV AL,[SI]
MOV CL,ES:[DI]
CMPSB
LAHF
IF A MOV CL,AL
XOR CH,CH
JCXZ >L1
REPE CMPSB
JNZ >L2
L1:
SAHF
L2:
POP CX,SI,DI
RET
V0 EQU W[BP-02H]
Q1 EQU W[BP-04H]
Q0 EQU W[BP-06H]
Z0 EQU W[BP-08H]
TRANSLATESTR:
PUSH CX,BX,DI,SI,DS
PUSH BP
MOV BP,SP
MOV BX,DX
MOV AL,[BX]
MOV AH,[SI]
CMP AH,AL
IF B MOV AL,AH
XOR AH,AH
PUSH AX
PUSH DS
INC SI
PUSH SI
INC DX
PUSH DX
MOV DS,ES
MOV SI,DI
MOV BX,OFFSET INTERN_TRANSLATESTRING
CALL INTERN_KONVERTSTRING
MOV SP,BP
POP BP
POP DS,SI,DI,BX,CX
RET
INTERN_TRANSLATESTRING:
PUSH DI,ES,SI,CX
LES DI,W Q0
MOV SI,Z0
MOV CX,V0
L0:
SCASB
JE >L10
INC SI
LOOP L0
JMP >L1
L10:
MOV AL,ES:[SI]
L1:
POP CX,SI,ES,DI
RET
INTERN_KONVERTSTRING:
PUSH SI,CX
MOV CL,[SI]
XOR CH,CH
JCXZ >L2
L1:
INC SI
MOV AL,[SI]
CALL BX
MOV [SI],AL
LOOP L1
L2:
POP CX,SI
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