2011-07-14 00:49:52 +02:00
|
|
|
#ifndef Z80_H_
|
|
|
|
#define Z80_H_
|
|
|
|
|
|
|
|
#include "osd_cpu.h"
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
/* line states */
|
|
|
|
CLEAR_LINE = 0, /* clear (a fired, held or pulsed) line */
|
|
|
|
ASSERT_LINE, /* assert an interrupt immediately */
|
|
|
|
HOLD_LINE, /* hold interrupt line until acknowledged */
|
|
|
|
PULSE_LINE /* pulse interrupt line for one instruction */
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
Z80_PC, Z80_SP,
|
|
|
|
Z80_A, Z80_B, Z80_C, Z80_D, Z80_E, Z80_H, Z80_L,
|
|
|
|
Z80_AF, Z80_BC, Z80_DE, Z80_HL,
|
|
|
|
Z80_IX, Z80_IY, Z80_AF2, Z80_BC2, Z80_DE2, Z80_HL2,
|
|
|
|
Z80_R, Z80_I, Z80_IM, Z80_IFF1, Z80_IFF2, Z80_HALT,
|
|
|
|
Z80_DC0, Z80_DC1, Z80_DC2, Z80_DC3, Z80_WZ
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
Z80_TABLE_op,
|
|
|
|
Z80_TABLE_cb,
|
|
|
|
Z80_TABLE_ed,
|
|
|
|
Z80_TABLE_xy,
|
|
|
|
Z80_TABLE_xycb,
|
|
|
|
Z80_TABLE_ex /* cycles counts for taken jr/jp/call and interrupt latency (rst opcodes) */
|
|
|
|
};
|
|
|
|
|
|
|
|
/****************************************************************************/
|
|
|
|
/* The Z80 registers. HALT is set to 1 when the CPU is halted, the refresh */
|
|
|
|
/* register is calculated as follows: refresh=(Z80.r&127)|(Z80.r2&128) */
|
|
|
|
/****************************************************************************/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
PAIR pc,sp,af,bc,de,hl,ix,iy,wz;
|
|
|
|
PAIR af2,bc2,de2,hl2;
|
|
|
|
UINT8 r,r2,iff1,iff2,halt,im,i;
|
|
|
|
UINT8 nmi_state; /* nmi line state */
|
|
|
|
UINT8 nmi_pending; /* nmi pending */
|
|
|
|
UINT8 irq_state; /* irq line state */
|
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
2012-07-05 21:22:12 +02:00
|
|
|
UINT8 after_ei; /* are we in the EI shadow? */
|
|
|
|
UINT32 cycles; /* master clock cycles global counter */
|
2011-07-14 00:49:52 +02:00
|
|
|
const struct z80_irq_daisy_chain *daisy;
|
|
|
|
int (*irq_callback)(int irqline);
|
|
|
|
} Z80_Regs;
|
|
|
|
|
|
|
|
|
|
|
|
extern Z80_Regs Z80;
|
|
|
|
|
|
|
|
extern unsigned char *z80_readmap[64];
|
|
|
|
extern unsigned char *z80_writemap[64];
|
|
|
|
|
|
|
|
extern void (*z80_writemem)(unsigned int address, unsigned char data);
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
extern unsigned char (*z80_readmem)(unsigned int address);
|
2011-07-14 00:49:52 +02:00
|
|
|
extern void (*z80_writeport)(unsigned int port, unsigned char data);
|
|
|
|
extern unsigned char (*z80_readport)(unsigned int port);
|
|
|
|
|
|
|
|
extern void z80_init(const void *config, int (*irqcallback)(int));
|
|
|
|
extern void z80_reset (void);
|
|
|
|
extern void z80_run(unsigned int cycles);
|
|
|
|
extern void z80_get_context (void *dst);
|
|
|
|
extern void z80_set_context (void *src);
|
----------------------
Genesis Plus GX 1.6.0
----------------------
[Core/Sound]
---------------
* added YM2413 emulation in Master System compatibility mode.
* fixed SN76489 noise boost initialization.
* minor YM2612 core optimizations.
[Core/VDP]
---------------
* added accurate emulation of SG-1000, Master System (315-5124, 315-5246) & Game Gear VDP.
* added support for all TMS9918 rendering modes.
* improved Mega Drive VDP timings accuracy in Master System Compatibility mode.
* fixed color palette initialization.
* fixed shifted sprites rendering in Mode 4.
* modified pixel rendering support (pixel depth is now forced at compilation time).
[Core/CPU]
---------------
* optimized 68k core (rewrote 68k interrupt handling, removed multiple CPU types support & unused code) for 5~8% speed improvment
[Core/IO]
---------------
* added accurate emulation of Master System (315-5216, 315-5237, 315-5297) & Game Gear I/O controllers.
* added Terebi Oekaki tablet emulation.
* improved Mouse emulation (fixes mouse support in Cannon Fodder).
* improved Justifier emulation (fixes gun support in Lethal Enforcers 2).
* improved 6-Buttons control pad emulation (fixes Duke Nukem 3D)
* modified lightgun emulation to use common key inputs for all devices.
* 2-buttons controller is now picked by default for Master System games.
[Core/MD]
---------------
* added copy-protection hardware emulation for some new dumped games (Tiny Toon Adventures 3, Mighty Morphin Power Rangers & The Battle of Red Cliffs).
* added Game Toshokan in EEPROM database (verified on real cartridge).
* fixed Micro Machines 2 - Turbo Tournament EEPROM size (verified on real cartridge).
* modified SRAM banswitch hardware emulation to be more compatible with some hacks.
[Core/MS]
---------------
* added Cyborg Z to Korean mapper database.
[Core/GG]
---------------
* added 93C46 EEPROM emulation (Majors Pro Baseball, World Series Baseball & World Series Baseball 95).
[Core/General]
---------------
* added support for .mdx ROM format.
* added Game Gear & SG-1000 ROM support.
* added accurate emulation of SG-1000, Master System (I, II) & Game Gear hardware models for 100% compatibility.
* updated to new Genesis Plus license (see http://cgfm2.emuviews.com/)
* removed DOS port
* various code cleanup.
[Gamecube/Wii]
---------------
* IMPORTANT: cheats, screenshots & save files are now stored in console-specific directories (ex: /snaps/md, /cheats/ms, /saves/gg, ...)
* added 8-bit Action Replay & Game Genie codes support (for Master System & Game Gear games).
* improved audio/video synchronization for PAL games in 50Hz TV modes (now use VSYNC like NTSC games in 60hz modes).
* improved gun cursor positioning accuracy.
* improved horizontal scaling & screenshots rendering in H32 mode.
* fixed a bug with ROM file extension handling that would affect cheats, snapshots, sram & savestate files.
* removed ARAM/injected ROM support (unused).
* removed WPAD_ and PAD_ update from VSYNC callback.
* increased GCC inlining limits for some speed improvment.
* compiled with devkitPPC r24 & libogc 1.8.7.
2011-08-07 19:49:46 +02:00
|
|
|
extern void z80_set_irq_line(unsigned int state);
|
|
|
|
extern void z80_set_nmi_line(unsigned int state);
|
2011-07-14 00:49:52 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|