mirror of
https://github.com/holub/mame
synced 2025-07-05 01:48:29 +03:00
hp9k_3xx: preliminary support for DIO and DIO-II buses and 98544 video card. [R. Belmont]
This commit is contained in:
parent
4536ab184c
commit
8bf9290a1e
@ -735,6 +735,19 @@ if (BUSES["HPHIL"]~=null) then
|
||||
}
|
||||
end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
--@src/devices/bus/hp_dio/hp_dio.h,BUSES["HPDIO"] = true
|
||||
---------------------------------------------------
|
||||
|
||||
if (BUSES["HPDIO"]~=null) then
|
||||
files {
|
||||
MAME_DIR .. "src/devices/bus/hp_dio/hp_dio.cpp",
|
||||
MAME_DIR .. "src/devices/bus/hp_dio/hp_dio.h",
|
||||
MAME_DIR .. "src/devices/bus/hp_dio/hp98544.cpp",
|
||||
MAME_DIR .. "src/devices/bus/hp_dio/hp98544.h",
|
||||
}
|
||||
end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
|
@ -657,6 +657,7 @@ BUSES["GAMEGEAR"] = true
|
||||
BUSES["GBA"] = true
|
||||
BUSES["GENERIC"] = true
|
||||
BUSES["HPHIL"] = true
|
||||
BUSES["HPDIO"] = true
|
||||
BUSES["IEEE488"] = true
|
||||
BUSES["IMI7000"] = true
|
||||
BUSES["INTV"] = true
|
||||
|
120
src/devices/bus/hp_dio/hp98544.cpp
Normal file
120
src/devices/bus/hp_dio/hp98544.cpp
Normal file
@ -0,0 +1,120 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:R. Belmont
|
||||
/***************************************************************************
|
||||
|
||||
HP98544 high-resolution monochrome board
|
||||
|
||||
VRAM at 0x200000, ROM and registers at 0x560000
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "hp98544.h"
|
||||
#include "screen.h"
|
||||
|
||||
#define HP98544_SCREEN_NAME "98544_screen"
|
||||
#define HP98544_ROM_REGION "98544_rom"
|
||||
|
||||
#define VRAM_SIZE (0x100000)
|
||||
|
||||
ROM_START( hp98544 )
|
||||
ROM_REGION( 0x4000, HP98544_ROM_REGION, ROMREGION_ERASEFF | ROMREGION_BE | ROMREGION_32BIT )
|
||||
ROM_LOAD16_BYTE( "98544_1818-1999.bin", 0x000001, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) )
|
||||
ROM_END
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(HPDIO_98544, dio16_98544_device, "dio98544", "HP98544 high-res monochrome DIO video card")
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
MACHINE_CONFIG_MEMBER( dio16_98544_device::device_add_mconfig )
|
||||
MCFG_SCREEN_ADD(HP98544_SCREEN_NAME, RASTER)
|
||||
MCFG_SCREEN_UPDATE_DEVICE(DEVICE_SELF, dio16_98544_device, screen_update)
|
||||
MCFG_SCREEN_SIZE(1024,768)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1)
|
||||
MCFG_SCREEN_REFRESH_RATE(70)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
//-------------------------------------------------
|
||||
// rom_region - device-specific ROM region
|
||||
//-------------------------------------------------
|
||||
|
||||
const tiny_rom_entry *dio16_98544_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME( hp98544 );
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// dio16_98544_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
dio16_98544_device::dio16_98544_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
dio16_98544_device(mconfig, HPDIO_98544, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
dio16_98544_device::dio16_98544_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, type, tag, owner, clock),
|
||||
device_dio16_card_interface(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void dio16_98544_device::device_start()
|
||||
{
|
||||
// set_nubus_device makes m_slot valid
|
||||
set_dio_device();
|
||||
|
||||
uint8_t *rom = device().machine().root_device().memregion(this->subtag(HP98544_ROM_REGION).c_str())->base();
|
||||
|
||||
m_vram.resize(VRAM_SIZE);
|
||||
m_dio->install_bank(0x200000, 0x2fffff, "bank_98544", reinterpret_cast<uint8_t *>(&m_vram[0]));
|
||||
m_dio->install_bank(0x580000, 0x583fff, "rom_98544", rom);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void dio16_98544_device::device_reset()
|
||||
{
|
||||
memset(&m_vram[0], 0, VRAM_SIZE);
|
||||
|
||||
m_palette[1] = rgb_t(255, 255, 255);
|
||||
m_palette[0] = rgb_t(0, 0, 0);
|
||||
}
|
||||
|
||||
uint32_t dio16_98544_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
uint32_t *scanline;
|
||||
int x, y;
|
||||
uint32_t pixels;
|
||||
|
||||
for (y = 0; y < 768; y++)
|
||||
{
|
||||
scanline = &bitmap.pix32(y);
|
||||
for (x = 0; x < 1024/4; x++)
|
||||
{
|
||||
pixels = m_vram[((y * 256) + x)];
|
||||
|
||||
*scanline++ = m_palette[(pixels>>24) & 1];
|
||||
*scanline++ = m_palette[(pixels>>16) & 1];
|
||||
*scanline++ = m_palette[(pixels>>8) & 1];
|
||||
*scanline++ = m_palette[(pixels & 1)];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
46
src/devices/bus/hp_dio/hp98544.h
Normal file
46
src/devices/bus/hp_dio/hp98544.h
Normal file
@ -0,0 +1,46 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:R. Belmont
|
||||
|
||||
#ifndef MAME_BUS_HPDIO_98544_H
|
||||
#define MAME_BUS_HPDIO_98544_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "hp_dio.h"
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> dio16_98544_device
|
||||
|
||||
class dio16_98544_device :
|
||||
public device_t,
|
||||
public device_dio16_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
dio16_98544_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
dio16_98544_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
private:
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
|
||||
std::vector<uint32_t> m_vram;
|
||||
uint32_t m_palette[2];
|
||||
};
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(HPDIO_98544, dio16_98544_device)
|
||||
|
||||
#endif // MAME_BUS_HPDIO_98544_H
|
328
src/devices/bus/hp_dio/hp_dio.cpp
Normal file
328
src/devices/bus/hp_dio/hp_dio.cpp
Normal file
@ -0,0 +1,328 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic, R. Belmont
|
||||
/***************************************************************************
|
||||
|
||||
HP DIO and DIO-II bus devices
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "hp_dio.h"
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(DIO16_SLOT, dio16_slot_device, "dio16_slot", "16-bit DIO slot")
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// dio16_slot_device - constructor
|
||||
//-------------------------------------------------
|
||||
dio16_slot_device::dio16_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
dio16_slot_device(mconfig, DIO16_SLOT, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
dio16_slot_device::dio16_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, type, tag, owner, clock),
|
||||
device_slot_interface(mconfig, *this),
|
||||
m_owner(nullptr), m_dio_tag(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void dio16_slot_device::static_set_dio16_slot(device_t &device, device_t *owner, const char *dio_tag)
|
||||
{
|
||||
dio16_slot_device &dio_card = dynamic_cast<dio16_slot_device &>(device);
|
||||
dio_card.m_owner = owner;
|
||||
dio_card.m_dio_tag = dio_tag;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void dio16_slot_device::device_start()
|
||||
{
|
||||
device_dio16_card_interface *dev = dynamic_cast<device_dio16_card_interface *>(get_card_device());
|
||||
const device_dio32_card_interface *intf;
|
||||
if (get_card_device() && get_card_device()->interface(intf))
|
||||
fatalerror("DIO32 device in DIO16 slot\n");
|
||||
|
||||
if (dev) device_dio16_card_interface::static_set_diobus(*dev,m_owner->subdevice(m_dio_tag));
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(DIO32_SLOT, dio32_slot_device, "dio32_slot", "32-bit DIO-II slot")
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// dio32_slot_device - constructor
|
||||
//-------------------------------------------------
|
||||
dio32_slot_device::dio32_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
dio16_slot_device(mconfig, DIO32_SLOT, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
void dio32_slot_device::static_set_dio32_slot(device_t &device, device_t *owner, const char *dio_tag)
|
||||
{
|
||||
dio32_slot_device &dio_card = dynamic_cast<dio32_slot_device &>(device);
|
||||
dio_card.m_owner = owner;
|
||||
dio_card.m_dio_tag = dio_tag;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void dio32_slot_device::device_start()
|
||||
{
|
||||
device_dio16_card_interface *dev = dynamic_cast<device_dio16_card_interface *>(get_card_device());
|
||||
if (dev) device_dio16_card_interface::static_set_diobus(*dev,m_owner->subdevice(m_dio_tag));
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// GLOBAL VARIABLES
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(DIO16, dio16_device, "dio16", "16-bit DIO bus")
|
||||
|
||||
void dio16_device::static_set_cputag(device_t &device, const char *tag)
|
||||
{
|
||||
dio16_device &dio = downcast<dio16_device &>(device);
|
||||
dio.m_cputag = tag;
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// dio16_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
dio16_device::dio16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
dio16_device(mconfig, DIO16, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
dio16_device::dio16_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, type, tag, owner, clock),
|
||||
device_memory_interface(mconfig, *this),
|
||||
m_program_config("DIO 16-bit program", ENDIANNESS_LITTLE, 8, 24, 0, nullptr),
|
||||
m_program32_config("DIO-II 32-bit program", ENDIANNESS_LITTLE, 16, 32, 0, nullptr),
|
||||
m_maincpu(nullptr),
|
||||
m_prgspace(nullptr),
|
||||
m_out_irq3_cb(*this),
|
||||
m_out_irq4_cb(*this),
|
||||
m_out_irq5_cb(*this),
|
||||
m_out_irq6_cb(*this),
|
||||
m_cputag(nullptr)
|
||||
{
|
||||
m_prgwidth = 0;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void dio16_device::device_start()
|
||||
{
|
||||
m_out_irq3_cb.resolve_safe();
|
||||
m_out_irq4_cb.resolve_safe();
|
||||
m_out_irq5_cb.resolve_safe();
|
||||
m_out_irq6_cb.resolve_safe();
|
||||
|
||||
m_maincpu = subdevice<cpu_device>(m_cputag);
|
||||
m_prgspace = &m_maincpu->space(AS_PROGRAM);
|
||||
m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->m_databus_width;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void dio16_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void dio16_device::install_space(address_spacenum spacenum, offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
|
||||
{
|
||||
int buswidth;
|
||||
address_space *space;
|
||||
|
||||
if (spacenum == AS_PROGRAM)
|
||||
{
|
||||
space = m_prgspace;
|
||||
buswidth = m_prgwidth;
|
||||
}
|
||||
else
|
||||
{
|
||||
fatalerror("Unknown space passed to dio16_device::install_space!\n");
|
||||
}
|
||||
|
||||
switch(buswidth)
|
||||
{
|
||||
case 16:
|
||||
space->install_readwrite_handler(start, end, rhandler, whandler, 0xffff);
|
||||
break;
|
||||
case 32:
|
||||
if ((start % 4) == 0) {
|
||||
if ((end-start)==1) {
|
||||
space->install_readwrite_handler(start, end+2, rhandler, whandler, 0x0000ffff);
|
||||
} else {
|
||||
space->install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff);
|
||||
}
|
||||
} else {
|
||||
// we handle just misaligned by 2
|
||||
space->install_readwrite_handler(start-2, end, rhandler, whandler, 0xffff0000);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
fatalerror("DIO16: Bus width %d not supported\n", buswidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dio16_device::install_memory(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
|
||||
{
|
||||
install_space(AS_PROGRAM, start, end, rhandler, whandler);
|
||||
}
|
||||
|
||||
void dio16_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
|
||||
{
|
||||
install_space(AS_IO, start, end, rhandler, whandler);
|
||||
}
|
||||
|
||||
|
||||
void dio16_device::install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data)
|
||||
{
|
||||
m_prgspace->install_readwrite_bank(start, end, 0, tag );
|
||||
machine().root_device().membank(m_prgspace->device().siblingtag(tag).c_str())->set_base(data);
|
||||
}
|
||||
|
||||
void dio16_device::unmap_bank(offs_t start, offs_t end)
|
||||
{
|
||||
m_prgspace->unmap_readwrite(start, end);
|
||||
}
|
||||
|
||||
void dio16_device::install_rom(device_t *dev, offs_t start, offs_t end, const char *tag, const char *region)
|
||||
{
|
||||
if (machine().root_device().memregion("dio")) {
|
||||
uint8_t *src = dev->memregion(region)->base();
|
||||
uint8_t *dest = machine().root_device().memregion("dio")->base() + start - 0xc0000;
|
||||
memcpy(dest,src, end - start + 1);
|
||||
} else {
|
||||
m_prgspace->install_read_bank(start, end, 0, tag);
|
||||
m_prgspace->unmap_write(start, end);
|
||||
machine().root_device().membank(m_prgspace->device().siblingtag(tag).c_str())->set_base(machine().root_device().memregion(dev->subtag(region).c_str())->base());
|
||||
}
|
||||
}
|
||||
|
||||
void dio16_device::unmap_rom(offs_t start, offs_t end)
|
||||
{
|
||||
m_prgspace->unmap_read(start, end);
|
||||
}
|
||||
|
||||
// interrupt request from dio card
|
||||
WRITE_LINE_MEMBER( dio16_device::irq3_w ) { m_out_irq3_cb(state); }
|
||||
WRITE_LINE_MEMBER( dio16_device::irq4_w ) { m_out_irq4_cb(state); }
|
||||
WRITE_LINE_MEMBER( dio16_device::irq5_w ) { m_out_irq5_cb(state); }
|
||||
WRITE_LINE_MEMBER( dio16_device::irq6_w ) { m_out_irq6_cb(state); }
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE CONFIG DIO16 CARD INTERFACE
|
||||
//**************************************************************************
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DIO16 CARD INTERFACE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_dio16_card_interface - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_dio16_card_interface::device_dio16_card_interface(const machine_config &mconfig, device_t &device)
|
||||
: device_slot_card_interface(mconfig, device),
|
||||
m_dio(nullptr), m_dio_dev(nullptr), m_next(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ~device_dio16_card_interface - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_dio16_card_interface::~device_dio16_card_interface()
|
||||
{
|
||||
}
|
||||
|
||||
void device_dio16_card_interface::static_set_diobus(device_t &device, device_t *dio_device)
|
||||
{
|
||||
device_dio16_card_interface &dio_card = dynamic_cast<device_dio16_card_interface &>(device);
|
||||
dio_card.m_dio_dev = dio_device;
|
||||
}
|
||||
|
||||
void device_dio16_card_interface::set_dio_device()
|
||||
{
|
||||
m_dio = dynamic_cast<dio16_device *>(m_dio_dev);
|
||||
}
|
||||
|
||||
|
||||
DEFINE_DEVICE_TYPE(DIO32, dio32_device, "dio32", "32-bit DIO-II bus")
|
||||
|
||||
//-------------------------------------------------
|
||||
// dio32_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
dio32_device::dio32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
dio16_device(mconfig, DIO32, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void dio32_device::device_start()
|
||||
{
|
||||
dio16_device::device_start();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_dio32_card_interface - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_dio32_card_interface::device_dio32_card_interface(const machine_config &mconfig, device_t &device)
|
||||
: device_dio16_card_interface(mconfig,device), m_dio(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ~device_dio32_card_interface - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_dio32_card_interface::~device_dio32_card_interface()
|
||||
{
|
||||
}
|
||||
|
||||
void device_dio32_card_interface::set_dio_device()
|
||||
{
|
||||
m_dio = dynamic_cast<dio32_device *>(m_dio_dev);
|
||||
}
|
||||
|
248
src/devices/bus/hp_dio/hp_dio.h
Normal file
248
src/devices/bus/hp_dio/hp_dio.h
Normal file
@ -0,0 +1,248 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic, R.Belmont
|
||||
/***************************************************************************
|
||||
|
||||
HP DIO and DIO-II bus devices
|
||||
|
||||
DIO is 16-bit, essentially the MC68000 bus
|
||||
DIO-II extends to 32-bit for 68020/030/040 machines
|
||||
|
||||
16-bit DIO cards fit and work in either 16 or 32 bit systems, much like 8-bit ISA.
|
||||
32-bit DIO-II cards only work in 32 bit DIO-II systems.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MAME_BUS_HPDIO_HPDIO_H
|
||||
#define MAME_BUS_HPDIO_HPDIO_H
|
||||
|
||||
#pragma once
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_DIO16_CPU(_cputag) \
|
||||
dio16_device::static_set_cputag(*device, _cputag);
|
||||
#define MCFG_DIO16_SLOT_ADD(_diotag, _tag, _slot_intf, _def_slot, _fixed) \
|
||||
MCFG_DEVICE_ADD(_tag, DIO16_SLOT, 0) \
|
||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) \
|
||||
dio16_slot_device::static_set_dio16_slot(*device, owner, _diotag);
|
||||
#define MCFG_DIO32_CPU(_cputag) \
|
||||
dio32_device::static_set_cputag(*device, _cputag);
|
||||
#define MCFG_DIO32_SLOT_ADD(_diotag, _tag, _slot_intf, _def_slot, _fixed) \
|
||||
MCFG_DEVICE_ADD(_tag, DIO32_SLOT, 0) \
|
||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _fixed) \
|
||||
dio32_slot_device::static_set_dio32_slot(*device, owner, _diotag);
|
||||
|
||||
#define MCFG_ISA_OUT_IRQ3_CB(_devcb) \
|
||||
devcb = &dio16_device::set_out_irq3_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_ISA_OUT_IRQ4_CB(_devcb) \
|
||||
devcb = &dio16_device::set_out_irq4_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_ISA_OUT_IRQ5_CB(_devcb) \
|
||||
devcb = &dio16_device::set_out_irq5_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_ISA_OUT_IRQ6_CB(_devcb) \
|
||||
devcb = &dio16_device::set_out_irq6_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
class dio16_device;
|
||||
|
||||
class dio16_slot_device : public device_t,
|
||||
public device_slot_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
dio16_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
// inline configuration
|
||||
static void static_set_dio16_slot(device_t &device, device_t *owner, const char *dio_tag);
|
||||
|
||||
protected:
|
||||
dio16_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// configuration
|
||||
device_t *m_owner;
|
||||
const char *m_dio_tag;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(DIO16_SLOT, dio16_slot_device)
|
||||
|
||||
class device_dio16_card_interface;
|
||||
// ======================> dio16_device
|
||||
class dio16_device : public device_t,
|
||||
public device_memory_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
dio16_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
// inline configuration
|
||||
static void static_set_cputag(device_t &device, const char *tag);
|
||||
template <class Object> static devcb_base &set_out_irq3_callback(device_t &device, Object &&cb) { return downcast<dio16_device &>(device).m_out_irq3_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_irq4_callback(device_t &device, Object &&cb) { return downcast<dio16_device &>(device).m_out_irq4_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_irq5_callback(device_t &device, Object &&cb) { return downcast<dio16_device &>(device).m_out_irq5_cb.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> static devcb_base &set_out_irq6_callback(device_t &device, Object &&cb) { return downcast<dio16_device &>(device).m_out_irq6_cb.set_callback(std::forward<Object>(cb)); }
|
||||
|
||||
// for DIO16, put the 16-bit configs in the primary slots and the 32-bit configs in the secondary
|
||||
virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override
|
||||
{
|
||||
switch (spacenum)
|
||||
{
|
||||
case AS_PROGRAM: return &m_program_config;
|
||||
case AS_DATA: return &m_program32_config;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
|
||||
|
||||
void install_bank(offs_t start, offs_t end, const char *tag, uint8_t *data);
|
||||
void install_rom(device_t *dev, offs_t start, offs_t end, const char *tag, const char *region);
|
||||
void install_memory(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
|
||||
|
||||
void unmap_bank(offs_t start, offs_t end);
|
||||
void unmap_rom(offs_t start, offs_t end);
|
||||
|
||||
// IRQs 1, 2, and 7 are reserved for non-bus usage.
|
||||
DECLARE_WRITE_LINE_MEMBER( irq3_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( irq4_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( irq5_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( irq6_w );
|
||||
|
||||
const address_space_config m_program_config, m_program32_config;
|
||||
|
||||
protected:
|
||||
dio16_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
void install_space(address_spacenum spacenum, offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// internal state
|
||||
cpu_device *m_maincpu;
|
||||
|
||||
// address spaces
|
||||
address_space *m_prgspace;
|
||||
int m_prgwidth;
|
||||
|
||||
devcb_write_line m_out_irq3_cb;
|
||||
devcb_write_line m_out_irq4_cb;
|
||||
devcb_write_line m_out_irq5_cb;
|
||||
devcb_write_line m_out_irq6_cb;
|
||||
|
||||
const char *m_cputag;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(DIO16, dio16_device)
|
||||
|
||||
// ======================> device_dio16_card_interface
|
||||
|
||||
// class representing interface-specific live dio16 card
|
||||
class device_dio16_card_interface : public device_slot_card_interface
|
||||
{
|
||||
friend class dio16_device;
|
||||
template <class ElementType> friend class simple_list;
|
||||
public:
|
||||
// construction/destruction
|
||||
virtual ~device_dio16_card_interface();
|
||||
|
||||
device_dio16_card_interface *next() const { return m_next; }
|
||||
|
||||
void set_dio_device();
|
||||
|
||||
// inline configuration
|
||||
static void static_set_diobus(device_t &device, device_t *dio_device);
|
||||
|
||||
public:
|
||||
device_dio16_card_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
dio16_device *m_dio;
|
||||
device_t *m_dio_dev;
|
||||
|
||||
private:
|
||||
device_dio16_card_interface *m_next;
|
||||
};
|
||||
|
||||
class dio32_device;
|
||||
|
||||
class dio32_slot_device : public dio16_slot_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
dio32_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
// inline configuration
|
||||
static void static_set_dio32_slot(device_t &device, device_t *owner, const char *dio_tag);
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(DIO32_SLOT, dio32_slot_device)
|
||||
|
||||
// ======================> dio32_device
|
||||
class dio32_device : public dio16_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
dio32_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
void install16_device(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler);
|
||||
|
||||
// for DIO32, put the 32-bit configs in the primary slots and the 16-bit configs in the secondary
|
||||
virtual const address_space_config *memory_space_config(address_spacenum spacenum) const override
|
||||
{
|
||||
switch (spacenum)
|
||||
{
|
||||
case AS_PROGRAM: return &m_program32_config;
|
||||
case AS_DATA: return &m_program_config;
|
||||
default: return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(DIO32, dio32_device)
|
||||
|
||||
// ======================> device_dio32_card_interface
|
||||
|
||||
// class representing interface-specific live dio32 card
|
||||
class device_dio32_card_interface : public device_dio16_card_interface
|
||||
{
|
||||
friend class dio32_device;
|
||||
public:
|
||||
// construction/destruction
|
||||
virtual ~device_dio32_card_interface();
|
||||
|
||||
void set_dio_device();
|
||||
|
||||
protected:
|
||||
device_dio32_card_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
dio32_device *m_dio;
|
||||
};
|
||||
|
||||
#endif // MAME_BUS_HPDIO_HPDIO_H
|
Loading…
Reference in New Issue
Block a user