RE: union REGS don't get DOS Version

Discussion in 'C Programming' started by Rod Pemberton, Feb 8, 2006.

  1. Sorry to start another thread about this, but the newsserver complained
    about 8-bit data in header.

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

    > 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
    > >>8);

    > }


    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
    Rod Pemberton, Feb 8, 2006
    #1
    1. Advertising

  2. Rod Pemberton

    Bruno Barros Guest

    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:...
    >
    > > 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
    > > >>8);

    > > }

    >
    > 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
    Bruno Barros, Feb 9, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Karl Core

    Any regs up for a CSS challenge

    Karl Core, Feb 20, 2005, in forum: HTML
    Replies:
    2
    Views:
    396
    Augustus
    Feb 21, 2005
  2. what are REGS,SREGS ?

    , Oct 5, 2005, in forum: C Programming
    Replies:
    5
    Views:
    677
    Alexei A. Frounze
    Oct 6, 2005
  3. Marcpp
    Replies:
    1
    Views:
    262
    Jorgen Bodde
    Jun 12, 2007
  4. V Green
    Replies:
    0
    Views:
    810
    V Green
    Feb 5, 2008
  5. PA Bear [MS MVP]
    Replies:
    0
    Views:
    912
    PA Bear [MS MVP]
    Feb 5, 2008
Loading...

Share This Page