2 ; process control system calls for MSDOS
7 CODE SEGMENT BYTE PUBLIC 'CODE'
8 ASSUME
SS:DOSGROUP
,CS:DOSGROUP
17 i_need CurrentPDB
,WORD
25 SUBTTL $
WAIT - return previous process error
code
28 ; process control data
30 i_need exit_code
,WORD ; code of exit
36 ; AX has the exit code
38 ASSUME
DS:NOTHING
,ES:NOTHING
47 error error_invalid_function
54 SUBTTL Terminate
and stay resident handler
57 ; Input: DX is an offset from CurrentPDB at which to
58 ; truncate the current block.
60 ; output: The current block is truncated (expanded) to be [DX+15]/16
61 ; paragraphs long. An exit is simulated via resetting CurrentPDB
62 ; and restoring the vectors.
64 procedure $Keep_process
,NEAR
65 ASSUME
DS:NOTHING
,ES:NOTHING
,SS:DOSGROUP
67 PUSH AX ; keep exit code around
68 MOV BYTE PTR [Exit_type
],Exit_keep_process
70 CMP DX,6h
; keep enough space around for system
71 JAE Keep_shrink
; info
77 invoke $SETBLOCK
; ignore return codes.
80 JC keep_done
; failed on modification
83 MOV DS:[PDB_block_len
],AX
87 JMP SHORT exit_inner
; and let abort take care of the rest
91 procedure Stay_resident
,NEAR
92 ASSUME
DS:NOTHING
,ES:NOTHING
,SS:NOTHING
93 MOV AX,(Keep_process
SHL 8) + 0 ; Lower part is return code
101 SUBTTL $EXIT
- return to parent process
112 ASSUME
DS:NOTHING
,ES:NOTHING
,SS:DOSGROUP
114 XCHG AH,BYTE PTR [DidCTRLC
]
116 MOV BYTE PTR [Exit_type
],exit_terminate
118 MOV BYTE PTR [Exit_type
],exit_ctrl_c
121 invoke get_user_stack