Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbbert committed Mar 22, 2024
2 parents e4666aa + 5f8eb31 commit ccd0d61
Show file tree
Hide file tree
Showing 78 changed files with 6,298 additions and 2,268 deletions.
24 changes: 14 additions & 10 deletions docs/source/debugger/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -190,18 +190,22 @@ available:

%c
Prints the corresponding argument as an 8-bit character.
%[0][<n>]d
%[-][0][<n>]d
Prints the corresponding argument as a decimal number with optional
minimum field width and zero fill.
%[0][<n>]o
left justification, zero fill and minimum field width.
%[-][0][<n>]o
Prints the corresponding argument as an octal number with optional
minimum field width and zero fill using lowercase letters.
%[0][<n>]x
Prints the corresponding argument as a hexadecimal number with
optional minimum field width and zero fill using lowercase letters.
%[0][<n>]X
Prints the corresponding argument as a hexadecimal number with
optional minimum field width and zero fill using uppercase letters.
left justification, zero fill and minimum field width.
%[-][0][<n>]x
Prints the corresponding argument as a lowercase hexadecimal number
with optional left justification, zero fill and minimum field width.
%[-][0][<n>]X
Prints the corresponding argument as an uppercase hexadecimal number
with optional left justification, zero fill and minimum field width.
%[-][<n>][.[<n>]]s
Prints a null-terminated string of 8-bit characters from the address
and address space given by the corresponding argument, with optional
left justification, minimum and maximum field widths.
\%%
Prints a literal percent symbol.
\\n
Expand Down
298 changes: 149 additions & 149 deletions hash/snes_bspack.xml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions scripts/src/machine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2917,6 +2917,8 @@ if (MACHINES["PCI"]~=null) then
MAME_DIR .. "src/devices/machine/mediagx_cs5530_bridge.h",
MAME_DIR .. "src/devices/machine/mediagx_cs5530_ide.cpp",
MAME_DIR .. "src/devices/machine/mediagx_cs5530_ide.h",
MAME_DIR .. "src/devices/machine/mediagx_cs5530_video.cpp",
MAME_DIR .. "src/devices/machine/mediagx_cs5530_video.h",
MAME_DIR .. "src/devices/machine/mediagx_host.cpp",
MAME_DIR .. "src/devices/machine/mediagx_host.h",
MAME_DIR .. "src/devices/machine/zfmicro_usb.cpp",
Expand Down
15 changes: 13 additions & 2 deletions src/devices/imagedev/cassette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "util/ioprocs.h"
#include "util/ioprocsfilter.h"

#include <regex>

#define LOG_WARN (1U << 1) // Warnings
#define LOG_DETAIL (1U << 2) // Details

Expand Down Expand Up @@ -258,6 +260,16 @@ std::pair<std::error_condition, std::string> cassette_image_device::call_load()
return std::make_pair(internal_load(false), std::string());
}

bool cassette_image_device::has_any_extension(std::string_view candidate_extensions) const
{
const char separator = ',';
std::istringstream extension_stream(std::string{candidate_extensions});
for (std::string extension; std::getline(extension_stream, extension, separator);)
if (is_filetype(extension))
return true;
return false;
}

std::error_condition cassette_image_device::internal_load(bool is_create)
{
cassette_image::error err;
Expand All @@ -270,10 +282,9 @@ std::error_condition cassette_image_device::internal_load(bool is_create)
auto io = util::random_read_write_fill(image_core_file(), 0x00);
if (io)
{
// creating an image
err = cassette_image::create(
std::move(io),
&cassette_image::wavfile_format,
has_any_extension(cassette_image::flacfile_format.extensions) ? &cassette_image::flacfile_format : &cassette_image::wavfile_format,
m_create_opts,
cassette_image::FLAG_READWRITE|cassette_image::FLAG_SAVEONEXIT,
m_cassette);
Expand Down
1 change: 1 addition & 0 deletions src/devices/imagedev/cassette.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class cassette_image_device : public device_t,
const char * m_interface;

std::error_condition internal_load(bool is_create);
bool has_any_extension(std::string_view candidate_extensions) const;
bool m_stereo;
std::vector<s16> m_samples;
};
Expand Down
55 changes: 55 additions & 0 deletions src/devices/machine/mediagx_cs5530_video.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// license: BSD-3-Clause
// copyright-holders: Angelo Salese
/**************************************************************************************************
[Cyrix/National Semiconductor/AMD] [MediaGX/Geode] [Cx/CS]5530 VIDEO implementation (XpressGRAPHICS?)
TODO:
- extensions for host display section (GX_BASE+8300h);
**************************************************************************************************/

#include "emu.h"
#include "mediagx_cs5530_video.h"

#define VERBOSE (LOG_GENERAL)
//#define LOG_OUTPUT_FUNC osd_printf_info

#include "logmacro.h"

DEFINE_DEVICE_TYPE(MEDIAGX_CS5530_VIDEO, mediagx_cs5530_video_device, "mediagx_cs5530_video", "MediaGX CS5530 Video Controller")

mediagx_cs5530_video_device::mediagx_cs5530_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: pci_device(mconfig, MEDIAGX_CS5530_VIDEO, tag, owner, clock)
{
set_ids(0x10780104, 0x00, 0x030000, 0x00);
}

void mediagx_cs5530_video_device::config_map(address_map &map)
{
pci_device::config_map(map);
// map(0x14, 0xff).unmaprw(); // <reserved>
}

void mediagx_cs5530_video_device::io_map(address_map &map)
{

}

void mediagx_cs5530_video_device::device_start()
{
pci_device::device_start();

add_map(4*1024, M_MEM, FUNC(mediagx_cs5530_video_device::io_map));

// no INT pin
}

void mediagx_cs5530_video_device::device_reset()
{
pci_device::device_reset();

command = 0x0000;
command_mask = 0x0003;
status = 0x0280;
}
29 changes: 29 additions & 0 deletions src/devices/machine/mediagx_cs5530_video.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// license: BSD-3-Clause
// copyright-holders: Angelo Salese

#ifndef MAME_MACHINE_SIS630_VGA_H
#define MAME_MACHINE_SIS630_VGA_H

#pragma once

#include "pci.h"
#include "video/pc_vga.h"

class mediagx_cs5530_video_device : public pci_device
{
public:
mediagx_cs5530_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

protected:
virtual void device_start() override;
virtual void device_reset() override;

virtual void config_map(address_map &map) override;

void io_map(address_map &map);
};

DECLARE_DEVICE_TYPE(MEDIAGX_CS5530_VIDEO, mediagx_cs5530_video_device)


#endif
42 changes: 41 additions & 1 deletion src/devices/machine/mediagx_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// copyright-holders: Angelo Salese
/**************************************************************************************************
MediaGX host implementation (northbridge)
MediaGX host implementation (northbridge)
TODO:
- Currently cheat around software VGA, MediaGX notoriously triggers SMI for every access to
VGA legacy ranges, which is horrible both for emulation purposes and for performance.
**************************************************************************************************/

Expand All @@ -23,6 +27,7 @@ DEFINE_DEVICE_TYPE(MEDIAGX_HOST, mediagx_host_device, "mediagx_host", "MediaGX X
mediagx_host_device::mediagx_host_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: pci_host_device(mconfig, MEDIAGX_HOST, tag, owner, clock)
, m_host_cpu(*this, finder_base::DUMMY_TAG)
, m_vga(*this, "vga")
{
m_superio_space_config = address_space_config("superio_space", ENDIANNESS_LITTLE, 8, 8, 0, address_map_constructor(FUNC(mediagx_host_device::superio_map), this));
}
Expand Down Expand Up @@ -134,6 +139,18 @@ void mediagx_host_device::device_reset()
remap_cb();
}

void mediagx_host_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(vga_device::screen_update));

// HACK: needs an interruptible x86 core to even try.
VGA(config, m_vga, 0);
m_vga->set_screen("screen");
m_vga->set_vram_size(16*1024*1024);
}

void mediagx_host_device::config_map(address_map &map)
{
pci_host_device::config_map(map);
Expand Down Expand Up @@ -201,6 +218,9 @@ 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]);
memory_space->install_device(0x000a0000, 0x000bffff, *this, &mediagx_host_device::legacy_memory_map);
io_space->install_device(0x03b0, 0x03df, *this, &mediagx_host_device::legacy_io_map);

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:
Expand Down Expand Up @@ -266,3 +286,23 @@ void mediagx_host_device::gxbase_map(address_map &map)
// 0x400000 SMM System Code
// 0x800000 GFX memory
}

void mediagx_host_device::legacy_memory_map(address_map &map)
{
map(0x00000, 0x1ffff).rw(FUNC(mediagx_host_device::vram_r), FUNC(mediagx_host_device::vram_w));
}

void mediagx_host_device::legacy_io_map(address_map &map)
{
map(0x000, 0x02f).m(m_vga, FUNC(vga_device::io_map));
}

uint8_t mediagx_host_device::vram_r(offs_t offset)
{
return downcast<vga_device *>(m_vga.target())->mem_r(offset);
}

void mediagx_host_device::vram_w(offs_t offset, uint8_t data)
{
downcast<vga_device *>(m_vga.target())->mem_w(offset, data);
}
8 changes: 8 additions & 0 deletions src/devices/machine/mediagx_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once

#include "pci.h"
#include "video/pc_vga.h"

class mediagx_host_device : public pci_host_device
{
Expand All @@ -28,6 +29,7 @@ class mediagx_host_device : public pci_host_device
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;
Expand All @@ -42,6 +44,7 @@ class mediagx_host_device : public pci_host_device
AS_PCI_IO = 2
};
required_device<cpu_device> m_host_cpu;
required_device<vga_device> m_vga;
std::vector<uint32_t> m_ram;
address_space_config m_superio_space_config;

Expand All @@ -62,6 +65,11 @@ class mediagx_host_device : public pci_host_device
void gxbase_map(address_map &map);

u32 m_bc_xmap[3]{};

void legacy_memory_map(address_map &map);
void legacy_io_map(address_map &map);
u8 vram_r(offs_t offset);
void vram_w(offs_t offset, uint8_t data);
};

DECLARE_DEVICE_TYPE(MEDIAGX_HOST, mediagx_host_device)
Expand Down
Loading

0 comments on commit ccd0d61

Please sign in to comment.