中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-06-26 05:11
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [原创]dos下进程切换事例 查看 515 回复 1
楼 主 [原创]dos下进程切换事例 发表于 2004-09-07 00:00 ·  中国 北京 联通
初级用户
积分 160
发帖 21
注册 2004-08-26 00:00
21年会员
UID 30763
性别 男
状态 离线
#include <dos.h>
#include <stdio.h>
#include <conio.h>
#define INTERRUPT 0xfc
unsigned task1;
unsigned task2;
int l=0;
int h=0;
int num=0;
//void (interrupt far * oldhandler)();
void os_task1(void)
{
while(1)
{
printf("this 1\n";
// getchar();
// sleep(1);
asm int 0xfc
}
}
void os_task2(void)
{
while(1)
{
printf("this 2\n";
// getchar();
// sleep(1);
asm int 0xfc
}
}
void interrupt far handler()
{
// printf("this is interrupt";
h++;
printf("num=%d\n",h);
if(l){
l=0;
//pusha
//pop
// printf("%d\n"",num
/* asm mov bx,offset task2
asm pop ax
asm mov word ptr ,ax
asm pop ax
asm mov word ptr ,ax
// asm popf
*/
{ asm pop ax
asm pop ax
asm pop ax
asm pop ax
asm mov bx,offset task1
asm mov ax,word ptr
asm push ax
asm mov ax,word ptr
asm push ax
//asm pushf
asm iret
} }
else
{
l=1;
asm pop ax
asm pop ax
asm pop ax
asm pop ax
// asm popf
asm mov bx,offset task2
asm mov ax,word ptr
asm push ax
asm mov ax,word ptr
asm push ax
// asm pushf
asm iret
}
}
main()
{
void interrupt far handler();
task1=FP_OFF(os_task1);
task1=FP_SEG(os_task1);
// task2=FP_OFF(os_task2);
// task2=FP_SEG(os_task2);
// os_task1();
// printf("task1=%04x task1=%04x\n",task1,task1);
task2=FP_OFF(os_task2);
task2=FP_SEG(os_task2);
setvect(INTERRUPT,handler);
// asm int 0xfc
os_task1();
}
msn:yaly163@hotmail.com
2 发表于 2004-09-08 00:00 ·  美国
系统支持
★★★★★★
“新DOS时代”站长
积分 27,736
发帖 10,521
注册 2002-10-09 12:00
23年会员
UID 9
状态 离线
沒有說明?
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

论坛跳转: