From 0d08766ccc80cacfe0690cb8a1ea8f13038e404b Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 3 Aug 2021 21:43:06 +0000 Subject: Sped up Z80 emulation --- include/z80.h | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'include/z80.h') diff --git a/include/z80.h b/include/z80.h index ab095d8..c9bd107 100644 --- a/include/z80.h +++ b/include/z80.h @@ -56,20 +56,30 @@ 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. +/* A Z80 16-bit register made up of 2 8-bit registers. */ +#ifdef Z80_LITTLE_ENDIAN +typedef struct +{ + Z80Byte lo; + Z80Byte hi; +} Z80RegPair; +#endif + +#ifdef Z80_BIG_ENDIAN +typedef struct +{ + Z80Byte hi; + Z80Byte lo; +} Z80RegPair; +#endif + typedef union { Z80Word w; - Z80Byte b[2]; + Z80RegPair b; } Z80Reg; -extern int Z80_HI_WORD; -extern int Z80_LO_WORD; - - /* The processor */ struct Z80Private; -- cgit v1.2.3