-
Notifications
You must be signed in to change notification settings - Fork 0
/
sys.plm
66 lines (61 loc) · 1.5 KB
/
sys.plm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/****h* plm/sys
*
* NAME
* sys -- the system module
*
* DESCRIPTION
* This module deals with OS-related stuff, which is not related to console
* and files.
*
******
*/
/****f* sys/get_command_tail
*
* NAME
* get_command_tail -- return the pointer to the command tail
*
* SYNOPSIS
* call get_command_tail(p$str, len);
*
* DESCRIPTION
* Write the command tail into the area pointed by p$str of maximum length
* len. The written string is null-terminated.
*
******
*/
get_command_tail: procedure (p$str, len) public;
declare p$str pointer;
declare len uint;
declare str based p$str (*) byte;
declare psp$sel selector;
declare psp based psp$sel structure (
skip (80h) byte,
length byte,
buf (7Fh) byte);
declare i uint;
psp$sel = dos_get_psp;
i = 1; /* the first char is a space */
do while i < psp.length and psp.buf(i) <> cr;
str(i - 1) = psp.buf(i);
i = i + 1;
end;
str(i - 1) = 0;
end get_command_tail;
/****f* sys/terminate
*
* NAME
* terminate -- terminate the current program
*
* SYNOPSIS
* call terminate(code);
*
* DESCRIPTION
* Terminate the currently running program and return the code.
*
******
*/
terminate: procedure (code) public;
declare code byte;
call dos_exit(code);
end terminate;