精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>C/C++>>DOS编程>>怎样在tc3.0里面调用dos的07号中断

主题:怎样在tc3.0里面调用dos的07号中断
发信人: kingfox()
整理人: wenbobo(2002-08-13 10:45:44), 站内信件
【 在 jamwang (雨后) 的大作中提到: 】


------------------------
 int86, int86x?                     <DOS.H>
------------------------
 General 8086 software interrupt interfaces

 Declaration:
  ?int int86(int intno, union REGS *inregs, union REGS *outregs);
  ?int int86x(int intno, union REGS *inregs, union REGS *outregs,
      struct SREGS *segregs);

 Remarks:
int86 and int86x execute an 8086 software interrupt specified by the
argument intno.

With int86x, you can invoke an 8086 software interrupt that takes a va
lue o
DS different from the default data segment, and/or takes an argument i
n ES.

 Before the interrupt
------------------------
Before executing the software interrupt, these functions copy register

values from inregs into the registers.

int86x also copies the segregs->ds and segregs->es values into the
corresponding registers before executing the software interrupt.

This feature allows programs that use far pointers or a large data mem
ory
model to specify which segment is to be used for the software interrup
t.

 After the interrupt
------------------------
After the software interrupt returns, these functions copy the followi
ng:
 ?current register values          to outregs
 ?status of the carry flag         to the x.cflag field in outregs
 ?value of the 8086 flags register to the x.flags field in outregs

int86x also restores DS and sets the segregs->es and segregs->ds field
s to
the values of the corresponding segment registers.

If the carry flag is set, it usually indicates that an error has occur
red.

>>NOTE: inregs can point to the same structure that outregs points to.


 Return Value:
Both functions return the value of AX after completion of the software

interrupt.

If the carry flag is set, indicating an error (outregs -> x.cflag != 0
),
these functions set _doserrno to the error code.

Examples:

  int86 example
-------------------------

 #include <stdio.h>
 #include <conio.h>
 #include <dos.h>

 #define VIDEO 0x10

 void movetoxy(int x, int y)
 {
    union REGS regs;

    regs.h.ah = 2;  /* set cursor position */
    regs.h.dh = y;
    regs.h.dl = x;
    regs.h.bh = 0;  /* video page 0 */
    int86(VIDEO, &regs, &regs);
 }

 int main(void)
  int86 example
 哌哌哌哌哌哌哌?

 #include <stdio.h>
 #include <conio.h>
 #include <dos.h>

 #define VIDEO 0x10

 void movetoxy(int x, int y)
 {
    union REGS regs;

    regs.h.ah = 2;  /* set cursor position */
    regs.h.dh = y;
    regs.h.dl = x;
    regs.h.bh = 0;  /* video page 0 */
    int86(VIDEO, &regs, &regs);
 }

 int main(void)
  int86 example
 哌哌哌哌哌哌哌?

 #include <stdio.h>
 #include <conio.h>
 #include <dos.h>

 #define VIDEO 0x10

 void movetoxy(int x, int y)
 {
    union REGS regs;

    regs.h.ah = 2;  /* set cursor position */
    regs.h.dh = y;
    regs.h.dl = x;
    regs.h.bh = 0;  /* video page 0 */
    int86(VIDEO, &regs, &regs);
 }

 int main(void)
 {
    clrscr();
    movetoxy(35, 10);
    printf("Hello\n");
    return 0;
 }



--
------------------------------------------------------------
有缘则聚,缘尽则散,随缘而定,随遇而安。
------------------------------------------------------------
欢迎光临“电子工程师园地”http://kingfox.163.net

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.101.20.121]

[关闭][返回]