machine/mediagx_host.cpp: implement BC_XMAP_2 & BC_XMAP_3

This commit is contained in:
angelosa 2023-12-15 23:41:20 +01:00
parent b32d7fb837
commit f35442bd36
3 changed files with 72 additions and 4 deletions

View File

@ -9,11 +9,15 @@
#include "emu.h"
#include "mediagx_host.h"
#define LOG_MAP (1U << 1) // log full remaps
#define VERBOSE (LOG_GENERAL)
//#define LOG_OUTPUT_FUNC osd_printf_warning
#include "logmacro.h"
#define LOGMAP(...) LOGMASKED(LOG_MAP, __VA_ARGS__)
DEFINE_DEVICE_TYPE(MEDIAGX_HOST, mediagx_host_device, "mediagx_host", "MediaGX X-Bus Host PCI")
mediagx_host_device::mediagx_host_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
@ -157,6 +161,32 @@ void mediagx_host_device::config_map(address_map &map)
);
}
void mediagx_host_device::map_shadowram(address_space *memory_space, uint32_t start_offs, uint32_t end_offs, bool read_enable, bool write_enable)
{
LOGMAP("- 0x%08x-0x%08x ", start_offs, end_offs);
switch(write_enable << 1 | read_enable)
{
case 0:
LOGMAP("shadow RAM off\n");
//memory_space->unmap_write(start_offs, end_offs);
break;
case 1:
LOGMAP("shadow RAM r/o\n");
memory_space->install_rom(start_offs, end_offs, &m_ram[start_offs/4]);
break;
case 2:
LOGMAP("shadow RAM w/o\n");
//memory_space->install_rom(start_offs, end_offs, m_region->base() + bios_rom_offset);
memory_space->install_writeonly(start_offs, end_offs, &m_ram[start_offs/4]);
break;
case 3:
LOGMAP("shadow RAM r/w\n");
memory_space->install_ram(start_offs, end_offs, &m_ram[start_offs/4]);
break;
}
}
void mediagx_host_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
@ -172,9 +202,35 @@ void mediagx_host_device::map_extra(
memory_space->install_ram(0x00000000, 0x0009ffff, &m_ram[0x00000000/4]);
// memory_space->install_ram(0x000a0000, 0x000bffff, &m_ram[0x000a0000/4]);
// FIXME: BC_XMAP_* regs
memory_space->install_ram(0x000c0000, 0x000dffff, &m_ram[0x000c0000/4]);
LOGMAP("Host Remapping table (BC_XMAP_1 %08x BC_XMAP_2 %08x BC_XMAP_3):\n", m_bc_xmap[0], m_bc_xmap[1], m_bc_xmap[2]);
// BC_XMAP_2 & BC_XMAP_3 bits remaps with this arrangement:
// x--- PCI accessible
// -x-- Cache Enable
// --x- Write Enable
// ---x Read Enable
for (int i = 0; i < 8; i ++)
{
u32 start_offs = 0x000c0000 + i * 0x4000;
u32 end_offs = start_offs + 0x3fff;
map_shadowram(
memory_space,
start_offs, end_offs,
bool(BIT(m_bc_xmap[1], i * 4)), bool(BIT(m_bc_xmap[1], i * 4 + 1))
);
}
for (int i = 0; i < 8; i ++)
{
u32 start_offs = 0x000e0000 + i * 0x4000;
u32 end_offs = start_offs + 0x3fff;
map_shadowram(
memory_space,
start_offs, end_offs,
bool(BIT(m_bc_xmap[2], i * 4)), bool(BIT(m_bc_xmap[2], i * 4 + 1))
);
}
memory_space->install_ram (0x00100000, 0x00efffff, &m_ram[0x00100000/4]);
// TODO: verify if there's a memory hole 15M-16M like other x86 PCI hosts
//if(memory_hole_upper)
@ -195,6 +251,15 @@ void mediagx_host_device::gxbase_map(address_map &map)
{
// 0x001000 scratchpad
// 0x008000 Internal bus I/F Unit
map(0x008004, 0x00800f).lrw32(
NAME([this] (offs_t offset) {
return m_bc_xmap[offset];
}),
NAME([this] (offs_t offset, u32 data, u32 mem_mask) {
COMBINE_DATA(&m_bc_xmap[offset]);
remap_cb();
})
);
// 0x008100 GFX pipeline
// 0x008300 Display controller
// 0x008400 Memory controller

View File

@ -35,6 +35,7 @@ protected:
virtual space_config_vector memory_space_config() const override;
virtual void config_map(address_map &map) override;
private:
void map_shadowram(address_space *memory_space, uint32_t start_offs, uint32_t end_offs, bool read_enable, bool write_enable);
enum
{
//AS_PCI_MEM = 1,
@ -59,6 +60,8 @@ private:
u8 m_pci_arbitration[2]{};
void gxbase_map(address_map &map);
u32 m_bc_xmap[3]{};
};
DECLARE_DEVICE_TYPE(MEDIAGX_HOST, mediagx_host_device)

View File

@ -1,12 +1,12 @@
// license:BSD-3-Clause
// copyright-holders:
// copyright-holders: Angelo Salese
/*
'Matrix' slot machine or poker game (the bezel has poker cards) by unidentified manufacturer
Game title is taken from ROM labels and cabinet. Might be incomplete.
Hardware consists of:
Motherboard (GXM-530D):
Motherboard (GXM-530D): (ETA: BIOS boots as SuperTek ST-MGXm3HB -AS)
Cyrix MediaGX GXm-266GP 2.9V
Cyrix GXm Cx5530 with GCT bios
128MB RAM