AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

C nach Delphi portieren

Ein Thema von Preddy2005 · begonnen am 3. Feb 2009
Antwort Antwort
Preddy2005

Registriert seit: 27. Nov 2005
Ort: Mettmann
38 Beiträge
 
#1

C nach Delphi portieren

  Alt 3. Feb 2009, 21:01
Hallo Leute, ich hoffe ihr könnt mir beim portieren von Code helfen.

Hier mal der C Code

Delphi-Quellcode:


typedef union
{         
   UINT16 w;
   struct
   {
      UINT8 l,h;      
      UINT16 pad;      
   }
 b;            
} i8080Reg;   

struct i8080Context
{
   i8080Reg AF;      
   i8080Reg BC;      
   i8080Reg DE;      
   i8080Reg HL;      
   
   UINT16 PC;         
   UINT16 SP;         
   UINT32 flagC;      
   UINT32 flagZPS;      
   UINT32 flagAc;      

   UINT32 halted;      
   UINT32 intEnabled;   
   UINT32 intPending;   
   UINT16 intAddress;   
   UINT16 NMIAddress;   
   UINT32 NMIPending;   

   UINT8 *mainMemory;   

   struct readMemoryHandler *readMemoryHandler;   
   struct writeMemoryHandler *writeMemoryHandler;   
   struct readIOHandler *readIOHandler;      
   struct writeIOHandler *writeIOHandler;      

   UINT32 numMemoryBanks;   
   void *pBankList;      

   UINT32 cycleCount;   
   UINT32 opcodeStatistics[256];   
   UINT32 tracePC[256];   
   UINT32 traceIndex;      
}
;

struct readMemoryHandler
{
   UINT32 startAddress;      
   UINT32 endAddress;         
   UINT8 (*memoryHandler) (UINT32, struct readMemoryHandler *);
   void *pUserData;      
}
;
Bei dieser Struktur scheitere ich. Ich verstehe nicht, was diese Zeile bedeuten soll...

UINT8 (*memoryHandler) (UINT32, struct readMemoryHandler *);

Im Visual Studio steht zu der Funktion folgendes :

Uint8 (__cdecl *) (Uint32, readMemoryHandler *)

Soweit ich weiss, werden die Werte auf dem Stack abgelegt durch diese Aufrufkonvention... Wie würde man dies nun portieren, falls das überhaupt so möglich ist.

Hier mal der Delphi-Code:

Korrekturen und Vorschläge sind stets Willkommen, habe sowas noch nie gemacht.

Delphi-Quellcode:

Type TReadMemoryHandler = packed record
 startAddress : LongWord;
 endAddress : LongWord;
 // UINT8 (*memoryHandler) (UINT32, struct readMemoryHandler *); // How to port?
 pUserData : ^Pointer;
end;

Type Ti8080Register = packed record
 w : Word;
 h : Byte;
 l : Byte;
end;

 // The Cpu Context
Type Ti8080Context = class(TObject)
 AF : Ti8080Register;
 BC : Ti8080Register;
 DE : Ti8080Register;
 HL : Ti8080Register;

 ProgramCounter : Word;
 StackPointer : Word;
 CarryFlag : Longword;
 ZeroParityNegativeFlag : Longword;
 AuxiliaryCarryFlag : Longword;

 Halted : Longword;
 intEnabled : Longword;
 intPending : Longword;
 intAddress : Word;
 NMIAdress : Word;
 NMIPending : Longword;

 mainMemory : ^Byte;

 readMemoryHandler : ^TReadMemoryHandler;
 writeMemoryHandler : ^TWriteMemoryHandler;
 readIoHandler : ^TReadIoHandler;
 writeIoHandler : ^TWriteIoHandler;

 numMemoryBanks : LongWord;
 pBankList : ^Byte; //

 cycleCount : LongWord;
 opcodeStatistics : Array [0..255] of LongWord;
 tracePC : Array [0..255] of LongWord;
 traceIndex : LongWord;

end;
Danke im Voraus für jegliche Hilfe.

Gruß

Matthias

[edit=SirThornberry]Titel geändert - Mfg, SirThornberry[/edit]
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:20 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz