Thema: Delphi Comparing functions

Einzelnen Beitrag anzeigen

Razor
(Gast)

n/a Beiträge
 
#36

Re: Comparing functions

  Alt 4. Nov 2007, 22:07
Anyways i wanted to post this also...


Old functions


Delphi-Quellcode:
function GetPCRD(Bus, Dev, Func, Reg : byte): dword;
begin
  SetPortLong($0CF8, $80000000 or (dword(Bus) shl 16) or ((dword(Dev) and
             $1f) shl 11) or ((dword(Func) and $07) shl 8) or (Reg and $fc));
  GetPCRD:=GetPortLong($0CFC);
end;

procedure SetPCRD(Bus, Dev, Func, Reg : byte; value : dword);
begin
  SetPortLong($0CF8,$80000000 or (dword(Bus) shl 16) or ((dword(Dev) and
              $1f) shl 11) or ((dword(Func) and $07) shl 8) or (Reg and $fc));
  SetPortLong($0CFC, value);
end;

New functions
Delphi-Quellcode:
procedure tPCIIO.GetPCIRDWord( dwBus, dwDev, dwFunc, offs : byte; var pdata:DWord );
begin
  FIPortIORef.WritePortL(PCRAddress,$80000000 or (longint(dwBus) shl 16) or ((longint(dwDev) and $1f) shl 11) or
            ((longint(dwFunc) and $07 ) shl 8) or (offs and $fc));
  pdata := FIPortIORef.ReadPortL(PCRData);
end;

procedure tPCIIO.SetPCIRDWord(dwBus, dwDev, dwFunc, offs:byte; pdata:DWord);
//var IPort: IPortIO;
begin


  //IPort := oHWIO.IPortIORef;
  FIPortIORef.WritePortL(PCRAddress,$80000000 or (longint(dwBus) shl 16) or ((longint(dwDev) and $1f) shl 11) or
              ((longint(dwFunc) and $07) shl 8) or (offs and $fc));
  FIPortIORef.WritePortL(PCRData, pdata);
end;







What i tried to do

Delphi-Quellcode:
procedure tmainfrm.amd64x2start;
var
C0:string;
GetInstance:tomcdrv;
pdata: DWord;
begin

       GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
       GetInstance.IPCIIORef.SetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));
       GetInstance.IPCIIORef.GetPCIRDWord(0,24,$03,$E4,pdata);
       C0:=Format('%d °C',[(pdata shr 16 and $FF)-49]);
       RzLabel99.caption:=C0;

//But then i get [Warning] Temperatures.inc(117): Variable 'GetInstance' might not have been initialized
Or.....


Delphi-Quellcode:
procedure tmainfrm.amd64x2start;
var
C0:string;

pdata: DWord;
begin

       OMCDRV.tGetPCIRDWord(0,24,$03,$E4,pdata);
       OMCDRV.tSetPCIRDWord(0,24,$03,$E4, pdata and not (1 shl 2));
       OMCDRV.tGetPCIRDWord(0,24,$03,$E4,pdata);
       C0:=Format('%d °C',[(pdata shr 16 and $FF)-49]);
       RzLabel99.caption:=C0;

//But then i get [Fatal Error]Internal error: BA1993 or [Fatal Error] Internal error: L1333

Hilfee!!!!
  Mit Zitat antworten Zitat