summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/spec128.cpp
diff options
context:
space:
mode:
author holub <andrei.holub@gmail.com>2022-04-25 12:08:07 -0400
committer GitHub <noreply@github.com>2022-04-26 02:08:07 +1000
commit44dae68dbb5cd5d9fbb56e919e7bb59644830d2c (patch)
tree16e83588992432d59667aa8b64a24f246746ff55 /src/mame/drivers/spec128.cpp
parentd7cfc3c187f41ce37a3269c84b184b4474a8ef35 (diff)
cpu/z80: Improved timing within instructions. (#9449)
This allows improved emulation of bus contention in the ZX Spectrum family. Also updated Z80 timings for MSX, Amstrad CPC, and Sega System 1/System 2.
Diffstat (limited to 'src/mame/drivers/spec128.cpp')
-rw-r--r--src/mame/drivers/spec128.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mame/drivers/spec128.cpp b/src/mame/drivers/spec128.cpp
index 00394d67a02..03990c326cd 100644
--- a/src/mame/drivers/spec128.cpp
+++ b/src/mame/drivers/spec128.cpp
@@ -165,6 +165,13 @@ resulting mess can be seen in the F4 viewer display.
/****************************************************************************************************/
/* Spectrum 128 specific functions */
+void spectrum_128_state::video_start()
+{
+ m_frame_invert_count = 16;
+ m_screen_location = m_ram->pointer() + (5 << 14);
+ m_contention_pattern = {1, 0, 7, 6, 5, 4, 3, 2};
+}
+
uint8_t spectrum_128_state::spectrum_128_pre_opcode_fetch_r(offs_t offset)
{
/* this allows expansion devices to act upon opcode fetches from MEM addresses
@@ -172,6 +179,7 @@ uint8_t spectrum_128_state::spectrum_128_pre_opcode_fetch_r(offs_t offset)
enable paged ROM and then fetches at 0700 to disable it
*/
m_exp->pre_opcode_fetch(offset);
+ if (is_contended(offset)) content_early();
uint8_t retval = m_maincpu->space(AS_PROGRAM).read_byte(offset);
m_exp->post_opcode_fetch(offset);
return retval;
@@ -291,6 +299,18 @@ void spectrum_128_state::machine_reset()
spectrum_128_update_memory();
}
+bool spectrum_128_state::is_vram_write(offs_t offset) {
+ // TODO respect banks 2,5 mapped to 0xc000
+ return (BIT(m_port_7ffd_data, 3))
+ ? offset >= 0x8000 && offset < 0x9b00
+ : spectrum_state::is_vram_write(offset);
+}
+
+bool spectrum_128_state::is_contended(offs_t offset) {
+ // TODO Unlike the base 128K machine, RAM banks 4, 5, 6 and 7 are contended.
+ return spectrum_state::is_contended(offset);// || (offset >= 0x8000 && offset < 0xc000);
+}
+
static const gfx_layout spectrum_charlayout =
{
8, 8, /* 8 x 8 characters */