From 80ab2fddfdf30f09f0a0a637654cbb3cd5c7baa6 Mon Sep 17 00:00:00 2001 From: Rich Turner Date: Fri, 12 Aug 1983 17:53:34 -0700 Subject: MS-DOS v2.0 Release --- v2.0/source/PROC.ASM | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 v2.0/source/PROC.ASM (limited to 'v2.0/source/PROC.ASM') diff --git a/v2.0/source/PROC.ASM b/v2.0/source/PROC.ASM new file mode 100644 index 0000000..abc6f9c --- /dev/null +++ b/v2.0/source/PROC.ASM @@ -0,0 +1,130 @@ +; +; process control system calls for MSDOS +; + +INCLUDE DOSSEG.ASM + +CODE SEGMENT BYTE PUBLIC 'CODE' + ASSUME SS:DOSGROUP,CS:DOSGROUP + +.xlist +.xcref +INCLUDE DOSSYM.ASM +INCLUDE DEVSYM.ASM +.cref +.list + + i_need CurrentPDB,WORD + i_need CreatePDB,BYTE + i_need NUMIO,BYTE + i_need Exit_type,BYTE + i_need INDOS,BYTE + i_need DMAADD,DWORD + i_need DidCTRLC,BYTE + +SUBTTL $WAIT - return previous process error code +PAGE +; +; process control data +; + i_need exit_code,WORD ; code of exit + +; +; Assembler usage: +; MOV AH, Wait +; INT int_command +; AX has the exit code + procedure $WAIT,NEAR + ASSUME DS:NOTHING,ES:NOTHING + MOV AX,[exit_code] + XOR DX,DX + MOV [exit_code],DX + transfer SYS_RET_OK +$WAIT ENDP + +IF IBM + procedure $EXEC,NEAR + error error_invalid_function +$EXEC ENDP +ENDIF +IF NOT IBM +INCLUDE EXEC.ASM +ENDIF + +SUBTTL Terminate and stay resident handler +PAGE +; +; Input: DX is an offset from CurrentPDB at which to +; truncate the current block. +; +; output: The current block is truncated (expanded) to be [DX+15]/16 +; paragraphs long. An exit is simulated via resetting CurrentPDB +; and restoring the vectors. +; + procedure $Keep_process,NEAR + ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP + + PUSH AX ; keep exit code around + MOV BYTE PTR [Exit_type],Exit_keep_process + MOV ES,[CurrentPDB] + CMP DX,6h ; keep enough space around for system + JAE Keep_shrink ; info + MOV DX,6h +keep_shrink: + MOV BX,DX + PUSH BX + PUSH ES + invoke $SETBLOCK ; ignore return codes. + POP DS + POP BX + JC keep_done ; failed on modification + MOV AX,DS + ADD AX,BX + MOV DS:[PDB_block_len],AX + +keep_done: + POP AX + JMP SHORT exit_inner ; and let abort take care of the rest + +$Keep_process ENDP + + procedure Stay_resident,NEAR + ASSUME DS:NOTHING,ES:NOTHING,SS:NOTHING + MOV AX,(Keep_process SHL 8) + 0 ; Lower part is return code + ADD DX,15 + MOV CL,4 + SHR DX,CL + + transfer COMMAND +Stay_resident ENDP + +SUBTTL $EXIT - return to parent process +PAGE +; +; Assembler usage: +; MOV AL, code +; MOV AH, Exit +; INT int_command +; Error return: +; None. +; + procedure $EXIT,NEAR + ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP + XOR AH,AH + XCHG AH,BYTE PTR [DidCTRLC] + OR AH,AH + MOV BYTE PTR [Exit_type],exit_terminate + JZ exit_inner + MOV BYTE PTR [Exit_type],exit_ctrl_c + +Exit_inner: + invoke get_user_stack + PUSH [CurrentPDB] + POP [SI.user_CS] + transfer abort_inner +$EXIT ENDP + +do_ext + +CODE ENDS + END -- cgit v1.2.3