summaryrefslogtreecommitdiff
path: root/z80.h
diff options
context:
space:
mode:
Diffstat (limited to 'z80.h')
-rw-r--r--z80.h103
1 files changed, 49 insertions, 54 deletions
diff --git a/z80.h b/z80.h
index f6bc041..000b950 100644
--- a/z80.h
+++ b/z80.h
@@ -35,12 +35,6 @@
/* ---------------------------------------- TYPES
*/
-/* The processor
-*/
-struct Z80;
-typedef struct Z80 Z80;
-
-
/* Large unsigned type
*/
typedef unsigned long Z80Val;
@@ -61,6 +55,53 @@ typedef signed char Z80Relative;
typedef unsigned short Z80Word;
+/* A Z80 16-bit register. To access the HI/LO component use the indexes
+ Z80_HI_WORD and Z80_LO_WORD which will be initialised once Z80Init has been
+ called.
+*/
+typedef union
+{
+ Z80Word w;
+ Z80Byte b[2];
+} Z80Reg;
+
+extern int Z80_HI_WORD;
+extern int Z80_LO_WORD;
+
+
+/* The processor
+*/
+struct Z80Private;
+
+typedef struct
+{
+ Z80Word PC;
+
+ Z80Reg AF;
+ Z80Reg BC;
+ Z80Reg DE;
+ Z80Reg HL;
+
+ Z80Word AF_;
+ Z80Word BC_;
+ Z80Word DE_;
+ Z80Word HL_;
+
+ Z80Reg IX;
+ Z80Reg IY;
+
+ Z80Word SP;
+
+ Z80Byte IFF1;
+ Z80Byte IFF2;
+ Z80Byte IM;
+ Z80Byte I;
+ Z80Byte R;
+
+ struct Z80Private *priv;
+} Z80;
+
+
/* Interfaces used to handle memory
*/
typedef Z80Byte (*Z80ReadMemory)(Z80 *cpu, Z80Word address);
@@ -100,36 +141,6 @@ typedef enum
} Z80CallbackReason;
-/* Get/settable state of the Z80
-*/
-typedef struct
-{
- Z80Word PC;
- Z80Word SP;
-
- Z80Val cycle;
-
- Z80Word AF;
- Z80Word BC;
- Z80Word DE;
- Z80Word HL;
-
- Z80Word AF_; /* Alternate registers */
- Z80Word BC_;
- Z80Word DE_;
- Z80Word HL_;
-
- Z80Word IX;
- Z80Word IY;
-
- Z80Byte IFF1;
- Z80Byte IFF2;
- Z80Byte IM;
- Z80Byte I;
- Z80Byte R;
-} Z80State;
-
-
/* Flags in the F register
*/
typedef enum
@@ -179,21 +190,6 @@ Z80 *Z80Init(Z80ReadMemory read_memory,
void Z80Reset(Z80 *cpu);
-/* Sets the PC
-*/
-void Z80SetPC(Z80 *cpu, Z80Word PC);
-
-
-/* Gets the PC
-*/
-Z80Word Z80GetPC(Z80 *cpu);
-
-
-/* Sets the cycle count to the specified count
-*/
-void Z80ResetCycles(Z80 *cpu, Z80Val cycles);
-
-
/* Lodge a callback to be invoked after special events. Returns FALSE
if the callback couldn't be lodged (there is a max of 10 callbacks per
reason).
@@ -233,11 +229,10 @@ int Z80SingleStep(Z80 *cpu);
void Z80Exec(Z80 *cpu);
-/* Interrogate the state of the Z80
+/* Manipulate the cylce count of the Z80
*/
Z80Val Z80Cycles(Z80 *cpu);
-void Z80GetState(Z80 *cpu, Z80State *state);
-void Z80SetState(Z80 *cpu, const Z80State *state);
+void Z80ResetCycles(Z80 *cpu, Z80Val cycles);
/* Set address to label mappings for the disassembler