Opie Pecheux a écrit:
I want to use the function intr, but in the dos unit, there is only a
comment about it and i didn't find the definition. For now, i use my own
intr with a asmname ?__dpmi_int', but i want to know if there is a unit
how do this.
I attach a dosint.pas unit which do that. I do not remember if it is hacked from
an old bpcompat or from grx.
Second question: how can i access directly to the screen (address
a0000)?
See Capter 10.2, accessing the video memory, of the DJGPP faq. It is C code but
a gpc wrapper is easy to do.
Hope this help
--
Maurice Lombardi
Laboratoire de Spectrometrie Physique,
Universite Joseph Fourier de Grenoble, BP87
38402 Saint Martin d'Heres Cedex FRANCE
Tel: 33 (0)4 76 51 47 51
Fax: 33 (0)4 76 51 45 44
mailto:Maurice.Lombardi@ujf-grenoble.fr
UNIT dosint;
{$DEFINE _BORLAND_DOS_REGS}
INTERFACE
{$X+} { use extended syntax }
{$W-} { disable warnings }
(*
type
{Registers record used by Intr and MsDos: version originale}
Registers = record
case Integer of
0: (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags: Word); {word 16bits}
1: (AL, AH, BL, BH, CL, CH, DL, DH: Byte);
end;
*)
{fonctionnellement equivalent et compatible avec le type REGS pour DPMI}
type registers= record case integer of
0:(di, _upper_di : ShortWord;
si, _upper_si : ShortWord;
bp, _upper_bp : ShortWord;
cflag, _upper_cflag : ShortWord;
bx, _upper_bx : ShortWord;
dx, _upper_dx : ShortWord;
cx, _upper_cx : ShortWord;
ax, _upper_ax : ShortWord;
flags : ShortWord);
1:(_di, __upper_di : ShortWord;
_si, __upper_si : ShortWord;
_bp, __upper_bp : ShortWord;
_cflag : MedWord;
bl : Byte;
bh : Byte;
__upper_bx : ShortWord;
dl : Byte;
dh : Byte;
__upper_dx : ShortWord;
cl : Byte;
ch : Byte;
__upper_cx : ShortWord;
al : Byte;
ah : Byte;
__upper_ax : ShortWord;
_flags : ShortWord);
end;
var DosError: integer;
procedure Intr(IntNo: Byte; var R: Registers);
procedure MsDos(var R: Registers);
IMPLEMENTATION
Type DWORDREGS = record
edi : MedWord;
esi : MedWord;
ebp : MedWord;
cflag : MedWord;
ebx : MedWord;
edx : MedWord;
ecx : MedWord;
eax : MedWord;
eflags : ShortWord;
end {DWORDREGS};
Type DWORDREGS_W = record
di : MedWord;
si : MedWord;
bp : MedWord;
cflag : MedWord;
bx : MedWord;
dx : MedWord;
cx : MedWord;
ax : MedWord;
flags : ShortWord;
end {DWORDREGS_W};
Type WORDREGS = record
di, _upper_di : ShortWord;
si, _upper_si : ShortWord;
bp, _upper_bp : ShortWord;
cflag, _upper_cflag : ShortWord;
bx, _upper_bx : ShortWord;
dx, _upper_dx : ShortWord;
cx, _upper_cx : ShortWord;
ax, _upper_ax : ShortWord;
flags : ShortWord;
end {WORDREGS};
Type BYTEREGS = record
di, _upper_di : ShortWord;
si, _upper_si : ShortWord;
bp, _upper_bp : ShortWord;
cflag : MedWord;
bl : Byte;
bh : Byte;
_upper_bx : ShortWord;
dl : Byte;
dh : Byte;
_upper_dx : ShortWord;
cl : Byte;
ch : Byte;
_upper_cx : ShortWord;
al : Byte;
ah : Byte;
_upper_ax : ShortWord;
flags : ShortWord;
end {BYTEREGS};
Type REGS = record
case Word of
{= Compatible with DPMI structure, except cflag }
1 : ( d : DWORDREGS; );
{$IFDEF _NAIVE_DOS_REGS}
2 : ( x : WORDREGS; );
{$ELSE}
{$IFDEF _BORLAND_DOS_REGS}
3 : ( x : DWORDREGS; );
{$ELSE}
4 : ( x : DWORDREGS_W; );
{$ENDIF}
{$ENDIF}
5 : ( w : WORDREGS; );
6 : ( h : BYTEREGS; );
end {REGS};
Function int86 ( ivec : integer; Var _in : regs; Var _out : regs ) : integer;C;
procedure Intr(IntNo: Byte; var R: Registers);
var inr,outr: REGS;
begin
inr.w:=WORDREGS(R);
DosError:=int86(IntNo,inr,outr);
WORDREGS(R):=outr.w;
end;
procedure MsDos(var R: Registers);
begin
Intr($21,R);
end;
{$W+}
End.