Solved

How to (VAR regs: registers) in Delphi

Posted on 1997-08-09
2
364 Views
Last Modified: 2010-04-04
There a procedure I want to translate..


PROCEDURE GetPhysical(VAR lw:Byte);
VAR regs : registers;
  BEGIN
    WITH regs DO BEGIN
      GetIntVec($58,old58);
      GetIntVec($13,old13);
      SetIntVec($58,@Help58);
      SetIntVec($13,@GetPhys);
      al:=lw; cx:=1; dx:=0;
      ds:=Seg(buffer); bx:=Ofs(buffer);
      intr($58,regs);
      SetIntVec($58,old58);
      SetIntVec($13,old13);
      lw:=Mem[$40:$41];
    END;
  END;

How can we use registers in Delphi.
0
Comment
Question by:Quartz
2 Comments
 
LVL 3

Accepted Solution

by:
mirek071497 earned 100 total points
ID: 1341063
You mast do this with SimulateRealModeInt.
Here is example:

type
  TRealModeRegisters = 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;

function RealModeInterrupt( Int:Byte; var Regs:TRealModeRegsisters):boolean;
var
  Error : boolean;
begin
  asm
    mov Error,0
    mov ax,0300h
    mov bl,Int
    mov bh,0
    mov cx,0
    les di,Regs
    int 31h
    jnc @@End
    @@Err:
    mov Error,1
    @@End:
  end
  Result := not Error;
end;

procedure YourProc;
var Reg : TRealModeRegisters;
begin
  with Reg do
  begin
     { set you'r AX,BL,DX ..... }
     if RealModeInterrupt( $13{you'r int nr}, Reg ) then;
  end;
end;


0
 

Author Comment

by:Quartz
ID: 1341064
Ok, I try your answer then i give you your points soon...

0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now