mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
i8087: Replace memory interface with address space finder
m24: Eliminate MCFG_ macros; clean up some comments (nw)
This commit is contained in:
parent
064847316c
commit
1779e0014a
@ -169,7 +169,7 @@ DEFINE_DEVICE_TYPE(I8087, i8087_device, "i8087", "Intel 8087")
|
|||||||
|
|
||||||
i8087_device::i8087_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
|
i8087_device::i8087_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) :
|
||||||
device_t(mconfig, type, tag, owner, clock),
|
device_t(mconfig, type, tag, owner, clock),
|
||||||
device_memory_interface(mconfig, *this),
|
m_space(*this, finder_base::DUMMY_TAG, -1),
|
||||||
m_int_handler(*this),
|
m_int_handler(*this),
|
||||||
m_busy_handler(*this)
|
m_busy_handler(*this)
|
||||||
{
|
{
|
||||||
@ -180,13 +180,6 @@ i8087_device::i8087_device(const machine_config &mconfig, const char *tag, devic
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
device_memory_interface::space_config_vector i8087_device::memory_space_config() const
|
|
||||||
{
|
|
||||||
return space_config_vector {
|
|
||||||
std::make_pair(AS_PROGRAM, &m_space_config),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
void i8087_device::device_start()
|
void i8087_device::device_start()
|
||||||
{
|
{
|
||||||
save_item(NAME(m_reg[0].high));
|
save_item(NAME(m_reg[0].high));
|
||||||
@ -222,11 +215,6 @@ void i8087_device::device_start()
|
|||||||
build_opcode_table();
|
build_opcode_table();
|
||||||
}
|
}
|
||||||
|
|
||||||
void i8087_device::device_config_complete()
|
|
||||||
{
|
|
||||||
m_space_config = address_space_config("program", ENDIANNESS_LITTLE, m_data_width, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
void i8087_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
void i8087_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||||
{
|
{
|
||||||
m_busy_handler(1);
|
m_busy_handler(1);
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
DECLARE_DEVICE_TYPE(I8087, i8087_device)
|
DECLARE_DEVICE_TYPE(I8087, i8087_device)
|
||||||
|
|
||||||
class i8087_device : public device_t,
|
class i8087_device : public device_t
|
||||||
public device_memory_interface
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
i8087_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
i8087_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||||
void set_data_width(u8 data_width) { m_data_width = data_width; }
|
template <class Object> void set_space_88(Object &&tag, int spacenum) { m_space.set_tag(std::forward<Object>(tag), spacenum); m_space.set_data_width(8); }
|
||||||
|
template <class Object> void set_space_86(Object &&tag, int spacenum) { m_space.set_tag(std::forward<Object>(tag), spacenum); m_space.set_data_width(16); }
|
||||||
auto irq() { return m_int_handler.bind(); }
|
auto irq() { return m_int_handler.bind(); }
|
||||||
auto busy() { return m_busy_handler.bind(); }
|
auto busy() { return m_busy_handler.bind(); }
|
||||||
|
|
||||||
@ -26,13 +26,13 @@ protected:
|
|||||||
i8087_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
|
i8087_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
|
||||||
virtual void device_start() override;
|
virtual void device_start() override;
|
||||||
virtual void device_reset() override;
|
virtual void device_reset() override;
|
||||||
virtual void device_config_complete() override;
|
|
||||||
virtual space_config_vector memory_space_config() const override;
|
|
||||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
address_space &space() { return *m_space; }
|
||||||
|
|
||||||
typedef void (i8087_device::*x87_func)(u8 modrm);
|
typedef void (i8087_device::*x87_func)(u8 modrm);
|
||||||
address_space_config m_space_config;
|
required_address_space m_space;
|
||||||
devcb_write_line m_int_handler;
|
devcb_write_line m_int_handler;
|
||||||
devcb_write_line m_busy_handler;
|
devcb_write_line m_busy_handler;
|
||||||
emu_timer *m_timer;
|
emu_timer *m_timer;
|
||||||
@ -45,7 +45,6 @@ private:
|
|||||||
u16 m_cw;
|
u16 m_cw;
|
||||||
u16 m_sw;
|
u16 m_sw;
|
||||||
u16 m_tw;
|
u16 m_tw;
|
||||||
int m_data_width;
|
|
||||||
int m_icount;
|
int m_icount;
|
||||||
|
|
||||||
x87_func m_opcode_table_d8[256];
|
x87_func m_opcode_table_d8[256];
|
||||||
|
@ -475,8 +475,7 @@ void a7150_state::a7150(machine_config &config)
|
|||||||
m_maincpu->esc_data_handler().set("i8087", FUNC(i8087_device::addr_w));
|
m_maincpu->esc_data_handler().set("i8087", FUNC(i8087_device::addr_w));
|
||||||
|
|
||||||
i8087_device &i8087(I8087(config, "i8087", XTAL(9'832'000)/2));
|
i8087_device &i8087(I8087(config, "i8087", XTAL(9'832'000)/2));
|
||||||
i8087.set_addrmap(AS_PROGRAM, &a7150_state::a7150_mem);
|
i8087.set_space_86(m_maincpu, AS_PROGRAM);
|
||||||
i8087.set_data_width(16);
|
|
||||||
i8087.irq().set(m_pic8259, FUNC(pic8259_device::ir0_w));
|
i8087.irq().set(m_pic8259, FUNC(pic8259_device::ir0_w));
|
||||||
i8087.busy().set_inputline("maincpu", INPUT_LINE_TEST);
|
i8087.busy().set_inputline("maincpu", INPUT_LINE_TEST);
|
||||||
|
|
||||||
|
@ -956,8 +956,7 @@ void fanucspmg_state::fanucspmg(machine_config &config)
|
|||||||
m_maincpu->esc_data_handler().set("i8087", FUNC(i8087_device::addr_w));
|
m_maincpu->esc_data_handler().set("i8087", FUNC(i8087_device::addr_w));
|
||||||
|
|
||||||
i8087_device &i8087(I8087(config, "i8087", XTAL(15'000'000)/3));
|
i8087_device &i8087(I8087(config, "i8087", XTAL(15'000'000)/3));
|
||||||
i8087.set_addrmap(AS_PROGRAM, &fanucspmg_state::maincpu_mem);
|
i8087.set_space_86(m_maincpu, AS_PROGRAM);
|
||||||
i8087.set_data_width(16);
|
|
||||||
//i8087.irq().set_inputline("maincpu", INPUT_LINE_NMI); // TODO: presumably this is connected to the pic
|
//i8087.irq().set_inputline("maincpu", INPUT_LINE_NMI); // TODO: presumably this is connected to the pic
|
||||||
i8087.busy().set_inputline("maincpu", INPUT_LINE_TEST);
|
i8087.busy().set_inputline("maincpu", INPUT_LINE_TEST);
|
||||||
|
|
||||||
|
@ -133,7 +133,6 @@ private:
|
|||||||
void m24_state::machine_start()
|
void m24_state::machine_start()
|
||||||
{
|
{
|
||||||
m_maincpu->space(AS_PROGRAM).install_ram(0, m_ram->size() - 1, m_ram->pointer());
|
m_maincpu->space(AS_PROGRAM).install_ram(0, m_ram->size() - 1, m_ram->pointer());
|
||||||
subdevice<i8087_device>("ndp")->space(0).install_ram(0, m_ram->size() - 1, m_ram->pointer());
|
|
||||||
|
|
||||||
std::fill_n(&m_dma_segment[0], 4, 0);
|
std::fill_n(&m_dma_segment[0], 4, 0);
|
||||||
m_dma_active = 0;
|
m_dma_active = 0;
|
||||||
@ -333,12 +332,12 @@ u8 m24_state::ctrlport_b_r()
|
|||||||
{
|
{
|
||||||
// Bit 0 = NC
|
// Bit 0 = NC
|
||||||
// Bit 1 = SW4 (8087 present)
|
// Bit 1 = SW4 (8087 present)
|
||||||
// Bit 2 = ~R11
|
// Bit 2 = ~RI1
|
||||||
// Bit 3 = ~DSR1
|
// Bit 3 = ~DSR1
|
||||||
// Bit 4 = OUT2 (8253)
|
// Bit 4 = OUT2 (8253)
|
||||||
// Bit 5 = SPKR
|
// Bit 5 = SPKR
|
||||||
// Bit 6 = IOCHK
|
// Bit 6 = IOCHK
|
||||||
// Bit 7 = memory parity error (page 4)
|
// Bit 7 = MBMERR (MRD parity check)
|
||||||
|
|
||||||
if (BIT(m_dsw0->read(), 4))
|
if (BIT(m_dsw0->read(), 4))
|
||||||
m_ctrlport_b |= 0x02;
|
m_ctrlport_b |= 0x02;
|
||||||
@ -522,7 +521,8 @@ void m24_state::cfg_m20_format(device_t *device)
|
|||||||
device->subdevice<floppy_connector>("fdc:1")->set_formats(m24_state::floppy_formats);
|
device->subdevice<floppy_connector>("fdc:1")->set_formats(m24_state::floppy_formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
MACHINE_CONFIG_START(m24_state::olivetti)
|
void m24_state::olivetti(machine_config &config)
|
||||||
|
{
|
||||||
/* basic machine hardware */
|
/* basic machine hardware */
|
||||||
I8086(config, m_maincpu, 24_MHz_XTAL / 3);
|
I8086(config, m_maincpu, 24_MHz_XTAL / 3);
|
||||||
m_maincpu->set_addrmap(AS_PROGRAM, &m24_state::m24_map);
|
m_maincpu->set_addrmap(AS_PROGRAM, &m24_state::m24_map);
|
||||||
@ -532,8 +532,7 @@ MACHINE_CONFIG_START(m24_state::olivetti)
|
|||||||
m_maincpu->esc_data_handler().set("ndp", FUNC(i8087_device::addr_w));
|
m_maincpu->esc_data_handler().set("ndp", FUNC(i8087_device::addr_w));
|
||||||
|
|
||||||
i8087_device &i8087(I8087(config, "ndp", 24_MHz_XTAL / 3));
|
i8087_device &i8087(I8087(config, "ndp", 24_MHz_XTAL / 3));
|
||||||
i8087.set_addrmap(AS_PROGRAM, &m24_state::m24_map);
|
i8087.set_space_86(m_maincpu, AS_PROGRAM);
|
||||||
i8087.set_data_width(16);
|
|
||||||
i8087.irq().set(FUNC(m24_state::int87_w));
|
i8087.irq().set(FUNC(m24_state::int87_w));
|
||||||
i8087.busy().set_inputline(m_maincpu, INPUT_LINE_TEST);
|
i8087.busy().set_inputline(m_maincpu, INPUT_LINE_TEST);
|
||||||
|
|
||||||
@ -581,15 +580,14 @@ MACHINE_CONFIG_START(m24_state::olivetti)
|
|||||||
m_isabus->drq3_callback().set(m_dmac, FUNC(am9517a_device::dreq3_w));
|
m_isabus->drq3_callback().set(m_dmac, FUNC(am9517a_device::dreq3_w));
|
||||||
m_isabus->iochck_callback().set(FUNC(m24_state::chck_w));
|
m_isabus->iochck_callback().set(FUNC(m24_state::chck_w));
|
||||||
|
|
||||||
MCFG_DEVICE_ADD("mb1", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, "cga_m24", true)
|
ISA8_SLOT(config, "mb1", 0, m_isabus, pc_isa8_cards, "cga_m24", true);
|
||||||
MCFG_DEVICE_ADD("mb2", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, "fdc_xt", true)
|
ISA8_SLOT(config, "mb2", 0, m_isabus, pc_isa8_cards, "fdc_xt", true).set_option_machine_config("fdc_xt", cfg_m20_format);
|
||||||
MCFG_SLOT_OPTION_MACHINE_CONFIG("fdc_xt", cfg_m20_format)
|
ISA8_SLOT(config, "mb3", 0, m_isabus, pc_isa8_cards, "lpt", true);
|
||||||
MCFG_DEVICE_ADD("mb3", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, "lpt", true)
|
ISA8_SLOT(config, "mb4", 0, m_isabus, pc_isa8_cards, "com", true);
|
||||||
MCFG_DEVICE_ADD("mb4", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, "com", true)
|
|
||||||
|
|
||||||
MCFG_DEVICE_ADD("isa1", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, nullptr, false)
|
ISA8_SLOT(config, "isa1", 0, m_isabus, pc_isa8_cards, nullptr, false);
|
||||||
MCFG_DEVICE_ADD("isa2", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, nullptr, false)
|
ISA8_SLOT(config, "isa2", 0, m_isabus, pc_isa8_cards, nullptr, false);
|
||||||
MCFG_DEVICE_ADD("isa3", ISA8_SLOT, 0, m_isabus, pc_isa8_cards, nullptr, false)
|
ISA8_SLOT(config, "isa3", 0, m_isabus, pc_isa8_cards, nullptr, false);
|
||||||
|
|
||||||
/* internal ram */
|
/* internal ram */
|
||||||
RAM(config, m_ram).set_default_size("640K").set_extra_options("64K, 128K, 256K, 512K");
|
RAM(config, m_ram).set_default_size("640K").set_extra_options("64K, 128K, 256K, 512K");
|
||||||
@ -607,12 +605,12 @@ MACHINE_CONFIG_START(m24_state::olivetti)
|
|||||||
mm58174an.set_mode24(1); // ?
|
mm58174an.set_mode24(1); // ?
|
||||||
mm58174an.set_day1(1); // ?
|
mm58174an.set_day1(1); // ?
|
||||||
|
|
||||||
M24_Z8000(config, m_z8000_apb, 0);
|
M24_Z8000(config, m_z8000_apb, 0); // TODO: make this a slot device (uses custom bus connector)
|
||||||
m_z8000_apb->halt_callback().set(FUNC(m24_state::halt_i86_w));
|
m_z8000_apb->halt_callback().set(FUNC(m24_state::halt_i86_w));
|
||||||
|
|
||||||
/* software lists */
|
/* software lists */
|
||||||
MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150")
|
SOFTWARE_LIST(config, "disk_list").set_original("ibm5150");
|
||||||
MACHINE_CONFIG_END
|
}
|
||||||
|
|
||||||
ROM_START( m24 )
|
ROM_START( m24 )
|
||||||
ROM_REGION16_LE(0x8000,"bios", 0)
|
ROM_REGION16_LE(0x8000,"bios", 0)
|
||||||
|
@ -232,8 +232,7 @@ MACHINE_CONFIG_START(mbc55x_state::mbc55x)
|
|||||||
m_maincpu->esc_data_handler().set("coproc", FUNC(i8087_device::addr_w));
|
m_maincpu->esc_data_handler().set("coproc", FUNC(i8087_device::addr_w));
|
||||||
|
|
||||||
i8087_device &i8087(I8087(config, "coproc", 14.318181_MHz_XTAL / 4));
|
i8087_device &i8087(I8087(config, "coproc", 14.318181_MHz_XTAL / 4));
|
||||||
i8087.set_addrmap(AS_PROGRAM, &mbc55x_state::mbc55x_mem);
|
i8087.set_space_88(m_maincpu, AS_PROGRAM);
|
||||||
i8087.set_data_width(8);
|
|
||||||
i8087.irq().set(m_pic, FUNC(pic8259_device::ir6_w));
|
i8087.irq().set(m_pic, FUNC(pic8259_device::ir6_w));
|
||||||
i8087.busy().set_inputline("maincpu", INPUT_LINE_TEST);
|
i8087.busy().set_inputline("maincpu", INPUT_LINE_TEST);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user