Thread: What is REGS

  1. #1
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    Posts
    751

    What is REGS

    coding an example from a book and i get the message
    storage size of 'regs' not known


    wondering why i get this if it supposed to return the dos version i am on.


    Code:
    /* gets DOS version and number */
    
    
    #include <stdio.h>
    #include <dos.h>
    
    
    int main()
    
    {
    
    int major, minor;
    union REGS regs;      // required for making DOS calls
    
    
    regs.h.a=1;            // GET VERSION NUMBER
    regs.h.ah=0x30;       //get version function 30h
    int86(0x21,&regs,&regs);   // call DOS
    
    
    major=regs.h.al;           // major version number
    minor=regs.h.ah;           // minor version number
    
    printf("This is DOS version %i, release %i\n", major, minor);
    
    
    return 0;
    
    }

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    491
    What book is this? dos.h is not a standard header, is it defined in your book? Are there any other headers included that you left out? Is this the exact copy from your book? Does the index say anything abotu REGS? Can you provide any more information at all?

  3. #3
    Registered User caroundw5h's Avatar
    Join Date
    Oct 2003
    Posts
    751
    The dos.h is a standard header on my compiler Devc++, don't know if its compiler specific though. Probably is. anyway WYSIWYG in terms of the code i posted. That is exactly how it was done. What other info do you need?

  4. #4
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Originally posted by caroundw5h
    The dos.h is a standard header on my compiler Devc++, don't know if its compiler specific though.
    Isn't this an oxymoron?
    The world is waiting. I must leave you now.

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Isn't this an oxymoron?
    It depends on your definition of standard.
    My best code is written with the delete key.

  6. #6
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765
    Well, he said that dos.h is standard on his compiler. So, isn't this an oxymoron? I always thought stdio.h, for example, was standard, because it's just standard. Every darn compiler "has it." For example, even though quite a few compilers have conio.h, conio.h is not standard.
    The world is waiting. I must leave you now.

  7. #7
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    No, dos.h is NOT a standard header. It was added to various compilers to enhance the C language. I'll bet the book was written for Borland or Turbo C and you are not using these compilers. The implementation of dos.h is completely up to the compiler designers so your implementation is not the same as the compiler the book used.

    Read the requirements of the book to find out which compiler you should be using.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  8. #8
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Go into your dos.h and view it in your IDE or a text editor. You should find the structure for REGS there.

  9. #9
    .
    Join Date
    Nov 2003
    Posts
    307
    What you're writing is straight Turbo C code for DOS.

    REGS is a union of two structs - WORDREGS which is 7 unsigned 16 byte ints, and BYTEREGS which is a struct of 8 unsigned chars.

    int86 will not work under Win2K and XP. Some interrupts may work, but not all.

    Your problem is that you declare major & minor as signed int.
    reg.h.al is an unsigned char.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. regs list
    By cigcode in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 03-17-2004, 05:54 AM
  2. regs
    By cigcode in forum C Programming
    Replies: 3
    Last Post: 03-14-2004, 11:59 PM
  3. storage size of regs is unkown
    By Vertex34 in forum C Programming
    Replies: 5
    Last Post: 11-04-2003, 10:17 AM
  4. Problem with 'union REGS in, out;'
    By JLBSchreck in forum C++ Programming
    Replies: 3
    Last Post: 05-14-2003, 12:57 AM
  5. mouse support in C++ (DOS)
    By mitchwardrop in forum C++ Programming
    Replies: 5
    Last Post: 01-13-2002, 11:34 PM