mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
push forward with the spectrum betadisc stuff, now system at least boots with it enabled (nw) (#5576)
* work towards betadisc (nw) * work towards older betadisk support (nw) * some refactoring (nw) * add note from Metallic (nw)
This commit is contained in:
parent
49a844fc7b
commit
d673a392f1
@ -60,8 +60,23 @@
|
||||
separate as the enable / disable mechanisms are different and
|
||||
remaining mappings of devices unconfirmed
|
||||
|
||||
These devices are not currently working as the disable logic is
|
||||
not understood.
|
||||
---
|
||||
|
||||
Based on older BDI schematics, it seems the logic is like:
|
||||
|
||||
memory access 0x3CXX (any type of access: code or data, read or write) -> temporary use BDI ROM (NOT permanent latch/switch like in beta128)
|
||||
memory access <0x4000 area and BDI ROM_latch==true -> use BDI ROM
|
||||
|
||||
IO write to port 0bxxxxxx00 -> D7 master_latch, 0=enable, 1=disable
|
||||
|
||||
while master_latch is enabled access to regular Spectrum IO is blocked (output /IORQ forced to 1) but enabled BDI ports:
|
||||
|
||||
IO write to port 0b1xxxx111 -> D7 BDI ROM_latch (0=enable, 1=disble), D6 - FDC DDEN, D4 - SIDE, D3 - FDC HLT, D2 - FDC /MR (reset), D0-1 - floppy drive select.
|
||||
IO read port 0b1xxxx111 <- D7 - FDC INTRQ, D6 - FDC DRQ
|
||||
IO read/write ports 0b0YYxx111 - access FDC ports YY
|
||||
|
||||
So mostly the same as beta128, except for new BDI ROM_latch bit
|
||||
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
@ -266,6 +281,8 @@ void spectrum_betav2_device::device_reset()
|
||||
{
|
||||
// always paged in on boot? (no mode switch like beta128)
|
||||
m_romcs = 1;
|
||||
m_romlatch = 0;
|
||||
// m_masterportdisable = 1;
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@ -277,30 +294,42 @@ READ_LINE_MEMBER(spectrum_betav2_device::romcs)
|
||||
return m_romcs | m_exp->romcs();
|
||||
}
|
||||
|
||||
|
||||
void spectrum_betav2_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_betav2_device::fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch(offset);
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
if ((offset & 0xff00) == 0x3c00)
|
||||
m_romcs = 1;
|
||||
else
|
||||
m_romcs = 0;
|
||||
|
||||
// how does the ROM get disabled on these older beta units
|
||||
// there are no RETs that end up in RAM as with the 128
|
||||
// so it looks like jumps to the 0xxx and 1xxx regions, but
|
||||
// that doesn't work?
|
||||
if (!m_romlatch)
|
||||
{
|
||||
if (offset < 0x4000)
|
||||
m_romcs = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void spectrum_betav2_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
fetch(offset);
|
||||
}
|
||||
|
||||
void spectrum_betav2_device::pre_data_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->pre_data_fetch(offset);
|
||||
fetch(offset);
|
||||
}
|
||||
|
||||
uint8_t spectrum_betav2_device::iorq_r(offs_t offset)
|
||||
{
|
||||
uint8_t data = m_exp->iorq_r(offset);
|
||||
|
||||
#if 0 // this is the Beta 128 logic, it may or may not be the same here
|
||||
// if (!m_masterportdisable)
|
||||
if (m_romcs)
|
||||
{
|
||||
{
|
||||
switch (offset & 0xff)
|
||||
{
|
||||
case 0x1f: case 0x3f: case 0x5f: case 0x7f:
|
||||
@ -314,14 +343,18 @@ uint8_t spectrum_betav2_device::iorq_r(offs_t offset)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void spectrum_betav2_device::iorq_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
#if 0 // this is the Beta 128 logic, it may or may not be the same here
|
||||
// if ((offset & 0x03) == 0x00)
|
||||
// {
|
||||
// m_masterportdisable = data & 0x80;
|
||||
// }
|
||||
|
||||
// if (!m_masterportdisable)
|
||||
if (m_romcs)
|
||||
{
|
||||
switch (offset & 0xff)
|
||||
@ -331,6 +364,8 @@ void spectrum_betav2_device::iorq_w(offs_t offset, uint8_t data)
|
||||
break;
|
||||
|
||||
case 0xff:
|
||||
m_romlatch = data & 0x80;
|
||||
|
||||
floppy_image_device* floppy = m_floppy[data & 3]->get_device();
|
||||
|
||||
m_fdc->set_floppy(floppy);
|
||||
@ -356,7 +391,7 @@ void spectrum_betav2_device::iorq_w(offs_t offset, uint8_t data)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
m_exp->iorq_w(offset, data);
|
||||
}
|
||||
|
||||
@ -400,6 +435,7 @@ INPUT_CHANGED_MEMBER(spectrum_betaplus_device::magic_button)
|
||||
{
|
||||
m_slot->nmi_w(ASSERT_LINE);
|
||||
m_romcs = 1;
|
||||
m_romlatch = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -40,7 +40,8 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_data_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
@ -53,6 +54,10 @@ protected:
|
||||
required_device<spectrum_expansion_slot_device> m_exp;
|
||||
|
||||
int m_romcs;
|
||||
int m_romlatch;
|
||||
// int m_masterportdisable;
|
||||
|
||||
void fetch(offs_t offset);
|
||||
};
|
||||
|
||||
class spectrum_betav3_device :
|
||||
|
@ -176,9 +176,9 @@ READ_LINE_MEMBER(spectrum_beta128_device::romcs)
|
||||
}
|
||||
|
||||
|
||||
void spectrum_beta128_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_beta128_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
|
@ -101,20 +101,28 @@ READ_LINE_MEMBER(spectrum_expansion_slot_device::romcs)
|
||||
// fetch_r
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_expansion_slot_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_expansion_slot_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->opcode_fetch(offset);
|
||||
m_card->pre_opcode_fetch(offset);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// fetch_r
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_expansion_slot_device::opcode_fetch_post(offs_t offset)
|
||||
void spectrum_expansion_slot_device::post_opcode_fetch(offs_t offset)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->opcode_fetch_post(offset);
|
||||
m_card->post_opcode_fetch(offset);
|
||||
}
|
||||
|
||||
void spectrum_expansion_slot_device::pre_data_fetch(offs_t offset)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->pre_data_fetch(offset);
|
||||
}
|
||||
|
||||
void spectrum_expansion_slot_device::post_data_fetch(offs_t offset)
|
||||
{
|
||||
if (m_card)
|
||||
m_card->post_data_fetch(offset);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -73,8 +73,11 @@ public:
|
||||
auto irq_handler() { return m_irq_handler.bind(); }
|
||||
auto nmi_handler() { return m_nmi_handler.bind(); }
|
||||
|
||||
void opcode_fetch(offs_t offset);
|
||||
void opcode_fetch_post(offs_t offset);
|
||||
void pre_opcode_fetch(offs_t offset);
|
||||
void post_opcode_fetch(offs_t offset);
|
||||
void pre_data_fetch(offs_t offset);
|
||||
void post_data_fetch(offs_t offset);
|
||||
|
||||
uint8_t mreq_r(offs_t offset);
|
||||
void mreq_w(offs_t offset, uint8_t data);
|
||||
uint8_t iorq_r(offs_t offset);
|
||||
@ -107,8 +110,10 @@ public:
|
||||
device_spectrum_expansion_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
// reading and writing
|
||||
virtual void opcode_fetch(offs_t offset) { };
|
||||
virtual void opcode_fetch_post(offs_t offset) { };
|
||||
virtual void pre_opcode_fetch(offs_t offset) { };
|
||||
virtual void post_opcode_fetch(offs_t offset) { };
|
||||
virtual void pre_data_fetch(offs_t offset) { };
|
||||
virtual void post_data_fetch(offs_t offset) { };
|
||||
virtual uint8_t mreq_r(offs_t offset) { return 0xff; }
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) { }
|
||||
virtual uint8_t iorq_r(offs_t offset) { return 0xff; }
|
||||
|
@ -93,9 +93,9 @@ READ_LINE_MEMBER(spectrum_fuller_device::romcs)
|
||||
return m_exp->romcs();
|
||||
}
|
||||
|
||||
void spectrum_fuller_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_fuller_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
}
|
||||
|
||||
uint8_t spectrum_fuller_device::mreq_r(offs_t offset)
|
||||
|
@ -37,7 +37,7 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
|
@ -111,9 +111,9 @@ READ_LINE_MEMBER(spectrum_intf1_device::romcs)
|
||||
// the Interface 1 looks for specific bus conditions to enable / disable the expansion overlay ROM
|
||||
|
||||
// the enable must occur BEFORE the opcode is fetched, as the opcode must be fetched from the expansion ROM
|
||||
void spectrum_intf1_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_intf1_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
@ -127,9 +127,9 @@ void spectrum_intf1_device::opcode_fetch(offs_t offset)
|
||||
}
|
||||
|
||||
// the disable must occur AFTER the opcode fetch, or the incorrect opcode is fetched for 0x0700
|
||||
void spectrum_intf1_device::opcode_fetch_post(offs_t offset)
|
||||
void spectrum_intf1_device::post_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch_post(offset);
|
||||
m_exp->post_opcode_fetch(offset);
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
|
@ -37,8 +37,8 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void opcode_fetch_post(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual void post_opcode_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
|
@ -69,9 +69,9 @@ READ_LINE_MEMBER(spectrum_melodik_device::romcs)
|
||||
return m_exp->romcs();
|
||||
}
|
||||
|
||||
void spectrum_melodik_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_melodik_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
}
|
||||
|
||||
uint8_t spectrum_melodik_device::mreq_r(offs_t offset)
|
||||
|
@ -36,7 +36,7 @@ protected:
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
|
@ -177,9 +177,9 @@ READ_LINE_MEMBER(spectrum_mface1_device::romcs)
|
||||
return m_romcs | m_exp->romcs();
|
||||
}
|
||||
|
||||
void spectrum_mface1_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_mface1_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
|
@ -162,9 +162,9 @@ READ_LINE_MEMBER(spectrum_opus_device::romcs)
|
||||
return m_romcs | m_exp->romcs();
|
||||
}
|
||||
|
||||
void spectrum_opus_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_opus_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ protected:
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
|
@ -76,10 +76,10 @@ READ_LINE_MEMBER(spectrum_uslot_device::romcs)
|
||||
return m_exp1->romcs() | m_exp2->romcs();
|
||||
}
|
||||
|
||||
void spectrum_uslot_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_uslot_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp1->opcode_fetch(offset);
|
||||
m_exp2->opcode_fetch(offset);
|
||||
m_exp1->pre_opcode_fetch(offset);
|
||||
m_exp2->pre_opcode_fetch(offset);
|
||||
}
|
||||
|
||||
uint8_t spectrum_uslot_device::mreq_r(offs_t offset)
|
||||
|
@ -36,7 +36,7 @@ protected:
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
|
@ -83,7 +83,7 @@ READ_LINE_MEMBER(spectrum_usource_device::romcs)
|
||||
return m_romcs;
|
||||
}
|
||||
|
||||
void spectrum_usource_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_usource_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
if (!machine().side_effects_disabled() && (offset == 0x2bae))
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ protected:
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
|
||||
|
@ -99,7 +99,7 @@ READ_LINE_MEMBER(spectrum_uspeech_device::romcs)
|
||||
return m_romcs;
|
||||
}
|
||||
|
||||
void spectrum_uspeech_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_uspeech_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
if (!machine().side_effects_disabled() && (offset == 0x0038))
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual DECLARE_READ_LINE_MEMBER(romcs) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
|
@ -106,9 +106,9 @@ READ_LINE_MEMBER(spectrum_wafa_device::romcs)
|
||||
return m_romcs | m_exp->romcs();
|
||||
}
|
||||
|
||||
void spectrum_wafa_device::opcode_fetch(offs_t offset)
|
||||
void spectrum_wafa_device::pre_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
@ -124,9 +124,9 @@ void spectrum_wafa_device::opcode_fetch(offs_t offset)
|
||||
}
|
||||
}
|
||||
|
||||
void spectrum_wafa_device::opcode_fetch_post(offs_t offset)
|
||||
void spectrum_wafa_device::post_opcode_fetch(offs_t offset)
|
||||
{
|
||||
m_exp->opcode_fetch_post(offset);
|
||||
m_exp->post_opcode_fetch(offset);
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
|
@ -39,8 +39,8 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
virtual void opcode_fetch(offs_t offset) override;
|
||||
virtual void opcode_fetch_post(offs_t offset) override;
|
||||
virtual void pre_opcode_fetch(offs_t offset) override;
|
||||
virtual void post_opcode_fetch(offs_t offset) override;
|
||||
virtual uint8_t mreq_r(offs_t offset) override;
|
||||
virtual void mreq_w(offs_t offset, uint8_t data) override;
|
||||
virtual uint8_t iorq_r(offs_t offset) override;
|
||||
|
@ -165,7 +165,7 @@ resulting mess can be seen in the F4 viewer display.
|
||||
/****************************************************************************************************/
|
||||
/* Spectrum 128 specific functions */
|
||||
|
||||
READ8_MEMBER(spectrum_state::spectrum_128_opcode_fetch_r)
|
||||
READ8_MEMBER(spectrum_state::spectrum_128_pre_opcode_fetch_r)
|
||||
{
|
||||
/* this allows expansion devices to act upon opcode fetches from MEM addresses */
|
||||
if (BIT(m_port_7ffd_data, 4))
|
||||
@ -174,9 +174,9 @@ READ8_MEMBER(spectrum_state::spectrum_128_opcode_fetch_r)
|
||||
for example, interface1 detection fetches requires fetches at 0008 / 0708 to
|
||||
enable paged ROM and then fetches at 0700 to disable it
|
||||
*/
|
||||
m_exp->opcode_fetch(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
uint8_t retval = m_maincpu->space(AS_PROGRAM).read_byte(offset);
|
||||
m_exp->opcode_fetch_post(offset);
|
||||
m_exp->post_opcode_fetch(offset);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ void spectrum_state::spectrum_128_mem(address_map &map)
|
||||
|
||||
void spectrum_state::spectrum_128_fetch(address_map &map)
|
||||
{
|
||||
map(0x0000, 0xffff).r(FUNC(spectrum_state::spectrum_128_opcode_fetch_r));
|
||||
map(0x0000, 0xffff).r(FUNC(spectrum_state::spectrum_128_pre_opcode_fetch_r));
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(spectrum_state,spectrum_128)
|
||||
|
@ -291,18 +291,31 @@ SamRam
|
||||
/****************************************************************************************************/
|
||||
/* Spectrum 48k functions */
|
||||
|
||||
READ8_MEMBER(spectrum_state::opcode_fetch_r)
|
||||
READ8_MEMBER(spectrum_state::pre_opcode_fetch_r)
|
||||
{
|
||||
/* this allows expansion devices to act upon opcode fetches from MEM addresses
|
||||
for example, interface1 detection fetches requires fetches at 0008 / 0708 to
|
||||
enable paged ROM and then fetches at 0700 to disable it
|
||||
*/
|
||||
m_exp->opcode_fetch(offset);
|
||||
uint8_t retval = m_maincpu->space(AS_PROGRAM).read_byte(offset);
|
||||
m_exp->opcode_fetch_post(offset);
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
uint8_t retval = m_specmem->space(AS_PROGRAM).read_byte(offset);
|
||||
m_exp->post_opcode_fetch(offset);
|
||||
return retval;
|
||||
}
|
||||
|
||||
READ8_MEMBER(spectrum_state::spectrum_data_r)
|
||||
{
|
||||
m_exp->pre_data_fetch(offset);
|
||||
uint8_t retval = m_specmem->space(AS_PROGRAM).read_byte(offset);
|
||||
m_exp->post_data_fetch(offset);
|
||||
return retval;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(spectrum_state::spectrum_data_w)
|
||||
{
|
||||
m_specmem->space(AS_PROGRAM).write_byte(offset,data);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(spectrum_state::spectrum_rom_w)
|
||||
{
|
||||
if (m_exp->romcs())
|
||||
@ -442,17 +455,23 @@ READ8_MEMBER(spectrum_state::spectrum_port_ula_r)
|
||||
|
||||
/* Memory Maps */
|
||||
|
||||
void spectrum_state::spectrum_mem(address_map &map)
|
||||
void spectrum_state::spectrum_map(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");
|
||||
// installed later depending on ramsize
|
||||
//map(0x5b00, 0x7fff).ram();
|
||||
//map(0x8000, 0xffff).ram();
|
||||
}
|
||||
|
||||
void spectrum_state::spectrum_fetch(address_map &map)
|
||||
void spectrum_state::spectrum_opcodes(address_map &map)
|
||||
{
|
||||
map(0x0000, 0xffff).r(FUNC(spectrum_state::opcode_fetch_r));
|
||||
map(0x0000, 0xffff).rw(FUNC(spectrum_state::spectrum_data_r), FUNC(spectrum_state::spectrum_data_w));
|
||||
}
|
||||
|
||||
void spectrum_state::spectrum_data(address_map &map)
|
||||
{
|
||||
map(0x0000, 0xffff).r(FUNC(spectrum_state::pre_opcode_fetch_r));
|
||||
}
|
||||
|
||||
/* ports are not decoded full.
|
||||
@ -625,14 +644,12 @@ INPUT_PORTS_END
|
||||
|
||||
void spectrum_state::init_spectrum()
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
|
||||
switch (m_ram->size())
|
||||
{
|
||||
case 48*1024:
|
||||
space.install_ram(0x8000, 0xffff, nullptr); // Fall through
|
||||
m_specmem->space(AS_PROGRAM).install_ram(0x8000, 0xffff, nullptr); // Fall through
|
||||
case 16*1024:
|
||||
space.install_ram(0x5b00, 0x7fff, nullptr);
|
||||
m_specmem->space(AS_PROGRAM).install_ram(0x5b00, 0x7fff, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -686,11 +703,13 @@ void spectrum_state::spectrum_common(machine_config &config)
|
||||
{
|
||||
/* 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_PROGRAM, &spectrum_state::spectrum_opcodes);
|
||||
m_maincpu->set_addrmap(AS_OPCODES, &spectrum_state::spectrum_data);
|
||||
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));
|
||||
|
||||
ADDRESS_MAP_BANK(config, m_specmem).set_map(&spectrum_state::spectrum_map).set_options(ENDIANNESS_LITTLE, 8, 16, 0x10000);
|
||||
|
||||
config.m_minimum_quantum = attotime::from_hz(60);
|
||||
|
||||
MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, spectrum )
|
||||
|
@ -12,7 +12,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "machine/spec_snqk.h"
|
||||
|
||||
#include "machine/bankdev.h"
|
||||
#include "bus/spectrum/exp.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "imagedev/snapquik.h"
|
||||
@ -59,6 +59,8 @@ struct EVENT_LIST_ITEM
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class spectrum_state : public driver_device
|
||||
{
|
||||
public:
|
||||
@ -69,6 +71,7 @@ public:
|
||||
m_screen(*this, "screen"),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_specmem(*this, "specmem"),
|
||||
m_speaker(*this, "speaker"),
|
||||
m_exp(*this, "exp"),
|
||||
m_io_line0(*this, "LINE0"),
|
||||
@ -97,6 +100,7 @@ public:
|
||||
void init_spectrum();
|
||||
|
||||
protected:
|
||||
|
||||
enum
|
||||
{
|
||||
TIMER_IRQ_ON,
|
||||
@ -135,14 +139,17 @@ protected:
|
||||
|
||||
uint8_t *m_ram_0000;
|
||||
uint8_t m_ram_disabled_by_beta;
|
||||
DECLARE_READ8_MEMBER(opcode_fetch_r);
|
||||
DECLARE_READ8_MEMBER(pre_opcode_fetch_r);
|
||||
DECLARE_WRITE8_MEMBER(spectrum_rom_w);
|
||||
DECLARE_READ8_MEMBER(spectrum_rom_r);
|
||||
DECLARE_READ8_MEMBER(spectrum_data_r);
|
||||
DECLARE_WRITE8_MEMBER(spectrum_data_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(spectrum_port_fe_w);
|
||||
DECLARE_READ8_MEMBER(spectrum_port_fe_r);
|
||||
DECLARE_READ8_MEMBER(spectrum_port_ula_r);
|
||||
|
||||
DECLARE_READ8_MEMBER(spectrum_128_opcode_fetch_r);
|
||||
DECLARE_READ8_MEMBER(spectrum_128_pre_opcode_fetch_r);
|
||||
DECLARE_WRITE8_MEMBER(spectrum_128_bank1_w);
|
||||
DECLARE_READ8_MEMBER(spectrum_128_bank1_r);
|
||||
DECLARE_WRITE8_MEMBER(spectrum_128_port_7ffd_w);
|
||||
@ -176,11 +183,13 @@ protected:
|
||||
void spectrum_128_mem(address_map &map);
|
||||
void spectrum_128_fetch(address_map &map);
|
||||
void spectrum_io(address_map &map);
|
||||
void spectrum_mem(address_map &map);
|
||||
void spectrum_fetch(address_map &map);
|
||||
void spectrum_opcodes(address_map &map);
|
||||
void spectrum_map(address_map &map);
|
||||
void spectrum_data(address_map &map);
|
||||
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
required_device<ram_device> m_ram;
|
||||
optional_device<address_map_bank_device> m_specmem;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
optional_device<spectrum_expansion_slot_device> m_exp;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user