From 5c84856b508ed72c89579da7ce61486da45e59f9 Mon Sep 17 00:00:00 2001 From: angelosa Date: Sun, 25 Feb 2024 01:52:51 +0100 Subject: [PATCH] bus/pci: add Vision 864 and 968 cards --- hash/ibm5170_cdrom.xml | 2 +- scripts/src/bus.lua | 2 + src/devices/bus/pci/pci_slot.cpp | 6 ++ src/devices/bus/pci/vision.cpp | 177 +++++++++++++++++++++++++++++++ src/devices/bus/pci/vision.h | 55 ++++++++++ src/devices/video/pc_vga_s3.cpp | 18 +++- src/mame/misc/odyssey.cpp | 5 +- 7 files changed, 260 insertions(+), 5 deletions(-) create mode 100644 src/devices/bus/pci/vision.cpp create mode 100644 src/devices/bus/pci/vision.h diff --git a/hash/ibm5170_cdrom.xml b/hash/ibm5170_cdrom.xml index efb9dd624b4..6d7885069e7 100644 --- a/hash/ibm5170_cdrom.xml +++ b/hash/ibm5170_cdrom.xml @@ -7092,7 +7092,7 @@ Contains software drivers for a ScanExpress 6000SP Flatbed Scanner, SCSI i/f S3 set_screen("screen"); + // 1MB, option for 2MB + m_vga->set_vram_size(2*1024*1024); +// m_vga->linear_config_changed().set(FUNC(s3_vga_device::linear_config_changed_w)); +} + +void vision864_device::device_start() +{ + pci_card_device::device_start(); + +// add_map(64 * 1024 * 1024, M_MEM | M_DISABLED, FUNC(vision864_device::lfb_map)); +// set_map_address(0, 0x70000000); + + add_rom((u8 *)m_bios->base(), 0x8000); + expansion_rom_base = 0xc0000; + + // Shouldn't have an intr pin +} + +void vision864_device::device_reset() +{ + pci_card_device::device_reset(); + + command = 0x0020; + command_mask = 0x23; + // Medium DEVSEL + status = 0x0200; + + remap_cb(); +} + +void vision864_device::legacy_io_map(address_map &map) +{ + map(0, 0x02f).m(m_vga, FUNC(s3_vga_device::io_map)); +} + +uint8_t vision864_device::vram_r(offs_t offset) +{ + return downcast(m_vga.target())->mem_r(offset); +} + +void vision864_device::vram_w(offs_t offset, uint8_t data) +{ + downcast(m_vga.target())->mem_w(offset, data); +} + +void vision864_device::map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, + uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space) +{ + if (BIT(command, 1)) + { + memory_space->install_readwrite_handler(0xa0000, 0xbffff, read8sm_delegate(*this, FUNC(vision864_device::vram_r)), write8sm_delegate(*this, FUNC(vision864_device::vram_w))); + } + + if (BIT(command, 0)) + { + io_space->install_device(0x03b0, 0x03df, *this, &vision864_device::legacy_io_map); + } +} + +/****************** + * + * Vision968 + * + *****************/ + +vision968_device::vision968_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : vision864_device(mconfig, VISION968_PCI, tag, owner, clock) +{ + // device IDs: + // 88f0-88f3 = 86c968 RAM v0-3 + // NOTE: class code = 0 (backward compatible VGA device) + set_ids(0x533388f0, 0x00, 0x000100, 0x533388f0); +} + +ROM_START( vision968 ) + ROM_REGION32_LE( 0x8000, "bios", ROMREGION_ERASEFF ) + ROM_DEFAULT_BIOS("no9fx771") + + ROM_SYSTEM_BIOS( 0, "no9fx771", "Number Nine 9FX MotionFX 771 v2.45.11" ) + ROMX_LOAD( "no9motionfx771.bin", 0x0000, 0x8000, CRC(7732e382) SHA1(9ec2fe056712cef39bd8380d406be3c874ea5ec9), ROM_BIOS(0) ) + ROM_IGNORE( 0x8000 ) + + ROM_SYSTEM_BIOS( 1, "elsaw2k", "Elsa Winner 2000Pro/X-8 v1.21.01-B" ) + ROMX_LOAD( "elsaw20008m.bin", 0x0000, 0x8000, CRC(47563211) SHA1(f51a40956c3e6e7c86851d81f81ba5f77509d361), ROM_BIOS(1) ) + ROM_IGNORE( 0x8000 ) + + ROM_SYSTEM_BIOS( 2, "speamp64", "SPEA/Videoseven V7-Mercury P-64 v1.01-08" ) + ROMX_LOAD( "spea.bin", 0x0000, 0x8000, CRC(2caeadaf) SHA1(236829f1e6065a2f0ebee91f71891d8402f0ab5a), ROM_BIOS(2) ) + ROM_IGNORE( 0x8000 ) +ROM_END + +const tiny_rom_entry *vision968_device::device_rom_region() const +{ + return ROM_NAME(vision968); +} + +void vision968_device::device_add_mconfig(machine_config &config) +{ + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(25'174'800), 900, 0, 640, 526, 0, 480); + screen.set_screen_update("vga", FUNC(s3_vga_device::screen_update)); + + S3_VGA(config, m_vga, 0); + m_vga->set_screen("screen"); + // 2MB/4MB/8MB + m_vga->set_vram_size(4*1024*1024); +// m_vga->linear_config_changed().set(FUNC(s3_vga_device::linear_config_changed_w)); +} diff --git a/src/devices/bus/pci/vision.h b/src/devices/bus/pci/vision.h new file mode 100644 index 00000000000..2a54702f231 --- /dev/null +++ b/src/devices/bus/pci/vision.h @@ -0,0 +1,55 @@ +// license:BSD-3-Clause +// copyright-holders: Angelo Salese + +#ifndef MAME_BUS_PCI_S3VISION_PCI_H +#define MAME_BUS_PCI_S3VISION_PCI_H + +#pragma once + +#include "pci_slot.h" + +#include "video/pc_vga_s3.h" + +class vision864_device : public pci_card_device +{ +public: + vision864_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + static constexpr feature_type imperfect_features() { return feature::GRAPHICS; } + + void legacy_io_map(address_map &map); + +protected: + vision864_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 void map_extra(uint64_t memory_window_start, uint64_t memory_window_end, uint64_t memory_offset, address_space *memory_space, + uint64_t io_window_start, uint64_t io_window_end, uint64_t io_offset, address_space *io_space) override; + + required_device m_vga; + required_memory_region m_bios; +private: + u8 vram_r(offs_t offset); + void vram_w(offs_t offset, uint8_t data); +}; + +class vision968_device : public vision864_device +{ +public: + vision968_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + +protected: + virtual void device_add_mconfig(machine_config &config) override; + + virtual const tiny_rom_entry *device_rom_region() const override; +}; + +DECLARE_DEVICE_TYPE(VISION864_PCI, vision864_device) +DECLARE_DEVICE_TYPE(VISION968_PCI, vision968_device) + +#endif // MAME_BUS_PCI_S3VISION_PCI_H diff --git a/src/devices/video/pc_vga_s3.cpp b/src/devices/video/pc_vga_s3.cpp index 2bab4deef24..8d4e7500568 100644 --- a/src/devices/video/pc_vga_s3.cpp +++ b/src/devices/video/pc_vga_s3.cpp @@ -70,6 +70,7 @@ void s3_vga_device::device_start() s3.id_low = 0x11; // CR2E s3.revision = 0x00; // CR2F s3.id_cr30 = 0xe1; // CR30 +// s3.id_cr30 = 0xc1; } void s3_vga_device::device_reset() @@ -115,17 +116,32 @@ void s3_vga_device::s3_define_video_mode() svga.rgb15_en = 0; svga.rgb16_en = 0; svga.rgb32_en = 0; + // FIXME: vision has only first 7 modes switch((s3.ext_misc_ctrl_2) >> 4) { + // 0001 Mode 8: 2x 8-bit 1 VCLK/2 pixels case 0x01: svga.rgb8_en = 1; break; + // 0010 Mode 1: 15-bit 2 VCLK/pixel + case 0x02: svga.rgb15_en = 1; break; + // 0011 Mode 9: 15-bit 1 VCLK/pixel case 0x03: svga.rgb15_en = 1; divisor = 2; break; + // 0100 Mode 2: 24-bit 3 VCLK/pixel + case 0x04: svga.rgb24_en = 1; break; + // 0101 Mode 10: 16-bit 1 VCLK/pixel case 0x05: svga.rgb16_en = 1; divisor = 2; break; + // 0110 Mode 3: 16-bit 2 VCLK/pixel + case 0x06: svga.rgb16_en = 1; break; + // 0111 Mode 11: 24/32-bit 2 VCLK/pixel + case 0x07: svga.rgb32_en = 1; divisor = 4; break; case 0x0d: svga.rgb32_en = 1; divisor = 1; break; - default: fatalerror("TODO: S3 colour mode not implemented %02x\n",((s3.ext_misc_ctrl_2) >> 4)); + default: + popmessage("pc_vga_s3: PA16B-COLOR-MODE %02x\n",((s3.ext_misc_ctrl_2) >> 4)); + break; } } else { + // 0000: Mode 0 8-bit 1 VCLK/pixel svga.rgb8_en = (s3.memory_config & 8) >> 3; svga.rgb15_en = 0; svga.rgb16_en = 0; diff --git a/src/mame/misc/odyssey.cpp b/src/mame/misc/odyssey.cpp index d5500819c30..de1d7911285 100644 --- a/src/mame/misc/odyssey.cpp +++ b/src/mame/misc/odyssey.cpp @@ -78,7 +78,7 @@ #include "machine/i82371sb.h" #include "machine/i82439hx.h" #include "bus/isa/isa_cards.h" -#include "bus/pci/virge_pci.h" +#include "bus/pci/vision.h" //#include "bus/rs232/hlemouse.h" //#include "bus/rs232/null_modem.h" //#include "bus/rs232/rs232.h" @@ -188,8 +188,7 @@ void odyssey_state::odyssey(machine_config &config) // TODO: 82371FB USB at 07.2 // On-board S3 Vision 968 - // FIXME: replace once we have a core for it - VIRGE_PCI(config, "pci:08.0", 0); + VISION968_PCI(config, "pci:08.0", 0); // pci:0d.0 (J4E1) PCI expansion slot 1 //PCI_SLOT(config, "pci:1", pci_cards, 13, 0, 1, 2, 3, nullptr);