www.delorie.com/djgpp/v2faq/faq142.html | search |
To port such code to DJGPP, use the fields of the __dpmi_regs
structure (declared on the dpmi.h header file) to set the register values, and library function
__dpmi_int
to invoke the interrupt service. For example, consider the following code snippet:
#include <dos.h> void _highcolor (void) { _AH = 0x10; _AL = 0x03; _BL = 0; geninterrupt (0x10); }Here's one way to express this in DJGPP(Note: This function calls the video BIOS interrupt 10h to allow bright background colors to be used instead of blinking characters. DJGPP has a library function, called
intensevideo
, to do that, but let's assume we have reasons not to use it.):
#include <dpmi.h> void _highcolor (void) { __dpmi_regs r; r.h.ah = 0x10; r.h.al = 0x03; r.h.bl = 0; __dpmi_int (0x10, &r); }Please read how to call real-mode interrupt functions, elsewhere in this document, for further details on how call real-mode services from DJGPP programs.
GCC features extensive inline assembly facilities which allow you to assign values to, or read values from registers from the inline assembly code. See description of inline assembly, for further info.
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)