procsupt.lst
来自「DOS SOURCE CODE,DOS-C started in 1988 as」· LST 代码 · 共 506 行 · 第 1/2 页
LST
506 行
Turbo Assembler Version 3.1 04/11/13 12:54:49 Page 1
PROCSUPT.ASM
1 ;
2 ; File:
3 ; procsupt.asm
4 ; Description:
5 ; Assembly support routines for process handling, etc.
6 ;
7 ; Copyright (c) 1995
8 ; Pasquale J. Villani
9 ; All Rights Reserved
10 ;
11 ; This file is part of DOS-C.
12 ;
13 ; DOS-C is free software; you can redistribute it and/or
14 ; modify it under the terms of the GNU General Public License
15 ; as published by the Free Software Foundation; either version
16 ; 2, or (at your option) any later version.
17 ;
18 ; DOS-C is distributed in the hope that it will be useful, but
19 ; WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
21 ; the GNU General Public License for more details.
22 ;
23 ; You should have received a copy of the GNU General Public
24 ; License along with DOS-C; see the file COPYING. If not,
25 ; write to the Free Software Foundation, 675 Mass Ave,
26 ; Cambridge, MA 02139, USA.
27 ;
28 ; $Logfile: C:/dos-c/src/kernel/procsupt.asv $
29 ;
30 ; $Header: C:/dos-c/src/kernel/procsupt.asv 1.3 07 Feb 1998 20:42:08 patv $
31 ;
32 ; $Log: C:/dos-c/src/kernel/procsupt.asv $
33 ;
34 ; Rev 1.3 07 Feb 1998 20:42:08 patv
35 ;Modified stack fram to match DOS standard
36 ;
37 ; Rev 1.2 29 May 1996 21:03:36 patv
38 ;bug fixes for v0.91a
39 ;
40 ; Rev 1.1 01 Sep 1995 17:54:24 patv
41 ;First GPL release.
42 ;
43 ; Rev 1.0 02 Jul 1995 9:05:58 patv
44 ;Initial revision.
45 ;
46
47
48 0000 _TEXT segment byte public 'CODE'
49 DGROUP group _DATA,_BSS,_BSSEND ; small model
50 assume cs:_TEXT,ds:DGROUP,ss:DGROUP
51 0000 _TEXT ends
52
53 0000 _DATA segment word public 'DATA'
54 0000 _DATA ends
55
Turbo Assembler Version 3.1 04/11/13 12:54:49 Page 2
PROCSUPT.ASM
56 0000 _BSS segment word public 'BSS'
57 0000 _BSS ends
58
59 0000 _BSSEND segment byte public 'STACK'
60 0000 _BSSEND ends
61
62
63
64 extrn _api_sp:word ; api stacks - for context
65 extrn _api_ss:word ; switching
66 extrn _usr_sp:word ; user stacks
67 extrn _usr_ss:word
68
69 extrn _kstackp:near ; kernel stack
70 extrn _ustackp:near ; new task stack
71
72 extrn _break_flg:near ; break detected flag
73 extrn _int21_entry:far ; far call system services
74
75 include stacks.inc
1 76 ;
1 77 ; File:
1 78 ; stacks.inc
1 79 ; Description:
1 80 ; Macro support for register stack frame
1 81 ;
1 82 ; Copyright (c) 1998
1 83 ; Pasquale J. Villani
1 84 ; All Rights Reserved
1 85 ;
1 86 ; This file is part of DOS-C.
1 87 ;
1 88 ; DOS-C is free software; you can redistribute it and/or
1 89 ; modify it under the terms of the GNU General Public License
1 90 ; as published by the Free Software Foundation; either version
1 91 ; 2, or (at your option) any later version.
1 92 ;
1 93 ; DOS-C is distributed in the hope that it will be useful, but
1 94 ; WITHOUT ANY WARRANTY; without even the implied warranty of
1 95 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
1 96 ; the GNU General Public License for more details.
1 97 ;
1 98 ; You should have received a copy of the GNU General Public
1 99 ; License along with DOS-C; see the file COPYING. If not,
1 100 ; write to the Free Software Foundation, 675 Mass Ave,
1 101 ; Cambridge, MA 02139, USA.
1 102 ;
1 103 ; $Logfile: C:/dos-c/hdr/stacks.inv $
1 104 ;
1 105 ; $Header: C:/dos-c/hdr/stacks.inv 1.0 07 Feb 1998 20:59:16 patv $
1 106 ;
1 107 ; $Log: C:/dos-c/hdr/stacks.inv $
1 108 ;
1 109 ; Rev 1.0 07 Feb 1998 20:59:16 patv
1 110 ;Modified stack frame to match DOS standard
Turbo Assembler Version 3.1 04/11/13 12:54:49 Page 3
PROCSUPT.ASM
1 111 ; $EndLog$
1 112
1 113
1 114 ;
1 115 ; Standard stack frame used throughout DOS-C
1 116 ;
1 117 ; MS-DOS specific
1 118 ;
1 119 ; +---------------+
1 120 ; | irp hi | 26
1 121 ; +---------------+
1 122 ; | irp low | 24
1 123 ; +---------------+
1 124 ; | flags | 22
1 125 ; +---------------+
1 126 ; | cs | 20
1 127 ; +---------------+
1 128 ; | ip | 18
1 129 ; +---------------+
1 130 ; | es | 16
1 131 ; +---------------+
1 132 ; | ds | 14
1 133 ; +---------------+
1 134 ; | bp | 12
1 135 ; +---------------+
1 136 ; | di | 10
1 137 ; +---------------+
1 138 ; | si | 8
1 139 ; +---------------+
1 140 ; | dx | 6
1 141 ; +---------------+
1 142 ; | cx | 4
1 143 ; +---------------+
1 144 ; | bx | 2
1 145 ; +---------------+
1 146 ; | ax | 0
1 147 ; +---------------+
1 148 ;
1 149
1 150 *000 RegFrame struc
1 151 *000 01*(0000) reg_ax dw (?)
1 152 *002 01*(0000) reg_bx dw (?)
1 153 *004 01*(0000) reg_cx dw (?)
1 154 *006 01*(0000) reg_dx dw (?)
1 155 *008 01*(0000) reg_si dw (?)
1 156 *00A 01*(0000) reg_di dw (?)
1 157 *00C 01*(0000) reg_bp dw (?)
1 158 *00E 01*(0000) reg_ds dw (?)
1 159 *010 01*(0000) reg_es dw (?)
1 160 *012 01*(0000) reg_ip dw (?)
1 161 *014 01*(0000) reg_cs dw (?)
1 162 *016 01*(0000) reg_flags dw (?)
1 163 *018 01*(0000) irp_low dw (?)
1 164 *01A 01*(0000) irp_hi dw (?)
1 165 *01C ends
Turbo Assembler Version 3.1 04/11/13 12:54:49 Page 4
PROCSUPT.ASM
1 166
1 167
1 168 PUSH$ALL macro
1 169 push es
1 170 push ds
1 171 push bp
1 172 push di
1 173 push si
1 174 push dx
1 175 push cx
1 176 push bx
1 177 push ax
1 178 endm
1 179
1 180 POP$ALL macro
1 181 pop ax
1 182 pop bx
1 183 pop cx
1 184 pop dx
1 185 pop si
1 186 pop di
1 187 pop bp
1 188 pop ds
1 189 pop es
1 190 endm
1 191
1 192
193
194 0000 _TEXT segment
195 assume cs: _TEXT
196
197 ;
198 ; Special call for switching processes
199 ;
200 ; void interrupt far exec_user(irp)
201 ; iregs far *irp;
202 ;
203 public _exec_user
204 0000 _exec_user proc far
205
206 PUSH$ALL
1 207 0000 06 push es
1 208 0001 1E push ds
1 209 0002 55 push bp
1 210 0003 57 push di
1 211 0004 56 push si
1 212 0005 52 push dx
1 213 0006 51 push cx
1 214 0007 53 push bx
1 215 0008 50 push ax
216 0009 B8 0000s mov ax,DGROUP
217 000C 8E D8 mov ds,ax
218 000E 8B EC mov bp,sp
219 0010 FC cld
220 0011 FA cli
Turbo Assembler Version 3.1 04/11/13 12:54:49 Page 5
PROCSUPT.ASM
221 ;
222 ;
223 ;
224 0012 8B 46 18 mov ax,WORD PTR [bp.irp_low] ; irp (user ss:sp)
225 0015 8B 56 1A mov dx,WORD PTR [bp.irp_hi]
226 0018 8B E0 mov sp,ax ; set-up user stack
227 001A 8E D2 mov ss,dx
228 001C FB sti
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?