Compatibility

SDL_bgi has been designed to be functionally compatible with the old Borland Graphics Interface (GRAPHICS.H) for DOS, and with WinBGIm, which itself is a mostly complete GRAPHICS.H implementation.

SDL_bgi is a superset of both, and as far as I can say it provides the most compatible GRAPHICS.H implementation available. It should be stressed, however, that SDL_bgi is not a Turbo C or Borland C++ emulator! Besides, SDL_bgi is also designed to be portable and to take advantage of modern graphics hardware, thanks to the SDL2 library.

Compatibility with GRAPHICS.H

Compatibility with the original GRAPHICS.H is nearly perfect, but 100% compatibility with old programs written for Turbo C or Borland C++ is technically impossible to attain. In fact, Borland compilers were inherently non portable; they were specifically designed for the PC/DOS platform. Hence, they implemented low-level details such as hardware key codes, memory models, DOS and BIOS calls, inline assembly, and so on. Besides, even in the original Turbo C / Borland C++ different graphic drivers were not fully compatible with one another. For example, programs written for the IBM8514.BGI driver needed modifications to compile and run on the EGAVGA.BGI driver.

Full compatibility is only possible in a hardware emulator like DOSBox. If a program uses CONIO.H, DOS.H, BIOS.H and the like, chances are you won’t be able to compile it. Please consider using DOSBox and one of the original Borland compilers that are available as freeware.

That said, SDL_bgi is almost perfectly compatible with the original GRAPHICS.H. It has been tested on the original BGIDEMO.C included in Turbo C 2.01 and Borland C++ 1.01, and on the sample programs available here. These sample programs were taken from the original Borland C 3.1 Library Reference.

Nearly all functions are correctly implemented and work just like in old BGI; in most cases, output is pixel-perfect.

Differences

Some of the following differences might be eliminated in future releases of SDL_bgi.

errorcode = registerbgidriver(EGAVGA_driver);

you must add -D EGAVGA_driver to the gcc command line. You’ll get a compiler warning, but the program will compile and run.

setpalette (RED, COLOR (0xa0, 0x10, 0x10));
// use the n-th entry in the ARGB palette
setpalette (GREEN, RGBPALETTE (n));

Compatibility with WinBGIm

Most extensions introduced by WinBGIm have been implemented, with a few differences; WinBGIm, in fact, is written in C++, while SDL_bgi is written in C.

When WinBGIm breaks C compatibility with GRAPHICS.H by providing C++ extensions, SDL_bgi follows the original C syntax.

Differences

Back to document index