From e76b6ab32fb763c221e16c7771b63e5a0ce71ea4 Mon Sep 17 00:00:00 2001 From: cracyc Date: Fri, 24 Nov 2017 22:32:29 -0600 Subject: cga: add compaq portable iii video, text modes and color need to be fixed (nw) --- src/devices/bus/isa/cga.cpp | 74 ++++++++++++++++++++++++++++++++++++++- src/devices/bus/isa/cga.h | 20 +++++++++++ src/devices/bus/isa/isa_cards.cpp | 2 ++ src/mame/drivers/at.cpp | 39 ++++++++++++++++----- 4 files changed, 126 insertions(+), 9 deletions(-) diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index 2f810bdafdb..a578881be7e 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -1919,7 +1919,12 @@ MACHINE_CONFIG_MEMBER( isa8_cga_m24_device::device_add_mconfig ) MACHINE_CONFIG_END isa8_cga_m24_device::isa8_cga_m24_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - isa8_cga_device(mconfig, ISA8_CGA_M24, tag, owner, clock), m_mode2(0), m_index(0) + isa8_cga_m24_device(mconfig, ISA8_CGA_M24, tag, owner, clock) +{ +} + +isa8_cga_m24_device::isa8_cga_m24_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + isa8_cga_device(mconfig, type, tag, owner, clock), m_mode2(0), m_index(0) { m_vram_size = 0x8000; } @@ -2040,3 +2045,70 @@ MC6845_UPDATE_ROW( isa8_cga_m24_device::m24_gfx_1bpp_m24_update_row ) *p = palette[( data & 0x01 ) ? fg : 0]; p++; } } + +DEFINE_DEVICE_TYPE(ISA8_CGA_CPORTIII, isa8_cga_cportiii_device, "cga_cportiii", "Compaq Portable III CGA") + +MACHINE_CONFIG_MEMBER( isa8_cga_cportiii_device::device_add_mconfig ) + isa8_cga_m24_device::device_add_mconfig(config); + + MCFG_DEVICE_MODIFY(CGA_SCREEN_NAME) + MCFG_SCREEN_COLOR(rgb_t(255, 125, 0)) +MACHINE_CONFIG_END + +isa8_cga_cportiii_device::isa8_cga_cportiii_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + isa8_cga_m24_device(mconfig, ISA8_CGA_CPORTIII, tag, owner, clock) +{ +} + +ROM_START(cga_cportiii) + ROM_REGION(0x2000, "gfx1", 0) + ROM_FILL(0, 0x2000, 0) +ROM_END + +const tiny_rom_entry *isa8_cga_cportiii_device::device_rom_region() const +{ + return ROM_NAME(cga_cportiii); +} + +void isa8_cga_cportiii_device::device_reset() +{ + isa8_cga_m24_device::device_reset(); + m_isa->install_device(0x13c6, 0x13c7, read8_delegate(FUNC(isa8_cga_cportiii_device::port_13c6_r), this), write8_delegate(FUNC(isa8_cga_cportiii_device::port_13c6_w), this)); + m_isa->install_device(0x23c6, 0x23c7, read8_delegate(FUNC(isa8_cga_cportiii_device::port_23c6_r), this), write8_delegate(FUNC(isa8_cga_cportiii_device::port_23c6_w), this)); + m_palette->set_pen_color(0, 100, 25, 0); + +} + +WRITE8_MEMBER(isa8_cga_cportiii_device::char_ram_write) +{ + if(!BIT(offset, 0)) // FIXME: the font is 16 chars high, this needs it's own text drawing + m_chr_gen_base[(offset >> 1) + 0x1000] = data; +} + +READ8_MEMBER(isa8_cga_cportiii_device::char_ram_read) +{ + return m_chr_gen_base[(offset >> 1) + 0x1000]; +} + +READ8_MEMBER(isa8_cga_cportiii_device::port_13c6_r) +{ + return 0x04; +} + +WRITE8_MEMBER(isa8_cga_cportiii_device::port_13c6_w) +{ +} + +READ8_MEMBER(isa8_cga_cportiii_device::port_23c6_r) +{ + return 0; +} + +WRITE8_MEMBER(isa8_cga_cportiii_device::port_23c6_w) +{ + io_write(space, 0x0e, BIT(data, 0)); + if(BIT(data, 3)) + m_isa->install_memory(0xb8000, 0xb9fff, read8_delegate(FUNC(isa8_cga_cportiii_device::char_ram_read), this), write8_delegate(FUNC(isa8_cga_cportiii_device::char_ram_write), this)); + else + m_isa->install_bank(0xb8000, 0xb8000 + 0x8000 - 1, "bank_cga", &m_vram[0]); +} diff --git a/src/devices/bus/isa/cga.h b/src/devices/bus/isa/cga.h index d482859fbb4..a69030070fb 100644 --- a/src/devices/bus/isa/cga.h +++ b/src/devices/bus/isa/cga.h @@ -285,6 +285,7 @@ public: MC6845_RECONFIGURE(reconfigure); protected: + isa8_cga_m24_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); virtual void device_reset() override; // optional information overrides virtual void device_add_mconfig(machine_config &config) override; @@ -296,4 +297,23 @@ private: // device type definition DECLARE_DEVICE_TYPE(ISA8_CGA_M24, isa8_cga_m24_device) +class isa8_cga_cportiii_device : + public isa8_cga_m24_device +{ +public: + isa8_cga_cportiii_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + DECLARE_READ8_MEMBER(port_13c6_r); + DECLARE_WRITE8_MEMBER(port_13c6_w); + DECLARE_READ8_MEMBER(port_23c6_r); + DECLARE_WRITE8_MEMBER(port_23c6_w); + DECLARE_READ8_MEMBER(char_ram_read); + DECLARE_WRITE8_MEMBER(char_ram_write); +protected: + virtual void device_reset() override; + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; +}; + +DECLARE_DEVICE_TYPE(ISA8_CGA_CPORTIII, isa8_cga_cportiii_device) + #endif // MAME_BUS_ISA_CGA_H diff --git a/src/devices/bus/isa/isa_cards.cpp b/src/devices/bus/isa/isa_cards.cpp index 218c0231baa..5f1e5243fd1 100644 --- a/src/devices/bus/isa/isa_cards.cpp +++ b/src/devices/bus/isa/isa_cards.cpp @@ -69,6 +69,7 @@ SLOT_INTERFACE_START( pc_isa8_cards ) SLOT_INTERFACE("cga_poisk2", ISA8_CGA_POISK2) SLOT_INTERFACE("cga_mc1502", ISA8_CGA_MC1502) SLOT_INTERFACE("cga_m24", ISA8_CGA_M24) + SLOT_INTERFACE("cga_cportiii", ISA8_CGA_CPORTIII) SLOT_INTERFACE("aga", ISA8_AGA) SLOT_INTERFACE("aga_pc200", ISA8_AGA_PC200) SLOT_INTERFACE("ega", ISA8_EGA) @@ -110,6 +111,7 @@ SLOT_INTERFACE_START( pc_isa16_cards ) // 8-bit SLOT_INTERFACE("mda", ISA8_MDA) SLOT_INTERFACE("cga", ISA8_CGA) + SLOT_INTERFACE("cga_cportiii", ISA8_CGA_CPORTIII) SLOT_INTERFACE("wyse700", ISA8_WYSE700) SLOT_INTERFACE("ega", ISA8_EGA) SLOT_INTERFACE("pgc", ISA8_PGC) diff --git a/src/mame/drivers/at.cpp b/src/mame/drivers/at.cpp index b938bec1c30..694bc6b2a55 100644 --- a/src/mame/drivers/at.cpp +++ b/src/mame/drivers/at.cpp @@ -328,6 +328,13 @@ MACHINE_START_MEMBER(at_state,vrom_fix) membank("vrom_bank")->set_base(machine().root_device().memregion("bios")->base()); } +static MACHINE_CONFIG_START( cfg_single_1200K ) + MCFG_DEVICE_MODIFY("fdc:0") + MCFG_SLOT_DEFAULT_OPTION("525hd") + MCFG_DEVICE_MODIFY("fdc:1") + MCFG_SLOT_DEFAULT_OPTION("") +MACHINE_CONFIG_END + static SLOT_INTERFACE_START( pci_devices ) SLOT_INTERFACE_INTERNAL("vt82c505", VT82C505) SLOT_INTERFACE_END @@ -658,16 +665,32 @@ static MACHINE_CONFIG_START( ficpio2 ) MACHINE_CONFIG_END // Compaq Portable III -static MACHINE_CONFIG_DERIVED( comportiii, ibm5170 ) - MCFG_CPU_MODIFY("maincpu") - MCFG_CPU_CLOCK(XTAL_48MHz / 4) - MCFG_DEVICE_MODIFY(RAM_TAG) +static MACHINE_CONFIG_START( comportiii ) + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", I80286, XTAL_48MHz/4 /*12000000*/) + MCFG_CPU_PROGRAM_MAP(at16_map) + MCFG_CPU_IO_MAP(at16_io) + MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("mb:pic8259_master", pic8259_device, inta_cb) + MCFG_80286_SHUTDOWN(DEVWRITELINE("mb", at_mb_device, shutdown)) + + MCFG_DEVICE_ADD("mb", AT_MB, 0) + MCFG_QUANTUM_TIME(attotime::from_hz(60)) + MCFG_FRAGMENT_ADD(at_softlists) + + MCFG_ISA16_SLOT_ADD("mb:isabus","board1", pc_isa16_cards, "fdc", true) + MCFG_SLOT_OPTION_MACHINE_CONFIG("fdc", cfg_single_1200K) + MCFG_ISA16_SLOT_ADD("mb:isabus","board2", pc_isa16_cards, "comat", true) + MCFG_ISA16_SLOT_ADD("mb:isabus","board3", pc_isa16_cards, "hdc", true) + MCFG_ISA16_SLOT_ADD("mb:isabus","board4", pc_isa16_cards, "cga_cportiii", true) + MCFG_ISA16_SLOT_ADD("mb:isabus","isa1", pc_isa16_cards, nullptr, false) + MCFG_ISA16_SLOT_ADD("mb:isabus","isa2", pc_isa16_cards, nullptr, false) + + MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_at_keyboards, STR_KBD_IBM_PC_AT_84) + + /* internal ram */ + MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("640K") MCFG_RAM_EXTRA_OPTIONS("1152K,1664K,2176K,2688K,4736K,6784K") - MCFG_DEVICE_MODIFY("isa1") - MCFG_DEVICE_SLOT_INTERFACE(pc_isa8_cards, "cga_m24", false) - MCFG_DEVICE_MODIFY("isa4") - MCFG_DEVICE_SLOT_INTERFACE(pc_isa16_cards, "hdc", false) MACHINE_CONFIG_END //************************************************************************** -- cgit v1.2.3