Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C Programming Language

Trap Int21h problem


I saw a lot of info about the problems of trapping int21h, but I
really dont understand what happens. I need to watch some serial
operations from another program, wich uses fopen() function as
interface for the comm port. Heres my code:

void interrupt (*old21)();

void interrupt int21(void)
  {
    char far* str;
    if (_AH == 0x3d)
      {
        str = MK_FP(_DS, _DX);
        if (str == "com1:")
          reboot();  //Debugging purpouses
      }
    old21();
  }

void main(void)
  {
    union REGS regs;
    long far* vect;

    old21 = getvect(0x21);
    vect = MK_FP(0, 0x21 * 4); //using direct address cause setvect
could cause conflict??
    *vect =  int21 // Not sure about this

    reboot = MK_FP(0xffff, 0x0000);

    regs.x.ax = 0x3100;
    regs.x.dx = 0x1000;
    intdos(&regs, &regs);
  }

Im not sure if this pointers operations are correct but Im interested
about what happens inside the int21 function.
Tks in advance

Changed the string comparison to:

if (_fstricmp(str, "com1:") == 0)
          reboot();  //Debugging purpouses

gerotica wrote:

> I saw a lot of info about the problems of trapping int21h, but I
> really dont understand what happens. I need to watch some serial
> operations from another program, wich uses fopen() function as
> interface for the comm port. Heres my code:

This has nothing to do with the standard C language.  I suspect you
want a group that deals with your particular system, which is
probably some form of MsDos.

--
Chuck F (cbfalconer at maineline dot net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com

Sorry...
On 23 Mar 2007 19:38:56 -0700, "gerotica" <pgerot@gmail.com> wrote
in comp.lang.c:

> I saw a lot of info about the problems of trapping int21h, but I
> really dont understand what happens. I need to watch some serial
> operations from another program, wich uses fopen() function as
> interface for the comm port. Heres my code:

> void interrupt (*old21)();

There is no such thing as an "interrupt" keyword in C.

> void interrupt int21(void)
>   {
>     char far* str;
>     if (_AH == 0x3d)

...no "_AH".

>       {
>         str = MK_FP(_DS, _DX);
>         if (str == "com1:")
>           reboot();  //Debugging purpouses
>       }
>     old21();
>   }

> void main(void)

"void main(void)" is not a legal function definition in C, main()
returns int ALWAYS.

The C language has no "int21" function.  This is a non-standard,
platform specific extension.

> Tks in advance

You need to ask about MS-DOS system calls in
news:comp.os.msdos.programmer.  These things are defined by and part
of the MS-DOS operating system, not defined by or part of the C
language.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc