Aadit M Shah
Aadit M Shah

Reputation: 74244

Using the IBM 3514 Borland Graphics Interface driver in High resolution mode in Turbo C++ on Windows 7 64 bit OS using DosBox

I'm running a graphical program in Turbo C++ using DosBox on Windows 7 64 bit. Now, I want to use the IBM3514 graphics driver in the High resolution mode (IBM3514HI). So, I wrote the following bare bones program to test it:

#include <graphics.h>
#include <iostream.h>

void main() {
    int gd = IBM3514, gm = IBM3514HI, e;
    initgraph(&gd, &gm, "C:\\TC\\BGI");
    if (e = graphresult()) {
        cout << grapherrormsg(e);
    }
    cleardevice();
    rectangle(100, 100, 300, 300);
    cin.get();
    closegraph();
    restorecrtmode();
}

Now, the program compiles and runs without any errors. However, the initgraph function call doesn't initialize graphics mode. The return value of graphresult is 0. Hence, no error has occurred. Yet, the program still runs in text mode. The blinking underscore is visible and the rectangle is not drawn.

I checked my C:\TC\BGI folder and the IMB3514.BGI file exists. Thus I assume that it does load the graphics driver. Yet, I can't figure out why the program doesn't execute in graphics mode, or even throw an error. However it works perfectly fine if I use the default settings: int gd = DETECT, gm;

Any explanation as to why my program doesn't work will be greatly appreciated. Please try to provide a fix to this problem. I would really like to draw on a 1024x768 screen with 256 colors.

Upvotes: 2

Views: 1384

Answers (3)

Esteneat
Esteneat

Reputation: 11

Try this code instead:

int gd = 6, gm = 0, e;

(Both variables are INTEGERS, not STRINGS)

Upvotes: 0

Guenni60
Guenni60

Reputation: 21

The correctly name of the driver is ibm8514.bgi - not "3514" and not "imb" or so. But like my previous speaker said, better you use another driver. The best choice is to use the egavga.bgi driver of the Turbo resp. Borland C++ or Turbo Pascal package. Then you should compile them successful.

Expect you need a special feature of this driver. Then you must check them of this effort if you need them. I think the egavga.bgi, vesa or a directly switch to the graphic mode with some special routines to make graphic should work in DOSBox, EmuDOS or in all 32-Bit-Version of Windows like Windows XP or so.

Upvotes: 2

xanatos
xanatos

Reputation: 111940

Under Windows your graphical adaptor is virtualized. You can't access it directly and use its specific features (unless you use DirectX/OpenGL/other strange methods). DOSBox emulates some "historical" graphical adaptors for the programs it runs (to be precise: Tandy/Hercules/CGA/EGA/VGA/VESA). You must use the VESA 2.0 driver of TC (or in general the VESA driver).

Upvotes: 5

Related Questions