DjGpp's method

xiaoxiao2021-03-05  17

DJGPP is the complete 32-bit C / C protection mode compiler under DOS, runs in 386 or more machines. Djgpp has a good helper called Allegro, it is a graphic / sound program library, which is very powerful, which is very convenient to interface programming. You can write programs in the Allegro programming library and compile with DJGPP.

However, because DJGPP is standard C, there is no interrupt, setvect, and putvect function, which will let the habits Turbo C encountered some small trouble, the younger brother now introduces "solution". . . . :)

INT _GO32_DPMI_GET_REAL_MODE_INTERRUPT_VECTOR (int vector, _go32_dpmi_seginfo * info); int _GO32_DPMI_SET_REAL_MODE_INTERRUPT_VECTOR (int Vector, _GO32_dpmi_seginfo * info);

INT _GO32_DPMI_CHAIN_PROTECTED_MODE_INTERRUPT_VECTOR (INT Vector, _GO32_DPMI_SEGINFO * INFO);

Typedef struct {unsigned long size; unsigned long pm_select; unsigned short rm_select; unsigned short rm_segment;} _go32_dpmi_seginfo;

This is several functions of dpmi.h header files, and the usage is described below

_GO32_DPMI_SEGINFO OLDVECT; _GO32_DPMI_SEGINFO NEWVECT;

Static int newFunction (); // Application interrupt handler

_go32_dpmi_get_protected_mode_interrupt_vector (0x0c, & OldVect); // get the old interrupt vector NewVect.pm_offset = (int) NewFunction; // look at the definition of the structure to understand _go32_dpmi_chain_protected_mode_interrupt_vector (0x0c, & NewVect); // set the new interrupt vector

This is ok, ^ _ ^ I am also a newbie hope to help everyone!

转载请注明原文地址:https://www.9cbs.com/read-38560.html

New Post(0)