From 79e5eacf71105eceba0d9436b192860289e985e0 Mon Sep 17 00:00:00 2001 From: Sven Schnelle <41547105+svenschnelle@users.noreply.github.com> Date: Sat, 29 Jun 2024 18:20:10 +0200 Subject: bus/hp_dio: Modernize all of the HP DIO cards to use anonymous namespaces (#12528) --- src/devices/bus/hp_dio/hp98265a.cpp | 58 ++++++++++++++- src/devices/bus/hp_dio/hp98265a.h | 60 +-------------- src/devices/bus/hp_dio/hp98543.cpp | 63 ++++++++++++++-- src/devices/bus/hp_dio/hp98543.h | 62 +--------------- src/devices/bus/hp_dio/hp98544.cpp | 56 ++++++++++++-- src/devices/bus/hp_dio/hp98544.h | 55 +------------- src/devices/bus/hp_dio/hp98550.cpp | 66 +++++++++++++++-- src/devices/bus/hp_dio/hp98550.h | 64 +--------------- src/devices/bus/hp_dio/hp98603a.cpp | 34 ++++++++- src/devices/bus/hp_dio/hp98603a.h | 31 +------- src/devices/bus/hp_dio/hp98603b.cpp | 34 ++++++++- src/devices/bus/hp_dio/hp98603b.h | 31 +------- src/devices/bus/hp_dio/hp98620.cpp | 141 ++++++++++++++++++++++++++++++------ src/devices/bus/hp_dio/hp98620.h | 120 +----------------------------- src/devices/bus/hp_dio/hp98624.cpp | 44 ++++++++++- src/devices/bus/hp_dio/hp98624.h | 46 +----------- src/devices/bus/hp_dio/hp98643.cpp | 79 +++++++++++++++++++- src/devices/bus/hp_dio/hp98643.h | 79 +------------------- src/devices/bus/hp_dio/hp98644.cpp | 44 +++++++++-- src/devices/bus/hp_dio/hp98644.h | 47 +----------- 20 files changed, 563 insertions(+), 651 deletions(-) diff --git a/src/devices/bus/hp_dio/hp98265a.cpp b/src/devices/bus/hp_dio/hp98265a.cpp index e52a72ca032..1dff70a3d27 100644 --- a/src/devices/bus/hp_dio/hp98265a.cpp +++ b/src/devices/bus/hp_dio/hp98265a.cpp @@ -12,14 +12,64 @@ #include "machine/nscsi_bus.h" #include "bus/nscsi/devices.h" #include "machine/mb87030.h" +#include "bus/scsi/scsi.h" +#include "bus/scsi/scsicd.h" #define VERBOSE 0 #include "logmacro.h" +namespace { -DEFINE_DEVICE_TYPE(HPDIO_98265A, bus::hp_dio::dio16_98265a_device, "hp98265a", "HP98265A SCSI S16 Interface") +class dio16_98265a_device : + public device_t, + public bus::hp_dio::device_dio32_card_interface +{ +public: + // construction/destruction + dio16_98265a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + void mb87030(device_t *device); + +protected: + dio16_98265a_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; + + virtual ioport_constructor device_input_ports() const override; + virtual void device_add_mconfig(machine_config &config) override; + + uint16_t io_r(offs_t offset); + void io_w(offs_t offset, uint16_t data); -namespace bus::hp_dio { + void dmack_w_in(int channel, uint8_t data) override; + uint8_t dmack_r_in(int channel) override; + + void dmar0_w(int state); + + void irq_w(int state); + + required_device m_scsibus; + required_device m_spc; +private: + + static constexpr int REG_CONTROL_DE0 = (1 << 0); + static constexpr int REG_CONTROL_DE1 = (1 << 1); + + static void mb87030_scsi_adapter(device_t *device); + required_ioport m_sw1; + required_ioport m_sw2; + int get_int_level(); + void update_irq(bool state); + void update_dma(); + bool m_installed_io; + uint8_t m_control; + + bool m_irq_state; + bool m_dmar0; +}; void dio16_98265a_device::mb87030_scsi_adapter(device_t *device) { @@ -295,4 +345,6 @@ void dio16_98265a_device::dmar0_w(int state) } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98265A, bus::hp_dio::device_dio16_card_interface, dio16_98265a_device, "hp98265a", "HP98265A SCSI S16 Interface") diff --git a/src/devices/bus/hp_dio/hp98265a.h b/src/devices/bus/hp_dio/hp98265a.h index c21ad6e5bbe..f4be410e236 100644 --- a/src/devices/bus/hp_dio/hp98265a.h +++ b/src/devices/bus/hp_dio/hp98265a.h @@ -7,65 +7,7 @@ #pragma once #include "hp_dio.h" -#include "machine/mb87030.h" -#include "bus/scsi/scsi.h" -#include "bus/scsi/scsicd.h" -namespace bus::hp_dio { - -class dio16_98265a_device : - public device_t, - public device_dio32_card_interface -{ -public: - // construction/destruction - dio16_98265a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - void mb87030(device_t *device); - -protected: - dio16_98265a_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; - - virtual ioport_constructor device_input_ports() const override; - virtual void device_add_mconfig(machine_config &config) override; - - uint16_t io_r(offs_t offset); - void io_w(offs_t offset, uint16_t data); - - void dmack_w_in(int channel, uint8_t data) override; - uint8_t dmack_r_in(int channel) override; - - void dmar0_w(int state); - - void irq_w(int state); - - required_device m_scsibus; - required_device m_spc; -private: - - static constexpr int REG_CONTROL_DE0 = (1 << 0); - static constexpr int REG_CONTROL_DE1 = (1 << 1); - - static void mb87030_scsi_adapter(device_t *device); - required_ioport m_sw1; - required_ioport m_sw2; - int get_int_level(); - void update_irq(bool state); - void update_dma(); - bool m_installed_io; - uint8_t m_control; - - bool m_irq_state; - bool m_dmar0; -}; - -} // namespace bus::hp_dio - -DECLARE_DEVICE_TYPE_NS(HPDIO_98265A, bus::hp_dio, dio16_98265a_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98265A, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98265A_H diff --git a/src/devices/bus/hp_dio/hp98543.cpp b/src/devices/bus/hp_dio/hp98543.cpp index a84abd856d8..0582822e080 100644 --- a/src/devices/bus/hp_dio/hp98543.cpp +++ b/src/devices/bus/hp_dio/hp98543.cpp @@ -16,15 +16,66 @@ #define HP98543_SCREEN_NAME "98543_screen" #define HP98543_ROM_REGION "98543_rom" +namespace { + +class dio16_98543_device : + public device_t, + public bus::hp_dio::device_dio16_card_interface, + public device_memory_interface +{ +public: + dio16_98543_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + uint16_t rom_r(offs_t offset); + void rom_w(offs_t offset, uint16_t data); + + uint16_t ctrl_r(address_space &space, offs_t offset, uint16_t mem_mask = ~0); + void ctrl_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t vram_r(offs_t offset, uint16_t mem_mask = ~0); + void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + static constexpr int TOPCAT_COUNT = 4; + + required_device_array m_topcat; + required_device m_nereid; + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +protected: + dio16_98543_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void device_start() override; + virtual void device_reset() override; + + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + + virtual space_config_vector memory_space_config() const override; +private: + + void vblank_w(int state); + void int0_w(int state); + void int1_w(int state); + void int2_w(int state); + void int3_w(int state); + + const address_space_config m_space_config; + void map(address_map &map); + void update_int(); + static constexpr int m_h_pix = 1024; + static constexpr int m_v_pix = 400; + + required_region_ptr m_rom; + required_shared_ptr m_vram; + + uint8_t m_intreg; + bool m_ints[4]; +}; + ROM_START(hp98543) ROM_REGION(0x2000, HP98543_ROM_REGION, 0) ROM_LOAD("1818-3907.bin", 0x000000, 0x002000, CRC(5e2bf02a) SHA1(9ba9391cf39624ef8027ce42c84e100344b2a2b8)) ROM_END -DEFINE_DEVICE_TYPE(HPDIO_98543, bus::hp_dio::dio16_98543_device, "dio98543", "HP98543 medium-res color DIO video card") - -namespace bus::hp_dio { - void dio16_98543_device::device_add_mconfig(machine_config &config) { screen_device &screen(SCREEN(config, HP98543_SCREEN_NAME, SCREEN_TYPE_RASTER)); @@ -251,4 +302,6 @@ uint32_t dio16_98543_device::screen_update(screen_device &screen, bitmap_rgb32 & return 0; } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98543, bus::hp_dio::device_dio16_card_interface, dio16_98543_device, "dio98543", "HP98543 medium-res color DIO video card") diff --git a/src/devices/bus/hp_dio/hp98543.h b/src/devices/bus/hp_dio/hp98543.h index 56eb194d7e3..edf7ccdb3be 100644 --- a/src/devices/bus/hp_dio/hp98543.h +++ b/src/devices/bus/hp_dio/hp98543.h @@ -7,68 +7,8 @@ #pragma once #include "hp_dio.h" -#include "video/topcat.h" -#include "video/nereid.h" -#include "machine/ram.h" - -namespace bus::hp_dio { - -class dio16_98543_device : - public device_t, - public device_dio16_card_interface, - public device_memory_interface -{ -public: - dio16_98543_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - uint16_t rom_r(offs_t offset); - void rom_w(offs_t offset, uint16_t data); - - uint16_t ctrl_r(address_space &space, offs_t offset, uint16_t mem_mask = ~0); - void ctrl_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - uint16_t vram_r(offs_t offset, uint16_t mem_mask = ~0); - void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - static constexpr int TOPCAT_COUNT = 4; - - required_device_array m_topcat; - required_device m_nereid; - - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); -protected: - dio16_98543_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - virtual void device_start() override; - virtual void device_reset() override; - - virtual void device_add_mconfig(machine_config &config) override; - virtual const tiny_rom_entry *device_rom_region() const override; - - virtual space_config_vector memory_space_config() const override; -private: - - void vblank_w(int state); - void int0_w(int state); - void int1_w(int state); - void int2_w(int state); - void int3_w(int state); - - const address_space_config m_space_config; - void map(address_map &map); - void update_int(); - static constexpr int m_h_pix = 1024; - static constexpr int m_v_pix = 400; - - required_region_ptr m_rom; - required_shared_ptr m_vram; - - uint8_t m_intreg; - bool m_ints[4]; -}; - -} // namespace bus::hp_dio // device type definition -DECLARE_DEVICE_TYPE_NS(HPDIO_98543, bus::hp_dio, dio16_98543_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98543, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98543_H diff --git a/src/devices/bus/hp_dio/hp98544.cpp b/src/devices/bus/hp_dio/hp98544.cpp index ab566822293..80159b1001f 100644 --- a/src/devices/bus/hp_dio/hp98544.cpp +++ b/src/devices/bus/hp_dio/hp98544.cpp @@ -11,23 +11,63 @@ #include "emu.h" #include "hp98544.h" #include "screen.h" +#include "video/topcat.h" +#include "hp_dio.h" #define HP98544_SCREEN_NAME "98544_screen" #define HP98544_ROM_REGION "98544_rom" +namespace { + +class dio16_98544_device : + public device_t, + public bus::hp_dio::device_dio16_card_interface, + public device_memory_interface +{ +public: + // construction/destruction + dio16_98544_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + uint16_t rom_r(offs_t offset); + void rom_w(offs_t offset, uint16_t data); + + required_device m_topcat; + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + 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; + virtual space_config_vector memory_space_config() const override; +private: + + void vblank_w(int state); + void int_w(int state); + + static constexpr int m_v_pix = 768; + static constexpr int m_h_pix = 1024; + + const address_space_config m_space_config; + void map(address_map &map); + required_region_ptr m_rom; + required_shared_ptr m_vram; + + uint8_t m_intreg; +}; + //************************************************************************* // GLOBAL VARIABLES //************************************************************************** -DEFINE_DEVICE_TYPE(HPDIO_98544, bus::hp_dio::dio16_98544_device, "dio98544", "HP98544 high-res monochrome DIO video card") - -namespace bus::hp_dio { - ROM_START( hp98544 ) ROM_REGION( 0x2000, HP98544_ROM_REGION, 0 ) ROM_LOAD( "98544_1818-1999.bin", 0x000000, 0x002000, CRC(8c7d6480) SHA1(d2bcfd39452c38bc652df39f84c7041cfdf6bd51) ) ROM_END - //------------------------------------------------- // device_add_mconfig - add device configuration //------------------------------------------------- @@ -50,8 +90,6 @@ void dio16_98544_device::device_add_mconfig(machine_config &config) // rom_region - device-specific ROM region //------------------------------------------------- - - const tiny_rom_entry *dio16_98544_device::device_rom_region() const { return ROM_NAME( hp98544 ); @@ -184,4 +222,6 @@ uint32_t dio16_98544_device::screen_update(screen_device &screen, bitmap_rgb32 & return 0; } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98544, bus::hp_dio::device_dio16_card_interface, dio16_98544_device, "dio98544", "HP98544 high-res monochrome DIO video card") diff --git a/src/devices/bus/hp_dio/hp98544.h b/src/devices/bus/hp_dio/hp98544.h index 8f18d54d76b..63a41d4386e 100644 --- a/src/devices/bus/hp_dio/hp98544.h +++ b/src/devices/bus/hp_dio/hp98544.h @@ -1,65 +1,12 @@ // 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" -#include "video/topcat.h" -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> dio16_98544_device - -namespace bus::hp_dio { - -class dio16_98544_device : - public device_t, - public device_dio16_card_interface, - public device_memory_interface -{ -public: - // construction/destruction - dio16_98544_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - uint16_t rom_r(offs_t offset); - void rom_w(offs_t offset, uint16_t data); - - required_device m_topcat; - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - 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; - virtual space_config_vector memory_space_config() const override; -private: - - void vblank_w(int state); - void int_w(int state); - - static constexpr int m_v_pix = 768; - static constexpr int m_h_pix = 1024; - - const address_space_config m_space_config; - void map(address_map &map); - required_region_ptr m_rom; - required_shared_ptr m_vram; - - uint8_t m_intreg; -}; - -} // namespace bus::hp_dio -// device type definition -DECLARE_DEVICE_TYPE_NS(HPDIO_98544, bus::hp_dio, dio16_98544_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98544, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98544_H diff --git a/src/devices/bus/hp_dio/hp98550.cpp b/src/devices/bus/hp_dio/hp98550.cpp index 935c03eea6c..7d541bc35d5 100644 --- a/src/devices/bus/hp_dio/hp98550.cpp +++ b/src/devices/bus/hp_dio/hp98550.cpp @@ -18,15 +18,67 @@ HP98550 high-resolution color board //#define VERBOSE 1 #include "logmacro.h" +namespace { + +class dio32_98550_device : + public device_t, + public bus::hp_dio::device_dio32_card_interface, + public device_memory_interface +{ +public: + dio32_98550_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + uint16_t rom_r(offs_t offset, uint16_t mem_mask = ~0); + void rom_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + uint16_t catseye_r(address_space &space, offs_t offset, uint16_t mem_mask = ~0); + void catseye_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + uint16_t vram_r(offs_t offset, uint16_t mem_mask = ~0); + void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + static constexpr int CATSEYE_COUNT = 8; + + + uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); +protected: + required_device m_nereid; + required_device_array m_catseye; + + dio32_98550_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void device_start() override; + virtual void device_reset() override; + + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + + virtual space_config_vector memory_space_config() const override; + + void vblank_w(int state); + void int_w(offs_t offset, uint8_t data); + + const address_space_config m_space_config; + void map(address_map &map); + void update_int(); + + static constexpr int m_fb_width = 2048; + static constexpr int m_h_pix = 1280; + static constexpr int m_v_pix = 1024; + + required_region_ptr m_rom; + required_shared_ptr_array m_vram; + + uint16_t m_plane_mask; + uint8_t m_intreg; + uint8_t m_ints; +}; + ROM_START(hp98550) ROM_REGION(0x8000, "hp98550a_rom", 0) ROM_LOAD("98550a.bin", 0x000000, 0x008000, CRC(9d639233) SHA1(d6b23a34850f24525ca5fb36de3deb91196d2dc5)) ROM_END -DEFINE_DEVICE_TYPE(HPDIO_98550, bus::hp_dio::dio32_98550_device, "dio98550", "HP98550A high-res color DIO video card") - -namespace bus::hp_dio { - void dio32_98550_device::device_add_mconfig(machine_config &config) { screen_device &screen(SCREEN(config, "hp98550_screen", SCREEN_TYPE_RASTER)); @@ -70,7 +122,7 @@ dio32_98550_device::dio32_98550_device(const machine_config &mconfig, const char dio32_98550_device::dio32_98550_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_dio32_card_interface(mconfig, *this), device_memory_interface(mconfig, *this), m_nereid(*this, "nereid"), m_catseye(*this, "catseye%d", 0), @@ -232,4 +284,6 @@ uint32_t dio32_98550_device::screen_update(screen_device &screen, bitmap_rgb32 & return 0; } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98550, bus::hp_dio::device_dio32_card_interface, dio32_98550_device, "dio98550", "HP98550A high-res color DIO video card") diff --git a/src/devices/bus/hp_dio/hp98550.h b/src/devices/bus/hp_dio/hp98550.h index a577cdb6388..174a01a04d2 100644 --- a/src/devices/bus/hp_dio/hp98550.h +++ b/src/devices/bus/hp_dio/hp98550.h @@ -7,69 +7,7 @@ #pragma once #include "hp_dio.h" -#include "video/catseye.h" -#include "video/nereid.h" -#include "machine/ram.h" -namespace bus::hp_dio { - -class dio32_98550_device : - public device_t, - public device_dio16_card_interface, - public device_memory_interface -{ -public: - dio32_98550_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - - uint16_t rom_r(offs_t offset, uint16_t mem_mask = ~0); - void rom_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - uint16_t catseye_r(address_space &space, offs_t offset, uint16_t mem_mask = ~0); - void catseye_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - uint16_t vram_r(offs_t offset, uint16_t mem_mask = ~0); - void vram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - static constexpr int CATSEYE_COUNT = 8; - - - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); -protected: - required_device m_nereid; - required_device_array m_catseye; - - dio32_98550_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - virtual void device_start() override; - virtual void device_reset() override; - - virtual void device_add_mconfig(machine_config &config) override; - virtual const tiny_rom_entry *device_rom_region() const override; - - virtual space_config_vector memory_space_config() const override; - - void vblank_w(int state); - void int_w(offs_t offset, uint8_t data); - - const address_space_config m_space_config; - void map(address_map &map); - void update_int(); - - static constexpr int m_fb_width = 2048; - static constexpr int m_h_pix = 1280; - static constexpr int m_v_pix = 1024; - - required_region_ptr m_rom; - required_shared_ptr_array m_vram; - - uint16_t m_plane_mask; - uint8_t m_intreg; - uint8_t m_ints; -}; - -} // namespace bus::hp_dio - -// device type definition -DECLARE_DEVICE_TYPE_NS(HPDIO_98550, bus::hp_dio, dio32_98550_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98550, bus::hp_dio, device_dio32_card_interface) #endif // MAME_BUS_HPDIO_98550_H diff --git a/src/devices/bus/hp_dio/hp98603a.cpp b/src/devices/bus/hp_dio/hp98603a.cpp index 37458c43c36..3230b795905 100644 --- a/src/devices/bus/hp_dio/hp98603a.cpp +++ b/src/devices/bus/hp_dio/hp98603a.cpp @@ -8,12 +8,36 @@ #include "emu.h" #include "hp98603a.h" - -DEFINE_DEVICE_TYPE(HPDIO_98603A, bus::hp_dio::dio16_98603a_device, "dio98603a", "HP98603A BASIC 4.0 ROM card") +#include "hp_dio.h" #define HP98603A_ROM_REGION "98603a_rom" -namespace bus::hp_dio { +namespace { + +class dio16_98603a_device : + public device_t, + public bus::hp_dio::device_dio16_card_interface +{ +public: + // construction/destruction + dio16_98603a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + uint16_t rom_r(offs_t offset); + void rom_w(offs_t offset, uint16_t data); + +protected: + dio16_98603a_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: + uint8_t *m_rom; +}; ROM_START(hp98603a) ROM_REGION(0x80000, HP98603A_ROM_REGION, 0) @@ -79,4 +103,6 @@ void dio16_98603a_device::rom_w(offs_t offset, uint16_t data) { } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98603A, bus::hp_dio::device_dio16_card_interface, dio16_98603a_device, "dio98603a", "HP98603A BASIC 4.0 ROM card") diff --git a/src/devices/bus/hp_dio/hp98603a.h b/src/devices/bus/hp_dio/hp98603a.h index 15cccb7ab3d..e7f7efb40f4 100644 --- a/src/devices/bus/hp_dio/hp98603a.h +++ b/src/devices/bus/hp_dio/hp98603a.h @@ -8,35 +8,6 @@ #include "hp_dio.h" -namespace bus::hp_dio { - -class dio16_98603a_device : - public device_t, - public device_dio16_card_interface -{ -public: - // construction/destruction - dio16_98603a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - uint16_t rom_r(offs_t offset); - void rom_w(offs_t offset, uint16_t data); - -protected: - dio16_98603a_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: - uint8_t *m_rom; -}; - -} // namespace bus::hp_dio - -DECLARE_DEVICE_TYPE_NS(HPDIO_98603A, bus::hp_dio, dio16_98603a_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98603A, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98603A_H diff --git a/src/devices/bus/hp_dio/hp98603b.cpp b/src/devices/bus/hp_dio/hp98603b.cpp index 6210b3b0178..ff91eb05e8b 100644 --- a/src/devices/bus/hp_dio/hp98603b.cpp +++ b/src/devices/bus/hp_dio/hp98603b.cpp @@ -8,12 +8,36 @@ #include "emu.h" #include "hp98603b.h" - -DEFINE_DEVICE_TYPE(HPDIO_98603B, bus::hp_dio::dio16_98603b_device, "dio98603b", "HP98603 BASIC ROM card") +#include "hp_dio.h" #define HP98603B_ROM_REGION "98603b_rom" -namespace bus::hp_dio { +namespace { + +class dio16_98603b_device : + public device_t, + public bus::hp_dio::device_dio16_card_interface +{ +public: + // construction/destruction + dio16_98603b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + uint16_t rom_r(offs_t offset); + void rom_w(offs_t offset, uint16_t data); + +protected: + dio16_98603b_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: + uint8_t *m_rom; +}; ROM_START(hp98603b) ROM_REGION(0x100000, HP98603B_ROM_REGION, 0) @@ -74,4 +98,6 @@ void dio16_98603b_device::rom_w(offs_t offset, uint16_t data) { } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98603B, bus::hp_dio::device_dio16_card_interface, dio16_98603b_device, "dio98603b", "HP98603 BASIC ROM card") diff --git a/src/devices/bus/hp_dio/hp98603b.h b/src/devices/bus/hp_dio/hp98603b.h index 4f910781dba..ade7c285e3e 100644 --- a/src/devices/bus/hp_dio/hp98603b.h +++ b/src/devices/bus/hp_dio/hp98603b.h @@ -8,35 +8,6 @@ #include "hp_dio.h" -namespace bus::hp_dio { - -class dio16_98603b_device : - public device_t, - public device_dio16_card_interface -{ -public: - // construction/destruction - dio16_98603b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - uint16_t rom_r(offs_t offset); - void rom_w(offs_t offset, uint16_t data); - -protected: - dio16_98603b_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: - uint8_t *m_rom; -}; - -} // namespace bus::hp_dio - -DECLARE_DEVICE_TYPE_NS(HPDIO_98603B, bus::hp_dio, dio16_98603b_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98603B, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98603B_H diff --git a/src/devices/bus/hp_dio/hp98620.cpp b/src/devices/bus/hp_dio/hp98620.cpp index 0dc7add46c7..67d8507d3ea 100644 --- a/src/devices/bus/hp_dio/hp98620.cpp +++ b/src/devices/bus/hp_dio/hp98620.cpp @@ -8,14 +8,125 @@ #include "emu.h" #include "hp98620.h" +#include "hp_dio.h" #define VERBOSE 0 #include "logmacro.h" -DEFINE_DEVICE_TYPE(HPDIO_98620, bus::hp_dio::dio16_98620_device, "hp98620", "HP98620 DMA Controller") +namespace { -namespace bus::hp_dio { +class dio16_98620_device : + public device_t, + public bus::hp_dio::device_dio16_card_interface +{ +public: + // construction/destruction + dio16_98620_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + dio16_98620_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; + + uint16_t dma_r(offs_t offset); + void dma_w(offs_t offset, uint16_t data); + + void irq_w(int state); + +private: + + static constexpr int REG0_RESET_ARM_INT = 0x00; + static constexpr int REG0_ADDRESS_HIGH = 0x00; + static constexpr int REG0_ADDRESS_LOW = 0x02; + static constexpr int REG0_TRANSFER_COUNT = 0x04; + static constexpr int REG0_CONTROL_ARM = 0x06; + static constexpr int REG0_STATUS = 0x06; + + static constexpr int REG1_RESET_ARM_INT = 0x08; + static constexpr int REG1_ADDRESS_HIGH = 0x08; + static constexpr int REG1_ADDRESS_LOW = 0x0a; + static constexpr int REG1_TRANSFER_COUNT = 0x0c; + static constexpr int REG1_CONTROL_ARM = 0x0e; + static constexpr int REG1_STATUS = 0x0e; + + static constexpr uint8_t REG_CONTROL_IE = 1 << 0; + static constexpr uint8_t REG_CONTROL_WORD = 1 << 1; + static constexpr uint8_t REG_CONTROL_OUT = 1 << 2; + static constexpr uint8_t REG_CONTROL_PRI = 1 << 3; + static constexpr uint8_t REG_CONTROL_INT_MASK = 0x7; + static constexpr int REG_CONTROL_INT_SHIFT = 4; + + + static constexpr uint8_t REG_STATUS_ARMED = 1 << 0; + static constexpr uint8_t REG_STATUS_INT = 1 << 1; + + /* general control registers */ + static constexpr int REG_1TQ4_ID_LOW = 0x10; + static constexpr int REG_1TQ4_ID_HIGH = 0x12; + static constexpr int REG_GENERAL_CONTROL = 0x14; + static constexpr int REG_GENERAL_CONTROL_RESET0 = 1 << 4; + static constexpr int REG_GENERAL_CONTROL_RESET1 = 1 << 5; + + /* channel specific registers */ + static constexpr int REG0_1TQ4_ADDRESS_HIGH = 0x100; + static constexpr int REG0_1TQ4_ADDRESS_LOW = 0x102; + static constexpr int REG0_1TQ4_TRANSFER_COUNT_HIGH = 0x104; + static constexpr int REG0_1TQ4_TRANSFER_COUNT_LOW = 0x106; + + static constexpr int REG0_1TQ4_CONTROL = 0x108; + static constexpr int REG0_1TQ4_STATUS = 0x10a; + + static constexpr uint16_t REG_1TQ4_CONTROL_LWORD = 1 << 8; + static constexpr uint16_t REG_1TQ4_CONTROL_START = 1 << 15; + + static constexpr uint16_t REG_1TQ4_STATUS_ARMED = 1 << 0; + static constexpr uint16_t REG_1TQ4_STATUS_INT = 1 << 1; + + /* registers */ + static constexpr int REG1_1TQ4_ADDRESS_HIGH = 0x200; + static constexpr int REG1_1TQ4_ADDRESS_LOW = 0x202; + static constexpr int REG1_1TQ4_TRANSFER_COUNT_HIGH = 0x204; + static constexpr int REG1_1TQ4_TRANSFER_COUNT_LOW = 0x206; + + static constexpr int REG1_1TQ4_CONTROL = 0x208; + static constexpr int REG1_1TQ4_STATUS = 0x20a; + + void dmar0_in(int state) override; + void dmar1_in(int state) override; + + void dma_transfer(int channel); + void update_irq(); + void update_ctrl(const int channel, const uint16_t data, const bool is_1tq4); + + bool m_installed_io; + uint8_t m_control; + uint8_t m_data; + bool m_irq_state; + + struct dma_regs { + uint32_t address = 0; + uint32_t tc = 0; + uint32_t control = 0; + /* control register */ + int irq_level = 0; + int tsz = 0; + int subcount = 0; + + bool irq = false; + bool ie = false; + bool armed = false; + + bool dma_out = false; + bool dma_pri = false; // TODO + bool lword = false; + bool word = false; + } m_regs[2]; + + bool m_dmar[2]; +}; dio16_98620_device::dio16_98620_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : dio16_98620_device(mconfig, HPDIO_98620, tag, owner, clock) @@ -24,7 +135,7 @@ dio16_98620_device::dio16_98620_device(const machine_config &mconfig, const char dio16_98620_device::dio16_98620_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_dio32_card_interface{mconfig, *this}, + device_dio16_card_interface{mconfig, *this}, m_installed_io{false}, m_control{0}, m_data{0}, @@ -71,26 +182,6 @@ void dio16_98620_device::device_reset() m_irq_state = false; } -uint16_t dio16_98620_device::get_ctrl(const int channel) -{ - uint16_t ret = 0; - - if (m_regs[channel].ie) - ret |= REG_CONTROL_IE; - if (m_regs[channel].tsz == 2) - ret |= REG_CONTROL_WORD; - if (m_regs[channel].tsz == 4) - ret |= REG_1TQ4_CONTROL_LWORD; - if (m_regs[channel].dma_out) - ret |= REG_CONTROL_OUT; - if (m_regs[channel].dma_pri) - ret |= REG_CONTROL_PRI; - - ret |= ((m_regs[channel].irq_level-3) & REG_CONTROL_INT_MASK) << REG_CONTROL_INT_SHIFT; - - return ret; -} - uint16_t dio16_98620_device::dma_r(offs_t offset) { @@ -375,4 +466,6 @@ void dio16_98620_device::dmar1_in(int state) dma_transfer(1); } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98620, bus::hp_dio::device_dio16_card_interface, dio16_98620_device, "hp98620", "HP98620 DMA Controller") diff --git a/src/devices/bus/hp_dio/hp98620.h b/src/devices/bus/hp_dio/hp98620.h index 7a4b65f34f0..59b97b15131 100644 --- a/src/devices/bus/hp_dio/hp98620.h +++ b/src/devices/bus/hp_dio/hp98620.h @@ -8,124 +8,6 @@ #include "hp_dio.h" - -namespace bus::hp_dio { - -class dio16_98620_device : - public device_t, - public device_dio32_card_interface -{ -public: - // construction/destruction - dio16_98620_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - dio16_98620_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; - - uint16_t dma_r(offs_t offset); - void dma_w(offs_t offset, uint16_t data); - - void irq_w(int state); - -private: - - static constexpr int REG0_RESET_ARM_INT = 0x00; - static constexpr int REG0_ADDRESS_HIGH = 0x00; - static constexpr int REG0_ADDRESS_LOW = 0x02; - static constexpr int REG0_TRANSFER_COUNT = 0x04; - static constexpr int REG0_CONTROL_ARM = 0x06; - static constexpr int REG0_STATUS = 0x06; - - static constexpr int REG1_RESET_ARM_INT = 0x08; - static constexpr int REG1_ADDRESS_HIGH = 0x08; - static constexpr int REG1_ADDRESS_LOW = 0x0a; - static constexpr int REG1_TRANSFER_COUNT = 0x0c; - static constexpr int REG1_CONTROL_ARM = 0x0e; - static constexpr int REG1_STATUS = 0x0e; - - static constexpr uint8_t REG_CONTROL_IE = 1 << 0; - static constexpr uint8_t REG_CONTROL_WORD = 1 << 1; - static constexpr uint8_t REG_CONTROL_OUT = 1 << 2; - static constexpr uint8_t REG_CONTROL_PRI = 1 << 3; - static constexpr uint8_t REG_CONTROL_INT_MASK = 0x7; - static constexpr int REG_CONTROL_INT_SHIFT = 4; - - - static constexpr uint8_t REG_STATUS_ARMED = 1 << 0; - static constexpr uint8_t REG_STATUS_INT = 1 << 1; - - /* general control registers */ - static constexpr int REG_1TQ4_ID_LOW = 0x10; - static constexpr int REG_1TQ4_ID_HIGH = 0x12; - static constexpr int REG_GENERAL_CONTROL = 0x14; - static constexpr int REG_GENERAL_CONTROL_RESET0 = 1 << 4; - static constexpr int REG_GENERAL_CONTROL_RESET1 = 1 << 5; - - /* channel specific registers */ - static constexpr int REG0_1TQ4_ADDRESS_HIGH = 0x100; - static constexpr int REG0_1TQ4_ADDRESS_LOW = 0x102; - static constexpr int REG0_1TQ4_TRANSFER_COUNT_HIGH = 0x104; - static constexpr int REG0_1TQ4_TRANSFER_COUNT_LOW = 0x106; - - static constexpr int REG0_1TQ4_CONTROL = 0x108; - static constexpr int REG0_1TQ4_STATUS = 0x10a; - - static constexpr uint16_t REG_1TQ4_CONTROL_LWORD = 1 << 8; - static constexpr uint16_t REG_1TQ4_CONTROL_START = 1 << 15; - - static constexpr uint16_t REG_1TQ4_STATUS_ARMED = 1 << 0; - static constexpr uint16_t REG_1TQ4_STATUS_INT = 1 << 1; - - /* registers */ - static constexpr int REG1_1TQ4_ADDRESS_HIGH = 0x200; - static constexpr int REG1_1TQ4_ADDRESS_LOW = 0x202; - static constexpr int REG1_1TQ4_TRANSFER_COUNT_HIGH = 0x204; - static constexpr int REG1_1TQ4_TRANSFER_COUNT_LOW = 0x206; - - static constexpr int REG1_1TQ4_CONTROL = 0x208; - static constexpr int REG1_1TQ4_STATUS = 0x20a; - - void dmar0_in(int state) override; - void dmar1_in(int state) override; - - void dma_transfer(int channel); - void update_irq(); - void update_ctrl(const int channel, const uint16_t data, const bool is_1tq4); - uint16_t get_ctrl(const int channel); - - bool m_installed_io; - uint8_t m_control; - uint8_t m_data; - bool m_irq_state; - - struct dma_regs { - uint32_t address = 0; - uint32_t tc = 0; - uint32_t control = 0; - /* control register */ - int irq_level = 0; - int tsz = 0; - int subcount = 0; - - bool irq = false; - bool ie = false; - bool armed = false; - - bool dma_out = false; - bool dma_pri = false; // TODO - bool lword = false; - bool word = false; - } m_regs[2]; - - bool m_dmar[2]; -}; - -} // namespace bus::hp_dio - -DECLARE_DEVICE_TYPE_NS(HPDIO_98620, bus::hp_dio, dio16_98620_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98620, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98620_H diff --git a/src/devices/bus/hp_dio/hp98624.cpp b/src/devices/bus/hp_dio/hp98624.cpp index 80a3156e180..d8037d00363 100644 --- a/src/devices/bus/hp_dio/hp98624.cpp +++ b/src/devices/bus/hp_dio/hp98624.cpp @@ -10,14 +10,50 @@ #include "hp98624.h" #include "machine/tms9914.h" #include "bus/ieee488/ieee488.h" +#include "hp_dio.h" //#define VERBOSE 1 #include "logmacro.h" -DEFINE_DEVICE_TYPE(HPDIO_98624, bus::hp_dio::dio16_98624_device, "dio98624", "HP98624 GPIB Interface") +namespace { +class dio16_98624_device : + public device_t, + public bus::hp_dio::device_dio16_card_interface +{ +public: + dio16_98624_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + dio16_98624_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void device_start() override; + virtual void device_reset() override; + + virtual ioport_constructor device_input_ports() const override; + virtual void device_add_mconfig(machine_config &config) override; + + void dmack_w_in(int channel, uint8_t data) override; + uint8_t dmack_r_in(int channel) override; -namespace bus::hp_dio { + uint16_t io_r(offs_t offset); + void io_w(offs_t offset, uint16_t data); + + required_device m_tms9914; + required_device m_ieee488; + required_ioport m_switches; +private: + void update_gpib_irq(); + void update_gpib_dma(); + void gpib_irq(int state); + void gpib_dreq(int state); + + bool m_gpib_irq_line; + bool m_gpib_dma_line; + + bool m_installed_io; + uint8_t m_control; +}; void dio16_98624_device::device_add_mconfig(machine_config &config) { @@ -298,4 +334,6 @@ uint8_t dio16_98624_device::dmack_r_in(int channel) return ret; } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98624, bus::hp_dio::device_dio16_card_interface, dio16_98624_device, "dio98624", "HP98624 GPIB Interface") diff --git a/src/devices/bus/hp_dio/hp98624.h b/src/devices/bus/hp_dio/hp98624.h index 46ca67538c9..bc419cd4337 100644 --- a/src/devices/bus/hp_dio/hp98624.h +++ b/src/devices/bus/hp_dio/hp98624.h @@ -7,51 +7,7 @@ #pragma once #include "hp_dio.h" -#include "machine/tms9914.h" -#include "bus/ieee488/ieee488.h" -namespace bus::hp_dio { - -class dio16_98624_device : - public device_t, - public device_dio16_card_interface -{ -public: - dio16_98624_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - dio16_98624_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - - virtual void device_start() override; - virtual void device_reset() override; - - virtual ioport_constructor device_input_ports() const override; - virtual void device_add_mconfig(machine_config &config) override; - - void dmack_w_in(int channel, uint8_t data) override; - uint8_t dmack_r_in(int channel) override; - - uint16_t io_r(offs_t offset); - void io_w(offs_t offset, uint16_t data); - - required_device m_tms9914; - required_device m_ieee488; - required_ioport m_switches; -private: - void update_gpib_irq(); - void update_gpib_dma(); - void gpib_irq(int state); - void gpib_dreq(int state); - - bool m_gpib_irq_line; - bool m_gpib_dma_line; - - bool m_installed_io; - uint8_t m_control; -}; - -} // namespace bus::hp_dio - -DECLARE_DEVICE_TYPE_NS(HPDIO_98624, bus::hp_dio, dio16_98624_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98624, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98624_H diff --git a/src/devices/bus/hp_dio/hp98643.cpp b/src/devices/bus/hp_dio/hp98643.cpp index 1d8934f739a..dcc8da23245 100644 --- a/src/devices/bus/hp_dio/hp98643.cpp +++ b/src/devices/bus/hp_dio/hp98643.cpp @@ -13,9 +13,80 @@ //#define VERBOSE 1 #include "logmacro.h" -DEFINE_DEVICE_TYPE(HPDIO_98643, bus::hp_dio::dio16_98643_device, "dio98643", "HP98643A LANIC Ethernet card") -namespace bus::hp_dio { +namespace { + +static constexpr int REG_SWITCHES_REMOTE = 0x80; + +static constexpr int REG_SWITCHES_SELECT_CODE_MASK = 0x1f; +static constexpr int REG_SWITCHES_SELECT_CODE_SHIFT = 0x00; + +static constexpr int REG_SWITCHES_INT_LEVEL_MASK = 0x03; +static constexpr int REG_SWITCHES_INT_LEVEL_SHIFT = 0x05; + +static constexpr uint16_t REG_ID = 0x15; + +static constexpr uint16_t REG_STATUS_ACK = 0x04; + +static constexpr uint16_t REG_SC_REV = 0x01; +static constexpr uint16_t REG_SC_LOCK = 0x08; +static constexpr uint16_t REG_SC_IP = 0x40; +static constexpr uint16_t REG_SC_IE = 0x80; + +class dio16_98643_device : + public device_t, + public bus::hp_dio::device_dio16_card_interface +{ +public: + // construction/destruction + dio16_98643_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + dio16_98643_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; + + virtual ioport_constructor device_input_ports() const override; + virtual void device_add_mconfig(machine_config &config) override; + +private: + required_device m_lance; + required_ioport m_switches; + + void addrmap(address_map &map); + void update_int(); + int get_irq_line(); + + uint16_t sc_r(); + void sc_w(uint16_t data); + uint16_t id_r(); + void id_w(uint16_t data); + uint16_t novram_r(offs_t offset); + void novram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + void lance_int_w(int state); + void lance_dma_out(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + uint16_t lance_dma_in(offs_t offset); + + uint16_t m_novram[32] = { + 0xfff0, 0xfff0, 0xfff0, 0xfff0, + 0xfff0, 0xfff8, 0xfff0, 0xfff0, + 0xfff0, 0xfff9, 0xfff0, 0xfff6, + 0xfffa, 0xfff1, 0xffff, 0xfff1, + 0xfff0, 0xfff0, 0xfff0, 0xfff0, + 0xfff0, 0xfff0, 0xfff0, 0xfff0, + 0xfff0, 0xfff0, 0xfff0, 0xfff0, + 0xfff0, 0xfff0, 0xfffa, 0xfff9, + }; + + std::array m_ram; + + uint16_t m_sc; + bool m_installed_io; +}; void dio16_98643_device::device_add_mconfig(machine_config &config) { @@ -212,4 +283,6 @@ void dio16_98643_device::addrmap(address_map &map) map(0xc000, 0xffff).rw(FUNC(dio16_98643_device::novram_r), FUNC(dio16_98643_device::novram_w)); } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98643, bus::hp_dio::device_dio16_card_interface, dio16_98643_device, "dio98643", "HP98643A LANIC Ethernet card") diff --git a/src/devices/bus/hp_dio/hp98643.h b/src/devices/bus/hp_dio/hp98643.h index e58a973ae8f..58fdf8df71c 100644 --- a/src/devices/bus/hp_dio/hp98643.h +++ b/src/devices/bus/hp_dio/hp98643.h @@ -7,85 +7,8 @@ #pragma once #include "hp_dio.h" -#include "machine/am79c90.h" - -namespace bus::hp_dio { - -static constexpr int REG_SWITCHES_REMOTE = 0x80; - -static constexpr int REG_SWITCHES_SELECT_CODE_MASK = 0x1f; -static constexpr int REG_SWITCHES_SELECT_CODE_SHIFT = 0x00; - -static constexpr int REG_SWITCHES_INT_LEVEL_MASK = 0x03; -static constexpr int REG_SWITCHES_INT_LEVEL_SHIFT = 0x05; - -static constexpr uint16_t REG_ID = 0x15; - -static constexpr uint16_t REG_STATUS_ACK = 0x04; - -static constexpr uint16_t REG_SC_REV = 0x01; -static constexpr uint16_t REG_SC_LOCK = 0x08; -static constexpr uint16_t REG_SC_IP = 0x40; -static constexpr uint16_t REG_SC_IE = 0x80; - -class dio16_98643_device : - public device_t, - public device_dio16_card_interface -{ -public: - // construction/destruction - dio16_98643_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - dio16_98643_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; - - virtual ioport_constructor device_input_ports() const override; - virtual void device_add_mconfig(machine_config &config) override; - -private: - required_device m_lance; - required_ioport m_switches; - - void addrmap(address_map &map); - void update_int(); - int get_irq_line(); - - uint16_t sc_r(); - void sc_w(uint16_t data); - uint16_t id_r(); - void id_w(uint16_t data); - uint16_t novram_r(offs_t offset); - void novram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - void lance_int_w(int state); - void lance_dma_out(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - uint16_t lance_dma_in(offs_t offset); - - uint16_t m_novram[32] = { - 0xfff0, 0xfff0, 0xfff0, 0xfff0, - 0xfff0, 0xfff8, 0xfff0, 0xfff0, - 0xfff0, 0xfff9, 0xfff0, 0xfff6, - 0xfffa, 0xfff1, 0xffff, 0xfff1, - 0xfff0, 0xfff0, 0xfff0, 0xfff0, - 0xfff0, 0xfff0, 0xfff0, 0xfff0, - 0xfff0, 0xfff0, 0xfff0, 0xfff0, - 0xfff0, 0xfff0, 0xfffa, 0xfff9, - }; - - std::array m_ram; - - uint16_t m_sc; - bool m_installed_io; -}; - -} // namespace bus::hp_dio // device type definition -DECLARE_DEVICE_TYPE_NS(HPDIO_98643, bus::hp_dio, dio16_98643_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98643, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98643_H diff --git a/src/devices/bus/hp_dio/hp98644.cpp b/src/devices/bus/hp_dio/hp98644.cpp index 5551d537bf3..731ca67a246 100644 --- a/src/devices/bus/hp_dio/hp98644.cpp +++ b/src/devices/bus/hp_dio/hp98644.cpp @@ -9,15 +9,44 @@ #include "emu.h" #include "hp98644.h" #include "bus/rs232/rs232.h" +#include "machine/ins8250.h" +#include "hp_dio.h" +namespace { -//************************************************************************** -// GLOBAL VARIABLES -//************************************************************************** +class dio16_98644_device : + public device_t, + public bus::hp_dio::device_dio16_card_interface +{ +public: + // construction/destruction + dio16_98644_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + dio16_98644_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; -DEFINE_DEVICE_TYPE(HPDIO_98644, bus::hp_dio::dio16_98644_device, "dio98644", "HP98644A Asynchronous Serial Interface") + virtual ioport_constructor device_input_ports() const override; + // optional information overrides + virtual void device_add_mconfig(machine_config &config) override; -namespace bus::hp_dio { + uint16_t io_r(offs_t offset); + void io_w(offs_t offset, uint16_t data); + + required_device m_uart; + +private: + required_ioport m_switches; + bool m_installed_io; + uint8_t m_control; + + bool m_loopback; + uint8_t m_data; +}; //------------------------------------------------- // device_add_mconfig - add device configuration @@ -240,4 +269,7 @@ void dio16_98644_device::io_w(offs_t offset, uint16_t data) } } -} // namespace bus::hp_dio +} // anonymous namespace + +DEFINE_DEVICE_TYPE_PRIVATE(HPDIO_98644, bus::hp_dio::device_dio16_card_interface, dio16_98644_device, "dio98644", "HP98644A Asynchronous Serial Interface") + diff --git a/src/devices/bus/hp_dio/hp98644.h b/src/devices/bus/hp_dio/hp98644.h index 6cd99123b92..848fb0ac09e 100644 --- a/src/devices/bus/hp_dio/hp98644.h +++ b/src/devices/bus/hp_dio/hp98644.h @@ -7,53 +7,8 @@ #pragma once #include "hp_dio.h" -#include "machine/ins8250.h" - -//************************************************************************** -// TYPE DEFINITIONS -//************************************************************************** - -// ======================> dio16_98644_device - -namespace bus::hp_dio { - -class dio16_98644_device : - public device_t, - public device_dio16_card_interface -{ -public: - // construction/destruction - dio16_98644_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - -protected: - dio16_98644_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; - - virtual ioport_constructor device_input_ports() const override; - // optional information overrides - virtual void device_add_mconfig(machine_config &config) override; - - uint16_t io_r(offs_t offset); - void io_w(offs_t offset, uint16_t data); - - required_device m_uart; - -private: - required_ioport m_switches; - bool m_installed_io; - uint8_t m_control; - - bool m_loopback; - uint8_t m_data; -}; - -} // namespace bus::hp_dio // device type definition -DECLARE_DEVICE_TYPE_NS(HPDIO_98644, bus::hp_dio, dio16_98644_device) +DECLARE_DEVICE_TYPE_NS(HPDIO_98644, bus::hp_dio, device_dio16_card_interface) #endif // MAME_BUS_HPDIO_98644_H -- cgit v1.2.3