Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > RE: union REGS don't get DOS Version

Reply
Thread Tools

RE: union REGS don't get DOS Version

 
 
Rod Pemberton
Guest
Posts: n/a
 
      02-08-2006
Sorry to start another thread about this, but the newsserver complained
about 8-bit data in header.

"Bruno Barros" <> wrote in message
news: oups.com...

> Hello,
>
> I donīt know if union REGS <dos.h> is part of this group, but i have
> a problem. At the moment i use turboc++lite and i donīt have reply
> when i execute the question code. Only a black screen! Anyone help me?
> Whatīs is wrong? This code return the DOS version.
>
> #include <stdio.h>
> #include <dos.h>
> #include <conio.h> //use getch() e clrscr()
>
> void main(void)
> {
> union REGS in_regs, out_regs;
> in_regs.x.ax = 0x3000;
>
> intdos(&in_regs,&out_regs);
> printf("Version %d.%d\n", out_regs.x.ax & 0xFF, out_regs.x.ax
> >>;

> }


Except for the headers, the code _appears_ correct for use with DJGPP and
OpenWatcom. However, I would suggest using memset() to clear in_regs befor
calling the DOS interrupt. If REGS is setup the same as DJGPP or OW, you
can use out_regs.h.ah or out_regs.h.al. You could probably post the code of
in openwatcom.user.c_cpp or comp.os.mdsos.djgpp for more responses.

Rod Pemberton




 
Reply With Quote
 
 
 
 
Bruno Barros
Guest
Posts: n/a
 
      02-09-2006
Thx for the elegant reply. I will go to reflect yours words and I will
find the house way ... =)
Thx for the help!

Bruno

Rod Pemberton escreveu:

> Sorry to start another thread about this, but the newsserver complained
> about 8-bit data in header.
>
> "Bruno Barros" <> wrote in message
> news: oups.com...
>
> > Hello,
> >
> > I donīt know if union REGS <dos.h> is part of this group, but i have
> > a problem. At the moment i use turboc++lite and i donīt have reply
> > when i execute the question code. Only a black screen! Anyone help me?
> > Whatīs is wrong? This code return the DOS version.
> >
> > #include <stdio.h>
> > #include <dos.h>
> > #include <conio.h> //use getch() e clrscr()
> >
> > void main(void)
> > {
> > union REGS in_regs, out_regs;
> > in_regs.x.ax = 0x3000;
> >
> > intdos(&in_regs,&out_regs);
> > printf("Version %d.%d\n", out_regs.x.ax & 0xFF, out_regs.x.ax
> > >>;

> > }

>
> Except for the headers, the code _appears_ correct for use with DJGPP and
> OpenWatcom. However, I would suggest using memset() to clear in_regs befor
> calling the DOS interrupt. If REGS is setup the same as DJGPP or OW, you
> can use out_regs.h.ah or out_regs.h.al. You could probably post the code of
> in openwatcom.user.c_cpp or comp.os.mdsos.djgpp for more responses.
>
> Rod Pemberton


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Where to get stand alone Dot Net Framework version 1.1, version2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? MowGreen [MVP] ASP .Net 5 02-09-2008 01:55 AM
Re: Where to get stand alone Dot Net Framework version 1.1, version 2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? PA Bear [MS MVP] ASP .Net 0 02-05-2008 03:28 AM
Re: Where to get stand alone Dot Net Framework version 1.1, version 2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? V Green ASP .Net 0 02-05-2008 02:45 AM
union in struct without union name Peter Dunker C Programming 2 04-26-2004 07:23 PM
map XML union to C union (and vice-versa) Matt Garman XML 1 04-25-2004 12:40 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57