home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power Programming
/
powerprogramming1994.iso
/
progtool
/
c
/
jazlib.arc
/
__CHKSTK.ASM
next >
Wrap
Assembly Source File
|
1986-05-20
|
2KB
|
35 lines
;__CHKSTK.ASM from the small model MS/C library.
; Disassembled by Jack A. Zucker 301-794-5950
; on entry, ax contains the combined total of the size of the local
; variables to be allocated on the stack. Note that chars are rounded up
; to words by default.
IGROUP:__chkstk:
50EF:0061 59 POP CX ; IP from near call
50EF:0062 8BDC MOV BX,SP ; get top of stack
50EF:0064 2BD8 SUB BX,AX ; Enough stack left?
10EF:0066 720A JB __chkstk+11 (0072) ; NO
50EF:0068 3B1E6000 CMP BX,[STKHQQ] ; Cmp to Stack Bottom
50EF:006C 7204 JB __chkstk+11 (0072) ; Below Stack Bottom
50EF:006E 8BE3 MOV SP,BX ; OK at this point
50EF:0070 FFE1 JMP CX ; remember,CX = IP (dumb)
50EF:0072 E96801 JMP __astkovr ; Stack overflow routine
IGROUP:__astkovr:
50EF:01DD B112 MOV CL,12 ; number of bytes
50EF:01DF BA9E01 MOV DX,019E ; cs:19e "stack overflow"
50EF:01E2 32ED XOR CH,CH ; 0 out high byte
50EF:01E4 0E PUSH CS
50EF:01E5 1F POP DS ; set data = code
50EF:01E6 BB0200 MOV BX,0002 ; stderr handle
50EF:01E9 B440 MOV AH,40 ; write file function
50EF:01EB CD21 INT 21 ; write it!
50EF:01ED 16 PUSH SS ; get data value back
50EF:01EE 1F POP DS ; small model ss=ds
50EF:01EF B8FF00 MOV AX,00FF ; exit errorlevel=255
50EF:01F2 50 PUSH AX ; save on stack
50EF:01F3 E80E01 CALL __exit ; quit program