From 37c419f51a0afa5ef4eeec25c77ff85256f86480 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 22 Feb 2024 19:11:00 +0100 Subject: video/gf7600gs: add basic legacy VGA control --- src/devices/video/gf7600gs.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++ src/devices/video/gf7600gs.h | 14 ++++++++++++ src/mame/sega/lindbergh.cpp | 23 ++++++++++++++------ 3 files changed, 79 insertions(+), 6 deletions(-) diff --git a/src/devices/video/gf7600gs.cpp b/src/devices/video/gf7600gs.cpp index 075c95c5628..10188e627d5 100644 --- a/src/devices/video/gf7600gs.cpp +++ b/src/devices/video/gf7600gs.cpp @@ -19,9 +19,22 @@ void geforce_7600gs_device::map3(address_map &map) geforce_7600gs_device::geforce_7600gs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pci_device(mconfig, GEFORCE_7600GS, tag, owner, clock) + , m_vga(*this, "vga") { } +void geforce_7600gs_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(m_vga, FUNC(nvidia_nv3_vga_device::screen_update)); + + // TODO: very late superset (G73) + NVIDIA_NV3_VGA(config, m_vga, 0); + m_vga->set_screen("screen"); + m_vga->set_vram_size(256*1024*1024); +} + void geforce_7600gs_device::device_start() { pci_device::device_start(); @@ -35,3 +48,38 @@ void geforce_7600gs_device::device_reset() { pci_device::device_reset(); } + +void geforce_7600gs_device::legacy_memory_map(address_map &map) +{ + map(0xa0000, 0xbffff).rw(FUNC(geforce_7600gs_device::vram_r), FUNC(geforce_7600gs_device::vram_w)); +} + +void geforce_7600gs_device::legacy_io_map(address_map &map) +{ + map(0, 0x02f).m(m_vga, FUNC(nvidia_nv3_vga_device::io_map)); +} + +uint8_t geforce_7600gs_device::vram_r(offs_t offset) +{ + return downcast(m_vga.target())->mem_r(offset); +} + +void geforce_7600gs_device::vram_w(offs_t offset, uint8_t data) +{ + downcast(m_vga.target())->mem_w(offset, data); +} + +void geforce_7600gs_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(geforce_7600gs_device::vram_r)), write8sm_delegate(*this, FUNC(geforce_7600gs_device::vram_w))); + } + + if (BIT(command, 0)) + { + io_space->install_device(0x03b0, 0x03df, *this, &geforce_7600gs_device::legacy_io_map); + //memory_space->install_rom(0xc0000, 0xcffff, (void *)expansion_rom); + } +} diff --git a/src/devices/video/gf7600gs.h b/src/devices/video/gf7600gs.h index db13718c6da..5a82f1ec437 100644 --- a/src/devices/video/gf7600gs.h +++ b/src/devices/video/gf7600gs.h @@ -6,7 +6,9 @@ #pragma once #include "machine/pci.h" +#include "video/pc_vga_nvidia.h" +// FIXME: PCIe x16 class geforce_7600gs_device : public pci_device { public: geforce_7600gs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, uint32_t subdevice_id) @@ -16,14 +18,26 @@ public: } geforce_7600gs_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + void legacy_memory_map(address_map &map); + void legacy_io_map(address_map &map); + protected: virtual void device_start() override; virtual void device_reset() override; + virtual void device_add_mconfig(machine_config &config) 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; private: void map1(address_map &map); void map2(address_map &map); void map3(address_map &map); + + required_device m_vga; + + u8 vram_r(offs_t offset); + void vram_w(offs_t offset, uint8_t data); }; DECLARE_DEVICE_TYPE(GEFORCE_7600GS, geforce_7600gs_device) diff --git a/src/mame/sega/lindbergh.cpp b/src/mame/sega/lindbergh.cpp index d83eb4195f5..888c1cc7a44 100644 --- a/src/mame/sega/lindbergh.cpp +++ b/src/mame/sega/lindbergh.cpp @@ -2,12 +2,23 @@ // copyright-holders:Olivier Galibert /*************************************************************************** - Sega Lindbergh skeleton driver - - TODO: - - tests area 0xd0000 - 0xd000f, wants an undumped ROM in there? - - Apparently there's no way to avoid a dead lock at 0xfd085, perhaps - tied to the aforementioned? +Sega Lindbergh + +TODO: +- tests area 0xd0000 - 0xd000f, wants an undumped ROM in there? +- Pinpoint root cause of all of the following debug breakpoints + https://github.com/mamedev/mame/files/8766682/lindbergh_megahack.txt +- bp fffffff0,1,{eip-=0x12 ;g} (spurious execution parse of below) +- bp f4f1c,1,{eip+=2;g} +- bp 78adb,1,{eip+=2;g} +- bp f6bb3,1,{eip+=2;g} +- bp 7518f,1,{eip+=2;g} +- bp e7a22,1,{eip+=3;g} +- bp e7abf,1,{eip+=3;g} +- bp 79068,1,{eip+=2;g} +- bp 78aed,1,{eip+=2;g} +- BIOS detects CPU as :), throws errors 0270 (RTC), CMOS bad (0251) and + PCI resource conflict on SATA. *************************************************************************** -- cgit v1.2.3