Delphi-PRAXiS
Seite 4 von 9   « Erste     234 56     Letzte »    

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi Comparing functions (https://www.delphipraxis.net/98537-comparing-functions.html)

Muetze1 4. Nov 2007 20:59

Re: Comparing functions
 
Learn the basics. It is increadibly how you show us your missing knowledge...

Ok, back to topic: what do you think does "outside" and "inside" mean?

mkinzler 4. Nov 2007 20:59

Re: Comparing functions
 
That'd be a new kind of OOP. Methods being hidden to the class itself and only accessable by others.

Razor 4. Nov 2007 21:05

Re: Comparing functions
 
Liste der Anhänge anzeigen (Anzahl: 1)
Okay guys if you help me with this i promise i will post the final and finished product :-D ...and yea i have a looot to learn.newbie i am...

Back to the problem..i made a pic


So why is it there var pdata:cardinal and in the omcdrv.pas its var pdata:dword; dont really really get it; and plus why cant i call that function.... :shock:

Muetze1 4. Nov 2007 22:56

Re: Comparing functions
 
Take a look in the help to get the facts about cardinal and dword and their sizes, properties, etc.

Razor 4. Nov 2007 23:02

Re: Comparing functions
 
Muetze1 you said something bout dividing by 4 what did you mean? :?

Razor 4. Nov 2007 23:07

Re: Comparing functions
 
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!!!! :wall:

DevidEspenschied 5. Nov 2007 08:12

Re: Comparing functions
 
Zitat:

Zitat von Razor
So why is it there var pdata:cardinal and in the omcdrv.pas its var pdata:dword; dont really really get it; and plus why cant i call that function.... :shock:

To help you with this problem I need a view into OMCDrv.pas, because the GetPCIRDWord function have to be validated.

Mackhack 5. Nov 2007 08:31

Re: Comparing functions
 
What is that unit exactly for? Sounds like an interesting project!

Razor 5. Nov 2007 08:32

Re: Comparing functions
 
As i said the project will be realased when finished but hilfeee!!! :(

Mackhack 5. Nov 2007 08:33

Re: Comparing functions
 
Zitat:

Zitat von Razor
As i said the project will be realased when finished but hilfeee!!! :(

Ok, is crystal clear and we all do understand it :roll: but I still would like to know what this is for and the unit you just posted so we might be able to help more out here!


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:21 Uhr.
Seite 4 von 9   « Erste     234 56     Letzte »    

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz