From 9ffce8b92a6bceef6bdd48139935847c99d3bb16 Mon Sep 17 00:00:00 2001 From: Matthew Daniels Date: Mon, 22 Nov 2021 17:15:06 +0000 Subject: [PATCH] Getting rid of most of the includes from Supermodel.h; each file now explicitly includes the header files it needs. Making changes to a header file should no longer force the entire project to recompile. --- Src/BlockFile.cpp | 2 + Src/CPU/68K/68K.cpp | 4 +- Src/CPU/68K/68K.h | 1 + Src/CPU/Bus.h | 1 + Src/CPU/PowerPC/ppc.cpp | 65 +- Src/CPU/PowerPC/ppc.h | 3 + Src/CPU/PowerPC/ppc_ops.c | 46 +- Src/CPU/Z80/Z80.cpp | 948 ++++++++++++------------ Src/Debugger/CPU/Z80Debug.h | 4 +- Src/Debugger/Exception.cpp | 4 +- Src/Debugger/SupermodelDebugger.cpp | 11 +- Src/Debugger/SupermodelDebugger.h | 2 +- Src/Graphics/Legacy3D/Error.cpp | 1 + Src/Graphics/Legacy3D/Legacy3D.cpp | 26 +- Src/Graphics/Legacy3D/Legacy3D.h | 40 +- Src/Graphics/Legacy3D/Models.cpp | 1 + Src/Graphics/Legacy3D/TextureRefs.cpp | 3 + Src/Graphics/Legacy3D/TextureRefs.h | 4 +- Src/Graphics/New3D/PolyHeader.cpp | 2 +- Src/Graphics/New3D/PolyHeader.h | 2 + Src/Graphics/Render2D.cpp | 8 +- Src/Graphics/Shader.cpp | 50 +- Src/Inputs/Input.cpp | 3 + Src/Inputs/Input.h | 2 +- Src/Inputs/InputSource.cpp | 3 + Src/Inputs/InputSystem.cpp | 8 +- Src/Inputs/InputTypes.cpp | 2 + Src/Inputs/Inputs.cpp | 4 + Src/Inputs/Inputs.h | 6 +- Src/Inputs/MultiInputSource.cpp | 3 + Src/Model3/53C810.cpp | 4 +- Src/Model3/53C810.h | 4 + Src/Model3/93C46.cpp | 2 + Src/Model3/93C46.h | 2 + Src/Model3/DSB.cpp | 2 + Src/Model3/DSB.h | 2 + Src/Model3/DriveBoard/BillBoard.cpp | 2 + Src/Model3/DriveBoard/BillBoard.h | 1 + Src/Model3/DriveBoard/DriveBoard.cpp | 2 + Src/Model3/DriveBoard/DriveBoard.h | 4 + Src/Model3/DriveBoard/JoystickBoard.cpp | 2 + Src/Model3/DriveBoard/JoystickBoard.h | 1 + Src/Model3/DriveBoard/SkiBoard.cpp | 3 + Src/Model3/DriveBoard/SkiBoard.h | 1 + Src/Model3/DriveBoard/WheelBoard.cpp | 3 +- Src/Model3/DriveBoard/WheelBoard.h | 1 + Src/Model3/IRQ.cpp | 3 + Src/Model3/IRQ.h | 2 + Src/Model3/JTAG.cpp | 5 +- Src/Model3/JTAG.h | 1 + Src/Model3/MPC10x.cpp | 2 + Src/Model3/MPC10x.h | 2 + Src/Model3/Model3.cpp | 8 + Src/Model3/Model3.h | 15 +- Src/Model3/PCI.cpp | 2 + Src/Model3/PCI.h | 2 + Src/Model3/RTC72421.cpp | 2 + Src/Model3/RTC72421.h | 1 + Src/Model3/Real3D.cpp | 453 +++++------ Src/Model3/Real3D.h | 34 +- Src/Model3/SoundBoard.cpp | 4 + Src/Model3/TileGen.cpp | 2 + Src/Model3/TileGen.h | 2 + Src/Network/NetBoard.h | 1 + Src/OSD/Audio.h | 2 + Src/OSD/Outputs.cpp | 2 + Src/OSD/Outputs.h | 1 + Src/OSD/SDL/Audio.cpp | 2 + Src/OSD/SDL/Main.cpp | 6 + Src/OSD/SDL/SDLInputSystem.cpp | 4 +- Src/OSD/SDL/Thread.cpp | 2 + Src/OSD/Thread.h | 2 + Src/Sound/SCSP.cpp | 9 +- Src/Sound/SCSP.h | 3 + Src/Sound/SCSPDSP.h | 2 + Src/Sound/SCSPLFO.cpp | 4 +- Src/Supermodel.h | 64 +- 77 files changed, 1024 insertions(+), 915 deletions(-) diff --git a/Src/BlockFile.cpp b/Src/BlockFile.cpp index 023828a..44c01a4 100644 --- a/Src/BlockFile.cpp +++ b/Src/BlockFile.cpp @@ -26,6 +26,8 @@ * class. */ +#include "BlockFile.h" + #include #include #include diff --git a/Src/CPU/68K/68K.cpp b/Src/CPU/68K/68K.cpp index 9d50982..6e79abd 100644 --- a/Src/CPU/68K/68K.cpp +++ b/Src/CPU/68K/68K.cpp @@ -33,9 +33,11 @@ * accesses (interrupts pending, halted status, etc.) */ +#include "68K.h" + #include "Supermodel.h" #include "Musashi/m68k.h" // Musashi 68K core - +#include "Debugger/CPU/Musashi68KDebug.h" /****************************************************************************** Internal Context diff --git a/Src/CPU/68K/68K.h b/Src/CPU/68K/68K.h index 99b267b..ed623ab 100644 --- a/Src/CPU/68K/68K.h +++ b/Src/CPU/68K/68K.h @@ -37,6 +37,7 @@ #include "Musashi/m68k.h" #include "Musashi/m68kctx.h" #include "CPU/Bus.h" +#include "BlockFile.h" // This doesn't work for now (needs to be added to the prototypes in m68k.h for m68k_read_memory*) //#ifndef FASTCALL diff --git a/Src/CPU/Bus.h b/Src/CPU/Bus.h index 99aa442..9988a23 100644 --- a/Src/CPU/Bus.h +++ b/Src/CPU/Bus.h @@ -28,6 +28,7 @@ #ifndef INCLUDED_BUS_H #define INCLUDED_BUS_H +#include "Types.h" /* * IBus: diff --git a/Src/CPU/PowerPC/ppc.cpp b/Src/CPU/PowerPC/ppc.cpp index 0185117..326b83b 100644 --- a/Src/CPU/PowerPC/ppc.cpp +++ b/Src/CPU/PowerPC/ppc.cpp @@ -28,16 +28,15 @@ /* IBM/Motorola PowerPC 4xx/6xx Emulator */ +#include "ppc.h" + #include // memset() #include "Supermodel.h" -#include "ppc.h" +#include "CPU/Bus.h" // Typedefs that Supermodel no longer provides typedef unsigned int UINT; -// C++ should allow this... -#define INLINE inline - // Model 3 context provides read/write handlers static class IBus *Bus = NULL; // pointer to Model 3 bus object (for access handlers) @@ -294,7 +293,7 @@ static void ppc_change_pc(UINT32 newpc) if (ppc.cur_fetch.start <= newpc && newpc <= ppc.cur_fetch.end) { - ppc.op = &ppc.cur_fetch.ptr[(newpc-ppc.cur_fetch.start)/4]; + ppc.op = &ppc.cur_fetch.ptr[(newpc-ppc.cur_fetch.start)/4]; // ppc.op = (UINT32 *)((void *)ppc.cur_fetch.ptr + (UINT32)(newpc - ppc.cur_fetch.start)); return; } @@ -307,7 +306,7 @@ static void ppc_change_pc(UINT32 newpc) ppc.cur_fetch.end = ppc.fetch[i].end; ppc.cur_fetch.ptr = ppc.fetch[i].ptr; -// ppc.op = (UINT32 *)((UINT32)ppc.cur_fetch.ptr + (UINT32)(newpc - ppc.cur_fetch.start)); +// ppc.op = (UINT32 *)((UINT32)ppc.cur_fetch.ptr + (UINT32)(newpc - ppc.cur_fetch.start)); ppc.op = &ppc.cur_fetch.ptr[(newpc-ppc.cur_fetch.start)/4]; return; } @@ -318,42 +317,42 @@ static void ppc_change_pc(UINT32 newpc) ppc.fatalError = true; } -INLINE UINT8 READ8(UINT32 address) +inline UINT8 READ8(UINT32 address) { return Bus->Read8(address); } -INLINE UINT16 READ16(UINT32 address) +inline UINT16 READ16(UINT32 address) { return Bus->Read16(address); } -INLINE UINT32 READ32(UINT32 address) +inline UINT32 READ32(UINT32 address) { return Bus->Read32(address); } -INLINE UINT64 READ64(UINT32 address) +inline UINT64 READ64(UINT32 address) { return Bus->Read64(address); } -INLINE void WRITE8(UINT32 address, UINT8 data) +inline void WRITE8(UINT32 address, UINT8 data) { Bus->Write8(address,data); } -INLINE void WRITE16(UINT32 address, UINT16 data) +inline void WRITE16(UINT32 address, UINT16 data) { Bus->Write16(address,data); } -INLINE void WRITE32(UINT32 address, UINT32 data) +inline void WRITE32(UINT32 address, UINT32 data) { Bus->Write32(address,data); } -INLINE void WRITE64(UINT32 address, UINT64 data) +inline void WRITE64(UINT32 address, UINT64 data) { Bus->Write64(address,data); } @@ -362,7 +361,7 @@ INLINE void WRITE64(UINT32 address, UINT64 data) /*********************************************************************/ -INLINE void SET_CR0(INT32 rd) +inline void SET_CR0(INT32 rd) { if( rd < 0 ) { CR(0) = 0x8; @@ -376,12 +375,12 @@ INLINE void SET_CR0(INT32 rd) CR(0) |= 0x1; } -INLINE void SET_CR1(void) +inline void SET_CR1(void) { CR(1) = (ppc.fpscr >> 28) & 0xf; } -INLINE void SET_ADD_OV(UINT32 rd, UINT32 ra, UINT32 rb) +inline void SET_ADD_OV(UINT32 rd, UINT32 ra, UINT32 rb) { if( ADD_OV(rd, ra, rb) ) XER |= XER_SO | XER_OV; @@ -389,7 +388,7 @@ INLINE void SET_ADD_OV(UINT32 rd, UINT32 ra, UINT32 rb) XER &= ~XER_OV; } -INLINE void SET_SUB_OV(UINT32 rd, UINT32 ra, UINT32 rb) +inline void SET_SUB_OV(UINT32 rd, UINT32 ra, UINT32 rb) { if( SUB_OV(rd, ra, rb) ) XER |= XER_SO | XER_OV; @@ -397,7 +396,7 @@ INLINE void SET_SUB_OV(UINT32 rd, UINT32 ra, UINT32 rb) XER &= ~XER_OV; } -INLINE void SET_ADD_CA(UINT32 rd, UINT32 ra, UINT32 rb) +inline void SET_ADD_CA(UINT32 rd, UINT32 ra, UINT32 rb) { if( ADD_CA(rd, ra, rb) ) XER |= XER_CA; @@ -405,7 +404,7 @@ INLINE void SET_ADD_CA(UINT32 rd, UINT32 ra, UINT32 rb) XER &= ~XER_CA; } -INLINE void SET_SUB_CA(UINT32 rd, UINT32 ra, UINT32 rb) +inline void SET_SUB_CA(UINT32 rd, UINT32 ra, UINT32 rb) { if( SUB_CA(rd, ra, rb) ) XER |= XER_CA; @@ -413,7 +412,7 @@ INLINE void SET_SUB_CA(UINT32 rd, UINT32 ra, UINT32 rb) XER &= ~XER_CA; } -INLINE UINT32 check_condition_code(UINT32 bo, UINT32 bi) +inline UINT32 check_condition_code(UINT32 bo, UINT32 bi) { UINT32 ctr_ok; UINT32 condition_ok; @@ -431,7 +430,7 @@ INLINE UINT32 check_condition_code(UINT32 bo, UINT32 bi) return ctr_ok && condition_ok; } -INLINE UINT64 ppc_read_timebase(void) +inline UINT64 ppc_read_timebase(void) { int cycles = ppc.tb_base_icount - ppc.icount; @@ -439,7 +438,7 @@ INLINE UINT64 ppc_read_timebase(void) return ppc.tb + (cycles / ppc.timer_ratio); } -INLINE void ppc_write_timebase_l(UINT32 tbl) +inline void ppc_write_timebase_l(UINT32 tbl) { UINT64 tb = ppc_read_timebase(); @@ -448,7 +447,7 @@ INLINE void ppc_write_timebase_l(UINT32 tbl) ppc.tb = (tb&~0xffffffff)|tbl; } -INLINE void ppc_write_timebase_h(UINT32 tbh) +inline void ppc_write_timebase_h(UINT32 tbh) { UINT64 tb = ppc_read_timebase(); @@ -457,7 +456,7 @@ INLINE void ppc_write_timebase_h(UINT32 tbh) ppc.tb = (tb&0xffffffff)|((UINT64)(tbh) << 32); } -INLINE UINT32 read_decrementer(void) +inline UINT32 read_decrementer(void) { int cycles = ppc.dec_base_icount - ppc.icount; @@ -465,7 +464,7 @@ INLINE UINT32 read_decrementer(void) return DEC - (cycles / ppc.timer_ratio); } -INLINE void write_decrementer(UINT32 value) +inline void write_decrementer(UINT32 value) { if (((value&0x80000000) && !(read_decrementer()&0x80000000))) { @@ -488,7 +487,7 @@ INLINE void write_decrementer(UINT32 value) /*********************************************************************/ -INLINE void ppc_set_spr(int spr, UINT32 value) +inline void ppc_set_spr(int spr, UINT32 value) { switch (spr) { @@ -561,7 +560,7 @@ INLINE void ppc_set_spr(int spr, UINT32 value) ppc.fatalError = true; } -INLINE UINT32 ppc_get_spr(int spr) +inline UINT32 ppc_get_spr(int spr) { switch(spr) { @@ -624,7 +623,7 @@ INLINE UINT32 ppc_get_spr(int spr) return 0; } -INLINE void ppc_set_msr(UINT32 value) +inline void ppc_set_msr(UINT32 value) { if( value & (MSR_ILE | MSR_LE) ) { @@ -638,12 +637,12 @@ INLINE void ppc_set_msr(UINT32 value) ppc603_check_interrupts(); } -INLINE UINT32 ppc_get_msr(void) +inline UINT32 ppc_get_msr(void) { return MSR; } -INLINE void ppc_set_cr(UINT32 value) +inline void ppc_set_cr(UINT32 value) { CR(0) = (value >> 28) & 0xf; CR(1) = (value >> 24) & 0xf; @@ -655,7 +654,7 @@ INLINE void ppc_set_cr(UINT32 value) CR(7) = (value >> 0) & 0xf; } -INLINE UINT32 ppc_get_cr(void) +inline UINT32 ppc_get_cr(void) { return CR(0) << 28 | CR(1) << 24 | CR(2) << 20 | CR(3) << 16 | CR(4) << 12 | CR(5) << 8 | CR(6) << 4 | CR(7); } @@ -1086,7 +1085,7 @@ UINT32 ppc_get_lr(void) { return ppc.lr; } - + UINT32 ppc_read_spr(unsigned spr) { return ppc_get_spr(spr); diff --git a/Src/CPU/PowerPC/ppc.h b/Src/CPU/PowerPC/ppc.h index 20ebdf2..f7b2426 100644 --- a/Src/CPU/PowerPC/ppc.h +++ b/Src/CPU/PowerPC/ppc.h @@ -28,6 +28,9 @@ #ifndef INCLUDED_PPC_H #define INCLUDED_PPC_H +#include "BlockFile.h" +#include "Types.h" +#include "Debugger/CPU/PPCDebug.h" /****************************************************************************** Definitions diff --git a/Src/CPU/PowerPC/ppc_ops.c b/Src/CPU/PowerPC/ppc_ops.c index 670dbb6..f115dd0 100644 --- a/Src/CPU/PowerPC/ppc_ops.c +++ b/Src/CPU/PowerPC/ppc_ops.c @@ -1568,33 +1568,33 @@ static void ppc_invalid(UINT32 op) */ /*************************OLD -INLINE int is_nan_double(FPR x) +inline int is_nan_double(FPR x) { return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) && ((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) ); } -INLINE int is_qnan_double(FPR x) +inline int is_qnan_double(FPR x) { return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) && ((x.id & 0x0007fffffffffff) == 0x000000000000000) && ((x.id & 0x000800000000000) == 0x000800000000000) ); } -INLINE int is_snan_double(FPR x) +inline int is_snan_double(FPR x) { return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) && ((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) && ((x.id & 0x0008000000000000) == DOUBLE_ZERO) ); } -INLINE int is_infinity_double(FPR x) +inline int is_infinity_double(FPR x) { return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) && ((x.id & DOUBLE_FRAC) == DOUBLE_ZERO) ); } -INLINE int is_normalized_double(FPR x) +inline int is_normalized_double(FPR x) { UINT64 exp; @@ -1603,18 +1603,18 @@ INLINE int is_normalized_double(FPR x) return (exp >= 1) && (exp <= 2046); } -INLINE int is_denormalized_double(FPR x) +inline int is_denormalized_double(FPR x) { return( ((x.id & DOUBLE_EXP) == 0) && ((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) ); } -INLINE int sign_double(FPR x) +inline int sign_double(FPR x) { return ((x.id & DOUBLE_SIGN) != 0); } -INLINE INT64 round_to_nearest(FPR f) +inline INT64 round_to_nearest(FPR f) { //return (INT64)(f.fd + 0.5); if (f.fd >= 0) @@ -1627,18 +1627,18 @@ INLINE INT64 round_to_nearest(FPR f) } } -INLINE INT64 round_toward_zero(FPR f) +inline INT64 round_toward_zero(FPR f) { return (INT64)(f.fd); } -INLINE INT64 round_toward_positive_infinity(FPR f) +inline INT64 round_toward_positive_infinity(FPR f) { double r = ceil(f.fd); return (INT64)(r); } -INLINE INT64 round_toward_negative_infinity(FPR f) +inline INT64 round_toward_negative_infinity(FPR f) { double r = floor(f.fd); return (INT64)(r); @@ -1647,33 +1647,33 @@ INLINE INT64 round_toward_negative_infinity(FPR f) // New below, based on changes in MAME -INLINE int is_nan_double(FPR x) +inline int is_nan_double(FPR x) { return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) && ((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) ); } -INLINE int is_qnan_double(FPR x) +inline int is_qnan_double(FPR x) { return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) && ((x.id & 0x0007fffffffffffULL) == 0x000000000000000ULL) && ((x.id & 0x000800000000000ULL) == 0x000800000000000ULL) ); } -INLINE int is_snan_double(FPR x) +inline int is_snan_double(FPR x) { return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) && ((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) && ((x.id & (0x0008000000000000ULL)) == DOUBLE_ZERO) ); } -INLINE int is_infinity_double(FPR x) +inline int is_infinity_double(FPR x) { return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) && ((x.id & DOUBLE_FRAC) == DOUBLE_ZERO) ); } -INLINE int is_normalized_double(FPR x) +inline int is_normalized_double(FPR x) { UINT64 exp; @@ -1682,18 +1682,18 @@ INLINE int is_normalized_double(FPR x) return (exp >= 1) && (exp <= 2046); } -INLINE int is_denormalized_double(FPR x) +inline int is_denormalized_double(FPR x) { return( ((x.id & DOUBLE_EXP) == 0) && ((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) ); } -INLINE int sign_double(FPR x) +inline int sign_double(FPR x) { return ((x.id & DOUBLE_SIGN) != 0); } -INLINE INT64 smround_to_nearest(FPR f) +inline INT64 smround_to_nearest(FPR f) { if (f.fd >= 0) { @@ -1705,18 +1705,18 @@ INLINE INT64 smround_to_nearest(FPR f) } } -INLINE INT64 smround_toward_zero(FPR f) +inline INT64 smround_toward_zero(FPR f) { return (INT64)(f.fd); } -INLINE INT64 round_toward_positive_infinity(FPR f) +inline INT64 round_toward_positive_infinity(FPR f) { double r = ceil(f.fd); return (INT64)(r); } -INLINE INT64 round_toward_negative_infinity(FPR f) +inline INT64 round_toward_negative_infinity(FPR f) { double r = floor(f.fd); return (INT64)(r); @@ -1725,7 +1725,7 @@ INLINE INT64 round_toward_negative_infinity(FPR f) #define SET_VXSNAN(a, b) if (is_snan_double(a) || is_snan_double(b)) ppc.fpscr |= 0x80000000 #define SET_VXSNAN_1(c) if (is_snan_double(c)) ppc.fpscr |= 0x80000000 -INLINE void set_fprf(FPR f) +inline void set_fprf(FPR f) { UINT32 fprf; diff --git a/Src/CPU/Z80/Z80.cpp b/Src/CPU/Z80/Z80.cpp index 1c1d36d..370f94c 100644 --- a/Src/CPU/Z80/Z80.cpp +++ b/Src/CPU/Z80/Z80.cpp @@ -29,10 +29,12 @@ * Please see Z80.h for a discussion of known inaccuracies. */ -#include // for NULL -#include "Supermodel.h" #include "Z80.h" // must include this first to define CZ80 +#include // for NULL +#include "Supermodel.h" + +#include "Debugger/CPU/Z80Debug.h" /****************************************************************************** Internal Helper Macros @@ -283,23 +285,23 @@ int CZ80::Run(int numCycles) #endif // SUPERMODEL_DEBUGGER switch(op) { case 0x00: /* NOP */ - cycles -= cycleTables[0][0x00]; + cycles -= cycleTables[0][0x00]; break; case 0x01: /* LD BC,nnnn */ - cycles -= cycleTables[0][0x01]; + cycles -= cycleTables[0][0x01]; BC = GetWORD(pc); pc += 2; break; case 0x02: /* LD (BC),A */ - cycles -= cycleTables[0][0x02]; + cycles -= cycleTables[0][0x02]; PutBYTE(BC, hreg(AF)); break; case 0x03: /* INC BC */ - cycles -= cycleTables[0][0x03]; + cycles -= cycleTables[0][0x03]; ++BC; break; case 0x04: /* INC B */ - cycles -= cycleTables[0][0x04]; + cycles -= cycleTables[0][0x04]; BC += 0x100; temp = hreg(BC); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -308,7 +310,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x05: /* DEC B */ - cycles -= cycleTables[0][0x05]; + cycles -= cycleTables[0][0x05]; BC -= 0x100; temp = hreg(BC); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -317,22 +319,22 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x06: /* LD B,nn */ - cycles -= cycleTables[0][0x06]; + cycles -= cycleTables[0][0x06]; Sethreg(BC, GetBYTE_pp(pc)); break; case 0x07: /* RLCA */ - cycles -= cycleTables[0][0x07]; + cycles -= cycleTables[0][0x07]; AF = ((AF >> 7) & 0x0128) | ((AF << 1) & ~0x1ff) | (AF & 0xc4) | ((AF >> 15) & 1); break; case 0x08: /* EX AF,AF' */ - cycles -= cycleTables[0][0x08]; + cycles -= cycleTables[0][0x08]; af[af_sel] = AF; af_sel = 1 - af_sel; AF = af[af_sel]; break; case 0x09: /* ADD HL,BC */ - cycles -= cycleTables[0][0x09]; + cycles -= cycleTables[0][0x09]; HL &= 0xffff; BC &= 0xffff; sum = HL + BC; @@ -342,15 +344,15 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x0A: /* LD A,(BC) */ - cycles -= cycleTables[0][0x0A]; + cycles -= cycleTables[0][0x0A]; Sethreg(AF, GetBYTE(BC)); break; case 0x0B: /* DEC BC */ - cycles -= cycleTables[0][0x0B]; + cycles -= cycleTables[0][0x0B]; --BC; break; case 0x0C: /* INC C */ - cycles -= cycleTables[0][0x0C]; + cycles -= cycleTables[0][0x0C]; temp = lreg(BC)+1; Setlreg(BC, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -359,7 +361,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x0D: /* DEC C */ - cycles -= cycleTables[0][0x0D]; + cycles -= cycleTables[0][0x0D]; temp = lreg(BC)-1; Setlreg(BC, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -368,35 +370,35 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x0E: /* LD C,nn */ - cycles -= cycleTables[0][0x0E]; + cycles -= cycleTables[0][0x0E]; Setlreg(BC, GetBYTE_pp(pc)); break; case 0x0F: /* RRCA */ - cycles -= cycleTables[0][0x0F]; + cycles -= cycleTables[0][0x0F]; temp = hreg(AF); sum = temp >> 1; AF = ((temp & 1) << 15) | (sum << 8) | (sum & 0x28) | (AF & 0xc4) | (temp & 1); break; case 0x10: /* DJNZ dd */ - cycles -= cycleTables[0][0x10]; + cycles -= cycleTables[0][0x10]; pc += ((BC -= 0x100) & 0xff00) ? (signed char) GetBYTE(pc) + 1 : 1; break; case 0x11: /* LD DE,nnnn */ - cycles -= cycleTables[0][0x11]; + cycles -= cycleTables[0][0x11]; DE = GetWORD(pc); pc += 2; break; case 0x12: /* LD (DE),A */ - cycles -= cycleTables[0][0x12]; + cycles -= cycleTables[0][0x12]; PutBYTE(DE, hreg(AF)); break; case 0x13: /* INC DE */ - cycles -= cycleTables[0][0x13]; + cycles -= cycleTables[0][0x13]; ++DE; break; case 0x14: /* INC D */ - cycles -= cycleTables[0][0x14]; + cycles -= cycleTables[0][0x14]; DE += 0x100; temp = hreg(DE); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -405,7 +407,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x15: /* DEC D */ - cycles -= cycleTables[0][0x15]; + cycles -= cycleTables[0][0x15]; DE -= 0x100; temp = hreg(DE); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -414,20 +416,20 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x16: /* LD D,nn */ - cycles -= cycleTables[0][0x16]; + cycles -= cycleTables[0][0x16]; Sethreg(DE, GetBYTE_pp(pc)); break; case 0x17: /* RLA */ - cycles -= cycleTables[0][0x17]; + cycles -= cycleTables[0][0x17]; AF = ((AF << 8) & 0x0100) | ((AF >> 7) & 0x28) | ((AF << 1) & ~0x01ff) | (AF & 0xc4) | ((AF >> 15) & 1); break; case 0x18: /* JR dd */ - cycles -= cycleTables[0][0x18]; + cycles -= cycleTables[0][0x18]; pc += (1) ? (signed char) GetBYTE(pc) + 1 : 1; break; case 0x19: /* ADD HL,DE */ - cycles -= cycleTables[0][0x19]; + cycles -= cycleTables[0][0x19]; HL &= 0xffff; DE &= 0xffff; sum = HL + DE; @@ -437,15 +439,15 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x1A: /* LD A,(DE) */ - cycles -= cycleTables[0][0x1A]; + cycles -= cycleTables[0][0x1A]; Sethreg(AF, GetBYTE(DE)); break; case 0x1B: /* DEC DE */ - cycles -= cycleTables[0][0x1B]; + cycles -= cycleTables[0][0x1B]; --DE; break; case 0x1C: /* INC E */ - cycles -= cycleTables[0][0x1C]; + cycles -= cycleTables[0][0x1C]; temp = lreg(DE)+1; Setlreg(DE, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -454,7 +456,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x1D: /* DEC E */ - cycles -= cycleTables[0][0x1D]; + cycles -= cycleTables[0][0x1D]; temp = lreg(DE)-1; Setlreg(DE, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -463,37 +465,37 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x1E: /* LD E,nn */ - cycles -= cycleTables[0][0x1E]; + cycles -= cycleTables[0][0x1E]; Setlreg(DE, GetBYTE_pp(pc)); break; case 0x1F: /* RRA */ - cycles -= cycleTables[0][0x1F]; + cycles -= cycleTables[0][0x1F]; temp = hreg(AF); sum = temp >> 1; AF = ((AF & 1) << 15) | (sum << 8) | (sum & 0x28) | (AF & 0xc4) | (temp & 1); break; case 0x20: /* JR NZ,dd */ - cycles -= cycleTables[0][0x20]; + cycles -= cycleTables[0][0x20]; pc += (!TSTFLAG(Z)) ? (signed char) GetBYTE(pc) + 1 : 1; break; case 0x21: /* LD HL,nnnn */ - cycles -= cycleTables[0][0x21]; + cycles -= cycleTables[0][0x21]; HL = GetWORD(pc); pc += 2; break; case 0x22: /* LD (nnnn),HL */ - cycles -= cycleTables[0][0x22]; + cycles -= cycleTables[0][0x22]; temp = GetWORD(pc); PutWORD(temp, HL); pc += 2; break; case 0x23: /* INC HL */ - cycles -= cycleTables[0][0x23]; + cycles -= cycleTables[0][0x23]; ++HL; break; case 0x24: /* INC H */ - cycles -= cycleTables[0][0x24]; + cycles -= cycleTables[0][0x24]; HL += 0x100; temp = hreg(HL); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -502,7 +504,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x25: /* DEC H */ - cycles -= cycleTables[0][0x25]; + cycles -= cycleTables[0][0x25]; HL -= 0x100; temp = hreg(HL); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -511,11 +513,11 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x26: /* LD H,nn */ - cycles -= cycleTables[0][0x26]; + cycles -= cycleTables[0][0x26]; Sethreg(HL, GetBYTE_pp(pc)); break; case 0x27: /* DAA */ - cycles -= cycleTables[0][0x27]; + cycles -= cycleTables[0][0x27]; acu = hreg(AF); temp = ldig(acu); cbits = TSTFLAG(C); @@ -544,11 +546,11 @@ int CZ80::Run(int numCycles) (AF & 0x12) | partab[acu] | cbits; break; case 0x28: /* JR Z,dd */ - cycles -= cycleTables[0][0x28]; + cycles -= cycleTables[0][0x28]; pc += (TSTFLAG(Z)) ? (signed char) GetBYTE(pc) + 1 : 1; break; case 0x29: /* ADD HL,HL */ - cycles -= cycleTables[0][0x29]; + cycles -= cycleTables[0][0x29]; HL &= 0xffff; sum = HL + HL; cbits = (HL ^ HL ^ sum) >> 8; @@ -557,17 +559,17 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x2A: /* LD HL,(nnnn) */ - cycles -= cycleTables[0][0x2A]; + cycles -= cycleTables[0][0x2A]; temp = GetWORD(pc); HL = GetWORD(temp); pc += 2; break; case 0x2B: /* DEC HL */ - cycles -= cycleTables[0][0x2B]; + cycles -= cycleTables[0][0x2B]; --HL; break; case 0x2C: /* INC L */ - cycles -= cycleTables[0][0x2C]; + cycles -= cycleTables[0][0x2C]; temp = lreg(HL)+1; Setlreg(HL, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -576,7 +578,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x2D: /* DEC L */ - cycles -= cycleTables[0][0x2D]; + cycles -= cycleTables[0][0x2D]; temp = lreg(HL)-1; Setlreg(HL, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -585,34 +587,34 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x2E: /* LD L,nn */ - cycles -= cycleTables[0][0x2E]; + cycles -= cycleTables[0][0x2E]; Setlreg(HL, GetBYTE_pp(pc)); break; case 0x2F: /* CPL */ - cycles -= cycleTables[0][0x2F]; + cycles -= cycleTables[0][0x2F]; AF = (~AF & ~0xff) | (AF & 0xc5) | ((~AF >> 8) & 0x28) | 0x12; break; case 0x30: /* JR NC,dd */ - cycles -= cycleTables[0][0x30]; + cycles -= cycleTables[0][0x30]; pc += (!TSTFLAG(C)) ? (signed char) GetBYTE(pc) + 1 : 1; break; case 0x31: /* LD SP,nnnn */ - cycles -= cycleTables[0][0x31]; + cycles -= cycleTables[0][0x31]; SP = GetWORD(pc); pc += 2; break; case 0x32: /* LD (nnnn),A */ - cycles -= cycleTables[0][0x32]; + cycles -= cycleTables[0][0x32]; temp = GetWORD(pc); PutBYTE(temp, hreg(AF)); pc += 2; break; case 0x33: /* INC SP */ - cycles -= cycleTables[0][0x33]; + cycles -= cycleTables[0][0x33]; ++SP; break; case 0x34: /* INC (HL) */ - cycles -= cycleTables[0][0x34]; + cycles -= cycleTables[0][0x34]; temp = GetBYTE(HL)+1; PutBYTE(HL, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -621,7 +623,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x35: /* DEC (HL) */ - cycles -= cycleTables[0][0x35]; + cycles -= cycleTables[0][0x35]; temp = GetBYTE(HL)-1; PutBYTE(HL, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -630,19 +632,19 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x36: /* LD (HL),nn */ - cycles -= cycleTables[0][0x36]; + cycles -= cycleTables[0][0x36]; PutBYTE(HL, GetBYTE_pp(pc)); break; case 0x37: /* SCF */ - cycles -= cycleTables[0][0x37]; + cycles -= cycleTables[0][0x37]; AF = (AF&~0x3b)|((AF>>8)&0x28)|1; break; case 0x38: /* JR C,dd */ - cycles -= cycleTables[0][0x38]; + cycles -= cycleTables[0][0x38]; pc += (TSTFLAG(C)) ? (signed char) GetBYTE(pc) + 1 : 1; break; case 0x39: /* ADD HL,SP */ - cycles -= cycleTables[0][0x39]; + cycles -= cycleTables[0][0x39]; HL &= 0xffff; SP &= 0xffff; sum = HL + SP; @@ -652,17 +654,17 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x3A: /* LD A,(nnnn) */ - cycles -= cycleTables[0][0x3A]; + cycles -= cycleTables[0][0x3A]; temp = GetWORD(pc); Sethreg(AF, GetBYTE(temp)); pc += 2; break; case 0x3B: /* DEC SP */ - cycles -= cycleTables[0][0x3B]; + cycles -= cycleTables[0][0x3B]; --SP; break; case 0x3C: /* INC A */ - cycles -= cycleTables[0][0x3C]; + cycles -= cycleTables[0][0x3C]; AF += 0x100; temp = hreg(AF); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -671,7 +673,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x3D: /* DEC A */ - cycles -= cycleTables[0][0x3D]; + cycles -= cycleTables[0][0x3D]; AF -= 0x100; temp = hreg(AF); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -680,271 +682,271 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x3E: /* LD A,nn */ - cycles -= cycleTables[0][0x3E]; + cycles -= cycleTables[0][0x3E]; Sethreg(AF, GetBYTE_pp(pc)); break; case 0x3F: /* CCF */ - cycles -= cycleTables[0][0x3F]; + cycles -= cycleTables[0][0x3F]; AF = (AF&~0x3b)|((AF>>8)&0x28)|((AF&1)<<4)|(~AF&1); break; case 0x40: /* LD B,B */ - cycles -= cycleTables[0][0x40]; + cycles -= cycleTables[0][0x40]; /* nop */ break; case 0x41: /* LD B,C */ - cycles -= cycleTables[0][0x41]; + cycles -= cycleTables[0][0x41]; BC = (BC & 255) | ((BC & 255) << 8); break; case 0x42: /* LD B,D */ - cycles -= cycleTables[0][0x42]; + cycles -= cycleTables[0][0x42]; BC = (BC & 255) | (DE & ~255); break; case 0x43: /* LD B,E */ - cycles -= cycleTables[0][0x43]; + cycles -= cycleTables[0][0x43]; BC = (BC & 255) | ((DE & 255) << 8); break; case 0x44: /* LD B,H */ - cycles -= cycleTables[0][0x44]; + cycles -= cycleTables[0][0x44]; BC = (BC & 255) | (HL & ~255); break; case 0x45: /* LD B,L */ - cycles -= cycleTables[0][0x45]; + cycles -= cycleTables[0][0x45]; BC = (BC & 255) | ((HL & 255) << 8); break; case 0x46: /* LD B,(HL) */ - cycles -= cycleTables[0][0x46]; + cycles -= cycleTables[0][0x46]; Sethreg(BC, GetBYTE(HL)); break; case 0x47: /* LD B,A */ - cycles -= cycleTables[0][0x47]; + cycles -= cycleTables[0][0x47]; BC = (BC & 255) | (AF & ~255); break; case 0x48: /* LD C,B */ - cycles -= cycleTables[0][0x48]; + cycles -= cycleTables[0][0x48]; BC = (BC & ~255) | ((BC >> 8) & 255); break; case 0x49: /* LD C,C */ - cycles -= cycleTables[0][0x49]; + cycles -= cycleTables[0][0x49]; /* nop */ break; case 0x4A: /* LD C,D */ - cycles -= cycleTables[0][0x4A]; + cycles -= cycleTables[0][0x4A]; BC = (BC & ~255) | ((DE >> 8) & 255); break; case 0x4B: /* LD C,E */ - cycles -= cycleTables[0][0x4B]; + cycles -= cycleTables[0][0x4B]; BC = (BC & ~255) | (DE & 255); break; case 0x4C: /* LD C,H */ - cycles -= cycleTables[0][0x4C]; + cycles -= cycleTables[0][0x4C]; BC = (BC & ~255) | ((HL >> 8) & 255); break; case 0x4D: /* LD C,L */ - cycles -= cycleTables[0][0x4D]; + cycles -= cycleTables[0][0x4D]; BC = (BC & ~255) | (HL & 255); break; case 0x4E: /* LD C,(HL) */ - cycles -= cycleTables[0][0x4E]; + cycles -= cycleTables[0][0x4E]; Setlreg(BC, GetBYTE(HL)); break; case 0x4F: /* LD C,A */ - cycles -= cycleTables[0][0x4F]; + cycles -= cycleTables[0][0x4F]; BC = (BC & ~255) | ((AF >> 8) & 255); break; case 0x50: /* LD D,B */ - cycles -= cycleTables[0][0x50]; + cycles -= cycleTables[0][0x50]; DE = (DE & 255) | (BC & ~255); break; case 0x51: /* LD D,C */ - cycles -= cycleTables[0][0x51]; + cycles -= cycleTables[0][0x51]; DE = (DE & 255) | ((BC & 255) << 8); break; case 0x52: /* LD D,D */ - cycles -= cycleTables[0][0x52]; + cycles -= cycleTables[0][0x52]; /* nop */ break; case 0x53: /* LD D,E */ - cycles -= cycleTables[0][0x53]; + cycles -= cycleTables[0][0x53]; DE = (DE & 255) | ((DE & 255) << 8); break; case 0x54: /* LD D,H */ - cycles -= cycleTables[0][0x54]; + cycles -= cycleTables[0][0x54]; DE = (DE & 255) | (HL & ~255); break; case 0x55: /* LD D,L */ - cycles -= cycleTables[0][0x55]; + cycles -= cycleTables[0][0x55]; DE = (DE & 255) | ((HL & 255) << 8); break; case 0x56: /* LD D,(HL) */ - cycles -= cycleTables[0][0x56]; + cycles -= cycleTables[0][0x56]; Sethreg(DE, GetBYTE(HL)); break; case 0x57: /* LD D,A */ - cycles -= cycleTables[0][0x57]; + cycles -= cycleTables[0][0x57]; DE = (DE & 255) | (AF & ~255); break; case 0x58: /* LD E,B */ - cycles -= cycleTables[0][0x58]; + cycles -= cycleTables[0][0x58]; DE = (DE & ~255) | ((BC >> 8) & 255); break; case 0x59: /* LD E,C */ - cycles -= cycleTables[0][0x59]; + cycles -= cycleTables[0][0x59]; DE = (DE & ~255) | (BC & 255); break; case 0x5A: /* LD E,D */ - cycles -= cycleTables[0][0x5A]; + cycles -= cycleTables[0][0x5A]; DE = (DE & ~255) | ((DE >> 8) & 255); break; case 0x5B: /* LD E,E */ - cycles -= cycleTables[0][0x5B]; + cycles -= cycleTables[0][0x5B]; /* nop */ break; case 0x5C: /* LD E,H */ - cycles -= cycleTables[0][0x5C]; + cycles -= cycleTables[0][0x5C]; DE = (DE & ~255) | ((HL >> 8) & 255); break; case 0x5D: /* LD E,L */ - cycles -= cycleTables[0][0x5D]; + cycles -= cycleTables[0][0x5D]; DE = (DE & ~255) | (HL & 255); break; case 0x5E: /* LD E,(HL) */ - cycles -= cycleTables[0][0x5E]; + cycles -= cycleTables[0][0x5E]; Setlreg(DE, GetBYTE(HL)); break; case 0x5F: /* LD E,A */ - cycles -= cycleTables[0][0x5F]; + cycles -= cycleTables[0][0x5F]; DE = (DE & ~255) | ((AF >> 8) & 255); break; case 0x60: /* LD H,B */ - cycles -= cycleTables[0][0x60]; + cycles -= cycleTables[0][0x60]; HL = (HL & 255) | (BC & ~255); break; case 0x61: /* LD H,C */ - cycles -= cycleTables[0][0x61]; + cycles -= cycleTables[0][0x61]; HL = (HL & 255) | ((BC & 255) << 8); break; case 0x62: /* LD H,D */ - cycles -= cycleTables[0][0x62]; + cycles -= cycleTables[0][0x62]; HL = (HL & 255) | (DE & ~255); break; case 0x63: /* LD H,E */ - cycles -= cycleTables[0][0x63]; + cycles -= cycleTables[0][0x63]; HL = (HL & 255) | ((DE & 255) << 8); break; case 0x64: /* LD H,H */ - cycles -= cycleTables[0][0x64]; + cycles -= cycleTables[0][0x64]; /* nop */ break; case 0x65: /* LD H,L */ - cycles -= cycleTables[0][0x65]; + cycles -= cycleTables[0][0x65]; HL = (HL & 255) | ((HL & 255) << 8); break; case 0x66: /* LD H,(HL) */ - cycles -= cycleTables[0][0x66]; + cycles -= cycleTables[0][0x66]; Sethreg(HL, GetBYTE(HL)); break; case 0x67: /* LD H,A */ - cycles -= cycleTables[0][0x67]; + cycles -= cycleTables[0][0x67]; HL = (HL & 255) | (AF & ~255); break; case 0x68: /* LD L,B */ - cycles -= cycleTables[0][0x68]; + cycles -= cycleTables[0][0x68]; HL = (HL & ~255) | ((BC >> 8) & 255); break; case 0x69: /* LD L,C */ - cycles -= cycleTables[0][0x69]; + cycles -= cycleTables[0][0x69]; HL = (HL & ~255) | (BC & 255); break; case 0x6A: /* LD L,D */ - cycles -= cycleTables[0][0x6A]; + cycles -= cycleTables[0][0x6A]; HL = (HL & ~255) | ((DE >> 8) & 255); break; case 0x6B: /* LD L,E */ - cycles -= cycleTables[0][0x6B]; + cycles -= cycleTables[0][0x6B]; HL = (HL & ~255) | (DE & 255); break; case 0x6C: /* LD L,H */ - cycles -= cycleTables[0][0x6C]; + cycles -= cycleTables[0][0x6C]; HL = (HL & ~255) | ((HL >> 8) & 255); break; case 0x6D: /* LD L,L */ - cycles -= cycleTables[0][0x6D]; + cycles -= cycleTables[0][0x6D]; /* nop */ break; case 0x6E: /* LD L,(HL) */ - cycles -= cycleTables[0][0x6E]; + cycles -= cycleTables[0][0x6E]; Setlreg(HL, GetBYTE(HL)); break; case 0x6F: /* LD L,A */ - cycles -= cycleTables[0][0x6F]; + cycles -= cycleTables[0][0x6F]; HL = (HL & ~255) | ((AF >> 8) & 255); break; case 0x70: /* LD (HL),B */ - cycles -= cycleTables[0][0x70]; + cycles -= cycleTables[0][0x70]; PutBYTE(HL, hreg(BC)); break; case 0x71: /* LD (HL),C */ - cycles -= cycleTables[0][0x71]; + cycles -= cycleTables[0][0x71]; PutBYTE(HL, lreg(BC)); break; case 0x72: /* LD (HL),D */ - cycles -= cycleTables[0][0x72]; + cycles -= cycleTables[0][0x72]; PutBYTE(HL, hreg(DE)); break; case 0x73: /* LD (HL),E */ - cycles -= cycleTables[0][0x73]; + cycles -= cycleTables[0][0x73]; PutBYTE(HL, lreg(DE)); break; case 0x74: /* LD (HL),H */ - cycles -= cycleTables[0][0x74]; + cycles -= cycleTables[0][0x74]; PutBYTE(HL, hreg(HL)); break; case 0x75: /* LD (HL),L */ - cycles -= cycleTables[0][0x75]; + cycles -= cycleTables[0][0x75]; PutBYTE(HL, lreg(HL)); break; case 0x76: /* HALT */ - cycles -= cycleTables[0][0x76]; + cycles -= cycleTables[0][0x76]; // ErrorLog("Z80 encountered an unemulated instruction at 0x%04X", (pc-1)&0xFFFF); goto HALTExit; case 0x77: /* LD (HL),A */ - cycles -= cycleTables[0][0x77]; + cycles -= cycleTables[0][0x77]; PutBYTE(HL, hreg(AF)); break; case 0x78: /* LD A,B */ - cycles -= cycleTables[0][0x78]; + cycles -= cycleTables[0][0x78]; AF = (AF & 255) | (BC & ~255); break; case 0x79: /* LD A,C */ - cycles -= cycleTables[0][0x79]; + cycles -= cycleTables[0][0x79]; AF = (AF & 255) | ((BC & 255) << 8); break; case 0x7A: /* LD A,D */ - cycles -= cycleTables[0][0x7A]; + cycles -= cycleTables[0][0x7A]; AF = (AF & 255) | (DE & ~255); break; case 0x7B: /* LD A,E */ - cycles -= cycleTables[0][0x7B]; + cycles -= cycleTables[0][0x7B]; AF = (AF & 255) | ((DE & 255) << 8); break; case 0x7C: /* LD A,H */ - cycles -= cycleTables[0][0x7C]; + cycles -= cycleTables[0][0x7C]; AF = (AF & 255) | (HL & ~255); break; case 0x7D: /* LD A,L */ - cycles -= cycleTables[0][0x7D]; + cycles -= cycleTables[0][0x7D]; AF = (AF & 255) | ((HL & 255) << 8); break; case 0x7E: /* LD A,(HL) */ - cycles -= cycleTables[0][0x7E]; + cycles -= cycleTables[0][0x7E]; Sethreg(AF, GetBYTE(HL)); break; case 0x7F: /* LD A,A */ - cycles -= cycleTables[0][0x7F]; + cycles -= cycleTables[0][0x7F]; /* nop */ break; case 0x80: /* ADD A,B */ - cycles -= cycleTables[0][0x80]; + cycles -= cycleTables[0][0x80]; temp = hreg(BC); acu = hreg(AF); sum = acu + temp; @@ -955,7 +957,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x81: /* ADD A,C */ - cycles -= cycleTables[0][0x81]; + cycles -= cycleTables[0][0x81]; temp = lreg(BC); acu = hreg(AF); sum = acu + temp; @@ -966,7 +968,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x82: /* ADD A,D */ - cycles -= cycleTables[0][0x82]; + cycles -= cycleTables[0][0x82]; temp = hreg(DE); acu = hreg(AF); sum = acu + temp; @@ -977,7 +979,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x83: /* ADD A,E */ - cycles -= cycleTables[0][0x83]; + cycles -= cycleTables[0][0x83]; temp = lreg(DE); acu = hreg(AF); sum = acu + temp; @@ -988,7 +990,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x84: /* ADD A,H */ - cycles -= cycleTables[0][0x84]; + cycles -= cycleTables[0][0x84]; temp = hreg(HL); acu = hreg(AF); sum = acu + temp; @@ -999,7 +1001,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x85: /* ADD A,L */ - cycles -= cycleTables[0][0x85]; + cycles -= cycleTables[0][0x85]; temp = lreg(HL); acu = hreg(AF); sum = acu + temp; @@ -1010,7 +1012,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x86: /* ADD A,(HL) */ - cycles -= cycleTables[0][0x86]; + cycles -= cycleTables[0][0x86]; temp = GetBYTE(HL); acu = hreg(AF); sum = acu + temp; @@ -1021,7 +1023,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x87: /* ADD A,A */ - cycles -= cycleTables[0][0x87]; + cycles -= cycleTables[0][0x87]; temp = hreg(AF); acu = hreg(AF); sum = acu + temp; @@ -1032,7 +1034,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x88: /* ADC A,B */ - cycles -= cycleTables[0][0x88]; + cycles -= cycleTables[0][0x88]; temp = hreg(BC); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1043,7 +1045,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x89: /* ADC A,C */ - cycles -= cycleTables[0][0x89]; + cycles -= cycleTables[0][0x89]; temp = lreg(BC); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1054,7 +1056,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8A: /* ADC A,D */ - cycles -= cycleTables[0][0x8A]; + cycles -= cycleTables[0][0x8A]; temp = hreg(DE); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1065,7 +1067,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8B: /* ADC A,E */ - cycles -= cycleTables[0][0x8B]; + cycles -= cycleTables[0][0x8B]; temp = lreg(DE); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1076,7 +1078,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8C: /* ADC A,H */ - cycles -= cycleTables[0][0x8C]; + cycles -= cycleTables[0][0x8C]; temp = hreg(HL); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1087,7 +1089,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8D: /* ADC A,L */ - cycles -= cycleTables[0][0x8D]; + cycles -= cycleTables[0][0x8D]; temp = lreg(HL); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1098,7 +1100,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8E: /* ADC A,(HL) */ - cycles -= cycleTables[0][0x8E]; + cycles -= cycleTables[0][0x8E]; temp = GetBYTE(HL); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1109,7 +1111,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8F: /* ADC A,A */ - cycles -= cycleTables[0][0x8F]; + cycles -= cycleTables[0][0x8F]; temp = hreg(AF); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1120,7 +1122,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x90: /* SUB B */ - cycles -= cycleTables[0][0x90]; + cycles -= cycleTables[0][0x90]; temp = hreg(BC); acu = hreg(AF); sum = acu - temp; @@ -1131,7 +1133,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x91: /* SUB C */ - cycles -= cycleTables[0][0x91]; + cycles -= cycleTables[0][0x91]; temp = lreg(BC); acu = hreg(AF); sum = acu - temp; @@ -1142,7 +1144,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x92: /* SUB D */ - cycles -= cycleTables[0][0x92]; + cycles -= cycleTables[0][0x92]; temp = hreg(DE); acu = hreg(AF); sum = acu - temp; @@ -1153,7 +1155,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x93: /* SUB E */ - cycles -= cycleTables[0][0x93]; + cycles -= cycleTables[0][0x93]; temp = lreg(DE); acu = hreg(AF); sum = acu - temp; @@ -1164,7 +1166,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x94: /* SUB H */ - cycles -= cycleTables[0][0x94]; + cycles -= cycleTables[0][0x94]; temp = hreg(HL); acu = hreg(AF); sum = acu - temp; @@ -1175,7 +1177,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x95: /* SUB L */ - cycles -= cycleTables[0][0x95]; + cycles -= cycleTables[0][0x95]; temp = lreg(HL); acu = hreg(AF); sum = acu - temp; @@ -1186,7 +1188,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x96: /* SUB (HL) */ - cycles -= cycleTables[0][0x96]; + cycles -= cycleTables[0][0x96]; temp = GetBYTE(HL); acu = hreg(AF); sum = acu - temp; @@ -1197,7 +1199,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x97: /* SUB A */ - cycles -= cycleTables[0][0x97]; + cycles -= cycleTables[0][0x97]; temp = hreg(AF); acu = hreg(AF); sum = acu - temp; @@ -1208,7 +1210,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x98: /* SBC A,B */ - cycles -= cycleTables[0][0x98]; + cycles -= cycleTables[0][0x98]; temp = hreg(BC); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -1219,7 +1221,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x99: /* SBC A,C */ - cycles -= cycleTables[0][0x99]; + cycles -= cycleTables[0][0x99]; temp = lreg(BC); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -1230,7 +1232,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9A: /* SBC A,D */ - cycles -= cycleTables[0][0x9A]; + cycles -= cycleTables[0][0x9A]; temp = hreg(DE); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -1241,7 +1243,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9B: /* SBC A,E */ - cycles -= cycleTables[0][0x9B]; + cycles -= cycleTables[0][0x9B]; temp = lreg(DE); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -1252,7 +1254,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9C: /* SBC A,H */ - cycles -= cycleTables[0][0x9C]; + cycles -= cycleTables[0][0x9C]; temp = hreg(HL); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -1263,7 +1265,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9D: /* SBC A,L */ - cycles -= cycleTables[0][0x9D]; + cycles -= cycleTables[0][0x9D]; temp = lreg(HL); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -1274,7 +1276,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9E: /* SBC A,(HL) */ - cycles -= cycleTables[0][0x9E]; + cycles -= cycleTables[0][0x9E]; temp = GetBYTE(HL); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -1285,7 +1287,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9F: /* SBC A,A */ - cycles -= cycleTables[0][0x9F]; + cycles -= cycleTables[0][0x9F]; temp = hreg(AF); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -1296,135 +1298,135 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0xA0: /* AND B */ - cycles -= cycleTables[0][0xA0]; + cycles -= cycleTables[0][0xA0]; sum = ((AF & (BC)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | 0x10 | partab[sum]; break; case 0xA1: /* AND C */ - cycles -= cycleTables[0][0xA1]; + cycles -= cycleTables[0][0xA1]; sum = ((AF >> 8) & BC) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xA2: /* AND D */ - cycles -= cycleTables[0][0xA2]; + cycles -= cycleTables[0][0xA2]; sum = ((AF & (DE)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | 0x10 | partab[sum]; break; case 0xA3: /* AND E */ - cycles -= cycleTables[0][0xA3]; + cycles -= cycleTables[0][0xA3]; sum = ((AF >> 8) & DE) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xA4: /* AND H */ - cycles -= cycleTables[0][0xA4]; + cycles -= cycleTables[0][0xA4]; sum = ((AF & (HL)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | 0x10 | partab[sum]; break; case 0xA5: /* AND L */ - cycles -= cycleTables[0][0xA5]; + cycles -= cycleTables[0][0xA5]; sum = ((AF >> 8) & HL) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xA6: /* AND (HL) */ - cycles -= cycleTables[0][0xA6]; + cycles -= cycleTables[0][0xA6]; sum = ((AF >> 8) & GetBYTE(HL)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xA7: /* AND A */ - cycles -= cycleTables[0][0xA7]; + cycles -= cycleTables[0][0xA7]; sum = ((AF & (AF)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | 0x10 | partab[sum]; break; case 0xA8: /* XOR B */ - cycles -= cycleTables[0][0xA8]; + cycles -= cycleTables[0][0xA8]; sum = ((AF ^ (BC)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xA9: /* XOR C */ - cycles -= cycleTables[0][0xA9]; + cycles -= cycleTables[0][0xA9]; sum = ((AF >> 8) ^ BC) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAA: /* XOR D */ - cycles -= cycleTables[0][0xAA]; + cycles -= cycleTables[0][0xAA]; sum = ((AF ^ (DE)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAB: /* XOR E */ - cycles -= cycleTables[0][0xAB]; + cycles -= cycleTables[0][0xAB]; sum = ((AF >> 8) ^ DE) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAC: /* XOR H */ - cycles -= cycleTables[0][0xAC]; + cycles -= cycleTables[0][0xAC]; sum = ((AF ^ (HL)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAD: /* XOR L */ - cycles -= cycleTables[0][0xAD]; + cycles -= cycleTables[0][0xAD]; sum = ((AF >> 8) ^ HL) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAE: /* XOR (HL) */ - cycles -= cycleTables[0][0xAE]; + cycles -= cycleTables[0][0xAE]; sum = ((AF >> 8) ^ GetBYTE(HL)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAF: /* XOR A */ - cycles -= cycleTables[0][0xAF]; + cycles -= cycleTables[0][0xAF]; sum = ((AF ^ (AF)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB0: /* OR B */ - cycles -= cycleTables[0][0xB0]; + cycles -= cycleTables[0][0xB0]; sum = ((AF | (BC)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB1: /* OR C */ - cycles -= cycleTables[0][0xB1]; + cycles -= cycleTables[0][0xB1]; sum = ((AF >> 8) | BC) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB2: /* OR D */ - cycles -= cycleTables[0][0xB2]; + cycles -= cycleTables[0][0xB2]; sum = ((AF | (DE)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB3: /* OR E */ - cycles -= cycleTables[0][0xB3]; + cycles -= cycleTables[0][0xB3]; sum = ((AF >> 8) | DE) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB4: /* OR H */ - cycles -= cycleTables[0][0xB4]; + cycles -= cycleTables[0][0xB4]; sum = ((AF | (HL)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB5: /* OR L */ - cycles -= cycleTables[0][0xB5]; + cycles -= cycleTables[0][0xB5]; sum = ((AF >> 8) | HL) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB6: /* OR (HL) */ - cycles -= cycleTables[0][0xB6]; + cycles -= cycleTables[0][0xB6]; sum = ((AF >> 8) | GetBYTE(HL)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB7: /* OR A */ - cycles -= cycleTables[0][0xB7]; + cycles -= cycleTables[0][0xB7]; sum = ((AF | (AF)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB8: /* CP B */ - cycles -= cycleTables[0][0xB8]; + cycles -= cycleTables[0][0xB8]; temp = hreg(BC); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -1436,7 +1438,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xB9: /* CP C */ - cycles -= cycleTables[0][0xB9]; + cycles -= cycleTables[0][0xB9]; temp = lreg(BC); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -1448,7 +1450,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBA: /* CP D */ - cycles -= cycleTables[0][0xBA]; + cycles -= cycleTables[0][0xBA]; temp = hreg(DE); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -1460,7 +1462,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBB: /* CP E */ - cycles -= cycleTables[0][0xBB]; + cycles -= cycleTables[0][0xBB]; temp = lreg(DE); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -1472,7 +1474,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBC: /* CP H */ - cycles -= cycleTables[0][0xBC]; + cycles -= cycleTables[0][0xBC]; temp = hreg(HL); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -1484,7 +1486,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBD: /* CP L */ - cycles -= cycleTables[0][0xBD]; + cycles -= cycleTables[0][0xBD]; temp = lreg(HL); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -1496,7 +1498,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBE: /* CP (HL) */ - cycles -= cycleTables[0][0xBE]; + cycles -= cycleTables[0][0xBE]; temp = GetBYTE(HL); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -1508,7 +1510,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBF: /* CP A */ - cycles -= cycleTables[0][0xBF]; + cycles -= cycleTables[0][0xBF]; temp = hreg(AF); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -1520,31 +1522,31 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xC0: /* RET NZ */ - cycles -= cycleTables[0][0xC0]; + cycles -= cycleTables[0][0xC0]; if (!TSTFLAG(Z)) POP(pc); break; case 0xC1: /* POP BC */ - cycles -= cycleTables[0][0xC1]; + cycles -= cycleTables[0][0xC1]; POP(BC); break; case 0xC2: /* JP NZ,nnnn */ - cycles -= cycleTables[0][0xC2]; + cycles -= cycleTables[0][0xC2]; Jpc(!TSTFLAG(Z)); break; case 0xC3: /* JP nnnn */ - cycles -= cycleTables[0][0xC3]; + cycles -= cycleTables[0][0xC3]; Jpc(1); break; case 0xC4: /* CALL NZ,nnnn */ - cycles -= cycleTables[0][0xC4]; + cycles -= cycleTables[0][0xC4]; CALLC(!TSTFLAG(Z)); break; case 0xC5: /* PUSH BC */ - cycles -= cycleTables[0][0xC5]; + cycles -= cycleTables[0][0xC5]; PUSH(BC); break; case 0xC6: /* ADD A,nn */ - cycles -= cycleTables[0][0xC6]; + cycles -= cycleTables[0][0xC6]; temp = GetBYTE_pp(pc); acu = hreg(AF); sum = acu + temp; @@ -1555,25 +1557,25 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0xC7: /* RST 0 */ - cycles -= cycleTables[0][0xC7]; + cycles -= cycleTables[0][0xC7]; PUSH(pc); pc = 0; break; case 0xC8: /* RET Z */ - cycles -= cycleTables[0][0xC8]; + cycles -= cycleTables[0][0xC8]; if (TSTFLAG(Z)) POP(pc); break; case 0xC9: /* RET */ - cycles -= cycleTables[0][0xC9]; + cycles -= cycleTables[0][0xC9]; POP(pc); break; case 0xCA: /* JP Z,nnnn */ - cycles -= cycleTables[0][0xCA]; + cycles -= cycleTables[0][0xCA]; Jpc(TSTFLAG(Z)); break; case 0xCB: /* CB prefix */ adr = HL; op = GetBYTE(pc); - cycles -= cycleTables[1][op]; + cycles -= cycleTables[1][op]; switch (op & 7) { case 0: ++pc; acu = hreg(BC); break; case 1: ++pc; acu = lreg(BC); break; @@ -1653,15 +1655,15 @@ int CZ80::Run(int numCycles) } break; case 0xCC: /* CALL Z,nnnn */ - cycles -= cycleTables[0][0xCC]; + cycles -= cycleTables[0][0xCC]; CALLC(TSTFLAG(Z)); break; case 0xCD: /* CALL nnnn */ - cycles -= cycleTables[0][0xCD]; + cycles -= cycleTables[0][0xCD]; CALLC(1); break; case 0xCE: /* ADC A,nn */ - cycles -= cycleTables[0][0xCE]; + cycles -= cycleTables[0][0xCE]; temp = GetBYTE_pp(pc); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -1672,35 +1674,35 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0xCF: /* RST 8 */ - cycles -= cycleTables[0][0xCF]; + cycles -= cycleTables[0][0xCF]; PUSH(pc); pc = 8; break; case 0xD0: /* RET NC */ - cycles -= cycleTables[0][0xD0]; + cycles -= cycleTables[0][0xD0]; if (!TSTFLAG(C)) POP(pc); break; case 0xD1: /* POP DE */ - cycles -= cycleTables[0][0xD1]; + cycles -= cycleTables[0][0xD1]; POP(DE); break; case 0xD2: /* JP NC,nnnn */ - cycles -= cycleTables[0][0xD2]; + cycles -= cycleTables[0][0xD2]; Jpc(!TSTFLAG(C)); break; case 0xD3: /* OUT (nn),A */ - cycles -= cycleTables[0][0xD3]; + cycles -= cycleTables[0][0xD3]; OUTPUT(GetBYTE_pp(pc), hreg(AF)); break; case 0xD4: /* CALL NC,nnnn */ - cycles -= cycleTables[0][0xD4]; + cycles -= cycleTables[0][0xD4]; CALLC(!TSTFLAG(C)); break; case 0xD5: /* PUSH DE */ - cycles -= cycleTables[0][0xD5]; + cycles -= cycleTables[0][0xD5]; PUSH(DE); break; case 0xD6: /* SUB nn */ - cycles -= cycleTables[0][0xD6]; + cycles -= cycleTables[0][0xD6]; temp = GetBYTE_pp(pc); acu = hreg(AF); sum = acu - temp; @@ -1711,15 +1713,15 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0xD7: /* RST 10H */ - cycles -= cycleTables[0][0xD7]; + cycles -= cycleTables[0][0xD7]; PUSH(pc); pc = 0x10; break; case 0xD8: /* RET C */ - cycles -= cycleTables[0][0xD8]; + cycles -= cycleTables[0][0xD8]; if (TSTFLAG(C)) POP(pc); break; case 0xD9: /* EXX */ - cycles -= cycleTables[0][0xD9]; + cycles -= cycleTables[0][0xD9]; regs[regs_sel].bc = BC; regs[regs_sel].de = DE; regs[regs_sel].hl = HL; @@ -1729,22 +1731,22 @@ int CZ80::Run(int numCycles) HL = regs[regs_sel].hl; break; case 0xDA: /* JP C,nnnn */ - cycles -= cycleTables[0][0xDA]; + cycles -= cycleTables[0][0xDA]; Jpc(TSTFLAG(C)); break; case 0xDB: /* IN A,(nn) */ - cycles -= cycleTables[0][0xDB]; + cycles -= cycleTables[0][0xDB]; Sethreg(AF, INPUT(GetBYTE_pp(pc))); break; case 0xDC: /* CALL C,nnnn */ - cycles -= cycleTables[0][0xDC]; + cycles -= cycleTables[0][0xDC]; CALLC(TSTFLAG(C)); break; case 0xDD: /* DD prefix */ op = GetBYTE_pp(pc); switch (op) { case 0x09: /* ADD IX,BC */ - cycles -= cycleTables[3][0x09]; + cycles -= cycleTables[3][0x09]; IX &= 0xffff; BC &= 0xffff; sum = IX + BC; @@ -1754,7 +1756,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x19: /* ADD IX,DE */ - cycles -= cycleTables[3][0x19]; + cycles -= cycleTables[3][0x19]; IX &= 0xffff; DE &= 0xffff; sum = IX + DE; @@ -1764,22 +1766,22 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x21: /* LD IX,nnnn */ - cycles -= cycleTables[3][0x21]; + cycles -= cycleTables[3][0x21]; IX = GetWORD(pc); pc += 2; break; case 0x22: /* LD (nnnn),IX */ - cycles -= cycleTables[3][0x22]; + cycles -= cycleTables[3][0x22]; temp = GetWORD(pc); PutWORD(temp, IX); pc += 2; break; case 0x23: /* INC IX */ - cycles -= cycleTables[3][0x23]; + cycles -= cycleTables[3][0x23]; ++IX; break; case 0x24: /* INC IXH */ - cycles -= cycleTables[3][0x24]; + cycles -= cycleTables[3][0x24]; IX += 0x100; temp = hreg(IX); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -1788,7 +1790,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x25: /* DEC IXH */ - cycles -= cycleTables[3][0x25]; + cycles -= cycleTables[3][0x25]; IX -= 0x100; temp = hreg(IX); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -1797,11 +1799,11 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x26: /* LD IXH,nn */ - cycles -= cycleTables[3][0x26]; + cycles -= cycleTables[3][0x26]; Sethreg(IX, GetBYTE_pp(pc)); break; case 0x29: /* ADD IX,IX */ - cycles -= cycleTables[3][0x29]; + cycles -= cycleTables[3][0x29]; IX &= 0xffff; sum = IX + IX; cbits = (IX ^ IX ^ sum) >> 8; @@ -1810,17 +1812,17 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x2A: /* LD IX,(nnnn) */ - cycles -= cycleTables[3][0x2A]; + cycles -= cycleTables[3][0x2A]; temp = GetWORD(pc); IX = GetWORD(temp); pc += 2; break; case 0x2B: /* DEC IX */ - cycles -= cycleTables[3][0x2B]; + cycles -= cycleTables[3][0x2B]; --IX; break; case 0x2C: /* INC IXL */ - cycles -= cycleTables[3][0x2C]; + cycles -= cycleTables[3][0x2C]; temp = lreg(IX)+1; Setlreg(IX, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -1829,7 +1831,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x2D: /* DEC IXL */ - cycles -= cycleTables[3][0x2D]; + cycles -= cycleTables[3][0x2D]; temp = lreg(IX)-1; Setlreg(IX, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -1838,11 +1840,11 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x2E: /* LD IXL,nn */ - cycles -= cycleTables[3][0x2E]; + cycles -= cycleTables[3][0x2E]; Setlreg(IX, GetBYTE_pp(pc)); break; case 0x34: /* INC (IX+dd) */ - cycles -= cycleTables[3][0x34]; + cycles -= cycleTables[3][0x34]; adr = IX + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr)+1; PutBYTE(adr, temp); @@ -1852,7 +1854,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x35: /* DEC (IX+dd) */ - cycles -= cycleTables[3][0x35]; + cycles -= cycleTables[3][0x35]; adr = IX + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr)-1; PutBYTE(adr, temp); @@ -1862,12 +1864,12 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x36: /* LD (IX+dd),nn */ - cycles -= cycleTables[3][0x36]; + cycles -= cycleTables[3][0x36]; adr = IX + (signed char) GetBYTE_pp(pc); PutBYTE(adr, GetBYTE_pp(pc)); break; case 0x39: /* ADD IX,SP */ - cycles -= cycleTables[3][0x39]; + cycles -= cycleTables[3][0x39]; IX &= 0xffff; SP &= 0xffff; sum = IX + SP; @@ -1877,173 +1879,173 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x44: /* LD B,IXH */ - cycles -= cycleTables[3][0x44]; + cycles -= cycleTables[3][0x44]; Sethreg(BC, hreg(IX)); break; case 0x45: /* LD B,IXL */ - cycles -= cycleTables[3][0x45]; + cycles -= cycleTables[3][0x45]; Sethreg(BC, lreg(IX)); break; case 0x46: /* LD B,(IX+dd) */ - cycles -= cycleTables[3][0x46]; + cycles -= cycleTables[3][0x46]; adr = IX + (signed char) GetBYTE_pp(pc); Sethreg(BC, GetBYTE(adr)); break; case 0x4C: /* LD C,IXH */ - cycles -= cycleTables[3][0x4C]; + cycles -= cycleTables[3][0x4C]; Setlreg(BC, hreg(IX)); break; case 0x4D: /* LD C,IXL */ - cycles -= cycleTables[3][0x4D]; + cycles -= cycleTables[3][0x4D]; Setlreg(BC, lreg(IX)); break; case 0x4E: /* LD C,(IX+dd) */ - cycles -= cycleTables[3][0x4E]; + cycles -= cycleTables[3][0x4E]; adr = IX + (signed char) GetBYTE_pp(pc); Setlreg(BC, GetBYTE(adr)); break; case 0x54: /* LD D,IXH */ - cycles -= cycleTables[3][0x54]; + cycles -= cycleTables[3][0x54]; Sethreg(DE, hreg(IX)); break; case 0x55: /* LD D,IXL */ - cycles -= cycleTables[3][0x55]; + cycles -= cycleTables[3][0x55]; Sethreg(DE, lreg(IX)); break; case 0x56: /* LD D,(IX+dd) */ - cycles -= cycleTables[3][0x56]; + cycles -= cycleTables[3][0x56]; adr = IX + (signed char) GetBYTE_pp(pc); Sethreg(DE, GetBYTE(adr)); break; case 0x5C: /* LD E,H */ - cycles -= cycleTables[3][0x5C]; + cycles -= cycleTables[3][0x5C]; Setlreg(DE, hreg(IX)); break; case 0x5D: /* LD E,L */ - cycles -= cycleTables[3][0x5D]; + cycles -= cycleTables[3][0x5D]; Setlreg(DE, lreg(IX)); break; case 0x5E: /* LD E,(IX+dd) */ - cycles -= cycleTables[3][0x5E]; + cycles -= cycleTables[3][0x5E]; adr = IX + (signed char) GetBYTE_pp(pc); Setlreg(DE, GetBYTE(adr)); break; case 0x60: /* LD IXH,B */ - cycles -= cycleTables[3][0x60]; + cycles -= cycleTables[3][0x60]; Sethreg(IX, hreg(BC)); break; case 0x61: /* LD IXH,C */ - cycles -= cycleTables[3][0x61]; + cycles -= cycleTables[3][0x61]; Sethreg(IX, lreg(BC)); break; case 0x62: /* LD IXH,D */ - cycles -= cycleTables[3][0x62]; + cycles -= cycleTables[3][0x62]; Sethreg(IX, hreg(DE)); break; case 0x63: /* LD IXH,E */ - cycles -= cycleTables[3][0x63]; + cycles -= cycleTables[3][0x63]; Sethreg(IX, lreg(DE)); break; case 0x64: /* LD IXH,IXH */ - cycles -= cycleTables[3][0x64]; + cycles -= cycleTables[3][0x64]; /* nop */ break; case 0x65: /* LD IXH,IXL */ - cycles -= cycleTables[3][0x65]; + cycles -= cycleTables[3][0x65]; Sethreg(IX, lreg(IX)); break; case 0x66: /* LD H,(IX+dd) */ - cycles -= cycleTables[3][0x66]; + cycles -= cycleTables[3][0x66]; adr = IX + (signed char) GetBYTE_pp(pc); Sethreg(HL, GetBYTE(adr)); break; case 0x67: /* LD IXH,A */ - cycles -= cycleTables[3][0x67]; + cycles -= cycleTables[3][0x67]; Sethreg(IX, hreg(AF)); break; case 0x68: /* LD IXL,B */ - cycles -= cycleTables[3][0x68]; + cycles -= cycleTables[3][0x68]; Setlreg(IX, hreg(BC)); break; case 0x69: /* LD IXL,C */ - cycles -= cycleTables[3][0x69]; + cycles -= cycleTables[3][0x69]; Setlreg(IX, lreg(BC)); break; case 0x6A: /* LD IXL,D */ - cycles -= cycleTables[3][0x6A]; + cycles -= cycleTables[3][0x6A]; Setlreg(IX, hreg(DE)); break; case 0x6B: /* LD IXL,E */ - cycles -= cycleTables[3][0x6B]; + cycles -= cycleTables[3][0x6B]; Setlreg(IX, lreg(DE)); break; case 0x6C: /* LD IXL,IXH */ - cycles -= cycleTables[3][0x6C]; + cycles -= cycleTables[3][0x6C]; Setlreg(IX, hreg(IX)); break; case 0x6D: /* LD IXL,IXL */ - cycles -= cycleTables[3][0x6D]; + cycles -= cycleTables[3][0x6D]; /* nop */ break; case 0x6E: /* LD L,(IX+dd) */ - cycles -= cycleTables[3][0x6E]; + cycles -= cycleTables[3][0x6E]; adr = IX + (signed char) GetBYTE_pp(pc); Setlreg(HL, GetBYTE(adr)); break; case 0x6F: /* LD IXL,A */ - cycles -= cycleTables[3][0x6F]; + cycles -= cycleTables[3][0x6F]; Setlreg(IX, hreg(AF)); break; case 0x70: /* LD (IX+dd),B */ - cycles -= cycleTables[3][0x70]; + cycles -= cycleTables[3][0x70]; adr = IX + (signed char) GetBYTE_pp(pc); PutBYTE(adr, hreg(BC)); break; case 0x71: /* LD (IX+dd),C */ - cycles -= cycleTables[3][0x71]; + cycles -= cycleTables[3][0x71]; adr = IX + (signed char) GetBYTE_pp(pc); PutBYTE(adr, lreg(BC)); break; case 0x72: /* LD (IX+dd),D */ - cycles -= cycleTables[3][0x72]; + cycles -= cycleTables[3][0x72]; adr = IX + (signed char) GetBYTE_pp(pc); PutBYTE(adr, hreg(DE)); break; case 0x73: /* LD (IX+dd),E */ - cycles -= cycleTables[3][0x73]; + cycles -= cycleTables[3][0x73]; adr = IX + (signed char) GetBYTE_pp(pc); PutBYTE(adr, lreg(DE)); break; case 0x74: /* LD (IX+dd),H */ - cycles -= cycleTables[3][0x74]; + cycles -= cycleTables[3][0x74]; adr = IX + (signed char) GetBYTE_pp(pc); PutBYTE(adr, hreg(HL)); break; case 0x75: /* LD (IX+dd),L */ - cycles -= cycleTables[3][0x75]; + cycles -= cycleTables[3][0x75]; adr = IX + (signed char) GetBYTE_pp(pc); PutBYTE(adr, lreg(HL)); break; case 0x77: /* LD (IX+dd),A */ - cycles -= cycleTables[3][0x77]; + cycles -= cycleTables[3][0x77]; adr = IX + (signed char) GetBYTE_pp(pc); PutBYTE(adr, hreg(AF)); break; case 0x7C: /* LD A,IXH */ - cycles -= cycleTables[3][0x7C]; + cycles -= cycleTables[3][0x7C]; Sethreg(AF, hreg(IX)); break; case 0x7D: /* LD A,IXL */ - cycles -= cycleTables[3][0x7D]; + cycles -= cycleTables[3][0x7D]; Sethreg(AF, lreg(IX)); break; case 0x7E: /* LD A,(IX+dd) */ - cycles -= cycleTables[3][0x7E]; + cycles -= cycleTables[3][0x7E]; adr = IX + (signed char) GetBYTE_pp(pc); Sethreg(AF, GetBYTE(adr)); break; case 0x84: /* ADD A,IXH */ - cycles -= cycleTables[3][0x84]; + cycles -= cycleTables[3][0x84]; temp = hreg(IX); acu = hreg(AF); sum = acu + temp; @@ -2054,7 +2056,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x85: /* ADD A,IXL */ - cycles -= cycleTables[3][0x85]; + cycles -= cycleTables[3][0x85]; temp = lreg(IX); acu = hreg(AF); sum = acu + temp; @@ -2065,7 +2067,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x86: /* ADD A,(IX+dd) */ - cycles -= cycleTables[3][0x86]; + cycles -= cycleTables[3][0x86]; adr = IX + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); acu = hreg(AF); @@ -2077,7 +2079,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8C: /* ADC A,IXH */ - cycles -= cycleTables[3][0x8C]; + cycles -= cycleTables[3][0x8C]; temp = hreg(IX); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -2088,7 +2090,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8D: /* ADC A,IXL */ - cycles -= cycleTables[3][0x8D]; + cycles -= cycleTables[3][0x8D]; temp = lreg(IX); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -2099,7 +2101,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8E: /* ADC A,(IX+dd) */ - cycles -= cycleTables[3][0x8E]; + cycles -= cycleTables[3][0x8E]; adr = IX + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); acu = hreg(AF); @@ -2111,7 +2113,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x94: /* SUB IXH */ - cycles -= cycleTables[3][0x94]; + cycles -= cycleTables[3][0x94]; temp = hreg(IX); acu = hreg(AF); sum = acu - temp; @@ -2122,7 +2124,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x95: /* SUB IXL */ - cycles -= cycleTables[3][0x95]; + cycles -= cycleTables[3][0x95]; temp = lreg(IX); acu = hreg(AF); sum = acu - temp; @@ -2133,7 +2135,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x96: /* SUB (IX+dd) */ - cycles -= cycleTables[3][0x96]; + cycles -= cycleTables[3][0x96]; adr = IX + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); acu = hreg(AF); @@ -2145,7 +2147,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9C: /* SBC A,IXH */ - cycles -= cycleTables[3][0x9C]; + cycles -= cycleTables[3][0x9C]; temp = hreg(IX); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -2156,7 +2158,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9D: /* SBC A,IXL */ - cycles -= cycleTables[3][0x9D]; + cycles -= cycleTables[3][0x9D]; temp = lreg(IX); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -2167,7 +2169,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9E: /* SBC A,(IX+dd) */ - cycles -= cycleTables[3][0x9E]; + cycles -= cycleTables[3][0x9E]; adr = IX + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); acu = hreg(AF); @@ -2179,58 +2181,58 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0xA4: /* AND IXH */ - cycles -= cycleTables[3][0xA4]; + cycles -= cycleTables[3][0xA4]; sum = ((AF & (IX)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | 0x10 | partab[sum]; break; case 0xA5: /* AND IXL */ - cycles -= cycleTables[3][0xA5]; + cycles -= cycleTables[3][0xA5]; sum = ((AF >> 8) & IX) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xA6: /* AND (IX+dd) */ - cycles -= cycleTables[3][0xA6]; + cycles -= cycleTables[3][0xA6]; adr = IX + (signed char) GetBYTE_pp(pc); sum = ((AF >> 8) & GetBYTE(adr)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xAC: /* XOR IXH */ - cycles -= cycleTables[3][0xAC]; + cycles -= cycleTables[3][0xAC]; sum = ((AF ^ (IX)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAD: /* XOR IXL */ - cycles -= cycleTables[3][0xAD]; + cycles -= cycleTables[3][0xAD]; sum = ((AF >> 8) ^ IX) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAE: /* XOR (IX+dd) */ - cycles -= cycleTables[3][0xAE]; + cycles -= cycleTables[3][0xAE]; adr = IX + (signed char) GetBYTE_pp(pc); sum = ((AF >> 8) ^ GetBYTE(adr)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB4: /* OR IXH */ - cycles -= cycleTables[3][0xB4]; + cycles -= cycleTables[3][0xB4]; sum = ((AF | (IX)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB5: /* OR IXL */ - cycles -= cycleTables[3][0xB5]; + cycles -= cycleTables[3][0xB5]; sum = ((AF >> 8) | IX) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB6: /* OR (IX+dd) */ - cycles -= cycleTables[3][0xB6]; + cycles -= cycleTables[3][0xB6]; adr = IX + (signed char) GetBYTE_pp(pc); sum = ((AF >> 8) | GetBYTE(adr)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xBC: /* CP IXH */ - cycles -= cycleTables[3][0xBC]; + cycles -= cycleTables[3][0xBC]; temp = hreg(IX); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -2242,7 +2244,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBD: /* CP IXL */ - cycles -= cycleTables[3][0xBD]; + cycles -= cycleTables[3][0xBD]; temp = lreg(IX); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -2254,7 +2256,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBE: /* CP (IX+dd) */ - cycles -= cycleTables[3][0xBE]; + cycles -= cycleTables[3][0xBE]; adr = IX + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); AF = (AF & ~0x28) | (temp & 0x28); @@ -2270,7 +2272,7 @@ int CZ80::Run(int numCycles) adr = IX + (signed char) GetBYTE_pp(pc); adr = adr; op = GetBYTE(pc); - cycles -= cycleTables[4][op]; + cycles -= cycleTables[4][op]; switch (op & 7) { case 0: ++pc; acu = hreg(BC); break; case 1: ++pc; acu = lreg(BC); break; @@ -2350,30 +2352,30 @@ int CZ80::Run(int numCycles) } break; case 0xE1: /* POP IX */ - cycles -= cycleTables[3][0xE1]; + cycles -= cycleTables[3][0xE1]; POP(IX); break; case 0xE3: /* EX (SP),IX */ - cycles -= cycleTables[3][0xE3]; + cycles -= cycleTables[3][0xE3]; temp = IX; POP(IX); PUSH(temp); break; case 0xE5: /* PUSH IX */ - cycles -= cycleTables[3][0xE5]; + cycles -= cycleTables[3][0xE5]; PUSH(IX); break; case 0xE9: /* JP (IX) */ - cycles -= cycleTables[3][0xE9]; + cycles -= cycleTables[3][0xE9]; pc = IX; break; case 0xF9: /* LD SP,IX */ - cycles -= cycleTables[3][0xF9]; + cycles -= cycleTables[3][0xF9]; SP = IX; break; default: pc--; /* ignore DD */ } break; case 0xDE: /* SBC A,nn */ - cycles -= cycleTables[0][0xDE]; + cycles -= cycleTables[0][0xDE]; temp = GetBYTE_pp(pc); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -2384,68 +2386,68 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0xDF: /* RST 18H */ - cycles -= cycleTables[0][0xDF]; + cycles -= cycleTables[0][0xDF]; PUSH(pc); pc = 0x18; break; case 0xE0: /* RET PO */ - cycles -= cycleTables[0][0xE0]; + cycles -= cycleTables[0][0xE0]; if (!TSTFLAG(P)) POP(pc); break; case 0xE1: /* POP HL */ - cycles -= cycleTables[0][0xE1]; + cycles -= cycleTables[0][0xE1]; POP(HL); break; case 0xE2: /* JP PO,nnnn */ - cycles -= cycleTables[0][0xE2]; + cycles -= cycleTables[0][0xE2]; Jpc(!TSTFLAG(P)); break; case 0xE3: /* EX (SP),HL */ - cycles -= cycleTables[0][0xE3]; + cycles -= cycleTables[0][0xE3]; temp = HL; POP(HL); PUSH(temp); break; case 0xE4: /* CALL PO,nnnn */ - cycles -= cycleTables[0][0xE4]; + cycles -= cycleTables[0][0xE4]; CALLC(!TSTFLAG(P)); break; case 0xE5: /* PUSH HL */ - cycles -= cycleTables[0][0xE5]; + cycles -= cycleTables[0][0xE5]; PUSH(HL); break; case 0xE6: /* AND nn */ - cycles -= cycleTables[0][0xE6]; + cycles -= cycleTables[0][0xE6]; sum = ((AF >> 8) & GetBYTE_pp(pc)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xE7: /* RST 20H */ - cycles -= cycleTables[0][0xE7]; + cycles -= cycleTables[0][0xE7]; PUSH(pc); pc = 0x20; break; case 0xE8: /* RET PE */ - cycles -= cycleTables[0][0xE8]; + cycles -= cycleTables[0][0xE8]; if (TSTFLAG(P)) POP(pc); break; case 0xE9: /* JP (HL) */ - cycles -= cycleTables[0][0xE9]; + cycles -= cycleTables[0][0xE9]; pc = HL; break; case 0xEA: /* JP PE,nnnn */ - cycles -= cycleTables[0][0xEA]; + cycles -= cycleTables[0][0xEA]; Jpc(TSTFLAG(P)); break; case 0xEB: /* EX DE,HL */ - cycles -= cycleTables[0][0xEB]; + cycles -= cycleTables[0][0xEB]; temp = HL; HL = DE; DE = temp; break; case 0xEC: /* CALL PE,nnnn */ - cycles -= cycleTables[0][0xEC]; + cycles -= cycleTables[0][0xEC]; CALLC(TSTFLAG(P)); break; case 0xED: /* ED prefix */ op = GetBYTE_pp(pc); switch (op) { case 0x40: /* IN B,(C) */ - cycles -= cycleTables[2][0x40]; + cycles -= cycleTables[2][0x40]; temp = INPUT(lreg(BC)); Sethreg(BC, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -2469,13 +2471,13 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | 2 | ((cbits >> 8) & 1); break; case 0x43: /* LD (nnnn),BC */ - cycles -= cycleTables[2][0x43]; + cycles -= cycleTables[2][0x43]; temp = GetWORD(pc); PutWORD(temp, BC); pc += 2; break; case 0x44: /* NEG */ - cycles -= cycleTables[2][0x44]; + cycles -= cycleTables[2][0x44]; temp = hreg(AF); AF = (-(AF & 0xff00) & 0xff00); AF |= ((AF >> 8) & 0xa8) | (((AF & 0xff00) == 0) << 6) | @@ -2483,20 +2485,20 @@ int CZ80::Run(int numCycles) 2 | (temp != 0); break; case 0x45: /* RETN */ - cycles -= cycleTables[2][0x45]; + cycles -= cycleTables[2][0x45]; iff |= iff >> 1; POP(pc); break; case 0x46: /* IM 0 */ - cycles -= cycleTables[2][0x46]; + cycles -= cycleTables[2][0x46]; im = 0; // interrupt mode 0 break; case 0x47: /* LD I,A */ - cycles -= cycleTables[2][0x47]; + cycles -= cycleTables[2][0x47]; ir = (ir & 255) | (AF & ~255); break; case 0x48: /* IN C,(C) */ - cycles -= cycleTables[2][0x48]; + cycles -= cycleTables[2][0x48]; temp = INPUT(lreg(BC)); Setlreg(BC, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -2520,22 +2522,22 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x4B: /* LD BC,(nnnn) */ - cycles -= cycleTables[2][0x4B]; + cycles -= cycleTables[2][0x4B]; temp = GetWORD(pc); BC = GetWORD(temp); pc += 2; break; case 0x4D: /* RETI */ - cycles -= cycleTables[2][0x4D]; + cycles -= cycleTables[2][0x4D]; iff |= iff >> 1; POP(pc); break; case 0x4F: /* LD R,A */ - cycles -= cycleTables[2][0x4F]; + cycles -= cycleTables[2][0x4F]; ir = (ir & ~255) | ((AF >> 8) & 255); break; case 0x50: /* IN D,(C) */ - cycles -= cycleTables[2][0x50]; + cycles -= cycleTables[2][0x50]; temp = INPUT(lreg(BC)); Sethreg(DE, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -2559,21 +2561,21 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | 2 | ((cbits >> 8) & 1); break; case 0x53: /* LD (nnnn),DE */ - cycles -= cycleTables[2][0x53]; + cycles -= cycleTables[2][0x53]; temp = GetWORD(pc); PutWORD(temp, DE); pc += 2; break; case 0x56: /* IM 1 */ - cycles -= cycleTables[2][0x56]; + cycles -= cycleTables[2][0x56]; im = 1; // interrupt mode 1 break; case 0x57: /* LD A,I */ - cycles -= cycleTables[2][0x57]; + cycles -= cycleTables[2][0x57]; AF = (AF & 0x29) | (ir & ~255) | ((ir >> 8) & 0x80) | (((ir & ~255) == 0) << 6) | ((iff & 2) << 1); break; case 0x58: /* IN E,(C) */ - cycles -= cycleTables[2][0x58]; + cycles -= cycleTables[2][0x58]; temp = INPUT(lreg(BC)); Setlreg(DE, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -2597,21 +2599,21 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x5B: /* LD DE,(nnnn) */ - cycles -= cycleTables[2][0x5B]; + cycles -= cycleTables[2][0x5B]; temp = GetWORD(pc); DE = GetWORD(temp); pc += 2; break; case 0x5E: /* IM 2 */ - cycles -= cycleTables[2][0x5E]; + cycles -= cycleTables[2][0x5E]; im = 2; // interrupt mode 2 break; case 0x5F: /* LD A,R */ - cycles -= cycleTables[2][0x5F]; + cycles -= cycleTables[2][0x5F]; AF = (AF & 0x29) | ((ir & 255) << 8) | (ir & 0x80) | (((ir & 255) == 0) << 6) | ((iff & 2) << 1); break; case 0x60: /* IN H,(C) */ - cycles -= cycleTables[2][0x60]; + cycles -= cycleTables[2][0x60]; temp = INPUT(lreg(BC)); Sethreg(HL, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -2634,13 +2636,13 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | 2 | ((cbits >> 8) & 1); break; case 0x63: /* LD (nnnn),HL */ - cycles -= cycleTables[2][0x63]; + cycles -= cycleTables[2][0x63]; temp = GetWORD(pc); PutWORD(temp, HL); pc += 2; break; case 0x67: /* RRD */ - cycles -= cycleTables[2][0x67]; + cycles -= cycleTables[2][0x67]; temp = GetBYTE(HL); acu = hreg(AF); PutBYTE(HL, hdig(temp) | (ldig(acu) << 4)); @@ -2649,7 +2651,7 @@ int CZ80::Run(int numCycles) partab[acu] | (AF & 1); break; case 0x68: /* IN L,(C) */ - cycles -= cycleTables[2][0x68]; + cycles -= cycleTables[2][0x68]; temp = INPUT(lreg(BC)); Setlreg(HL, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -2672,13 +2674,13 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x6B: /* LD HL,(nnnn) */ - cycles -= cycleTables[2][0x6B]; + cycles -= cycleTables[2][0x6B]; temp = GetWORD(pc); HL = GetWORD(temp); pc += 2; break; case 0x6F: /* RLD */ - cycles -= cycleTables[2][0x6F]; + cycles -= cycleTables[2][0x6F]; temp = GetBYTE(HL); acu = hreg(AF); PutBYTE(HL, (ldig(temp) << 4) | ldig(acu)); @@ -2687,7 +2689,7 @@ int CZ80::Run(int numCycles) partab[acu] | (AF & 1); break; case 0x70: /* IN (C) */ - cycles -= cycleTables[2][0x70]; + cycles -= cycleTables[2][0x70]; temp = INPUT(lreg(BC)); Setlreg(temp, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -2695,11 +2697,11 @@ int CZ80::Run(int numCycles) parity(temp); break; case 0x71: /* OUT (C),0 */ - cycles -= cycleTables[2][0x71]; + cycles -= cycleTables[2][0x71]; OUTPUT(lreg(BC), 0); break; case 0x72: /* SBC HL,SP */ - cycles -= cycleTables[2][0x72]; + cycles -= cycleTables[2][0x72]; HL &= 0xffff; SP &= 0xffff; sum = HL - SP - TSTFLAG(C); @@ -2711,13 +2713,13 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | 2 | ((cbits >> 8) & 1); break; case 0x73: /* LD (nnnn),SP */ - cycles -= cycleTables[2][0x73]; + cycles -= cycleTables[2][0x73]; temp = GetWORD(pc); PutWORD(temp, SP); pc += 2; break; case 0x78: /* IN A,(C) */ - cycles -= cycleTables[2][0x78]; + cycles -= cycleTables[2][0x78]; temp = INPUT(lreg(BC)); Sethreg(AF, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -2741,13 +2743,13 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x7B: /* LD SP,(nnnn) */ - cycles -= cycleTables[2][0x7B]; + cycles -= cycleTables[2][0x7B]; temp = GetWORD(pc); SP = GetWORD(temp); pc += 2; break; case 0xA0: /* LDI */ - cycles -= cycleTables[2][0xA0]; + cycles -= cycleTables[2][0xA0]; acu = GetBYTE_pp(HL); PutBYTE_pp(DE, acu); acu += hreg(AF); @@ -2755,7 +2757,7 @@ int CZ80::Run(int numCycles) (((--BC & 0xffff) != 0) << 2); break; case 0xA1: /* CPI */ - cycles -= cycleTables[2][0xA1]; + cycles -= cycleTables[2][0xA1]; acu = hreg(AF); temp = GetBYTE_pp(HL); sum = acu - temp; @@ -2768,20 +2770,20 @@ int CZ80::Run(int numCycles) AF &= ~8; break; case 0xA2: /* INI */ - cycles -= cycleTables[2][0xA2]; + cycles -= cycleTables[2][0xA2]; PutBYTE(HL, INPUT(lreg(BC))); ++HL; SETFLAG(N, 1); SETFLAG(P, (--BC & 0xffff) != 0); break; case 0xA3: /* OUTI */ - cycles -= cycleTables[2][0xA3]; + cycles -= cycleTables[2][0xA3]; OUTPUT(lreg(BC), GetBYTE(HL)); ++HL; SETFLAG(N, 1); Sethreg(BC, hreg(BC) - 1); SETFLAG(Z, hreg(BC) == 0); break; case 0xA8: /* LDD */ - cycles -= cycleTables[2][0xA8]; + cycles -= cycleTables[2][0xA8]; acu = GetBYTE_mm(HL); PutBYTE_mm(DE, acu); acu += hreg(AF); @@ -2789,7 +2791,7 @@ int CZ80::Run(int numCycles) (((--BC & 0xffff) != 0) << 2); break; case 0xA9: /* CPD */ - cycles -= cycleTables[2][0xA9]; + cycles -= cycleTables[2][0xA9]; acu = hreg(AF); temp = GetBYTE_mm(HL); sum = acu - temp; @@ -2802,21 +2804,21 @@ int CZ80::Run(int numCycles) AF &= ~8; break; case 0xAA: /* IND */ - cycles -= cycleTables[2][0xAA]; + cycles -= cycleTables[2][0xAA]; PutBYTE(HL, INPUT(lreg(BC))); --HL; SETFLAG(N, 1); Sethreg(BC, lreg(BC) - 1); SETFLAG(Z, lreg(BC) == 0); break; case 0xAB: /* OUTD */ - cycles -= cycleTables[2][0xAB]; + cycles -= cycleTables[2][0xAB]; OUTPUT(lreg(BC), GetBYTE(HL)); --HL; SETFLAG(N, 1); Sethreg(BC, hreg(BC) - 1); SETFLAG(Z, hreg(BC) == 0); break; case 0xB0: /* LDIR */ - cycles -= cycleTables[2][0xB0]; + cycles -= cycleTables[2][0xB0]; acu = hreg(AF); BC &= 0xffff; do { @@ -2827,7 +2829,7 @@ int CZ80::Run(int numCycles) AF = (AF & ~0x3e) | (acu & 8) | ((acu & 2) << 4); break; case 0xB1: /* CPIR */ - cycles -= cycleTables[2][0xB1]; + cycles -= cycleTables[2][0xB1]; acu = hreg(AF); BC &= 0xffff; do { @@ -2844,7 +2846,7 @@ int CZ80::Run(int numCycles) AF &= ~8; break; case 0xB2: /* INIR */ - cycles -= cycleTables[2][0xB2]; + cycles -= cycleTables[2][0xB2]; temp = hreg(BC); do { PutBYTE(HL, INPUT(lreg(BC))); ++HL; @@ -2854,7 +2856,7 @@ int CZ80::Run(int numCycles) SETFLAG(Z, 1); break; case 0xB3: /* OTIR */ - cycles -= cycleTables[2][0xB3]; + cycles -= cycleTables[2][0xB3]; temp = hreg(BC); do { OUTPUT(lreg(BC), GetBYTE(HL)); ++HL; @@ -2864,7 +2866,7 @@ int CZ80::Run(int numCycles) SETFLAG(Z, 1); break; case 0xB8: /* LDDR */ - cycles -= cycleTables[2][0xB8]; + cycles -= cycleTables[2][0xB8]; BC &= 0xffff; do { acu = GetBYTE_mm(HL); @@ -2874,7 +2876,7 @@ int CZ80::Run(int numCycles) AF = (AF & ~0x3e) | (acu & 8) | ((acu & 2) << 4); break; case 0xB9: /* CPDR */ - cycles -= cycleTables[2][0xB9]; + cycles -= cycleTables[2][0xB9]; acu = hreg(AF); BC &= 0xffff; do { @@ -2891,7 +2893,7 @@ int CZ80::Run(int numCycles) AF &= ~8; break; case 0xBA: /* INDR */ - cycles -= cycleTables[2][0xBA]; + cycles -= cycleTables[2][0xBA]; temp = hreg(BC); do { PutBYTE(HL, INPUT(lreg(BC))); --HL; @@ -2901,7 +2903,7 @@ int CZ80::Run(int numCycles) SETFLAG(Z, 1); break; case 0xBB: /* OTDR */ - cycles -= cycleTables[2][0xBB]; + cycles -= cycleTables[2][0xBB]; temp = hreg(BC); do { OUTPUT(lreg(BC), GetBYTE(HL)); --HL; @@ -2914,72 +2916,72 @@ int CZ80::Run(int numCycles) } break; case 0xEE: /* XOR nn */ - cycles -= cycleTables[0][0xEE]; + cycles -= cycleTables[0][0xEE]; sum = ((AF >> 8) ^ GetBYTE_pp(pc)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xEF: /* RST 28H */ - cycles -= cycleTables[0][0xEF]; + cycles -= cycleTables[0][0xEF]; PUSH(pc); pc = 0x28; break; case 0xF0: /* RET P */ - cycles -= cycleTables[0][0xF0]; + cycles -= cycleTables[0][0xF0]; if (!TSTFLAG(S)) POP(pc); break; case 0xF1: /* POP AF */ - cycles -= cycleTables[0][0xF1]; + cycles -= cycleTables[0][0xF1]; POP(AF); break; case 0xF2: /* JP P,nnnn */ - cycles -= cycleTables[0][0xF2]; + cycles -= cycleTables[0][0xF2]; Jpc(!TSTFLAG(S)); break; case 0xF3: /* DI */ - cycles -= cycleTables[0][0xF3]; + cycles -= cycleTables[0][0xF3]; iff = 0; break; case 0xF4: /* CALL P,nnnn */ - cycles -= cycleTables[0][0xF4]; + cycles -= cycleTables[0][0xF4]; CALLC(!TSTFLAG(S)); break; case 0xF5: /* PUSH AF */ - cycles -= cycleTables[0][0xF5]; + cycles -= cycleTables[0][0xF5]; PUSH(AF); break; case 0xF6: /* OR nn */ - cycles -= cycleTables[0][0xF6]; + cycles -= cycleTables[0][0xF6]; sum = ((AF >> 8) | GetBYTE_pp(pc)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xF7: /* RST 30H */ - cycles -= cycleTables[0][0xF7]; + cycles -= cycleTables[0][0xF7]; PUSH(pc); pc = 0x30; break; case 0xF8: /* RET M */ - cycles -= cycleTables[0][0xF8]; + cycles -= cycleTables[0][0xF8]; if (TSTFLAG(S)) POP(pc); break; case 0xF9: /* LD SP,HL */ - cycles -= cycleTables[0][0xF9]; + cycles -= cycleTables[0][0xF9]; SP = HL; break; case 0xFA: /* JP M,nnnn */ - cycles -= cycleTables[0][0xFA]; + cycles -= cycleTables[0][0xFA]; Jpc(TSTFLAG(S)); break; case 0xFB: /* EI */ - cycles -= cycleTables[0][0xFB]; + cycles -= cycleTables[0][0xFB]; iff = 3; break; case 0xFC: /* CALL M,nnnn */ - cycles -= cycleTables[0][0xFC]; + cycles -= cycleTables[0][0xFC]; CALLC(TSTFLAG(S)); break; case 0xFD: /* FD prefix */ op = GetBYTE_pp(pc); switch (op) { case 0x09: /* ADD IY,BC */ - cycles -= cycleTables[3][0x09]; + cycles -= cycleTables[3][0x09]; IY &= 0xffff; BC &= 0xffff; sum = IY + BC; @@ -2989,7 +2991,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x19: /* ADD IY,DE */ - cycles -= cycleTables[3][0x19]; + cycles -= cycleTables[3][0x19]; IY &= 0xffff; DE &= 0xffff; sum = IY + DE; @@ -2999,22 +3001,22 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x21: /* LD IY,nnnn */ - cycles -= cycleTables[3][0x21]; + cycles -= cycleTables[3][0x21]; IY = GetWORD(pc); pc += 2; break; case 0x22: /* LD (nnnn),IY */ - cycles -= cycleTables[3][0x22]; + cycles -= cycleTables[3][0x22]; temp = GetWORD(pc); PutWORD(temp, IY); pc += 2; break; case 0x23: /* INC IY */ - cycles -= cycleTables[3][0x23]; + cycles -= cycleTables[3][0x23]; ++IY; break; case 0x24: /* INC IYH */ - cycles -= cycleTables[3][0x24]; + cycles -= cycleTables[3][0x24]; IY += 0x100; temp = hreg(IY); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -3023,7 +3025,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x25: /* DEC IYH */ - cycles -= cycleTables[3][0x25]; + cycles -= cycleTables[3][0x25]; IY -= 0x100; temp = hreg(IY); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -3032,11 +3034,11 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x26: /* LD IYH,nn */ - cycles -= cycleTables[3][0x26]; + cycles -= cycleTables[3][0x26]; Sethreg(IY, GetBYTE_pp(pc)); break; case 0x29: /* ADD IY,IY */ - cycles -= cycleTables[3][0x29]; + cycles -= cycleTables[3][0x29]; IY &= 0xffff; sum = IY + IY; cbits = (IY ^ IY ^ sum) >> 8; @@ -3045,17 +3047,17 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x2A: /* LD IY,(nnnn) */ - cycles -= cycleTables[3][0x2A]; + cycles -= cycleTables[3][0x2A]; temp = GetWORD(pc); IY = GetWORD(temp); pc += 2; break; case 0x2B: /* DEC IY */ - cycles -= cycleTables[3][0x2B]; + cycles -= cycleTables[3][0x2B]; --IY; break; case 0x2C: /* INC IYL */ - cycles -= cycleTables[3][0x2C]; + cycles -= cycleTables[3][0x2C]; temp = lreg(IY)+1; Setlreg(IY, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -3064,7 +3066,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x2D: /* DEC IYL */ - cycles -= cycleTables[3][0x2D]; + cycles -= cycleTables[3][0x2D]; temp = lreg(IY)-1; Setlreg(IY, temp); AF = (AF & ~0xfe) | (temp & 0xa8) | @@ -3073,11 +3075,11 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x2E: /* LD IYL,nn */ - cycles -= cycleTables[3][0x2E]; + cycles -= cycleTables[3][0x2E]; Setlreg(IY, GetBYTE_pp(pc)); break; case 0x34: /* INC (IY+dd) */ - cycles -= cycleTables[3][0x34]; + cycles -= cycleTables[3][0x34]; adr = IY + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr)+1; PutBYTE(adr, temp); @@ -3087,7 +3089,7 @@ int CZ80::Run(int numCycles) ((temp == 0x80) << 2); break; case 0x35: /* DEC (IY+dd) */ - cycles -= cycleTables[3][0x35]; + cycles -= cycleTables[3][0x35]; adr = IY + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr)-1; PutBYTE(adr, temp); @@ -3097,12 +3099,12 @@ int CZ80::Run(int numCycles) ((temp == 0x7f) << 2) | 2; break; case 0x36: /* LD (IY+dd),nn */ - cycles -= cycleTables[3][0x36]; + cycles -= cycleTables[3][0x36]; adr = IY + (signed char) GetBYTE_pp(pc); PutBYTE(adr, GetBYTE_pp(pc)); break; case 0x39: /* ADD IY,SP */ - cycles -= cycleTables[3][0x39]; + cycles -= cycleTables[3][0x39]; IY &= 0xffff; SP &= 0xffff; sum = IY + SP; @@ -3112,173 +3114,173 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0x44: /* LD B,IYH */ - cycles -= cycleTables[3][0x44]; + cycles -= cycleTables[3][0x44]; Sethreg(BC, hreg(IY)); break; case 0x45: /* LD B,IYL */ - cycles -= cycleTables[3][0x45]; + cycles -= cycleTables[3][0x45]; Sethreg(BC, lreg(IY)); break; case 0x46: /* LD B,(IY+dd) */ - cycles -= cycleTables[3][0x46]; + cycles -= cycleTables[3][0x46]; adr = IY + (signed char) GetBYTE_pp(pc); Sethreg(BC, GetBYTE(adr)); break; case 0x4C: /* LD C,IYH */ - cycles -= cycleTables[3][0x4C]; + cycles -= cycleTables[3][0x4C]; Setlreg(BC, hreg(IY)); break; case 0x4D: /* LD C,IYL */ - cycles -= cycleTables[3][0x4D]; + cycles -= cycleTables[3][0x4D]; Setlreg(BC, lreg(IY)); break; case 0x4E: /* LD C,(IY+dd) */ - cycles -= cycleTables[3][0x4E]; + cycles -= cycleTables[3][0x4E]; adr = IY + (signed char) GetBYTE_pp(pc); Setlreg(BC, GetBYTE(adr)); break; case 0x54: /* LD D,IYH */ - cycles -= cycleTables[3][0x54]; + cycles -= cycleTables[3][0x54]; Sethreg(DE, hreg(IY)); break; case 0x55: /* LD D,IYL */ - cycles -= cycleTables[3][0x55]; + cycles -= cycleTables[3][0x55]; Sethreg(DE, lreg(IY)); break; case 0x56: /* LD D,(IY+dd) */ - cycles -= cycleTables[3][0x56]; + cycles -= cycleTables[3][0x56]; adr = IY + (signed char) GetBYTE_pp(pc); Sethreg(DE, GetBYTE(adr)); break; case 0x5C: /* LD E,H */ - cycles -= cycleTables[3][0x5C]; + cycles -= cycleTables[3][0x5C]; Setlreg(DE, hreg(IY)); break; case 0x5D: /* LD E,L */ - cycles -= cycleTables[3][0x5D]; + cycles -= cycleTables[3][0x5D]; Setlreg(DE, lreg(IY)); break; case 0x5E: /* LD E,(IY+dd) */ - cycles -= cycleTables[3][0x5E]; + cycles -= cycleTables[3][0x5E]; adr = IY + (signed char) GetBYTE_pp(pc); Setlreg(DE, GetBYTE(adr)); break; case 0x60: /* LD IYH,B */ - cycles -= cycleTables[3][0x60]; + cycles -= cycleTables[3][0x60]; Sethreg(IY, hreg(BC)); break; case 0x61: /* LD IYH,C */ - cycles -= cycleTables[3][0x61]; + cycles -= cycleTables[3][0x61]; Sethreg(IY, lreg(BC)); break; case 0x62: /* LD IYH,D */ - cycles -= cycleTables[3][0x62]; + cycles -= cycleTables[3][0x62]; Sethreg(IY, hreg(DE)); break; case 0x63: /* LD IYH,E */ - cycles -= cycleTables[3][0x63]; + cycles -= cycleTables[3][0x63]; Sethreg(IY, lreg(DE)); break; case 0x64: /* LD IYH,IYH */ - cycles -= cycleTables[3][0x64]; + cycles -= cycleTables[3][0x64]; /* nop */ break; case 0x65: /* LD IYH,IYL */ - cycles -= cycleTables[3][0x65]; + cycles -= cycleTables[3][0x65]; Sethreg(IY, lreg(IY)); break; case 0x66: /* LD H,(IY+dd) */ - cycles -= cycleTables[3][0x66]; + cycles -= cycleTables[3][0x66]; adr = IY + (signed char) GetBYTE_pp(pc); Sethreg(HL, GetBYTE(adr)); break; case 0x67: /* LD IYH,A */ - cycles -= cycleTables[3][0x67]; + cycles -= cycleTables[3][0x67]; Sethreg(IY, hreg(AF)); break; case 0x68: /* LD IYL,B */ - cycles -= cycleTables[3][0x68]; + cycles -= cycleTables[3][0x68]; Setlreg(IY, hreg(BC)); break; case 0x69: /* LD IYL,C */ - cycles -= cycleTables[3][0x69]; + cycles -= cycleTables[3][0x69]; Setlreg(IY, lreg(BC)); break; case 0x6A: /* LD IYL,D */ - cycles -= cycleTables[3][0x6A]; + cycles -= cycleTables[3][0x6A]; Setlreg(IY, hreg(DE)); break; case 0x6B: /* LD IYL,E */ - cycles -= cycleTables[3][0x6B]; + cycles -= cycleTables[3][0x6B]; Setlreg(IY, lreg(DE)); break; case 0x6C: /* LD IYL,IYH */ - cycles -= cycleTables[3][0x6C]; + cycles -= cycleTables[3][0x6C]; Setlreg(IY, hreg(IY)); break; case 0x6D: /* LD IYL,IYL */ - cycles -= cycleTables[3][0x6D]; + cycles -= cycleTables[3][0x6D]; /* nop */ break; case 0x6E: /* LD L,(IY+dd) */ - cycles -= cycleTables[3][0x6E]; + cycles -= cycleTables[3][0x6E]; adr = IY + (signed char) GetBYTE_pp(pc); Setlreg(HL, GetBYTE(adr)); break; case 0x6F: /* LD IYL,A */ - cycles -= cycleTables[3][0x6F]; + cycles -= cycleTables[3][0x6F]; Setlreg(IY, hreg(AF)); break; case 0x70: /* LD (IY+dd),B */ - cycles -= cycleTables[3][0x70]; + cycles -= cycleTables[3][0x70]; adr = IY + (signed char) GetBYTE_pp(pc); PutBYTE(adr, hreg(BC)); break; case 0x71: /* LD (IY+dd),C */ - cycles -= cycleTables[3][0x71]; + cycles -= cycleTables[3][0x71]; adr = IY + (signed char) GetBYTE_pp(pc); PutBYTE(adr, lreg(BC)); break; case 0x72: /* LD (IY+dd),D */ - cycles -= cycleTables[3][0x72]; + cycles -= cycleTables[3][0x72]; adr = IY + (signed char) GetBYTE_pp(pc); PutBYTE(adr, hreg(DE)); break; case 0x73: /* LD (IY+dd),E */ - cycles -= cycleTables[3][0x73]; + cycles -= cycleTables[3][0x73]; adr = IY + (signed char) GetBYTE_pp(pc); PutBYTE(adr, lreg(DE)); break; case 0x74: /* LD (IY+dd),H */ - cycles -= cycleTables[3][0x74]; + cycles -= cycleTables[3][0x74]; adr = IY + (signed char) GetBYTE_pp(pc); PutBYTE(adr, hreg(HL)); break; case 0x75: /* LD (IY+dd),L */ - cycles -= cycleTables[3][0x75]; + cycles -= cycleTables[3][0x75]; adr = IY + (signed char) GetBYTE_pp(pc); PutBYTE(adr, lreg(HL)); break; case 0x77: /* LD (IY+dd),A */ - cycles -= cycleTables[3][0x77]; + cycles -= cycleTables[3][0x77]; adr = IY + (signed char) GetBYTE_pp(pc); PutBYTE(adr, hreg(AF)); break; case 0x7C: /* LD A,IYH */ - cycles -= cycleTables[3][0x7C]; + cycles -= cycleTables[3][0x7C]; Sethreg(AF, hreg(IY)); break; case 0x7D: /* LD A,IYL */ - cycles -= cycleTables[3][0x7D]; + cycles -= cycleTables[3][0x7D]; Sethreg(AF, lreg(IY)); break; case 0x7E: /* LD A,(IY+dd) */ - cycles -= cycleTables[3][0x7E]; + cycles -= cycleTables[3][0x7E]; adr = IY + (signed char) GetBYTE_pp(pc); Sethreg(AF, GetBYTE(adr)); break; case 0x84: /* ADD A,IYH */ - cycles -= cycleTables[3][0x84]; + cycles -= cycleTables[3][0x84]; temp = hreg(IY); acu = hreg(AF); sum = acu + temp; @@ -3289,7 +3291,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x85: /* ADD A,IYL */ - cycles -= cycleTables[3][0x85]; + cycles -= cycleTables[3][0x85]; temp = lreg(IY); acu = hreg(AF); sum = acu + temp; @@ -3300,7 +3302,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x86: /* ADD A,(IY+dd) */ - cycles -= cycleTables[3][0x86]; + cycles -= cycleTables[3][0x86]; adr = IY + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); acu = hreg(AF); @@ -3312,7 +3314,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8C: /* ADC A,IYH */ - cycles -= cycleTables[3][0x8C]; + cycles -= cycleTables[3][0x8C]; temp = hreg(IY); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -3323,7 +3325,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8D: /* ADC A,IYL */ - cycles -= cycleTables[3][0x8D]; + cycles -= cycleTables[3][0x8D]; temp = lreg(IY); acu = hreg(AF); sum = acu + temp + TSTFLAG(C); @@ -3334,7 +3336,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x8E: /* ADC A,(IY+dd) */ - cycles -= cycleTables[3][0x8E]; + cycles -= cycleTables[3][0x8E]; adr = IY + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); acu = hreg(AF); @@ -3346,7 +3348,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x94: /* SUB IYH */ - cycles -= cycleTables[3][0x94]; + cycles -= cycleTables[3][0x94]; temp = hreg(IY); acu = hreg(AF); sum = acu - temp; @@ -3357,7 +3359,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x95: /* SUB IYL */ - cycles -= cycleTables[3][0x95]; + cycles -= cycleTables[3][0x95]; temp = lreg(IY); acu = hreg(AF); sum = acu - temp; @@ -3368,7 +3370,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x96: /* SUB (IY+dd) */ - cycles -= cycleTables[3][0x96]; + cycles -= cycleTables[3][0x96]; adr = IY + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); acu = hreg(AF); @@ -3380,7 +3382,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9C: /* SBC A,IYH */ - cycles -= cycleTables[3][0x9C]; + cycles -= cycleTables[3][0x9C]; temp = hreg(IY); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -3391,7 +3393,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9D: /* SBC A,IYL */ - cycles -= cycleTables[3][0x9D]; + cycles -= cycleTables[3][0x9D]; temp = lreg(IY); acu = hreg(AF); sum = acu - temp - TSTFLAG(C); @@ -3402,7 +3404,7 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0x9E: /* SBC A,(IY+dd) */ - cycles -= cycleTables[3][0x9E]; + cycles -= cycleTables[3][0x9E]; adr = IY + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); acu = hreg(AF); @@ -3414,58 +3416,58 @@ int CZ80::Run(int numCycles) ((cbits >> 8) & 1); break; case 0xA4: /* AND IYH */ - cycles -= cycleTables[3][0xA4]; + cycles -= cycleTables[3][0xA4]; sum = ((AF & (IY)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | 0x10 | partab[sum]; break; case 0xA5: /* AND IYL */ - cycles -= cycleTables[3][0xA5]; + cycles -= cycleTables[3][0xA5]; sum = ((AF >> 8) & IY) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xA6: /* AND (IY+dd) */ - cycles -= cycleTables[3][0xA6]; + cycles -= cycleTables[3][0xA6]; adr = IY + (signed char) GetBYTE_pp(pc); sum = ((AF >> 8) & GetBYTE(adr)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | 0x10 | ((sum == 0) << 6) | partab[sum]; break; case 0xAC: /* XOR IYH */ - cycles -= cycleTables[3][0xAC]; + cycles -= cycleTables[3][0xAC]; sum = ((AF ^ (IY)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAD: /* XOR IYL */ - cycles -= cycleTables[3][0xAD]; + cycles -= cycleTables[3][0xAD]; sum = ((AF >> 8) ^ IY) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xAE: /* XOR (IY+dd) */ - cycles -= cycleTables[3][0xAE]; + cycles -= cycleTables[3][0xAE]; adr = IY + (signed char) GetBYTE_pp(pc); sum = ((AF >> 8) ^ GetBYTE(adr)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB4: /* OR IYH */ - cycles -= cycleTables[3][0xB4]; + cycles -= cycleTables[3][0xB4]; sum = ((AF | (IY)) >> 8) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB5: /* OR IYL */ - cycles -= cycleTables[3][0xB5]; + cycles -= cycleTables[3][0xB5]; sum = ((AF >> 8) | IY) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xB6: /* OR (IY+dd) */ - cycles -= cycleTables[3][0xB6]; + cycles -= cycleTables[3][0xB6]; adr = IY + (signed char) GetBYTE_pp(pc); sum = ((AF >> 8) | GetBYTE(adr)) & 0xff; AF = (sum << 8) | (sum & 0xa8) | ((sum == 0) << 6) | partab[sum]; break; case 0xBC: /* CP IYH */ - cycles -= cycleTables[3][0xBC]; + cycles -= cycleTables[3][0xBC]; temp = hreg(IY); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -3477,7 +3479,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBD: /* CP IYL */ - cycles -= cycleTables[3][0xBD]; + cycles -= cycleTables[3][0xBD]; temp = lreg(IY); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -3489,7 +3491,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xBE: /* CP (IY+dd) */ - cycles -= cycleTables[3][0xBE]; + cycles -= cycleTables[3][0xBE]; adr = IY + (signed char) GetBYTE_pp(pc); temp = GetBYTE(adr); AF = (AF & ~0x28) | (temp & 0x28); @@ -3505,7 +3507,7 @@ int CZ80::Run(int numCycles) adr = IY + (signed char) GetBYTE_pp(pc); adr = adr; op = GetBYTE(pc); - cycles -= cycleTables[4][op]; + cycles -= cycleTables[4][op]; switch (op & 7) { case 0: ++pc; acu = hreg(BC); break; case 1: ++pc; acu = lreg(BC); break; @@ -3585,30 +3587,30 @@ int CZ80::Run(int numCycles) } break; case 0xE1: /* POP IY */ - cycles -= cycleTables[3][0xE1]; + cycles -= cycleTables[3][0xE1]; POP(IY); break; case 0xE3: /* EX (SP),IY */ - cycles -= cycleTables[3][0xE3]; + cycles -= cycleTables[3][0xE3]; temp = IY; POP(IY); PUSH(temp); break; case 0xE5: /* PUSH IY */ - cycles -= cycleTables[3][0xE5]; + cycles -= cycleTables[3][0xE5]; PUSH(IY); break; case 0xE9: /* JP (IY) */ - cycles -= cycleTables[3][0xE9]; + cycles -= cycleTables[3][0xE9]; pc = IY; break; case 0xF9: /* LD SP,IY */ - cycles -= cycleTables[3][0xF9]; + cycles -= cycleTables[3][0xF9]; SP = IY; break; default: pc--; /* ignore DD */ } break; case 0xFE: /* CP nn */ - cycles -= cycleTables[0][0xFE]; + cycles -= cycleTables[0][0xFE]; temp = GetBYTE_pp(pc); AF = (AF & ~0x28) | (temp & 0x28); acu = hreg(AF); @@ -3620,7 +3622,7 @@ int CZ80::Run(int numCycles) (cbits & 0x10) | ((cbits >> 8) & 1); break; case 0xFF: /* RST 38H */ - cycles -= cycleTables[0][0xFF]; + cycles -= cycleTables[0][0xFF]; PUSH(pc); pc = 0x38; break; } diff --git a/Src/Debugger/CPU/Z80Debug.h b/Src/Debugger/CPU/Z80Debug.h index be85edc..c0a6e68 100755 --- a/Src/Debugger/CPU/Z80Debug.h +++ b/Src/Debugger/CPU/Z80Debug.h @@ -19,8 +19,8 @@ ** with Supermodel. If not, see . **/ -/* - * Z80KDebug.h +/* + * Z80KDebug.h */ #ifdef SUPERMODEL_DEBUGGER diff --git a/Src/Debugger/Exception.cpp b/Src/Debugger/Exception.cpp index da03112..485db4c 100644 --- a/Src/Debugger/Exception.cpp +++ b/Src/Debugger/Exception.cpp @@ -19,8 +19,8 @@ ** with Supermodel. If not, see . **/ -/* - * Exception.cpp +/* + * Exception.cpp */ #ifdef SUPERMODEL_DEBUGGER diff --git a/Src/Debugger/SupermodelDebugger.cpp b/Src/Debugger/SupermodelDebugger.cpp index 050fad4..f802f55 100644 --- a/Src/Debugger/SupermodelDebugger.cpp +++ b/Src/Debugger/SupermodelDebugger.cpp @@ -25,14 +25,23 @@ #ifdef SUPERMODEL_DEBUGGER -#include "Supermodel.h" +#include "SupermodelDebugger.h" +#include "Supermodel.h" +#include "BlockFile.h" #include "ConsoleDebugger.h" #include "CPUDebug.h" #include "Label.h" #ifdef NET_BOARD #include "Network/NetBoard.h" #endif // NET_BOARD +#include "CPU/Musashi68KDebug.h" +#include "CPU/PPCDebug.h" +#include "CPU/Z80Debug.h" +#include "Inputs/Input.h" +#include "Inputs/InputSystem.h" +#include "Model3/SoundBoard.h" +#include "OSD/Audio.h" #include #include diff --git a/Src/Debugger/SupermodelDebugger.h b/Src/Debugger/SupermodelDebugger.h index 2f3b194..7100dcd 100644 --- a/Src/Debugger/SupermodelDebugger.h +++ b/Src/Debugger/SupermodelDebugger.h @@ -28,12 +28,12 @@ #define INCLUDED_SUPERMODELDEBUGGER_H #include "ConsoleDebugger.h" +#include "Model3/Model3.h" #include #define MODEL3_STATEFILE_VERSION 0 -class CModel3; class CInputs; class CInput; diff --git a/Src/Graphics/Legacy3D/Error.cpp b/Src/Graphics/Legacy3D/Error.cpp index 2e5e04e..3749908 100644 --- a/Src/Graphics/Legacy3D/Error.cpp +++ b/Src/Graphics/Legacy3D/Error.cpp @@ -32,6 +32,7 @@ */ #include "Supermodel.h" +#include "Legacy3D.h" namespace Legacy3D { diff --git a/Src/Graphics/Legacy3D/Legacy3D.cpp b/Src/Graphics/Legacy3D/Legacy3D.cpp index 8fa7828..5f39022 100644 --- a/Src/Graphics/Legacy3D/Legacy3D.cpp +++ b/Src/Graphics/Legacy3D/Legacy3D.cpp @@ -156,8 +156,12 @@ * - Can some of the floating point flag attribs be replaced with ints? */ +#include "Legacy3D.h" + #include "Supermodel.h" -#include "Graphics/Legacy3D/Shaders3D.h" // fragment and vertex shaders +#include "Shaders3D.h" // fragment and vertex shaders +#include "Graphics/Shader.h" + #include #include #include @@ -1298,21 +1302,21 @@ bool CLegacy3D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned } void CLegacy3D::SetSunClamp(bool enable) -{ -} - -void CLegacy3D::SetSignedShade(bool enable) -{ +{ +} + +void CLegacy3D::SetSignedShade(bool enable) +{ } float CLegacy3D::GetLosValue(int layer) { return 0.0f; -} - -CLegacy3D::CLegacy3D(const Util::Config::Node &config) - : m_config(config) -{ +} + +CLegacy3D::CLegacy3D(const Util::Config::Node &config) + : m_config(config) +{ cullingRAMLo = NULL; cullingRAMHi = NULL; polyRAM = NULL; diff --git a/Src/Graphics/Legacy3D/Legacy3D.h b/Src/Graphics/Legacy3D/Legacy3D.h index 8076124..d4b1040 100644 --- a/Src/Graphics/Legacy3D/Legacy3D.h +++ b/Src/Graphics/Legacy3D/Legacy3D.h @@ -29,9 +29,11 @@ #ifndef INCLUDED_LEGACY3D_H #define INCLUDED_LEGACY3D_H +#include "TextureRefs.h" #include "Graphics/IRender3D.h" #include #include "Util/NewConfig.h" +#include "Types.h" namespace Legacy3D { @@ -334,20 +336,20 @@ public: * Sets or unsets the clamped light model * * Parameters: - * enable Set clamp mode - */ - void SetSunClamp(bool enable); - - /* - * SetSignedShade(bool enable); - * - * Sets the sign-ness of fixed shading value - * - * Parameters: - * enable Fixed shading is expressed as signed value - */ - void SetSignedShade(bool enable); - + * enable Set clamp mode + */ + void SetSunClamp(bool enable); + + /* + * SetSignedShade(bool enable); + * + * Sets the sign-ness of fixed shading value + * + * Parameters: + * enable Fixed shading is expressed as signed value + */ + void SetSignedShade(bool enable); + /* * GetLosValue(int layer); * @@ -356,11 +358,11 @@ public: * Parameters: * layer Priority layer to read from */ - float GetLosValue(int layer); - - /* - * CLegacy3D(void): - * ~CLegacy3D(void): + float GetLosValue(int layer); + + /* + * CLegacy3D(void): + * ~CLegacy3D(void): * * Parameters: * config Configuration object. diff --git a/Src/Graphics/Legacy3D/Models.cpp b/Src/Graphics/Legacy3D/Models.cpp index 16521a7..f86db71 100644 --- a/Src/Graphics/Legacy3D/Models.cpp +++ b/Src/Graphics/Legacy3D/Models.cpp @@ -106,6 +106,7 @@ #include #include #include "Supermodel.h" +#include "Legacy3D.h" #ifdef DEBUG extern int g_testPolyHeaderIdx; diff --git a/Src/Graphics/Legacy3D/TextureRefs.cpp b/Src/Graphics/Legacy3D/TextureRefs.cpp index a5e96bd..67217b0 100644 --- a/Src/Graphics/Legacy3D/TextureRefs.cpp +++ b/Src/Graphics/Legacy3D/TextureRefs.cpp @@ -30,7 +30,10 @@ * to using a hashset to store the texture references, but this requires extra memory allocation. */ +#include "TextureRefs.h" + #include "Supermodel.h" +#include "Legacy3D.h" namespace Legacy3D { diff --git a/Src/Graphics/Legacy3D/TextureRefs.h b/Src/Graphics/Legacy3D/TextureRefs.h index 13e08f3..3146dfa 100644 --- a/Src/Graphics/Legacy3D/TextureRefs.h +++ b/Src/Graphics/Legacy3D/TextureRefs.h @@ -28,6 +28,8 @@ #ifndef INCLUDED_TEXTUREREFS_H #define INCLUDED_TEXTUREREFS_H + + namespace Legacy3D { #define TEXREFS_ARRAY_SIZE 12 @@ -38,7 +40,7 @@ struct HashEntry const unsigned texRef; // Texture reference as a bitfield HashEntry *nextEntry; // Next entry with the same hash - HashEntry(unsigned theTexRef) : texRef(theTexRef), nextEntry(NULL) { } + HashEntry(unsigned theTexRef) : texRef(theTexRef), nextEntry(nullptr) { } }; class CLegacy3D; diff --git a/Src/Graphics/New3D/PolyHeader.cpp b/Src/Graphics/New3D/PolyHeader.cpp index 12dfae0..f8322d7 100644 --- a/Src/Graphics/New3D/PolyHeader.cpp +++ b/Src/Graphics/New3D/PolyHeader.cpp @@ -5,7 +5,7 @@ namespace New3D { PolyHeader::PolyHeader() { - header = NULL; + header = nullptr; } PolyHeader::PolyHeader(UINT32* h) diff --git a/Src/Graphics/New3D/PolyHeader.h b/Src/Graphics/New3D/PolyHeader.h index a285aa3..dbc0a92 100644 --- a/Src/Graphics/New3D/PolyHeader.h +++ b/Src/Graphics/New3D/PolyHeader.h @@ -1,6 +1,8 @@ #ifndef _POLY_HEADER_H_ #define _POLY_HEADER_H_ +#include "Types.h" + namespace New3D { /* diff --git a/Src/Graphics/Render2D.cpp b/Src/Graphics/Render2D.cpp index e896cf8..4278350 100644 --- a/Src/Graphics/Render2D.cpp +++ b/Src/Graphics/Render2D.cpp @@ -274,10 +274,14 @@ * -- one for A/A' and another for B/B'. These are passed to the renderer. */ +#include "Render2D.h" + +#include "Supermodel.h" +#include "Shader.h" +#include "Shaders2D.h" // fragment and vertex shaders + #include #include -#include "Supermodel.h" -#include "Graphics/Shaders2D.h" // fragment and vertex shaders /****************************************************************************** diff --git a/Src/Graphics/Shader.cpp b/Src/Graphics/Shader.cpp index a5e8c00..3379498 100644 --- a/Src/Graphics/Shader.cpp +++ b/Src/Graphics/Shader.cpp @@ -25,18 +25,18 @@ * OpenGL shader management. * * To-Do List - * ---------- - * - Mesa crashes because, evidently, the function pointers are invalid. Mesa - * returns the following information: - * Vendor: Mesa project: www.mesa3d.org - * Renderer: Mesa GLX Indirect - * Version: 1.2 (1.5 Mesa 6.5.1) - * Shading Language Version: (null) - * Maximum Vertex Array Size: -1 vertices - * Maximum Texture Size: 2048 texels - * Maximum Vertex Attributes: 16 - * Maximum Vertex Uniforms: 16 - * - Check for OpenGL 2.0 and perhaps check some of the function pointers, + * ---------- + * - Mesa crashes because, evidently, the function pointers are invalid. Mesa + * returns the following information: + * Vendor: Mesa project: www.mesa3d.org + * Renderer: Mesa GLX Indirect + * Version: 1.2 (1.5 Mesa 6.5.1) + * Shading Language Version: (null) + * Maximum Vertex Array Size: -1 vertices + * Maximum Texture Size: 2048 texels + * Maximum Vertex Attributes: 16 + * Maximum Vertex Uniforms: 16 + * - Check for OpenGL 2.0 and perhaps check some of the function pointers, * which will be NULL, if GL 2.0 and shaders are not supported. * - Keep in mind that all these checks should probably go somewhere else... * - Turn this into a class. @@ -89,7 +89,7 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint GLuint shaderProgram, vertexShader, fragmentShader; GLint result, len; bool ret = OKAY; - + // Load shaders from files if specified if (!vsFile.empty()) vsSource = LoadShaderSource(vsFile.c_str()); @@ -103,14 +103,14 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint { ret = FAIL; goto Quit; - } - - // Ensure that shader support exists - if ((glCreateProgram==NULL) || (glCreateShader==NULL) || (glShaderSource==NULL) || (glCompileShader==NULL)) - { - ret = FAIL; - ErrorLog("OpenGL 2.x does not appear to be present. Unable to proceed."); - goto Quit; + } + + // Ensure that shader support exists + if ((glCreateProgram==NULL) || (glCreateShader==NULL) || (glShaderSource==NULL) || (glCompileShader==NULL)) + { + ret = FAIL; + ErrorLog("OpenGL 2.x does not appear to be present. Unable to proceed."); + goto Quit; } // Create the shaders and shader program @@ -169,10 +169,10 @@ Quit: } void DestroyShaderProgram(GLuint shaderProgram, GLuint vertexShader, GLuint fragmentShader) -{ - // In case LoadShaderProgram() failed above due to lack of OpenGL 2.0+ functions... - if ((glUseProgram==NULL) || (glDeleteShader==NULL) || (glDeleteProgram==NULL)) - return; +{ + // In case LoadShaderProgram() failed above due to lack of OpenGL 2.0+ functions... + if ((glUseProgram==NULL) || (glDeleteShader==NULL) || (glDeleteProgram==NULL)) + return; glUseProgram(0); // return to fixed function pipeline glDeleteShader(vertexShader); diff --git a/Src/Inputs/Input.cpp b/Src/Inputs/Input.cpp index 86bb828..e9f9466 100644 --- a/Src/Inputs/Input.cpp +++ b/Src/Inputs/Input.cpp @@ -26,7 +26,10 @@ * from this. */ +#include "Input.h" + #include "Supermodel.h" +#include "InputSystem.h" CInput::CInput(const char *inputId, const char *inputLabel, unsigned inputFlags, unsigned inputGameFlags, const char *defaultMapping, UINT16 initValue) : id(inputId), label(inputLabel), flags(inputFlags), gameFlags(inputGameFlags), m_defaultMapping(defaultMapping), value(initValue), prevValue(initValue), diff --git a/Src/Inputs/Input.h b/Src/Inputs/Input.h index b9de4ef..4f0b7af 100644 --- a/Src/Inputs/Input.h +++ b/Src/Inputs/Input.h @@ -29,11 +29,11 @@ #ifndef INCLUDED_INPUT_H #define INCLUDED_INPUT_H +#include "InputSource.h" #include "Types.h" #include "Game.h" #include "Util/NewConfig.h" -class CInputSource; class CInputSystem; // Flags for inputs diff --git a/Src/Inputs/InputSource.cpp b/Src/Inputs/InputSource.cpp index f761cbe..94f004b 100644 --- a/Src/Inputs/InputSource.cpp +++ b/Src/Inputs/InputSource.cpp @@ -27,7 +27,10 @@ * values for analog inputs. */ +#include "InputSource.h" + #include "Supermodel.h" +#include "Input.h" #include using namespace std; diff --git a/Src/Inputs/InputSystem.cpp b/Src/Inputs/InputSystem.cpp index 4c2ba68..c740ff2 100644 --- a/Src/Inputs/InputSystem.cpp +++ b/Src/Inputs/InputSystem.cpp @@ -32,7 +32,11 @@ // - open up API to allow direct access to keyboard, mouse and joystick values // - add GetKey method that is easier to use than reading keyboard with ReadMapping +#include "InputSystem.h" + #include "Supermodel.h" +#include "Input.h" +#include "OSD/Thread.h" #include #include @@ -1993,7 +1997,7 @@ Repeat: unsigned posDeadZone; unsigned negDeadZone; unsigned deadZone; - + int posVal = 0; int negVal = 0; int offVal = 0; @@ -2514,4 +2518,4 @@ bool CInputSystem::CJoyButInputSource::GetValueAsAnalog(int &val, int minVal, in return false; val = maxVal; return true; -} +} diff --git a/Src/Inputs/InputTypes.cpp b/Src/Inputs/InputTypes.cpp index c8d8b24..3ad9282 100644 --- a/Src/Inputs/InputTypes.cpp +++ b/Src/Inputs/InputTypes.cpp @@ -26,6 +26,8 @@ * all very simple classes. */ +#include "InputTypes.h" + #include "Supermodel.h" /* diff --git a/Src/Inputs/Inputs.cpp b/Src/Inputs/Inputs.cpp index 4aece0f..e944891 100644 --- a/Src/Inputs/Inputs.cpp +++ b/Src/Inputs/Inputs.cpp @@ -27,7 +27,11 @@ * maintains all individual inputs. */ +#include "Inputs.h" + #include "Supermodel.h" +#include "InputSystem.h" +#include "InputTypes.h" #include "Game.h" #include #include diff --git a/Src/Inputs/Inputs.h b/Src/Inputs/Inputs.h index 45abfe7..0320ac3 100644 --- a/Src/Inputs/Inputs.h +++ b/Src/Inputs/Inputs.h @@ -28,17 +28,13 @@ #ifndef INCLUDED_INPUTS_H #define INCLUDED_INPUTS_H +#include "InputTypes.h" #include "Types.h" #include "Util/NewConfig.h" #include class CInputSystem; class CInput; -class CAnalogInput; -class CAxisInput; -class CSwitchInput; -class CGearShift4Input; -class CTriggerInput; struct Game; /* diff --git a/Src/Inputs/MultiInputSource.cpp b/Src/Inputs/MultiInputSource.cpp index 363731d..e456a3d 100644 --- a/Src/Inputs/MultiInputSource.cpp +++ b/Src/Inputs/MultiInputSource.cpp @@ -25,7 +25,10 @@ * Implementation of CMultiInputSource. */ +#include "MultiInputSource.h" + #include "Supermodel.h" +#include "Input.h" #include using namespace std; diff --git a/Src/Model3/53C810.cpp b/Src/Model3/53C810.cpp index 89d995b..1fa34bb 100644 --- a/Src/Model3/53C810.cpp +++ b/Src/Model3/53C810.cpp @@ -43,9 +43,11 @@ * */ +#include "53C810.h" + #include #include "Supermodel.h" - +#include "CPU/PowerPC/ppc.h" /****************************************************************************** Save States diff --git a/Src/Model3/53C810.h b/Src/Model3/53C810.h index f8f71e3..44c245b 100644 --- a/Src/Model3/53C810.h +++ b/Src/Model3/53C810.h @@ -28,6 +28,10 @@ #ifndef INCLUDED_53C810_H #define INCLUDED_53C810_H +#include "IRQ.h" +#include "PCI.h" +#include "BlockFile.h" +#include "CPU/Bus.h" /* * struct NCR53C810Context: diff --git a/Src/Model3/93C46.cpp b/Src/Model3/93C46.cpp index dc966ba..160af3c 100644 --- a/Src/Model3/93C46.cpp +++ b/Src/Model3/93C46.cpp @@ -31,6 +31,8 @@ * should just be set to 0? */ +#include "93C46.h" + #include #include "Supermodel.h" diff --git a/Src/Model3/93C46.h b/Src/Model3/93C46.h index f53747f..a6e2c3a 100644 --- a/Src/Model3/93C46.h +++ b/Src/Model3/93C46.h @@ -28,6 +28,8 @@ #ifndef INCLUDED_93C46_H #define INCLUDED_93C46_H +#include "BlockFile.h" +#include "Types.h" /* * C93C46: diff --git a/Src/Model3/DSB.cpp b/Src/Model3/DSB.cpp index 54c38b1..36a84d5 100644 --- a/Src/Model3/DSB.cpp +++ b/Src/Model3/DSB.cpp @@ -37,6 +37,8 @@ * - Should we do some bounds checking on the MPEG start/end points? */ +#include "DSB.h" + #include "Supermodel.h" #include "Sound/MPEG/MpegAudio.h" #include diff --git a/Src/Model3/DSB.h b/Src/Model3/DSB.h index 59e3442..6fc391c 100644 --- a/Src/Model3/DSB.h +++ b/Src/Model3/DSB.h @@ -34,6 +34,8 @@ #include "Types.h" #include "CPU/Bus.h" +#include "CPU/68K/68K.h" +#include "CPU/Z80/Z80.h" #include "Util/NewConfig.h" diff --git a/Src/Model3/DriveBoard/BillBoard.cpp b/Src/Model3/DriveBoard/BillBoard.cpp index 7e9708c..b310837 100644 --- a/Src/Model3/DriveBoard/BillBoard.cpp +++ b/Src/Model3/DriveBoard/BillBoard.cpp @@ -57,6 +57,8 @@ ** **/ +#include "BillBoard.h" + #include "Supermodel.h" #include diff --git a/Src/Model3/DriveBoard/BillBoard.h b/Src/Model3/DriveBoard/BillBoard.h index 018cd41..5ab40ea 100644 --- a/Src/Model3/DriveBoard/BillBoard.h +++ b/Src/Model3/DriveBoard/BillBoard.h @@ -29,6 +29,7 @@ #ifndef INCLUDED_BILLBOARD_H #define INCLUDED_BILLBOARD_H +#include "DriveBoard.h" #include "Util/NewConfig.h" /* diff --git a/Src/Model3/DriveBoard/DriveBoard.cpp b/Src/Model3/DriveBoard/DriveBoard.cpp index e896dfd..c889bdf 100644 --- a/Src/Model3/DriveBoard/DriveBoard.cpp +++ b/Src/Model3/DriveBoard/DriveBoard.cpp @@ -52,6 +52,8 @@ * CDriveBoard::Disable() to update the disabled flag. */ +#include "DriveBoard.h" + #include "Supermodel.h" #include diff --git a/Src/Model3/DriveBoard/DriveBoard.h b/Src/Model3/DriveBoard/DriveBoard.h index 2d5cb3f..9df8f4e 100644 --- a/Src/Model3/DriveBoard/DriveBoard.h +++ b/Src/Model3/DriveBoard/DriveBoard.h @@ -30,6 +30,10 @@ #ifndef INCLUDED_DRIVEBOARD_H #define INCLUDED_DRIVEBOARD_H +#include "CPU/Bus.h" +#include "CPU/Z80/Z80.h" +#include "Inputs/Inputs.h" +#include "OSD/Outputs.h" #include "Util/NewConfig.h" #include "Game.h" diff --git a/Src/Model3/DriveBoard/JoystickBoard.cpp b/Src/Model3/DriveBoard/JoystickBoard.cpp index a51c6c1..570ab42 100644 --- a/Src/Model3/DriveBoard/JoystickBoard.cpp +++ b/Src/Model3/DriveBoard/JoystickBoard.cpp @@ -33,6 +33,8 @@ * NOTE: Simulation does not yet work. Drive board ROMs are required. */ +#include "JoystickBoard.h" + #include "Supermodel.h" #include diff --git a/Src/Model3/DriveBoard/JoystickBoard.h b/Src/Model3/DriveBoard/JoystickBoard.h index 8ab842b..3cf9000 100644 --- a/Src/Model3/DriveBoard/JoystickBoard.h +++ b/Src/Model3/DriveBoard/JoystickBoard.h @@ -29,6 +29,7 @@ #ifndef INCLUDED_JOYBOARD_H #define INCLUDED_JOYBOARD_H +#include "DriveBoard.h" #include "Util/NewConfig.h" #include "Game.h" diff --git a/Src/Model3/DriveBoard/SkiBoard.cpp b/Src/Model3/DriveBoard/SkiBoard.cpp index 4cf45a3..ec373cb 100644 --- a/Src/Model3/DriveBoard/SkiBoard.cpp +++ b/Src/Model3/DriveBoard/SkiBoard.cpp @@ -29,7 +29,10 @@ * NOTE: Simulation does not yet work. Drive board ROMs are required. */ +#include "SkiBoard.h" + #include "Supermodel.h" +#include "Inputs/Input.h" #include #include diff --git a/Src/Model3/DriveBoard/SkiBoard.h b/Src/Model3/DriveBoard/SkiBoard.h index 2f1cd68..774d9c5 100644 --- a/Src/Model3/DriveBoard/SkiBoard.h +++ b/Src/Model3/DriveBoard/SkiBoard.h @@ -29,6 +29,7 @@ #ifndef INCLUDED_SKIBOARD_H #define INCLUDED_SKIBOARD_H +#include "DriveBoard.h" #include "Util/NewConfig.h" #include "Game.h" diff --git a/Src/Model3/DriveBoard/WheelBoard.cpp b/Src/Model3/DriveBoard/WheelBoard.cpp index 28139b3..2e17b4a 100644 --- a/Src/Model3/DriveBoard/WheelBoard.cpp +++ b/Src/Model3/DriveBoard/WheelBoard.cpp @@ -29,8 +29,9 @@ * NOTE: Simulation does not yet work. Drive board ROMs are required. */ -#include "Supermodel.h" +#include "WheelBoard.h" +#include "Supermodel.h" #include #include #include diff --git a/Src/Model3/DriveBoard/WheelBoard.h b/Src/Model3/DriveBoard/WheelBoard.h index fddd1a3..b2a8bed 100644 --- a/Src/Model3/DriveBoard/WheelBoard.h +++ b/Src/Model3/DriveBoard/WheelBoard.h @@ -29,6 +29,7 @@ #ifndef INCLUDED_WHEELBOARD_H #define INCLUDED_WHEELBOARD_H +#include "DriveBoard.h" #include "Util/NewConfig.h" #include "Game.h" diff --git a/Src/Model3/IRQ.cpp b/Src/Model3/IRQ.cpp index cc55218..27a288e 100644 --- a/Src/Model3/IRQ.cpp +++ b/Src/Model3/IRQ.cpp @@ -31,7 +31,10 @@ * call the PPC core directly, which should not happen in proper OO code. */ +#include "IRQ.h" + #include "Supermodel.h" +#include "CPU/PowerPC/ppc.h" /****************************************************************************** diff --git a/Src/Model3/IRQ.h b/Src/Model3/IRQ.h index acc93bf..c37bc5a 100644 --- a/Src/Model3/IRQ.h +++ b/Src/Model3/IRQ.h @@ -28,6 +28,8 @@ #ifndef INCLUDED_IRQ_H #define INCLUDED_IRQ_H +#include "BlockFile.h" +#include "Types.h" /* * CIRQ: diff --git a/Src/Model3/JTAG.cpp b/Src/Model3/JTAG.cpp index c2e6ae5..ed5bd8e 100644 --- a/Src/Model3/JTAG.cpp +++ b/Src/Model3/JTAG.cpp @@ -30,8 +30,11 @@ * probably doesn't matter), so we assume IEEE 1149.1-1990 here. */ +#include "JTAG.h" + #include "Supermodel.h" -#include "Model3/JTAG.h" +#include "Real3D.h" + #include // Finite state machine. Each state has two possible next states. diff --git a/Src/Model3/JTAG.h b/Src/Model3/JTAG.h index 99bb636..1d03fe1 100644 --- a/Src/Model3/JTAG.h +++ b/Src/Model3/JTAG.h @@ -28,6 +28,7 @@ #ifndef INCLUDED_JTAG_H #define INCLUDED_JTAG_H +#include "BlockFile.h" #include "Util/BitRegister.h" class CReal3D; diff --git a/Src/Model3/MPC10x.cpp b/Src/Model3/MPC10x.cpp index 102bf02..9f24a3a 100644 --- a/Src/Model3/MPC10x.cpp +++ b/Src/Model3/MPC10x.cpp @@ -66,6 +66,8 @@ * endian, pushing the responsibility onto the caller. */ +#include "MPC10x.h" + #include #include "Supermodel.h" diff --git a/Src/Model3/MPC10x.h b/Src/Model3/MPC10x.h index 526a1ea..84dad4f 100644 --- a/Src/Model3/MPC10x.h +++ b/Src/Model3/MPC10x.h @@ -28,6 +28,8 @@ #ifndef INCLUDED_MPC10X_H #define INCLUDED_MPC10X_H +#include "PCI.h" +#include "BlockFile.h" /* * CMPC10x: diff --git a/Src/Model3/Model3.cpp b/Src/Model3/Model3.cpp index b115d3d..42ed635 100644 --- a/Src/Model3/Model3.cpp +++ b/Src/Model3/Model3.cpp @@ -210,17 +210,25 @@ * */ +#include "Model3.h" + #include #include #include #include #include "Supermodel.h" +#include "DriveBoard/BillBoard.h" +#include "DriveBoard/JoystickBoard.h" +#include "DriveBoard/SkiBoard.h" +#include "DriveBoard/WheelBoard.h" #include "Game.h" #include "ROMSet.h" #ifdef NET_BOARD #include "Network/NetBoard.h" #include "Network/SimNetBoard.h" #endif // NET_BOARD +#include "OSD/Audio.h" +#include "OSD/Video.h" #include "Util/Format.h" #include "Util/ByteSwap.h" #include diff --git a/Src/Model3/Model3.h b/Src/Model3/Model3.h index deed28b..fe6471a 100644 --- a/Src/Model3/Model3.h +++ b/Src/Model3/Model3.h @@ -29,9 +29,18 @@ #ifndef INCLUDED_MODEL3_H #define INCLUDED_MODEL3_H -#include "Model3/IEmulator.h" -#include "Model3/JTAG.h" -#include "Model3/Crypto.h" +#include "53C810.h" +#include "93C46.h" +#include "Crypto.h" +#include "IEmulator.h" +#include "JTAG.h" +#include "MPC10x.h" +#include "Real3D.h" +#include "RTC72421.h" +#include "SoundBoard.h" +#include "TileGen.h" +#include "DriveBoard/DriveBoard.h" +#include "CPU/PowerPC/ppc.h" #ifdef NET_BOARD #include "Network/INetBoard.h" #endif // NET_BOARD diff --git a/Src/Model3/PCI.cpp b/Src/Model3/PCI.cpp index 250733a..b1a7b6f 100644 --- a/Src/Model3/PCI.cpp +++ b/Src/Model3/PCI.cpp @@ -33,6 +33,8 @@ * the vectors do not run out of memory because so few PCI devices exist. */ +#include "PCI.h" + #include "Supermodel.h" diff --git a/Src/Model3/PCI.h b/Src/Model3/PCI.h index 501d9e2..280faa6 100644 --- a/Src/Model3/PCI.h +++ b/Src/Model3/PCI.h @@ -35,6 +35,8 @@ #ifndef INCLUDED_PCI_H #define INCLUDED_PCI_H +#include "Types.h" + #include /* diff --git a/Src/Model3/RTC72421.cpp b/Src/Model3/RTC72421.cpp index 73d44dd..7cc2c27 100644 --- a/Src/Model3/RTC72421.cpp +++ b/Src/Model3/RTC72421.cpp @@ -31,6 +31,8 @@ * - Writes do nothing yet. */ +#include "RTC72421.h" + #include #include "Supermodel.h" diff --git a/Src/Model3/RTC72421.h b/Src/Model3/RTC72421.h index 1c4f14b..08717db 100644 --- a/Src/Model3/RTC72421.h +++ b/Src/Model3/RTC72421.h @@ -28,6 +28,7 @@ #ifndef INCLUDED_RTC72421_H #define INCLUDED_RTC72421_H +#include "Types.h" /* * CRTC72421: diff --git a/Src/Model3/Real3D.cpp b/Src/Model3/Real3D.cpp index a9dea3d..30a00ee 100644 --- a/Src/Model3/Real3D.cpp +++ b/Src/Model3/Real3D.cpp @@ -40,9 +40,12 @@ * - Keep an eye out for games writing non-mipmap textures to the mipmap area. * The render currently cannot cope with this. */ - + +#include "Real3D.h" + #include "Supermodel.h" -#include "Model3/JTAG.h" +#include "JTAG.h" +#include "CPU/PowerPC/ppc.h" #include "Util/BMPFile.h" #include #include @@ -151,15 +154,15 @@ void CReal3D::LoadState(CBlockFile *SaveState) Rendering ******************************************************************************/ -static void UpdateRenderConfig(IRender3D *Render3D, uint64_t internalRenderConfig[]) -{ - bool noSunClamp = (internalRenderConfig[0] & 0x800000) != 0 && (internalRenderConfig[1] & 0x400000) != 0; - bool shadeIsSigned = (internalRenderConfig[0] & 0x1) == 0; - Render3D->SetSunClamp(!noSunClamp); - Render3D->SetSignedShade(shadeIsSigned); -} - -void CReal3D::BeginVBlank(int statusCycles) +static void UpdateRenderConfig(IRender3D *Render3D, uint64_t internalRenderConfig[]) +{ + bool noSunClamp = (internalRenderConfig[0] & 0x800000) != 0 && (internalRenderConfig[1] & 0x400000) != 0; + bool shadeIsSigned = (internalRenderConfig[0] & 0x1) == 0; + Render3D->SetSunClamp(!noSunClamp); + Render3D->SetSignedShade(shadeIsSigned); +} + +void CReal3D::BeginVBlank(int statusCycles) { // Calculate point at which status bit should change value. Currently the same timing is used for both the status bit in ReadRegister // and in WriteDMARegister32/ReadDMARegister32, however it may be that they are completely unrelated. It appears that step 1.x games @@ -249,18 +252,18 @@ uint32_t CReal3D::UpdateSnapshots(bool copyWhole) void CReal3D::BeginFrame(void) { - // If multi-threaded, perform now any queued texture uploads to renderer before rendering begins - if (m_gpuMultiThreaded) - { - for (const auto &it : queuedUploadTexturesRO) { - Render3D->UploadTextures(it.level, it.x, it.y, it.width, it.height); - } - - // done syncing data - queuedUploadTexturesRO.clear(); - } - - Render3D->BeginFrame(); + // If multi-threaded, perform now any queued texture uploads to renderer before rendering begins + if (m_gpuMultiThreaded) + { + for (const auto &it : queuedUploadTexturesRO) { + Render3D->UploadTextures(it.level, it.x, it.y, it.width, it.height); + } + + // done syncing data + queuedUploadTexturesRO.clear(); + } + + Render3D->BeginFrame(); } void CReal3D::RenderFrame(void) @@ -277,177 +280,177 @@ void CReal3D::EndFrame(void) /****************************************************************************** Texture Uploading and Decoding -******************************************************************************/ - +******************************************************************************/ + // Mipmap coordinates for each reduction level (within a single 2048x1024 page) static const int mipXBase[] = { 0, 1024, 1536, 1792, 1920, 1984, 2016, 2032, 2040, 2044, 2046, 2047 }; static const int mipYBase[] = { 0, 512, 768, 896, 960, 992, 1008, 1016, 1020, 1022, 1023 }; -static const int mipDivisor[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 }; - -// Tables of texel offsets corresponding to an NxN texel texture tile - -static const unsigned decode8x8[64] = -{ - 1, 0, 5, 4, 9, 8,13,12, - 3, 2, 7, 6,11,10,15,14, - 17,16,21,20,25,24,29,28, - 19,18,23,22,27,26,31,30, - 33,32,37,36,41,40,45,44, - 35,34,39,38,43,42,47,46, - 49,48,53,52,57,56,61,60, - 51,50,55,54,59,58,63,62 -}; - -static const unsigned decode8x4[32] = -{ - 1, 0, 5, 4, - 3, 2, 7, 6, - 9, 8,13,12, - 11,10,15,14, - 17,16,21,20, - 19,18,23,22, - 25,24,29,28, - 27,26,31,30 -}; - -static const unsigned decode8x2[16] = -{ - 1, 0, - 3, 2, - 5, 4, - 7, 6, - 9, 8, - 11, 10, - 13, 12, - 15, 14 -}; - -static const unsigned decode8x1[8] = -{ - 1, - 3, - 0, - 2, - 5, - 7, - 4, - 6 -}; - -void CReal3D::StoreTexture(unsigned level, unsigned xPos, unsigned yPos, unsigned width, unsigned height, const uint16_t *texData, bool sixteenBit, bool writeLSB, bool writeMSB, uint32_t &texDataOffset) -{ - uint32_t tileX = (std::min)(8u, width); - uint32_t tileY = (std::min)(8u, height); - - texDataOffset = 0; - - if (sixteenBit) // 16-bit textures - { - // Outer 2 loops: NxN tiles - for (uint32_t y = yPos; y < (yPos + height); y += tileY) - { - for (uint32_t x = xPos; x < (xPos + width); x += tileX) - { - // Inner 2 loops: NxN texels for the current tile - uint32_t destOffset = y * 2048 + x; - for (uint32_t yy = 0; yy < tileY; yy++) - { - for (uint32_t xx = 0; xx < tileX; xx++) - { - if (m_gpuMultiThreaded) - MARK_DIRTY(textureRAMDirty, destOffset * 2); - if (tileX == 1) texData -= tileY; - if (tileY == 1) texData -= tileX; - if (tileX == 8) - textureRAM[destOffset++] = texData[decode8x8[yy * tileX + xx]]; - else if (tileX == 4) - textureRAM[destOffset++] = texData[decode8x4[yy * tileX + xx]]; - else if (tileX == 2) - textureRAM[destOffset++] = texData[decode8x2[yy * tileX + xx]]; - else if (tileX == 1) - textureRAM[destOffset++] = texData[decode8x1[yy * tileX + xx]]; - texDataOffset++; - } - destOffset += 2048 - tileX; // next line - } - texData += tileY * tileX; // next tile - } - } - } +static const int mipDivisor[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 }; + +// Tables of texel offsets corresponding to an NxN texel texture tile + +static const unsigned decode8x8[64] = +{ + 1, 0, 5, 4, 9, 8,13,12, + 3, 2, 7, 6,11,10,15,14, + 17,16,21,20,25,24,29,28, + 19,18,23,22,27,26,31,30, + 33,32,37,36,41,40,45,44, + 35,34,39,38,43,42,47,46, + 49,48,53,52,57,56,61,60, + 51,50,55,54,59,58,63,62 +}; + +static const unsigned decode8x4[32] = +{ + 1, 0, 5, 4, + 3, 2, 7, 6, + 9, 8,13,12, + 11,10,15,14, + 17,16,21,20, + 19,18,23,22, + 25,24,29,28, + 27,26,31,30 +}; + +static const unsigned decode8x2[16] = +{ + 1, 0, + 3, 2, + 5, 4, + 7, 6, + 9, 8, + 11, 10, + 13, 12, + 15, 14 +}; + +static const unsigned decode8x1[8] = +{ + 1, + 3, + 0, + 2, + 5, + 7, + 4, + 6 +}; + +void CReal3D::StoreTexture(unsigned level, unsigned xPos, unsigned yPos, unsigned width, unsigned height, const uint16_t *texData, bool sixteenBit, bool writeLSB, bool writeMSB, uint32_t &texDataOffset) +{ + uint32_t tileX = (std::min)(8u, width); + uint32_t tileY = (std::min)(8u, height); + + texDataOffset = 0; + + if (sixteenBit) // 16-bit textures + { + // Outer 2 loops: NxN tiles + for (uint32_t y = yPos; y < (yPos + height); y += tileY) + { + for (uint32_t x = xPos; x < (xPos + width); x += tileX) + { + // Inner 2 loops: NxN texels for the current tile + uint32_t destOffset = y * 2048 + x; + for (uint32_t yy = 0; yy < tileY; yy++) + { + for (uint32_t xx = 0; xx < tileX; xx++) + { + if (m_gpuMultiThreaded) + MARK_DIRTY(textureRAMDirty, destOffset * 2); + if (tileX == 1) texData -= tileY; + if (tileY == 1) texData -= tileX; + if (tileX == 8) + textureRAM[destOffset++] = texData[decode8x8[yy * tileX + xx]]; + else if (tileX == 4) + textureRAM[destOffset++] = texData[decode8x4[yy * tileX + xx]]; + else if (tileX == 2) + textureRAM[destOffset++] = texData[decode8x2[yy * tileX + xx]]; + else if (tileX == 1) + textureRAM[destOffset++] = texData[decode8x1[yy * tileX + xx]]; + texDataOffset++; + } + destOffset += 2048 - tileX; // next line + } + texData += tileY * tileX; // next tile + } + } + } else // 8-bit textures { /* * 8-bit textures appear to be unpacked into 16-bit words in the * texture RAM. Oddly, the rows of the decoding table seem to be - * swapped. - */ - - if (writeLSB && writeMSB) // write to both? - DebugLog("Observed 8-bit texture with byte_select=3!"); - - // Outer 2 loops: NxN tiles - const uint8_t byteSelect = (uint8_t)writeLSB | ((uint8_t)writeMSB << 1); - uint16_t tempData; - const uint16_t byteMask[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000}; - for (uint32_t y = yPos; y < (yPos + height); y += tileY) - { - for (uint32_t x = xPos; x < (xPos + width); x += tileX) - { - // Inner 2 loops: NxN texels for the current tile - uint32_t destOffset = y * 2048 + x; - for (uint32_t yy = 0; yy < tileY; yy++) - { - for (uint32_t xx = 0; xx < tileX; xx++) - { - if (writeLSB | writeMSB) { - if (m_gpuMultiThreaded) - MARK_DIRTY(textureRAMDirty, destOffset * 2); - textureRAM[destOffset] &= byteMask[byteSelect]; - const uint8_t shift = (8 * ((xx & 1) ^ 1)); - const uint8_t index = (yy ^ 1) * tileX + (xx ^ 1) - (tileX & 1); - if (tileX == 1) texData -= tileY; - if (tileY == 1) texData -= tileX; - if (tileX == 8) - tempData = (texData[decode8x8[index] / 2] >> shift) & 0xFF; - else if (tileX == 4) - tempData = (texData[decode8x4[index] / 2] >> shift) & 0xFF; - else if (tileX == 2) - tempData = (texData[decode8x2[index] / 2] >> shift) & 0xFF; - else if (tileX == 1) - tempData = (texData[decode8x1[index] / 2] >> shift) & 0xFF; - tempData |= tempData << 8; - tempData &= byteMask[byteSelect] ^ 0xFFFF; - textureRAM[destOffset] |= tempData; - } - destOffset++; - } - destOffset += 2048 - tileX; // next line - } - uint32_t offset = (std::max)(1u, (tileY * tileX) / 2); - texData += offset; // next tile - texDataOffset += offset; // next tile - } - } - } + * swapped. + */ + + if (writeLSB && writeMSB) // write to both? + DebugLog("Observed 8-bit texture with byte_select=3!"); + + // Outer 2 loops: NxN tiles + const uint8_t byteSelect = (uint8_t)writeLSB | ((uint8_t)writeMSB << 1); + uint16_t tempData; + const uint16_t byteMask[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000}; + for (uint32_t y = yPos; y < (yPos + height); y += tileY) + { + for (uint32_t x = xPos; x < (xPos + width); x += tileX) + { + // Inner 2 loops: NxN texels for the current tile + uint32_t destOffset = y * 2048 + x; + for (uint32_t yy = 0; yy < tileY; yy++) + { + for (uint32_t xx = 0; xx < tileX; xx++) + { + if (writeLSB | writeMSB) { + if (m_gpuMultiThreaded) + MARK_DIRTY(textureRAMDirty, destOffset * 2); + textureRAM[destOffset] &= byteMask[byteSelect]; + const uint8_t shift = (8 * ((xx & 1) ^ 1)); + const uint8_t index = (yy ^ 1) * tileX + (xx ^ 1) - (tileX & 1); + if (tileX == 1) texData -= tileY; + if (tileY == 1) texData -= tileX; + if (tileX == 8) + tempData = (texData[decode8x8[index] / 2] >> shift) & 0xFF; + else if (tileX == 4) + tempData = (texData[decode8x4[index] / 2] >> shift) & 0xFF; + else if (tileX == 2) + tempData = (texData[decode8x2[index] / 2] >> shift) & 0xFF; + else if (tileX == 1) + tempData = (texData[decode8x1[index] / 2] >> shift) & 0xFF; + tempData |= tempData << 8; + tempData &= byteMask[byteSelect] ^ 0xFFFF; + textureRAM[destOffset] |= tempData; + } + destOffset++; + } + destOffset += 2048 - tileX; // next line + } + uint32_t offset = (std::max)(1u, (tileY * tileX) / 2); + texData += offset; // next tile + texDataOffset += offset; // next tile + } + } + } // Signal to renderer that textures have changed // TO-DO: mipmaps? What if a game writes non-mipmap textures to mipmap area? if (m_gpuMultiThreaded) - { - // If multi-threaded, then queue calls to UploadTextures for render thread to perform at beginning of next frame - QueuedUploadTextures upl; - upl.level = level; - upl.x = xPos; - upl.y = yPos; - upl.width = width; + { + // If multi-threaded, then queue calls to UploadTextures for render thread to perform at beginning of next frame + QueuedUploadTextures upl; + upl.level = level; + upl.x = xPos; + upl.y = yPos; + upl.width = width; upl.height = height; queuedUploadTextures.push_back(upl); } else Render3D->UploadTextures(level, xPos, yPos, width, height); } - + /* Texture header: -------- -------- -------- --xxxxxx X-position @@ -510,8 +513,8 @@ void CReal3D::UploadTexture(uint32_t header, const uint16_t *texData) DebugLog("Unknown texture format %02X\n", type); break; } -} - +} + /****************************************************************************** DMA Device @@ -617,15 +620,15 @@ void CReal3D::WriteDMARegister32(unsigned reg, uint32_t data) dmaLength = data; DMACopy(); dmaStatus |= 1; - IRQ->Assert(dmaIRQ); - break; - case 0x10: // command register - if ((data&0x20000000)) // DMA ID command - { - dmaData = pciID; - DebugLog("Real3D: DMA ID command issued (ATTENTION: make sure we're returning the correct value), PC=%08X, LR=%08X\n", ppc_get_pc(), ppc_get_lr()); - } - else if ((data&0x80000000)) + IRQ->Assert(dmaIRQ); + break; + case 0x10: // command register + if ((data&0x20000000)) // DMA ID command + { + dmaData = pciID; + DebugLog("Real3D: DMA ID command issued (ATTENTION: make sure we're returning the correct value), PC=%08X, LR=%08X\n", ppc_get_pc(), ppc_get_lr()); + } + else if ((data&0x80000000)) { dmaData = ReadRegister(data & 0x3F); } @@ -645,36 +648,36 @@ void CReal3D::WriteDMARegister32(unsigned reg, uint32_t data) ******************************************************************************/ void CReal3D::Flush(void) -{ - commandPortWritten = true; - DebugLog("Real3D 88000000 written @ PC=%08X\n", ppc_get_pc()); - - // Upload textures (if any) - if (fifoIdx > 0) - { +{ + commandPortWritten = true; + DebugLog("Real3D 88000000 written @ PC=%08X\n", ppc_get_pc()); + + // Upload textures (if any) + if (fifoIdx > 0) + { for (uint32_t i = 0; i < fifoIdx; ) { - uint32_t size = 2+textureFIFO[i+0]/2; - size /= 4; - uint32_t header = textureFIFO[i+1]; // texture information header - - // Spikeout seems to be uploading 0 length textures - if (0 == size) - { + uint32_t size = 2+textureFIFO[i+0]/2; + size /= 4; + uint32_t header = textureFIFO[i+1]; // texture information header + + // Spikeout seems to be uploading 0 length textures + if (0 == size) + { DebugLog("Real3D: 0-length texture upload @ PC=%08X (%08X %08X %08X)\n", ppc_get_pc(), textureFIFO[i+0], textureFIFO[i+1], textureFIFO[i+2]); break; } - - UploadTexture(header,(uint16_t *)&textureFIFO[i+2]); - DebugLog("Real3D: Texture upload completed: %X bytes (%X)\n", size*4, textureFIFO[i+0]); - - i += size; - } - } - - // Reset texture FIFO - fifoIdx = 0; -} + + UploadTexture(header,(uint16_t *)&textureFIFO[i+2]); + DebugLog("Real3D: Texture upload completed: %X bytes (%X)\n", size*4, textureFIFO[i+0]); + + i += size; + } + } + + // Reset texture FIFO + fifoIdx = 0; +} void CReal3D::WriteTextureFIFO(uint32_t data) { @@ -873,21 +876,21 @@ void CReal3D::AttachRenderer(IRender3D *Render3DPtr) uint32_t CReal3D::GetASICIDCode(ASIC asic) const { auto it = m_asicID.find(asic); - return it == m_asicID.end() ? 0 : it->second; -} - -void CReal3D::SetStepping(int stepping, uint32_t pciIDValue) - -{ - step = stepping; - if ((step!=0x10) && (step!=0x15) && (step!=0x20) && (step!=0x21)) + return it == m_asicID.end() ? 0 : it->second; +} + +void CReal3D::SetStepping(int stepping, uint32_t pciIDValue) + +{ + step = stepping; + if ((step!=0x10) && (step!=0x15) && (step!=0x20) && (step!=0x21)) { - DebugLog("Real3D: Unrecognized stepping: %d.%d\n", (step>>4)&0xF, step&0xF); - step = 0x10; - } - - // Set PCI ID - pciID = pciIDValue; + DebugLog("Real3D: Unrecognized stepping: %d.%d\n", (step>>4)&0xF, step&0xF); + step = 0x10; + } + + // Set PCI ID + pciID = pciIDValue; // Pass to renderer if (Render3D != NULL) diff --git a/Src/Model3/Real3D.h b/Src/Model3/Real3D.h index b7a64e9..598345c 100644 --- a/Src/Model3/Real3D.h +++ b/Src/Model3/Real3D.h @@ -29,6 +29,12 @@ #ifndef INCLUDED_REAL3D_H #define INCLUDED_REAL3D_H +#include "IRQ.h" +#include "PCI.h" +#include "CPU/Bus.h" +#include "Graphics/IRender3D.h" +#include "Util/NewConfig.h" + #include #include @@ -375,19 +381,19 @@ public: * any other emulation functions and after Init(). * * Parameters: - * stepping 0x10 for Step 1.0, 0x15 for Step 1.5, 0x20 for Step 2.0, or + * stepping 0x10 for Step 1.0, 0x15 for Step 1.5, 0x20 for Step 2.0, or * 0x21 for Step 2.1. Anything else defaults to 1.0. * pciIDValue The PCI ID code to return. This should be one of the PCIID * enum values otherwise games may fail to boot. Although the * PCI ID depends on stepping, there are a few games that * have to be explicitly configured with an older ID code, - * which is why this parameter is exposed. - */ - void SetStepping(int stepping, uint32_t pciIDValue); - - - /* - * Init(vromPtr, BusObjectPtr, IRQObjectPtr, dmaIRQBit): + * which is why this parameter is exposed. + */ + void SetStepping(int stepping, uint32_t pciIDValue); + + + /* + * Init(vromPtr, BusObjectPtr, IRQObjectPtr, dmaIRQBit): * * One-time initialization of the context. Must be called prior to all * other members. Connects the Real3D device to its video ROM and allocates @@ -424,12 +430,12 @@ public: private: // Private member functions - void DMACopy(void); - void StoreTexture(unsigned level, unsigned xPos, unsigned yPos, unsigned width, unsigned height, const uint16_t *texData, bool sixteenBit, bool writeLSB, bool writeMSB, uint32_t &texDataOffset); - - void UploadTexture(uint32_t header, const uint16_t *texData); - uint32_t UpdateSnapshots(bool copyWhole); - uint32_t UpdateSnapshot(bool copyWhole, uint8_t *src, uint8_t *dst, unsigned size, uint8_t *dirty); + void DMACopy(void); + void StoreTexture(unsigned level, unsigned xPos, unsigned yPos, unsigned width, unsigned height, const uint16_t *texData, bool sixteenBit, bool writeLSB, bool writeMSB, uint32_t &texDataOffset); + + void UploadTexture(uint32_t header, const uint16_t *texData); + uint32_t UpdateSnapshots(bool copyWhole); + uint32_t UpdateSnapshot(bool copyWhole, uint8_t *src, uint8_t *dst, unsigned size, uint8_t *dirty); // Config const Util::Config::Node &m_config; diff --git a/Src/Model3/SoundBoard.cpp b/Src/Model3/SoundBoard.cpp index 54b9cbd..52f0c30 100644 --- a/Src/Model3/SoundBoard.cpp +++ b/Src/Model3/SoundBoard.cpp @@ -54,7 +54,11 @@ * ROM 600000-7FFFFF -> E00000-FFFFFF */ +#include "SoundBoard.h" + #include "Supermodel.h" +#include "OSD/Audio.h" +#include "Sound/SCSP.h" // DEBUG //#define SUPERMODEL_LOG_AUDIO // define this to log all audio to sound.bin diff --git a/Src/Model3/TileGen.cpp b/Src/Model3/TileGen.cpp index 8203e1d..9cc2db5 100644 --- a/Src/Model3/TileGen.cpp +++ b/Src/Model3/TileGen.cpp @@ -50,6 +50,8 @@ * manually reverse the data. This keeps with the convention for VRAM. */ +#include "TileGen.h" + #include #include "Supermodel.h" diff --git a/Src/Model3/TileGen.h b/Src/Model3/TileGen.h index 44b9999..c1c8a87 100644 --- a/Src/Model3/TileGen.h +++ b/Src/Model3/TileGen.h @@ -28,6 +28,8 @@ #ifndef INCLUDED_TILEGEN_H #define INCLUDED_TILEGEN_H +#include "IRQ.h" +#include "Graphics/Render2D.h" /* * CTileGen: diff --git a/Src/Network/NetBoard.h b/Src/Network/NetBoard.h index 9a12f37..1b573f2 100644 --- a/Src/Network/NetBoard.h +++ b/Src/Network/NetBoard.h @@ -25,6 +25,7 @@ #include "Types.h" #include "CPU/Bus.h" +#include "CPU/68K/68K.h" #include "OSD/Thread.h" #include #include "INetBoard.h" diff --git a/Src/OSD/Audio.h b/Src/OSD/Audio.h index ccfbc57..7f732b4 100755 --- a/Src/OSD/Audio.h +++ b/Src/OSD/Audio.h @@ -27,6 +27,8 @@ #ifndef INCLUDED_AUDIO_H #define INCLUDED_AUDIO_H + +#include "Types.h" typedef void (*AudioCallbackFPtr)(void *data); diff --git a/Src/OSD/Outputs.cpp b/Src/OSD/Outputs.cpp index 1adc483..a944e90 100755 --- a/Src/OSD/Outputs.cpp +++ b/Src/OSD/Outputs.cpp @@ -23,6 +23,8 @@ * Outputs.cpp */ +#include "Outputs.h" + #include "Supermodel.h" const char *COutputs::s_outputNames[] = diff --git a/Src/OSD/Outputs.h b/Src/OSD/Outputs.h index f4f3bf1..e2ed37a 100755 --- a/Src/OSD/Outputs.h +++ b/Src/OSD/Outputs.h @@ -29,6 +29,7 @@ #define INCLUDED_OUTPUTS_H #include "Game.h" +#include "Types.h" /* * EOutputs enumeration of all available outputs. diff --git a/Src/OSD/SDL/Audio.cpp b/Src/OSD/SDL/Audio.cpp index 445d5ee..725dbd5 100755 --- a/Src/OSD/SDL/Audio.cpp +++ b/Src/OSD/SDL/Audio.cpp @@ -30,6 +30,8 @@ * initial set up of the buffer is correct. */ +#include "Audio.h" + #include "Supermodel.h" #include "SDLIncludes.h" diff --git a/Src/OSD/SDL/Main.cpp b/Src/OSD/SDL/Main.cpp index a02aa73..18aca0b 100644 --- a/Src/OSD/SDL/Main.cpp +++ b/Src/OSD/SDL/Main.cpp @@ -69,6 +69,12 @@ #include "WinOutputs.h" #endif #include "SDLIncludes.h" +#include "Debugger/SupermodelDebugger.h" +#include "Graphics/Legacy3D/Legacy3D.h" +#include "Graphics/New3D/New3D.h" +#include "Model3/IEmulator.h" +#include "Model3/Model3.h" +#include "OSD/Audio.h" #include #include "Util/BMPFile.h" diff --git a/Src/OSD/SDL/SDLInputSystem.cpp b/Src/OSD/SDL/SDLInputSystem.cpp index 8f6d8d9..e4d4a7f 100644 --- a/Src/OSD/SDL/SDLInputSystem.cpp +++ b/Src/OSD/SDL/SDLInputSystem.cpp @@ -29,9 +29,11 @@ * - Implement multiple keyboard and mouse support. */ -#include "Supermodel.h" #include "SDLInputSystem.h" +#include "Supermodel.h" +#include "Inputs/Input.h" + #include using namespace std; diff --git a/Src/OSD/SDL/Thread.cpp b/Src/OSD/SDL/Thread.cpp index 45d9bec..02a2fb5 100755 --- a/Src/OSD/SDL/Thread.cpp +++ b/Src/OSD/SDL/Thread.cpp @@ -25,6 +25,8 @@ * SDL-based implementation of threading primitives. */ +#include "Thread.h" + #include "Supermodel.h" #include "SDLIncludes.h" diff --git a/Src/OSD/Thread.h b/Src/OSD/Thread.h index cf49546..2ab8d1e 100755 --- a/Src/OSD/Thread.h +++ b/Src/OSD/Thread.h @@ -28,6 +28,8 @@ #ifndef INCLUDED_THREADS_H #define INCLUDED_THREADS_H +#include "Types.h" + #include class CSemaphore; diff --git a/Src/Sound/SCSP.cpp b/Src/Sound/SCSP.cpp index d4cd0c2..d10bfd7 100644 --- a/Src/Sound/SCSP.cpp +++ b/Src/Sound/SCSP.cpp @@ -63,13 +63,18 @@ It doesn't sound good at all. Anyways credit to R. Belmont and ElSemi for the code, and for being awesome emulation Gods. */ +#include "SCSP.h" + #include "Supermodel.h" -#include "Sound/SCSP.h" +#include "SCSPDSP.h" +#include "OSD/Thread.h" + + #include #include #include #include -#include "Sound/SCSPDSP.h" + static const Util::Config::Node *s_config = 0; static bool s_multiThreaded = false; diff --git a/Src/Sound/SCSP.h b/Src/Sound/SCSP.h index 610f021..3b46b64 100644 --- a/Src/Sound/SCSP.h +++ b/Src/Sound/SCSP.h @@ -28,6 +28,9 @@ #ifndef INCLUDED_SCSP_H #define INCLUDED_SCSP_H +#include "BlockFile.h" +#include "Types.h" +#include "Util/NewConfig.h" void SCSP_w8(UINT32 addr,UINT8 val); void SCSP_w16(UINT32 addr,UINT16 val); diff --git a/Src/Sound/SCSPDSP.h b/Src/Sound/SCSPDSP.h index 5c6b82a..ea88bac 100644 --- a/Src/Sound/SCSPDSP.h +++ b/Src/Sound/SCSPDSP.h @@ -29,6 +29,8 @@ #ifndef INCLUDED_SCSPDSP_H #define INCLUDED_SCSPDSP_H +#include "Types.h" + //#define DYNDSP #define DYNOPT 1 //set to 1 to enable optimization of recompiler diff --git a/Src/Sound/SCSPLFO.cpp b/Src/Sound/SCSPLFO.cpp index 297f400..3d19eaa 100644 --- a/Src/Sound/SCSPLFO.cpp +++ b/Src/Sound/SCSPLFO.cpp @@ -125,7 +125,7 @@ void LFO_Init(void) } } -signed int INLINE PLFO_Step(struct _LFO *LFO) +signed int inline PLFO_Step(struct _LFO *LFO) { int p; LFO->phase += LFO->phase_step; @@ -137,7 +137,7 @@ signed int INLINE PLFO_Step(struct _LFO *LFO) return p << (SHIFT - LFO_SHIFT); } -signed int INLINE ALFO_Step(struct _LFO *LFO) +signed int inline ALFO_Step(struct _LFO *LFO) { int p; LFO->phase += LFO->phase_step; diff --git a/Src/Supermodel.h b/Src/Supermodel.h index d539b59..4355e52 100644 --- a/Src/Supermodel.h +++ b/Src/Supermodel.h @@ -27,9 +27,7 @@ #ifndef INCLUDED_SUPERMODEL_H #define INCLUDED_SUPERMODEL_H -#if (defined NET_BOARD && defined _WIN32) -#include "Winsock2.h" // force include winsock2 before windows.h because conflict with winsock1 -#endif + // Used throughout Supermodel #include #include @@ -92,68 +90,10 @@ */ #include "Types.h" // located in OSD// directory -/* - * OSD Header Files - */ - + // Error logging interface #include "OSD/Logger.h" -// OSD Interfaces -#include "OSD/Thread.h" -#include "OSD/Audio.h" -#include "OSD/Video.h" -#include "OSD/Outputs.h" - - -/****************************************************************************** - Header Files - - All primary header files for modules used throughout Supermodel are included - here, except for external packages and APIs. -******************************************************************************/ - -#include "BlockFile.h" -#include "Graphics/New3D/New3D.h" -#include "Graphics/Render2D.h" -#include "Graphics/Legacy3D/TextureRefs.h" -#include "Graphics/Legacy3D/Legacy3D.h" -#include "Graphics/Shader.h" -#ifdef SUPERMODEL_DEBUGGER -#include "Debugger/SupermodelDebugger.h" -#include "Debugger/CPU/PPCDebug.h" -#include "Debugger/CPU/Musashi68KDebug.h" -#include "Debugger/CPU/Z80Debug.h" -#endif // SUPERMODEL_DEBUGGER -#include "CPU/Bus.h" -#include "CPU/PowerPC/PPCDisasm.h" -#include "CPU/PowerPC/ppc.h" -#include "CPU/68K/68K.h" -#include "CPU/Z80/Z80.h" -#include "Inputs/Input.h" -#include "Inputs/Inputs.h" -#include "Inputs/InputSource.h" -#include "Inputs/InputSystem.h" -#include "Inputs/InputTypes.h" -#include "Inputs/MultiInputSource.h" -#include "Model3/IRQ.h" -#include "Model3/PCI.h" -#include "Model3/53C810.h" -#include "Model3/MPC10x.h" -#include "Model3/RTC72421.h" -#include "Model3/93C46.h" -#include "Model3/TileGen.h" -#include "Model3/Real3D.h" -#include "Sound/SCSP.h" -#include "Model3/SoundBoard.h" -#include "Model3/DSB.h" -#include "Model3/DriveBoard/DriveBoard.h" -#include "Model3/DriveBoard/WheelBoard.h" -#include "Model3/DriveBoard/JoystickBoard.h" -#include "Model3/DriveBoard/SkiBoard.h" -#include "Model3/DriveBoard/BillBoard.h" -#include "Model3/Model3.h" - /****************************************************************************** Helpful Macros and Inlines