Board index » delphi » Need Gnu equivalent for type 'Registers'

Need Gnu equivalent for type 'Registers'

Quote
Roger Noss wrote:

> Does anyone know what gpc (GNU pascal for djgpp) equivalent
> type corresponds to Borland's "Registers" type?
> --
> Roger Noss                  n...@pupk.unibe.ch

From Borland's help file:

type
    (Registers record used by Intr and MsDos)
  Registers = record
    case Integer of
    0: (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags: Word);
    1: (AL, AH, BL, BH, CL, CH, DL, DH: Byte);
  end;

You should be able to declare this type directly using gpc,
but I don't know if it has procedures that accept it as a
parameter.

--
Jared Showalter
Remove the REMOVETHIS from my addresss to reply.

 

Re:Need Gnu equivalent for type 'Registers'


Quote
Jared Showalter <shonw...@gate.REMOVETHIS.net> wrote:

> From Borland's help file:

> type
>     (Registers record used by Intr and MsDos)
>   Registers = record
>     case Integer of
>     0: (AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags: Word);
>     1: (AL, AH, BL, BH, CL, CH, DL, DH: Byte);
>   end;

> You should be able to declare this type directly using gpc,
> but I don't know if it has procedures that accept it as a
> parameter.

The official version of GPC, 2.0, does not have built-in types
`Word' and `Byte'.  Recent beta versions do, so I am referring
to gpc-970714 or newer, here and below.

To use interrupts from GPC, you need to write headers for the
respective functions from the DJGPP system library:

    Function __DPMI_simulate_real_mode_interrupt ( Vector: Integer;
                                     Var Regs: Registers ) : Integer; C;

The `Registers' record itself must be declared a little different
from Borland's one.  You can look it up from a C header file that
comes with DJGPP.  (Do not forget: `Word' has 32 bits in GPC,
`ShortWord' has 16.:-)

If I remember correctly, `Registers' must be the following:

    Type
      Registers = record
        case Integer of
          0: ( edi, esi, ebp, res, ebx, edx, ecx, eax: Word );
          1: ( di, di_hi, si, si_hi, bp, bp_hi, res_lo, res_hi,
               bx, bx_hi, dx, dx_hi, cx, cx_hi, ax, ax_hi,
               flags, es, ds, fs, gs, ip, cs, sp, ss: ShortWord );
          2: ( edi2, esi2, ebp2, res2: Word;
               bl, bh, bl_hi, bh_hi, dl, dh, dl_hi, dh_hi,
               cl, ch, cl_hi, ch_hi, al, ah, al_hi, ah_hi: Byte );
      end (* Registers *);

Be invited to join the GNU Pascal mailing list if you have further
questions.  To subscribe, write to gpc-request at hut dot fi; the
list itself is gpc at hut dot fi.

Hope this helps,

    Peter

 Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwin...@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [971005]
 maintainer GNU Pascal [971001] - http://home.pages.de/~gnu-pascal/ [971005]

Other Threads