Finished processing z80

This commit is contained in:
SergioMartin86 2024-03-30 12:48:22 +01:00
parent 91542518e0
commit 2c89f68642
4 changed files with 40 additions and 27 deletions

View File

@ -138,6 +138,25 @@ int32_t out_fm[6]; /* outputs of working channels */
uint32_t op_mask[8][4]; /* operator output bitmasking (DAC quantization) */
int chip_type = YM2612_DISCRETE; /* chip type */
// z80/z80.c
Z80_Regs Z80;
uint8_t z80_last_fetch;
unsigned char *z80_readmap[64];
unsigned char *z80_writemap[64];
uint32_t EA;
uint8_t SZ[256]; /* zero and sign flags */
uint8_t SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
uint8_t SZP[256]; /* zero, sign and parity flags */
uint8_t SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */
uint8_t SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */
uint8_t SZHVC_add[2*256*256]; /* flags for ADD opcode */
uint8_t SZHVC_sub[2*256*256]; /* flags for SUB opcode */
#ifdef Z80_OVERCLOCK_SHIFT
uint32_t z80_cycle_ratio;
#endif
// genesis.c
uint8_t boot_rom[0x800];

View File

@ -25,6 +25,7 @@
#include "sound/ym2612.h"
#include "sound/ym3438.h"
#include "m68k/m68k.h"
#include "z80/z80.h"
#include "genesis.h"
#include "io_ctrl.h"
#include "loadrom.h"
@ -185,6 +186,25 @@ extern int32_t out_fm[6]; /* outputs of working channels */
extern uint32_t op_mask[8][4]; /* operator output bitmasking (DAC quantization) */
extern int chip_type; /* chip type */
// z80/z80.h
extern Z80_Regs Z80;
extern uint8_t z80_last_fetch;
extern unsigned char *z80_readmap[64];
extern unsigned char *z80_writemap[64];
extern uint32_t EA;
extern uint8_t SZ[256]; /* zero and sign flags */
extern uint8_t SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
extern uint8_t SZP[256]; /* zero, sign and parity flags */
extern uint8_t SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */
extern uint8_t SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */
extern uint8_t SZHVC_add[2*256*256]; /* flags for ADD opcode */
extern uint8_t SZHVC_sub[2*256*256]; /* flags for SUB opcode */
#ifdef Z80_OVERCLOCK_SHIFT
extern uint32_t z80_cycle_ratio;
#endif
// genesis.h
extern uint8_t boot_rom[0x800];

View File

@ -127,6 +127,7 @@
#include <string.h>
#include "../macros.h"
#include "../state.h"
#include "z80.h"
@ -207,33 +208,16 @@
#ifdef Z80_OVERCLOCK_SHIFT
#define USE_CYCLES(A) Z80.cycles += ((A) * z80_cycle_ratio) >> Z80_OVERCLOCK_SHIFT
uint32_t z80_cycle_ratio;
#else
#define USE_CYCLES(A) Z80.cycles += (A)
#endif
Z80_Regs Z80;
uint8_t z80_last_fetch;
unsigned char *z80_readmap[64];
unsigned char *z80_writemap[64];
void (*z80_writemem)(unsigned int address, unsigned char data);
unsigned char (*z80_readmem)(unsigned int address);
void (*z80_writeport)(unsigned int port, unsigned char data);
unsigned char (*z80_readport)(unsigned int port);
uint32_t EA;
uint8_t SZ[256]; /* zero and sign flags */
uint8_t SZ_BIT[256]; /* zero, sign and parity/overflow (=zero) flags for BIT opcode */
uint8_t SZP[256]; /* zero, sign and parity flags */
uint8_t SZHV_inc[256]; /* zero, sign, half carry and overflow flags INC r8 */
uint8_t SZHV_dec[256]; /* zero, sign, half carry and overflow flags DEC r8 */
uint8_t SZHVC_add[2*256*256]; /* flags for ADD opcode */
uint8_t SZHVC_sub[2*256*256]; /* flags for SUB opcode */
const uint16_t cc_op[0x100] = {
4*15,10*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15, 4*15,11*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15,
8*15,10*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15,12*15,11*15, 7*15, 6*15, 4*15, 4*15, 7*15, 4*15,

View File

@ -48,16 +48,6 @@ typedef struct
} Z80_Regs;
extern Z80_Regs Z80;
extern uint8_t z80_last_fetch;
#ifdef Z80_OVERCLOCK_SHIFT
extern uint32_t z80_cycle_ratio;
#endif
extern unsigned char *z80_readmap[64];
extern unsigned char *z80_writemap[64];
extern void (*z80_writemem)(unsigned int address, unsigned char data);
extern unsigned char (*z80_readmem)(unsigned int address);
extern void (*z80_writeport)(unsigned int port, unsigned char data);