473,320 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Trap Int21h problem

I saw a lot of info about the problems of trapping int21h, but I
really don´t understand what happens. I need to watch some serial
operations from another program, wich uses fopen() function as
interface for the comm port. Here´s 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

Mar 24 '07 #1
4 1674
Changed the string comparison to:

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

Mar 24 '07 #2
gerotica wrote:
>
I saw a lot of info about the problems of trapping int21h, but I
really don´t understand what happens. I need to watch some serial
operations from another program, wich uses fopen() function as
interface for the comm port. Here´s 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

Mar 24 '07 #3
Sorry...

Mar 24 '07 #4
On 23 Mar 2007 19:38:56 -0700, "gerotica" <pg*******@gmail.comwrote
in comp.lang.c:
I saw a lot of info about the problems of trapping int21h, but I
really don´t understand what happens. I need to watch some serial
operations from another program, wich uses fopen() function as
interface for the comm port. Here´s 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.
{
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.
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
Mar 24 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Jean-Marc Blaise | last post by:
Dear all, It seems there is a problem with some snapshot table functions, if you try to divide by some element that is unset or equal to 0. This generates a trap file with the db2fmp.exe...
2
by: aj | last post by:
DB2 WSE LUW 8.1 Fixpak 5 Red Hat AS 2.1 Has anyone ever seen a db2diag.log indicate that a trap file was written, but it is *not* written? For the 3rd time in 18 months, I had a production...
2
by: Bob Darlington | last post by:
When a user clears a value from a combo box (by pressing the delete key), the following message appears: "You tried to assign the null value to a variable that is not a variant data type". ...
1
by: sam | last post by:
Hi, I have seen many posts about this problem and no resolution. I have set the maxRequestLength to 200K as I don't want anyone uploading files to the server greater than this size. I have...
11
by: pemo | last post by:
Ambiguous? I have a student who's asked me to explain the following std text (esp. the footnote). 6.2.6.1.5 Certain object representations need not represent a value of the object type. If...
10
by: pemo | last post by:
As far as I understand it, a trap representation means something like - an uninitialised automatic variable might /implicitly/ hold a bit-pattern that, if read, *might* cause a 'trap' (I'm not...
6
by: temper3243 | last post by:
Hi Can someone explain me what is happening below ? Why is it printing 401380 $ cat scanf.c #include<stdio.h> int main() { int i; scanf(" %d",&i);
4
by: EManning | last post by:
Using A2003. I've got an FE with a main form with a subform. The subform is a mixture of bound and unbound fields. The main form is unbound and all it has on it is a combobox to choose a...
2
by: EManning | last post by:
I posted a question on 5/5/08 asking how to trap an error caused by multiple users trying to access the same patient. Here's what I posted: "Using A2003. I've got an FE with a main form with a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.