{ MyFonts

  DPMI support

  Copyright 1994 by Matthias K”ppe
}

type
  PRealModeRegs = ^TRealModeRegs;
  TRealModeRegs = record
    case Integer of
      0: (
	EDI, ESI, EBP, EXX, EBX, EDX, ECX, EAX: Longint;
	Flags, ES, DS, FS, GS, IP, CS, SP, SS: Word);
      1: (
	DI, DIH, SI, SIH, BP, BPH, XX, XXH: Word;
	case Integer of
	  0: (
	    BX, BXH, DX, DXH, CX, CXH, AX, AXH: Word);
	  1: (
	    BL, BH, BLH, BHH, DL, DH, DLH, DHH,
	    CL, CH, CLH, CHH, AL, AH, ALH, AHH: Byte));
  end;

var
  CallbackRegs: TRealModeRegs absolute System.RealModeRegs;

function CallInt: pointer; near; assembler;
asm
	MOV	CX, TYPE TRealModeRegs / 2
	XOR	AX, AX
	PUSH	DS
	POP	ES
	MOV	DI, OFFSET CallbackRegs
	CLD
	PUSH	DI
	REP	STOSW
	POP	DI
	MOV	CallbackRegs.&BH, BH
	MOV	CallbackRegs.&AX, 1130H
	MOV	AX, 0300H		{ Simulate real mode interrupt }
	MOV	BX, 0010H
	MOV	CX, 0
	INT	31H
	MOV	AX, CallbackRegs.&BP
	MOV	DX, CallbackRegs.&ES
end;
