![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-16 22:21 |
共 47,813 主题排行 / 349,903 发帖 / 今日 0 篇 / 48,259 会员排行 |
| DOS疑难解答 & 问题讨论 (解答室) » [原创]dos下进程切换事例 |
| 可打印版本 543 / 1 |
| 第1楼 yaly | 发表于 2004-09-07 00:00 |
| 初级用户 发帖 21 积分 160 | |
|
[原创]dos下进程切换事例 #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楼 Wengier | 发表于 2004-09-08 00:00 |
| 系统支持 发帖 10,521 积分 27,736 | |
|
沒有說明?
|
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |