summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/snes/snes_slot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/snes/snes_slot.cpp')
-rw-r--r--src/devices/bus/snes/snes_slot.cpp88
1 files changed, 44 insertions, 44 deletions
diff --git a/src/devices/bus/snes/snes_slot.cpp b/src/devices/bus/snes/snes_slot.cpp
index c70a1cac664..ae553a7f612 100644
--- a/src/devices/bus/snes/snes_slot.cpp
+++ b/src/devices/bus/snes/snes_slot.cpp
@@ -88,7 +88,7 @@ device_sns_cart_interface::~device_sns_cart_interface()
// rom_alloc - alloc the space for the cart
//-------------------------------------------------
-void device_sns_cart_interface::rom_alloc(UINT32 size, const char *tag)
+void device_sns_cart_interface::rom_alloc(uint32_t size, const char *tag)
{
if (m_rom == nullptr)
{
@@ -102,7 +102,7 @@ void device_sns_cart_interface::rom_alloc(UINT32 size, const char *tag)
// nvram_alloc - alloc the space for the nvram
//-------------------------------------------------
-void device_sns_cart_interface::nvram_alloc(UINT32 size)
+void device_sns_cart_interface::nvram_alloc(uint32_t size)
{
m_nvram.resize(size);
}
@@ -115,7 +115,7 @@ void device_sns_cart_interface::nvram_alloc(UINT32 size)
// saved by the device itself)
//-------------------------------------------------
-void device_sns_cart_interface::rtc_ram_alloc(UINT32 size)
+void device_sns_cart_interface::rtc_ram_alloc(uint32_t size)
{
m_rtc_ram.resize(size);
}
@@ -126,7 +126,7 @@ void device_sns_cart_interface::rtc_ram_alloc(UINT32 size)
// (optional) add-on CPU bios
//-------------------------------------------------
-void device_sns_cart_interface::addon_bios_alloc(UINT32 size)
+void device_sns_cart_interface::addon_bios_alloc(uint32_t size)
{
m_bios.resize(size);
}
@@ -137,7 +137,7 @@ void device_sns_cart_interface::addon_bios_alloc(UINT32 size)
// blocks, so to simplify ROM access
//-------------------------------------------------
-void device_sns_cart_interface::rom_map_setup(UINT32 size)
+void device_sns_cart_interface::rom_map_setup(uint32_t size)
{
int i;
// setup the rom_bank_map array to faster ROM read
@@ -172,7 +172,7 @@ void device_sns_cart_interface::rom_map_setup(UINT32 size)
//-------------------------------------------------
// base_sns_cart_slot_device - constructor
//-------------------------------------------------
-base_sns_cart_slot_device::base_sns_cart_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) :
+base_sns_cart_slot_device::base_sns_cart_slot_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source) :
device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_image_interface(mconfig, *this),
device_slot_interface(mconfig, *this),
@@ -181,17 +181,17 @@ base_sns_cart_slot_device::base_sns_cart_slot_device(const machine_config &mconf
{
}
-sns_cart_slot_device::sns_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+sns_cart_slot_device::sns_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
base_sns_cart_slot_device(mconfig, SNS_CART_SLOT, "SNES Cartridge Slot", tag, owner, clock, "sns_cart_slot", __FILE__)
{
}
-sns_sufami_cart_slot_device::sns_sufami_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+sns_sufami_cart_slot_device::sns_sufami_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
base_sns_cart_slot_device(mconfig, SNS_SUFAMI_CART_SLOT, "SNES Sufami Turbo Cartridge Slot", tag, owner, clock, "sns_sufami_cart_slot", __FILE__)
{
}
-sns_bsx_cart_slot_device::sns_bsx_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
+sns_bsx_cart_slot_device::sns_bsx_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
base_sns_cart_slot_device(mconfig, SNS_BSX_CART_SLOT, "SNES BS-X Cartridge Slot", tag, owner, clock, "sns_bsx_cart_slot", __FILE__)
{
}
@@ -320,10 +320,10 @@ static const char *sns_get_slot(int type)
/* Here we add a couple of cart utilities, to avoid duplicating the code in each DEVICE_IMAGE_LOAD */
-UINT32 base_sns_cart_slot_device::snes_skip_header( UINT8 *ROM, UINT32 rom_size )
+uint32_t base_sns_cart_slot_device::snes_skip_header( uint8_t *ROM, uint32_t rom_size )
{
- UINT8 header[512];
- UINT32 offset = 512;
+ uint8_t header[512];
+ uint32_t offset = 512;
/* Check for a header (512 bytes) */
memcpy(header, ROM, 512);
@@ -357,14 +357,14 @@ UINT32 base_sns_cart_slot_device::snes_skip_header( UINT8 *ROM, UINT32 rom_size
/* This function assign a 'score' to data immediately after 'offset' to measure how valid they are
as information block (to decide if the image is HiRom, LoRom, ExLoRom or ExHiRom) */
/* Code from bsnes, courtesy of byuu - http://byuu.org/ , based on previous code by Cowering */
-static int snes_validate_infoblock( UINT8 *infoblock, UINT32 offset )
+static int snes_validate_infoblock( uint8_t *infoblock, uint32_t offset )
{
int score = 0;
- UINT16 reset_vector = infoblock[offset + 0x3c] | (infoblock[offset + 0x3d] << 8);
- UINT16 checksum = infoblock[offset + 0x1e] | (infoblock[offset + 0x1f] << 8);
- UINT16 ichecksum = infoblock[offset + 0x1c] | (infoblock[offset + 0x1d] << 8);
- UINT8 reset_opcode = infoblock[(offset & ~0x7fff) | (reset_vector & 0x7fff)]; //first opcode executed upon reset
- UINT8 mapper = infoblock[offset + 0x15] & ~0x10; //mask off irrelevant FastROM-capable bit
+ uint16_t reset_vector = infoblock[offset + 0x3c] | (infoblock[offset + 0x3d] << 8);
+ uint16_t checksum = infoblock[offset + 0x1e] | (infoblock[offset + 0x1f] << 8);
+ uint16_t ichecksum = infoblock[offset + 0x1c] | (infoblock[offset + 0x1d] << 8);
+ uint8_t reset_opcode = infoblock[(offset & ~0x7fff) | (reset_vector & 0x7fff)]; //first opcode executed upon reset
+ uint8_t mapper = infoblock[offset + 0x15] & ~0x10; //mask off irrelevant FastROM-capable bit
/* $00:[000-7fff] contains uninitialized RAM and MMIO.
reset vector must point to ROM at $00:[8000-ffff] to be considered valid. */
@@ -466,12 +466,12 @@ static int snes_validate_infoblock( UINT8 *infoblock, UINT32 offset )
/* This determines if a cart is in Mode 20, 21, 22 or 25; sets state->m_cart[0].mode and
state->m_cart[0].sram accordingly; and returns the offset of the internal header (needed to
detect BSX and ST carts) */
-static UINT32 snes_find_hilo_mode(device_t *device, UINT8 *buffer, UINT32 buf_len )
+static uint32_t snes_find_hilo_mode(device_t *device, uint8_t *buffer, uint32_t buf_len )
{
- UINT8 valid_mode20 = 0;
- UINT8 valid_mode21 = 0;
- UINT8 valid_mode25 = 0;
- UINT32 retvalue;
+ uint8_t valid_mode20 = 0;
+ uint8_t valid_mode21 = 0;
+ uint8_t valid_mode25 = 0;
+ uint32_t retvalue;
/* Now to determine if this is a lo-ROM, a hi-ROM or an extended lo/hi-ROM */
if (buf_len > 0x007fc0)
@@ -502,7 +502,7 @@ static UINT32 snes_find_hilo_mode(device_t *device, UINT8 *buffer, UINT32 buf_le
}
-static int snes_find_addon_chip( UINT8 *buffer, UINT32 start_offs )
+static int snes_find_addon_chip( uint8_t *buffer, uint32_t start_offs )
{
/* Info mostly taken from http://snesemu.black-ship.net/misc/hardware/-from%20nsrt.edgeemu.com-chipinfo.htm */
switch (buffer[start_offs + 0x16])
@@ -604,15 +604,15 @@ image_init_result base_sns_cart_slot_device::call_load()
{
if (m_cart)
{
- UINT8 *ROM;
- UINT32 len, offset = 0;
+ uint8_t *ROM;
+ uint32_t len, offset = 0;
const char *slot_name;
/* Check for a header (512 bytes), and skip it if found */
if (software_entry() == nullptr)
{
- UINT32 tmplen = length();
- std::vector<UINT8> tmpROM(tmplen);
+ uint32_t tmplen = length();
+ std::vector<uint8_t> tmpROM(tmplen);
fread(&tmpROM[0], tmplen);
offset = snes_skip_header(&tmpROM[0], tmplen);
fseek(offset, SEEK_SET);
@@ -664,8 +664,8 @@ image_init_result base_sns_cart_slot_device::call_load()
if (m_cart->get_nvram_size() || m_cart->get_rtc_ram_size())
{
- UINT32 tot_size = m_cart->get_nvram_size() + m_cart->get_rtc_ram_size();
- std::vector<UINT8> temp_nvram(tot_size);
+ uint32_t tot_size = m_cart->get_nvram_size() + m_cart->get_rtc_ram_size();
+ std::vector<uint8_t> temp_nvram(tot_size);
battery_load(&temp_nvram[0], tot_size, 0xff);
if (m_cart->get_nvram_size())
memcpy(m_cart->get_nvram_base(), &temp_nvram[0], m_cart->get_nvram_size());
@@ -694,8 +694,8 @@ void base_sns_cart_slot_device::call_unload()
{
if (m_cart->get_nvram_size() || m_cart->get_rtc_ram_size())
{
- UINT32 tot_size = m_cart->get_nvram_size() + m_cart->get_rtc_ram_size();
- std::vector<UINT8> temp_nvram(tot_size);
+ uint32_t tot_size = m_cart->get_nvram_size() + m_cart->get_rtc_ram_size();
+ std::vector<uint8_t> temp_nvram(tot_size);
if (m_cart->get_nvram_size())
memcpy(&temp_nvram[0], m_cart->get_nvram_base(), m_cart->get_nvram_size());
if (m_cart->get_rtc_ram_size())
@@ -797,7 +797,7 @@ void base_sns_cart_slot_device::setup_addon_from_fullpath()
if (!m_cart->get_addon_bios_size())
{
std::string region = std::string(m_cart->device().tag()).append(":addon");
- UINT8 *ROM;
+ uint8_t *ROM;
switch (m_addon)
{
@@ -843,15 +843,15 @@ void base_sns_cart_slot_device::setup_addon_from_fullpath()
void base_sns_cart_slot_device::setup_nvram()
{
- UINT8 *ROM = (UINT8 *)m_cart->get_rom_base();
- UINT32 size = 0;
+ uint8_t *ROM = (uint8_t *)m_cart->get_rom_base();
+ uint32_t size = 0;
if (software_entry() == nullptr)
{
int hilo_mode = snes_find_hilo_mode(this, ROM, m_cart->get_rom_size());
- UINT8 sram_size = (m_type == SNES_SFX) ? (ROM[0x00ffbd] & 0x07) : (ROM[hilo_mode + 0x18] & 0x07);
+ uint8_t sram_size = (m_type == SNES_SFX) ? (ROM[0x00ffbd] & 0x07) : (ROM[hilo_mode + 0x18] & 0x07);
if (sram_size)
{
- UINT32 max = (hilo_mode == 0x007fc0) ? 0x80000 : 0x20000; // MODE20 vs MODE21
+ uint32_t max = (hilo_mode == 0x007fc0) ? 0x80000 : 0x20000; // MODE20 vs MODE21
size = 1024 << sram_size;
if (size > max)
size = max;
@@ -880,7 +880,7 @@ void base_sns_cart_slot_device::setup_nvram()
-void base_sns_cart_slot_device::get_cart_type_addon(UINT8 *ROM, UINT32 len, int &type, int &addon)
+void base_sns_cart_slot_device::get_cart_type_addon(uint8_t *ROM, uint32_t len, int &type, int &addon)
{
// First, look if the cart is HiROM or LoROM (and set snes_cart accordingly)
int hilo_mode = snes_find_hilo_mode(this,ROM, len);
@@ -913,7 +913,7 @@ void base_sns_cart_slot_device::get_cart_type_addon(UINT8 *ROM, UINT32 len, int
// Detect BS-X Flash Cart
if ((ROM[hilo_mode + 0x13] == 0x00 || ROM[hilo_mode + 0x13] == 0xff) && ROM[hilo_mode + 0x14] == 0x00)
{
- UINT8 n15 = ROM[hilo_mode + 0x15];
+ uint8_t n15 = ROM[hilo_mode + 0x15];
if (n15 == 0x00 || n15 == 0x80 || n15 == 0x84 || n15 == 0x9c || n15 == 0xbc || n15 == 0xfc)
{
if (ROM[hilo_mode + 0x1a] == 0x33 || ROM[hilo_mode + 0x1a] == 0xff)
@@ -996,9 +996,9 @@ std::string base_sns_cart_slot_device::get_default_card_software()
if (fullpath)
{
const char *slot_string;
- UINT32 offset;
- UINT32 len = m_file->size();
- std::vector<UINT8> rom(len);
+ uint32_t offset;
+ uint32_t len = m_file->size();
+ std::vector<uint8_t> rom(len);
int type = 0, addon = 0;
m_file->read(&rom[0], len);
@@ -1151,7 +1151,7 @@ static int char_to_int_conv( char id )
#define UNK "UNKNOWN"
-void base_sns_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len)
+void base_sns_cart_slot_device::internal_header_logging(uint8_t *ROM, uint32_t len)
{
static const char *const cart_types[] =
{
@@ -1270,7 +1270,7 @@ void base_sns_cart_slot_device::internal_header_logging(UINT8 *ROM, UINT32 len)
// Detect BS-X Flash Cart
if ((ROM[hilo_mode + 0x13] == 0x00 || ROM[hilo_mode + 0x13] == 0xff) && ROM[hilo_mode + 0x14] == 0x00)
{
- UINT8 n15 = ROM[hilo_mode + 0x15];
+ uint8_t n15 = ROM[hilo_mode + 0x15];
if (n15 == 0x00 || n15 == 0x80 || n15 == 0x84 || n15 == 0x9c || n15 == 0xbc || n15 == 0xfc)
{
if (ROM[hilo_mode + 0x1a] == 0x33 || ROM[hilo_mode + 0x1a] == 0xff)