home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
assemblr
/
library
/
lib4a86
/
lib
/
mstack.lib
< prev
next >
Wrap
Text File
|
1992-02-02
|
3KB
|
205 lines
#IF !LIB4A86
#ELSE
#IF !INTERN_LIB4A86_S
INTERN_LIB4A86_S EQU 01
JMP START
#ENDIF
#ENDIF
MSTACKHEADER STRUC
MSTACKLENGTH DW ?
MSTACKFREE DW ?
MSTACKSPTR DW ?
MSTACKCOUNT DW ?
MSTACKSEM DB ?
MSTACKDUMMY DB ?
MSTACKDUMMY1 DB ?
MSTACKUSERDATA1 DW ?
MSTACKUSERDATA2 DW ?
ENDS
MSTACKHEADERLENGTH EQU (TYPE MSTACKHEADER)
FIRSTMSTACKENTRY EQU TYPE ( MSTACKHEADER)
MINMSTACK EQU 256XD
SETMSTACKSEMAPHOR EQU 0FFH
FREEMSTACKSEMAPHOR EQU 000H
MSTACKISEMPTY EQU 08501H
MSTACKISFULL EQU 08502H
MSTACKLENGTHERROR EQU 08503H
MSTACKBUFFERERROR EQU 08504H
MSTACKMESSAGEERROR EQU 08205H
MSTACKAKTIVERROR EQU 082FFH
MSTACKSEG DW 0
INTERN_CHECKMSTACKSEMAPHOR MACRO
MOV AX,MSTACKAKTIVERROR
XCHG ES:MSTACKSEM,AL
CMP AL,FREEMSTACKSEMAPHOR
JE >M1
STC
RET
M1:
#EM
INTERN_FREEMSTACKSEMAPHOR MACRO
MOV ES:MSTACKSEM,FREEMSTACKSEMAPHOR
#EM
INITMSTACK:
CMP CX,MINMSTACK
JAE >L1
MOV AX,MSTACKLENGTHERROR
STC
RET
L1:
MOV CS:MSTACKSEG,ES
MOV ES:MSTACKSEM,SETMSTACKSEMAPHOR
MOV ES:MSTACKLENGTH,CX
INTERN_DELETEMSTACK:
SUB CX,MSTACKHEADERLENGTH
MOV ES:MSTACKFREE,CX
MOV AX,FIRSTMSTACKENTRY
MOV ES:MSTACKSPTR,AX
XOR AX,AX
MOV ES:MSTACKCOUNT,AX
INTERN_FREEMSTACKSEMAPHOR
RET
DELETEMSTACK_A:
MOV ES,CS:MSTACKSEG
DELETEMSTACK:
INTERN_CHECKMSTACKSEMAPHOR
MOV CX,ES:MSTACKLENGTH
JMP SHORT INTERN_DELETEMSTACK
LOCKMSTACK_A:
MOV ES,CS:MSTACKSEG
LOCKMSTACK:
INTERN_CHECKMSTACKSEMAPHOR
RET
UNLOCKMSTACK_A:
MOV ES,CS:MSTACKSEG
UNLOCKMSTACK:
INTERN_FREEMSTACKSEMAPHOR
RET
GETMSTACKSTATISTIK_A:
MOV ES,CS:MSTACKSEG
GETMSTACKSTATISTIK:
INTERN_CHECKMSTACKSEMAPHOR
MOV DX,ES:MSTACKLENGTH
SUB DX,MSTACKHEADERLENGTH
MOV CX,ES:MSTACKFREE
MOV AX,ES:MSTACKCOUNT
MOV BX,ES:MSTACKSPTR
INTERN_FREEMSTACKSEMAPHOR
RET
WRITEMSTACK_A:
MOV ES, CS:MSTACKSEG
WRITEMSTACK:
CLD
INTERN_CHECKMSTACKSEMAPHOR
PUSH DI,SI,CX
MOV AX,MSTACKMESSAGEERROR
OR CH,CH
JNZ >L8
INC CX
MOV AX,ES:MSTACKFREE
CMP CX,AX
JBE >L1
DEC AX
POP CX
PUSH AX
MOV AX,MSTACKISFULL
JMP >L8
L1:
INC ES:MSTACKCOUNT
SUB ES:MSTACKFREE,CX
DEC CX
PUSH CX
MOV DI,ES:MSTACKSPTR
REP MOVSB
POP CX
MOV ES:[DI],CL
INC DI
MOV ES:MSTACKSPTR,DI
CLC
JMP >L9
L8:
STC
L9:
POP CX,SI,DI
INTERN_FREEMSTACKSEMAPHOR
RET
LOOKMSTACK_A:
MOV ES,CS:MSTACKSEG
LOOKMSTACK:
XOR CX,CX
JMP SHORT READMSTACK
READMSTACK_A:
MOV ES, CS:MSTACKSEG
READMSTACK:
CLD
INTERN_CHECKMSTACKSEMAPHOR
PUSH ES,DS,DI,SI,DX
MOV DX,CX
XCHG ES,DS
MOV DI,MSTACKSPTR
XCHG DI,SI
XOR CX,CX
MOV AX,MSTACKISEMPTY
CMP MSTACKCOUNT,CX
JE >L8
L1:
DEC SI
MOV CL,[SI]
SUB SI,CX
OR DX,DX
JNZ >L1
JCXZ >L9
MOV AL,[SI]
JMP >L9
L1:
MOV AX,MSTACKBUFFERERROR
CMP DX,CX
JB >L8
PUSH SI
MOV DX,CX
REP MOVSB
POP SI
MOV MSTACKSPTR,SI
DEC MSTACKCOUNT
MOV CX,DX
INC DX,1
ADD MSTACKFREE,DX
CLC
JMP >L9
L8:
STC
L9:
POP DX,SI,DI,DS,ES
INTERN_FREEMSTACKSEMAPHOR
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