ROM BIOS interrupts in Borland C++ 5.02

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dfound
    New Member
    • Jan 2007
    • 52

    #1

    ROM BIOS interrupts in Borland C++ 5.02

    Hello, I am using Borland C++ 5.02 and I was trying to make ROM BIOS interrupts in a c program. But when I compile the program it says undefined structure REGS.
    I tried the program in a cpp program too but with same result.
    Here's my code
    Code:
    #include <dos.h>
    
    #define VIDEO 0x10
    
    void movetoxy(int x, int y)
    {
    	union REGS regs;
    
       regs.h.ah = 2;  /* set cursor position */
    	regs.h.dh = y;
       regs.h.dl = x;
       regs.h.bh = 0;  /* video page 0 */
    	int86(VIDEO, &regs, &regs);
    }
    
    int main(void)
    {
    	clrscr();
    	movetoxy(35, 10);
    	printf("Hello\n");
    	return 0;
    }
    Please help me with the problem. Thanks .
  • JosAH
    Recognized Expert MVP
    • Mar 2007
    • 11453

    #2
    I googled a bit for "union REGS" and found that all the code that uses that union
    also included the <bios.h> file but I don't think you can use that bios directly from
    a MS Windows environment (I might be totally wrong though).

    kind regards,

    Jos

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      JosAH is not wrong. Windows protects the bios and all access to this union is prohibited.

      Comment

      • dfound
        New Member
        • Jan 2007
        • 52

        #4
        Yes I used the bios.h header file. I just tried a function in the help file .
        The fuction was _bios_memsize() . But the compiler says call to undefined function.
        My code is (this is code is exactly as is in the help file)

        Code:
        #include <stdio.h>
        #include <bios.h>
        
        int main(void)
        {
          unsigned   memory_size;
        
          memory_size = _bios_memsize();   /* returns value up to 640K */
        
          printf("RAM size = %dK\n", memory_size);
        
          return 0;
        }
        Please tell me what is wrong

        Comment

        • weaknessforcats
          Recognized Expert Expert
          • Mar 2007
          • 9214

          #5
          Why can't you use the Windows functions that provide this capability?

          Comment

          • dfound
            New Member
            • Jan 2007
            • 52

            #6
            Originally posted by weaknessforcats
            Why can't you use the Windows functions that provide this capability?
            I cant see to find any functions equivalent to ROM-BIOS functions in Win32. I tried searching but of no use. It would be a great help if you give me the functions or where I can find them. Thanks

            Comment

            • weaknessforcats
              Recognized Expert Expert
              • Mar 2007
              • 9214

              #7
              You use Windows Management Instrumentation (WMI).

              Start here: http://msdn.microsoft.com/en-us/libr...77(VS.85).aspx.

              Comment

              Working...