diff options
Diffstat (limited to 'src/mame/drivers/spectrum.cpp')
-rw-r--r-- | src/mame/drivers/spectrum.cpp | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/src/mame/drivers/spectrum.cpp b/src/mame/drivers/spectrum.cpp index 26d8263160f..445b4ae16f5 100644 --- a/src/mame/drivers/spectrum.cpp +++ b/src/mame/drivers/spectrum.cpp @@ -292,27 +292,19 @@ SamRam /****************************************************************************************************/ /* Spectrum 48k functions */ -READ8_MEMBER(spectrum_state::opcode_fetch_r) -{ - /* this allows expansion devices to act upon opcode fetches from MEM addresses */ - m_exp->opcode_fetch(offset); - - return m_maincpu->space(AS_PROGRAM).read_byte(offset); -} - WRITE8_MEMBER(spectrum_state::spectrum_rom_w) { if (m_exp->romcs()) - m_exp->mreq_w(offset, data); + m_exp->mreq_w(space, offset, data); } READ8_MEMBER(spectrum_state::spectrum_rom_r) { uint8_t data; - if (m_exp->romcs()) - data = m_exp->mreq_r(offset); - else + data = m_exp->mreq_r(space, offset); + + if (!m_exp->romcs()) data = memregion("maincpu")->base()[offset]; return data; @@ -368,10 +360,6 @@ READ8_MEMBER(spectrum_state::spectrum_port_fe_r) int joy1 = m_io_joy1.read_safe(0x1f) & 0x1f; int joy2 = m_io_joy2.read_safe(0x1f) & 0x1f; - /* expansion port */ - if (m_exp) - data = m_exp->iorq_r(offset); - /* Caps - V */ if ((lines & 1) == 0) { @@ -422,9 +410,13 @@ READ8_MEMBER(spectrum_state::spectrum_port_fe_r) data &= ~0x40; } + /* expansion port */ + if (m_exp) + data &= m_exp->port_fe_r(space, offset); + /* Issue 2 Spectrums default to having bits 5, 6 & 7 set. Issue 3 Spectrums default to having bits 5 & 7 set and bit 6 reset. */ - if ((m_io_config->read() & 0x80) == 0) + if (m_io_config->read() & 0x80) data ^= (0x40); return data; @@ -443,22 +435,16 @@ void spectrum_state::spectrum_mem(address_map &map) { map(0x0000, 0x3fff).rw(FUNC(spectrum_state::spectrum_rom_r), FUNC(spectrum_state::spectrum_rom_w)); map(0x4000, 0x5aff).ram().share("video_ram"); - //map(0x5b00, 0x7fff).ram(); - //map(0x8000, 0xffff).ram(); -} - -void spectrum_state::spectrum_fetch(address_map &map) -{ - map(0x0000, 0xffff).r(FUNC(spectrum_state::opcode_fetch_r)); + // AM_RANGE(0x5b00, 0x7fff) AM_RAM + // AM_RANGE(0x8000, 0xffff) AM_RAM } /* ports are not decoded full. The function decodes the ports appropriately */ void spectrum_state::spectrum_io(address_map &map) { - map(0x0000, 0xffff).rw(m_exp, FUNC(spectrum_expansion_slot_device::iorq_r), FUNC(spectrum_expansion_slot_device::iorq_w)); map(0x00, 0x00).rw(FUNC(spectrum_state::spectrum_port_fe_r), FUNC(spectrum_state::spectrum_port_fe_w)).select(0xfffe); - map(0x01, 0x01).r(FUNC(spectrum_state::spectrum_port_ula_r)); // .mirror(0xfffe); + map(0x01, 0x01).r(FUNC(spectrum_state::spectrum_port_ula_r)).mirror(0xfffe); } /* Input ports */ @@ -631,6 +617,9 @@ void spectrum_state::init_spectrum() case 16*1024: space.install_ram(0x5b00, 0x7fff, nullptr); } + + // setup expansion slot + m_exp->set_io_space(&m_maincpu->space(AS_IO)); } MACHINE_RESET_MEMBER(spectrum_state,spectrum) @@ -679,13 +668,12 @@ INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt) m_irq_off_timer->adjust(m_maincpu->clocks_to_attotime(32)); } -void spectrum_state::spectrum_common(machine_config &config) -{ +MACHINE_CONFIG_START(spectrum_state::spectrum_common) + /* basic machine hardware */ Z80(config, m_maincpu, X1 / 4); /* This is verified only for the ZX Spectrum. Other clones are reported to have different clocks */ m_maincpu->set_addrmap(AS_PROGRAM, &spectrum_state::spectrum_mem); m_maincpu->set_addrmap(AS_IO, &spectrum_state::spectrum_io); - m_maincpu->set_addrmap(AS_OPCODES, &spectrum_state::spectrum_fetch); m_maincpu->set_vblank_int("screen", FUNC(spectrum_state::spec_interrupt)); config.m_minimum_quantum = attotime::from_hz(60); @@ -715,10 +703,10 @@ void spectrum_state::spectrum_common(machine_config &config) m_exp->nmi_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); /* devices */ - snapshot_image_device &snapshot(SNAPSHOT(config, "snapshot")); - snapshot.set_handler(snapquick_load_delegate(&SNAPSHOT_LOAD_NAME(spectrum_state, spectrum), this), "ach,frz,plusd,prg,sem,sit,sna,snp,snx,sp,z80,zx"); - quickload_image_device &quickload(QUICKLOAD(config, "quickload")); - quickload.set_handler(snapquick_load_delegate(&QUICKLOAD_LOAD_NAME(spectrum_state, spectrum), this), "raw,scr", attotime::from_seconds(2)); // The delay prevents the screen from being cleared by the RAM test at boot + snapshot_image_device &snapshot(SNAPSHOT(config, "snapshot", 0)); + snapshot.set_handler(snapquick_load_delegate(&SNAPSHOT_LOAD_NAME(spectrum_state, spectrum), this), "ach,frz,plusd,prg,sem,sit,sna,snp,snx,sp,z80,zx", 0); + quickload_image_device &quickload(QUICKLOAD(config, "quickload", 0)); + quickload.set_handler(snapquick_load_delegate(&QUICKLOAD_LOAD_NAME(spectrum_state, spectrum), this), "raw,scr", 2); // The delay prevents the screen from being cleared by the RAM test at boot CASSETTE(config, m_cassette); m_cassette->set_formats(tzx_cassette_formats); @@ -726,7 +714,7 @@ void spectrum_state::spectrum_common(machine_config &config) m_cassette->set_interface("spectrum_cass"); SOFTWARE_LIST(config, "cass_list").set_original("spectrum_cass"); -} +MACHINE_CONFIG_END void spectrum_state::spectrum(machine_config &config) { |