diff options
Diffstat (limited to 'src')
136 files changed, 2832 insertions, 1033 deletions
diff --git a/src/devices/bus/gba/gba_slot.cpp b/src/devices/bus/gba/gba_slot.cpp index b32c6c21af4..5ed54717275 100644 --- a/src/devices/bus/gba/gba_slot.cpp +++ b/src/devices/bus/gba/gba_slot.cpp @@ -54,7 +54,10 @@ void device_gba_cart_interface::rom_alloc(UINT32 size, const char *tag) // we always alloc 32MB of rom region! m_rom = (UINT32 *)device().machine().memory().region_alloc(std::string(tag).append(GBASLOT_ROM_REGION_TAG).c_str(), 0x2000000, 4, ENDIANNESS_LITTLE)->base(); else + { m_rom = (UINT32 *)device().machine().memory().region_alloc(std::string(tag).append(GBASLOT_ROM_REGION_TAG).c_str(), 0x4000000, 4, ENDIANNESS_LITTLE)->base(); + m_romhlp = (UINT32 *)device().machine().memory().region_alloc(std::string(tag).append(GBAHELP_ROM_REGION_TAG).c_str(), 0x2000000, 4, ENDIANNESS_LITTLE)->base(); + } m_rom_size = size; } } @@ -137,6 +140,7 @@ static const gba_slot slot_list[] = { GBA_FLASH, "gba_flash" }, { GBA_FLASH512, "gba_flash_512" }, { GBA_FLASH1M, "gba_flash_1m" }, + { GBA_3DMATRIX, "gba_3dmatrix" }, }; static int gba_get_pcb_id(const char *slot) @@ -219,6 +223,8 @@ bool gba_cart_slot_device::call_load() memcpy(ROM + 0x1000000, ROM, 0x1000000); break; } + if (size == 0x4000000) + memcpy((UINT8 *)m_cart->get_romhlp_base(), ROM, 0x2000000); if (m_cart->get_nvram_size()) battery_load(m_cart->get_nvram_base(), m_cart->get_nvram_size(), 0x00); @@ -397,6 +403,9 @@ int gba_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) break; } + if (len == 0x4000000) + type = GBA_3DMATRIX; + return type; } /*------------------------------------------------- diff --git a/src/devices/bus/gba/gba_slot.h b/src/devices/bus/gba/gba_slot.h index 11810ecd960..a3908730180 100644 --- a/src/devices/bus/gba/gba_slot.h +++ b/src/devices/bus/gba/gba_slot.h @@ -18,7 +18,8 @@ enum GBA_EEPROM64, GBA_FLASH, GBA_FLASH512, - GBA_FLASH1M + GBA_FLASH1M, + GBA_3DMATRIX }; @@ -35,12 +36,15 @@ public: virtual DECLARE_READ32_MEMBER(read_rom) { return 0xffffffff; } virtual DECLARE_READ32_MEMBER(read_ram) { return 0xffffffff; } virtual DECLARE_WRITE32_MEMBER(write_ram) {}; + virtual DECLARE_WRITE32_MEMBER(write_mapper) {}; void rom_alloc(UINT32 size, const char *tag); void nvram_alloc(UINT32 size); UINT32* get_rom_base() { return m_rom; } + UINT32* get_romhlp_base() { return m_romhlp; } UINT32* get_nvram_base() { return &m_nvram[0]; } UINT32 get_rom_size() { return m_rom_size; } + UINT32 get_romhlp_size() { return m_romhlp_size; } UINT32 get_nvram_size() { return m_nvram.size()*sizeof(UINT32); } void set_rom_size(UINT32 val) { m_rom_size = val; } @@ -49,6 +53,8 @@ public: // internal state UINT32 *m_rom; // this points to the cart rom region UINT32 m_rom_size; // this is the actual game size, not the rom region size! + UINT32 *m_romhlp; + UINT32 m_romhlp_size; std::vector<UINT32> m_nvram; }; @@ -98,6 +104,7 @@ public: virtual DECLARE_READ32_MEMBER(read_rom); virtual DECLARE_READ32_MEMBER(read_ram); virtual DECLARE_WRITE32_MEMBER(write_ram); + virtual DECLARE_WRITE32_MEMBER(write_mapper) { if (m_cart) return m_cart->write_mapper(space, offset, data, mem_mask); }; protected: @@ -117,6 +124,7 @@ extern const device_type GBA_CART_SLOT; ***************************************************************************/ #define GBASLOT_ROM_REGION_TAG ":cart:rom" +#define GBAHELP_ROM_REGION_TAG ":cart:romhlp" #define MCFG_GBA_CARTRIDGE_ADD(_tag,_slot_intf,_def_slot) \ MCFG_DEVICE_ADD(_tag, GBA_CART_SLOT, 0) \ diff --git a/src/devices/bus/gba/rom.cpp b/src/devices/bus/gba/rom.cpp index 8e857dfe004..b4b2899024f 100644 --- a/src/devices/bus/gba/rom.cpp +++ b/src/devices/bus/gba/rom.cpp @@ -27,6 +27,7 @@ const device_type GBA_ROM_EEPROM = &device_creator<gba_rom_eeprom_device>; const device_type GBA_ROM_EEPROM64 = &device_creator<gba_rom_eeprom64_device>; const device_type GBA_ROM_FLASH = &device_creator<gba_rom_flash_device>; const device_type GBA_ROM_FLASH1M = &device_creator<gba_rom_flash1m_device>; +const device_type GBA_ROM_3DMATRIX = &device_creator<gba_rom_3dmatrix_device>; gba_rom_device::gba_rom_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) @@ -68,6 +69,11 @@ gba_rom_flash1m_device::gba_rom_flash1m_device(const machine_config &mconfig, co { } +gba_rom_3dmatrix_device::gba_rom_3dmatrix_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : gba_rom_device(mconfig, GBA_ROM_3DMATRIX, "GBA Carts + 3D Matrix Memory Mapper", tag, owner, clock, "gba_3dmatrix", __FILE__) +{ +} + //------------------------------------------------- // mapper specific start/reset @@ -106,6 +112,20 @@ void gba_rom_eeprom64_device::device_start() m_eeprom = std::make_unique<gba_eeprom_device>(machine(), (UINT8*)get_nvram_base(), get_nvram_size(), 14); } +void gba_rom_3dmatrix_device::device_start() +{ + save_item(NAME(m_src)); + save_item(NAME(m_dst)); + save_item(NAME(m_nblock)); +} + +void gba_rom_3dmatrix_device::device_reset() +{ + m_src = 0; + m_dst = 0; + m_nblock = 0; +} + /*------------------------------------------------- mapper specific handlers @@ -436,3 +456,58 @@ WRITE32_MEMBER(gba_rom_eeprom64_device::write_ram) m_eeprom->write(data); } + + +/*------------------------------------------------- + Carts with 3D Matrix Memory controller + + Used by Video carts with 64MB ROM chips + Emulation based on the reverse engineering efforts + by endrift + + The Memory controller basically behaves like a DMA + chip by writing first source and destination address, + then the number of 512K blocks to copy and finally + by issuing the transfer command. + Disney Collection 2 carts uses command 0x01 to start + the transfer, other carts might use 0x11 but currently + they die before getting to the mapper communication + (CPU emulation issue? cart mapping issue? still unknown) + + To investigate: + - why the other carts fail + - which addresses might be used by the mapper + (Disney Collection 2 uses 0x08800180-0x0880018f + but it might well be possible to issue commands + in an extended range...) + - which bus addresses can be used by the mapper + (currently we restrict the mapping in the range + 0x08000000-0x09ffffff but maybe also the rest of + the cart "range" is accessible...) + -------------------------------------------------*/ + +WRITE32_MEMBER(gba_rom_3dmatrix_device::write_mapper) +{ + //printf("mapper write 0x%.8X - 0x%X\n", offset, data); + switch (offset & 3) + { + case 0: + if (data == 0x1) // transfer data + memcpy((UINT8 *)m_romhlp + m_dst, (UINT8 *)m_rom + m_src, m_nblock * 0x200); + else + printf("Unknown mapper command 0x%X\n", data); + break; + case 1: + m_src = data; + break; + case 2: + if (data >= 0xa000000) + printf("Unknown transfer destination 0x%X\n", data); + m_dst = (data & 0x1ffffff); + break; + case 3: + default: + m_nblock = data; + break; + } +} diff --git a/src/devices/bus/gba/rom.h b/src/devices/bus/gba/rom.h index f9a3c16cb2e..b43875af862 100644 --- a/src/devices/bus/gba/rom.h +++ b/src/devices/bus/gba/rom.h @@ -161,6 +161,26 @@ private: }; +// ======================> gba_rom_3dmatrix_device + +class gba_rom_3dmatrix_device : public gba_rom_device +{ +public: + // construction/destruction + gba_rom_3dmatrix_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // reading and writing + virtual DECLARE_WRITE32_MEMBER(write_mapper) override; + +private: + UINT32 m_src, m_dst, m_nblock; +}; + + // device type definition extern const device_type GBA_ROM_STD; extern const device_type GBA_ROM_SRAM; @@ -168,6 +188,7 @@ extern const device_type GBA_ROM_EEPROM; extern const device_type GBA_ROM_EEPROM64; extern const device_type GBA_ROM_FLASH; extern const device_type GBA_ROM_FLASH1M; +extern const device_type GBA_ROM_3DMATRIX; diff --git a/src/devices/bus/megadrive/eeprom.cpp b/src/devices/bus/megadrive/eeprom.cpp index b56273255e8..e790d7cace8 100644 --- a/src/devices/bus/megadrive/eeprom.cpp +++ b/src/devices/bus/megadrive/eeprom.cpp @@ -398,13 +398,14 @@ void md_eeprom_nbajam_device_alt::eeprom_i2c_init() m_eeprom_slave_mask = 0; m_eeprom_word_address = 0; m_eeprom_devsel = 0; + m_eeprom_byte = 0; m_eeprom_sda = m_eeprom_prev_sda = 1; m_eeprom_scl = m_eeprom_prev_scl = 1; m_eeprom_cur_state = STATE_I2C_IDLE; m_eeprom_mask = 0xff; - m_eeprom_pagewrite_mask = 0xff; + m_eeprom_pagewrite_mask = 0x03; } @@ -450,39 +451,32 @@ void md_eeprom_nbajam_device_alt::eeprom_i2c_update(void) // LOW to HIGH transition of SCL = prepare to transmit, by moving to cnt = 1 if (!m_eeprom_prev_scl && m_eeprom_scl) - if (m_eeprom_cnt == 0) - m_eeprom_cnt++; - - // HIGH to LOW transition of SCL = a new bit has been put on SDA line and we can read it - // provided we already got the LOW to HIGH transition above - if (m_eeprom_prev_scl && !m_eeprom_scl && (m_eeprom_cnt > 0)) { if (m_eeprom_cnt <= 4) { // here we would transmit the Device Type Identifier which is 0101 for X24C02 // but apparently the game does not check it, so let's skip it - m_eeprom_cnt++; } else if ((m_eeprom_cnt > 4) && (m_eeprom_cnt < 8)) { // here store the 3 bits of DEVICE ADDRESS - if (m_eeprom_prev_sda) - m_eeprom_devsel |= (1 << (7 - m_eeprom_cnt)); - else - m_eeprom_devsel &= ~(1 << (7 - m_eeprom_cnt)); - m_eeprom_cnt++; + m_eeprom_devsel = ((m_eeprom_devsel << 1) | m_eeprom_sda) & 0xff; } else if (m_eeprom_cnt == 8) - { - m_eeprom_readwrite = m_eeprom_prev_sda; + m_eeprom_readwrite = m_eeprom_sda; + } + + // HIGH to LOW transition of SCL = a new bit has been put on SDA line and we can read it + // provided we already got the LOW to HIGH transition above + if (m_eeprom_prev_scl && !m_eeprom_scl) + { + if (m_eeprom_cnt < 9) m_eeprom_cnt++; - } - else if (m_eeprom_cnt > 8) + else { // ACK m_eeprom_cnt = 1; m_eeprom_cur_state = m_eeprom_readwrite ? STATE_I2C_READ_DATA : STATE_I2C_GET_WORD_ADDR; - m_eeprom_slave_mask <<= 8; } } break; @@ -497,14 +491,20 @@ void md_eeprom_nbajam_device_alt::eeprom_i2c_update(void) if (m_eeprom_cnt < 9) m_eeprom_cnt++; else - { m_eeprom_cnt = 1; - + } + + // LOW to HIGH transition of SCL + if (!m_eeprom_prev_scl && m_eeprom_scl) + { + if (m_eeprom_cnt == 9) + { // no ACK - if (m_eeprom_prev_sda) + if (m_eeprom_sda) m_eeprom_cur_state = STATE_I2C_WAIT_STOP; } } + break; // For a write operation, the x24c02 requires a second address field. This address field is the @@ -516,22 +516,23 @@ void md_eeprom_nbajam_device_alt::eeprom_i2c_update(void) if (m_eeprom_prev_scl && !m_eeprom_scl) { if (m_eeprom_cnt < 9) - { - if (m_eeprom_prev_sda) - m_eeprom_word_address |= (1 << (8 - m_eeprom_cnt)); - else - m_eeprom_word_address &= ~(1 << (8 - m_eeprom_cnt)); - m_eeprom_cnt++; - } else { // ACK m_eeprom_cnt = 1; - m_eeprom_word_address &= m_eeprom_mask; m_eeprom_cur_state = STATE_I2C_WRITE_DATA; + m_eeprom_byte = 0; + m_eeprom_word_address &= m_eeprom_mask; } } + + // LOW to HIGH transition of SCL + if (!m_eeprom_prev_scl && m_eeprom_scl) + { + if (m_eeprom_cnt < 9) + m_eeprom_word_address = ((m_eeprom_word_address << 1) | m_eeprom_sda) & 0xff; + } break; // write operation @@ -542,27 +543,28 @@ void md_eeprom_nbajam_device_alt::eeprom_i2c_update(void) if (m_eeprom_prev_scl && !m_eeprom_scl) { if (m_eeprom_cnt < 9) + m_eeprom_cnt++; + else + m_eeprom_cnt = 1; + } + + // LOW to HIGH transition of SCL + if (!m_eeprom_prev_scl && m_eeprom_scl) + { + if (m_eeprom_cnt < 9) + m_eeprom_byte = ((m_eeprom_byte << 1) | m_eeprom_sda) & 0xff; + else { UINT8 *nvram = (UINT8 *)&m_nvram[0]; UINT16 sram_address = m_eeprom_slave_mask | (m_eeprom_devsel * 0x100) | m_eeprom_word_address; - sram_address &= 0xffff; - if (m_eeprom_prev_sda) - nvram[sram_address] |= (1 << (8 - m_eeprom_cnt)); - else - nvram[sram_address] &= ~(1 << (8 - m_eeprom_cnt)); - - if (m_eeprom_cnt == 8) - { - //printf("Write EEPROM : status %d addr %x data %x (count 8)\n", m_eeprom_cur_state, sram_address, nvram[sram_address]); - // WORD ADDRESS++ - m_eeprom_word_address = (m_eeprom_word_address & ~m_eeprom_pagewrite_mask) | - ((m_eeprom_word_address + 1) & m_eeprom_pagewrite_mask); - } - - m_eeprom_cnt++; + nvram[sram_address & 0xffff] = m_eeprom_byte; + m_eeprom_byte = 0; + + //printf("Write EEPROM : status %d addr %x data %x (count 8)\n", m_eeprom_cur_state, sram_address, nvram[sram_address]); + // WORD ADDRESS++ + m_eeprom_word_address = (m_eeprom_word_address & ~m_eeprom_pagewrite_mask) | + ((m_eeprom_word_address + 1) & m_eeprom_pagewrite_mask); } - else // ACK - m_eeprom_cnt = 1; } break; } diff --git a/src/devices/bus/megadrive/eeprom.h b/src/devices/bus/megadrive/eeprom.h index 619e821f051..176b6f48fdd 100644 --- a/src/devices/bus/megadrive/eeprom.h +++ b/src/devices/bus/megadrive/eeprom.h @@ -189,6 +189,7 @@ private: UINT16 m_eeprom_slave_mask; // dev addr UINT16 m_eeprom_word_address; // memory addr UINT16 m_eeprom_devsel; // selected device + UINT16 m_eeprom_byte; // byte to be written int m_eeprom_cur_state; // current state // EEPROM physical characteristics (configured at init) UINT16 m_eeprom_mask; // size of the memory - 1 diff --git a/src/devices/bus/megadrive/md_carts.cpp b/src/devices/bus/megadrive/md_carts.cpp index fd5a9032ac3..4c9f1b9b2e0 100644 --- a/src/devices/bus/megadrive/md_carts.cpp +++ b/src/devices/bus/megadrive/md_carts.cpp @@ -18,8 +18,9 @@ SLOT_INTERFACE_START(md_cart) SLOT_INTERFACE_INTERNAL("rom_fram", MD_ROM_FRAM) SLOT_INTERFACE_INTERNAL("rom_hardbl95", MD_ROM_SRAM) SLOT_INTERFACE_INTERNAL("rom_xinqig", MD_ROM_SRAM) - SLOT_INTERFACE_INTERNAL("rom_beggarp", MD_ROM_BEGGARP) - SLOT_INTERFACE_INTERNAL("rom_wukong", MD_ROM_WUKONG) + SLOT_INTERFACE_INTERNAL("rom_sf001", MD_ROM_BEGGARP) + SLOT_INTERFACE_INTERNAL("rom_sf002", MD_ROM_WUKONG) + SLOT_INTERFACE_INTERNAL("rom_sf004", MD_ROM_STARODYS) // EEPROM handling (not supported fully yet) SLOT_INTERFACE_INTERNAL("rom_eeprom", MD_STD_EEPROM) SLOT_INTERFACE_INTERNAL("rom_nbajam", MD_EEPROM_NBAJAM) diff --git a/src/devices/bus/megadrive/md_slot.cpp b/src/devices/bus/megadrive/md_slot.cpp index 2d7bc239968..84228207d5e 100644 --- a/src/devices/bus/megadrive/md_slot.cpp +++ b/src/devices/bus/megadrive/md_slot.cpp @@ -235,8 +235,9 @@ static const md_slot slot_list[] = { SEGA_FRAM, "rom_fram" }, { HARDBALL95, "rom_hardbl95" }, { XINQIG, "rom_xinqig"}, - { BEGGARP, "rom_beggarp"}, - { WUKONG, "rom_wukong"}, + { BEGGARP, "rom_sf001"}, + { WUKONG, "rom_sf002"}, + { STARODYS, "rom_sf004"}, { SEGA_EEPROM, "rom_eeprom" }, { NBA_JAM, "rom_nbajam" }, @@ -526,7 +527,7 @@ int base_md_cart_slot_device::load_nonlist() // STEP 4: determine the cart type (to deal with sram/eeprom & pirate mappers) - m_type = get_cart_type(ROM, len); + m_type = get_cart_type(ROM, tmplen - offset); // handle mirroring of ROM, unless it's SSF2 or Pier Solar if (m_type != SSF2 && m_type != PSOLAR) @@ -667,6 +668,12 @@ void base_md_cart_slot_device::setup_nvram() m_cart->nvram_alloc(m_cart->m_nvram_end - m_cart->m_nvram_start + 1); m_cart->m_nvram_active = 1; break; + case STARODYS: + m_cart->m_nvram_start = 0x200000; + m_cart->m_nvram_end = m_cart->m_nvram_start + 0xfffff; + m_cart->nvram_alloc(0x8000/2); // 32K mirrored + m_cart->m_nvram_active = 1; + break; case NBA_JAM_ALT: m_cart->nvram_alloc(0x100); break; @@ -816,6 +823,9 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp((char *)&ROM[0x0150], "Virtua Racing", 13)) type = SEGA_SVP; + if (!memcmp((char *)&ROM[0x0180], "SF-004", 6)) // Star Odyssey + type = STARODYS; + break; case 0x200005: @@ -823,6 +833,11 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) type = REDCL_EN; break; + case 0x220000: + if (!memcmp((char *)&ROM[0x0180], "SF-002", 6)) // Legend of Wukong + type = WUKONG; + break; + case 0x300000: if (!memcmp(&ROM[0x220], sdk_sig, sizeof(sdk_sig))) type = LIONK3; @@ -858,6 +873,9 @@ int base_md_cart_slot_device::get_cart_type(UINT8 *ROM, UINT32 len) if (!memcmp((char *)&ROM[0x0180], "GM T-81476", 10)) // Big Hurt Baseball type = C_SLAM; + if (!memcmp((char *)&ROM[0x0180], "SF-001", 6)) // Beggar Prince + type = BEGGARP; + break; case 0x500000: diff --git a/src/devices/bus/megadrive/md_slot.h b/src/devices/bus/megadrive/md_slot.h index 099b17e9d51..a033daec607 100644 --- a/src/devices/bus/megadrive/md_slot.h +++ b/src/devices/bus/megadrive/md_slot.h @@ -26,6 +26,7 @@ enum XINQIG, /* Xin Qigai Wangzi uses different sram start address and has no valid header */ BEGGARP, /* Beggar Prince uses different sram start address + bankswitch tricks */ WUKONG, /* Legend of Wukong uses different sram start address + bankswitch trick for last 128K of ROM */ + STARODYS, /* Star Odyssey */ // EEPROM SEGA_EEPROM, /* Wonder Boy V / Evander Holyfield's Boxing / Greatest Heavyweights of the Ring / Sports Talk Baseball / Megaman */ diff --git a/src/devices/bus/megadrive/rom.cpp b/src/devices/bus/megadrive/rom.cpp index 2ce6d353e35..5d38557ea86 100644 --- a/src/devices/bus/megadrive/rom.cpp +++ b/src/devices/bus/megadrive/rom.cpp @@ -61,6 +61,7 @@ const device_type MD_ROM_TOPF = &device_creator<md_rom_topf_device>; const device_type MD_ROM_RADICA = &device_creator<md_rom_radica_device>; const device_type MD_ROM_BEGGARP = &device_creator<md_rom_beggarp_device>; const device_type MD_ROM_WUKONG = &device_creator<md_rom_wukong_device>; +const device_type MD_ROM_STARODYS = &device_creator<md_rom_starodys_device>; md_std_rom_device::md_std_rom_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) @@ -235,6 +236,11 @@ md_rom_wukong_device::md_rom_wukong_device(const machine_config &mconfig, const { } +md_rom_starodys_device::md_rom_starodys_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : md_std_rom_device(mconfig, MD_ROM_STARODYS, "MD Star Odyssey", tag, owner, clock, "md_rom_starodys", __FILE__), m_mode(0), m_lock(0), m_ram_enable(0), m_base(0) +{ +} + //------------------------------------------------- // device_start - device-specific startup //------------------------------------------------- @@ -416,6 +422,22 @@ void md_rom_wukong_device::device_reset() m_mode = 0; } +void md_rom_starodys_device::device_start() +{ + save_item(NAME(m_mode)); + save_item(NAME(m_lock)); + save_item(NAME(m_ram_enable)); + save_item(NAME(m_base)); +} + +void md_rom_starodys_device::device_reset() +{ + m_mode = 0; + m_lock = 0; + m_ram_enable = 1; + m_base = 0; +} + /*------------------------------------------------- mapper specific handlers -------------------------------------------------*/ @@ -1356,16 +1378,14 @@ WRITE16_MEMBER(md_rom_beggarp_device::write) m_nvram[offset & 0x3fff] = data; } +// this works the same as in standard SRAM carts WRITE16_MEMBER(md_rom_beggarp_device::write_a13) { if (offset == 0xf0/2) { - /* unsure if this is actually supposed to toggle or just switch on? yet to encounter game that uses this */ m_nvram_active = BIT(data, 0); m_nvram_readonly = BIT(data, 1); - // since a lot of generic carts ends up here if loaded from fullpath - // we turn on nvram (with m_nvram_handlers_installed) only if they toggle it on by writing here! if (m_nvram_active) m_nvram_handlers_installed = 1; } @@ -1388,7 +1408,7 @@ READ16_MEMBER(md_rom_wukong_device::read) if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active) return m_nvram[offset - m_nvram_start/2]; - // here can access both last 128K of the ROM and the first 128K, depending of bit7 of m_mode + // here can access both last 128K of the ROM and the first 128K, depending of m_mode if (offset >= 0x200000/2 && offset < 0x220000/2) return !m_mode ? m_rom[offset] : m_rom[offset & 0xffff]; else if (offset < 0x400000/2) @@ -1406,17 +1426,110 @@ WRITE16_MEMBER(md_rom_wukong_device::write) m_nvram[offset - m_nvram_start/2] = data; } +// this works the same as in standard SRAM carts WRITE16_MEMBER(md_rom_wukong_device::write_a13) { if (offset == 0xf0/2) { - /* unsure if this is actually supposed to toggle or just switch on? yet to encounter game that uses this */ m_nvram_active = BIT(data, 0); m_nvram_readonly = BIT(data, 1); - // since a lot of generic carts ends up here if loaded from fullpath - // we turn on nvram (with m_nvram_handlers_installed) only if they toggle it on by writing here! if (m_nvram_active) m_nvram_handlers_installed = 1; } } + + +/*------------------------------------------------- + STAR ODYSSEY + This game uses a slightly more complex mapper: + not only RAM can be enabled / disabled, but also + ROM can be mapped in three different modes. + In what we call Mode0 the first 256K are mirrored + into area 0x000000-0x1fffff; in Mode1 cart gives + access to 5x256K banks into area 0x000000-0x13ffff + and open bus into 0x140000-0x1fffff; in Mode2 the + ROM is disabled and the whole 0x000000-0x1fffff + gives open bus +-------------------------------------------------*/ + +READ16_MEMBER(md_rom_starodys_device::read) +{ + if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active && m_ram_enable) + return m_nvram[offset & 0x3fff]; + + if (offset < 0x200000/2) + { + if (m_mode == 0) + return m_rom[offset & 0x3ffff]; + else if (m_mode == 1 && offset < 0x140000/2) + return m_rom[m_base * 0x40000/2 + offset]; + else + return 0xffff; + } + else if (offset < 0x400000/2) + return m_rom[offset & 0xfffff]; + else + return 0xffff; +} + +WRITE16_MEMBER(md_rom_starodys_device::write) +{ + if (offset >= m_nvram_start/2 && offset <= m_nvram_end/2 && m_nvram_active && !m_nvram_readonly && m_ram_enable) + m_nvram[offset & 0x3fff] = data; + + if (offset < 0x10000/2) + { + UINT32 prot_offs = (offset * 2) & 0xf00; + if (!m_lock) + { + if (prot_offs == 0xd00) + { + //printf("RAM enable %s!\n", BIT(data, 7) ? "Yes" : "No"); + m_ram_enable = BIT(data, 7); + } + if (prot_offs == 0xe00) + { + if (BIT(data, 5)) + m_mode = 2; + else if (BIT(data, 6)) + m_mode = 1; + else + m_mode = 0; + //printf("ROM mode %d!\n", m_mode); + + if (!BIT(data, 7)) + { + //printf("LOCK BANKSWITCH!\n"); + m_lock = 1; + } + } + if (prot_offs == 0xf00) + { + m_base = ((data >> 4) & 7); + m_mode = 1; + //printf("ROM base %d!\n", m_base); + } + } + } + +} + +READ16_MEMBER(md_rom_starodys_device::read_a13) +{ + return m_base << 4; +} + +// this works the same as in standard SRAM carts +WRITE16_MEMBER(md_rom_starodys_device::write_a13) +{ + if (offset == 0xf0/2) + { + m_nvram_active = BIT(data, 0); + m_nvram_readonly = BIT(data, 1); + + if (m_nvram_active) + m_nvram_handlers_installed = 1; + } +} + diff --git a/src/devices/bus/megadrive/rom.h b/src/devices/bus/megadrive/rom.h index 796b29dc9fb..4e9b656e08a 100644 --- a/src/devices/bus/megadrive/rom.h +++ b/src/devices/bus/megadrive/rom.h @@ -545,6 +545,28 @@ private: UINT8 m_mode; }; +// ======================> md_rom_starodys_device + +class md_rom_starodys_device : public md_std_rom_device +{ +public: + // construction/destruction + md_rom_starodys_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + + // device-level overrides + virtual void device_start() override; + virtual void device_reset() override; + + // reading and writing + virtual DECLARE_READ16_MEMBER(read) override; + virtual DECLARE_WRITE16_MEMBER(write) override; + virtual DECLARE_READ16_MEMBER(read_a13) override; + virtual DECLARE_WRITE16_MEMBER(write_a13) override; + +private: + UINT8 m_mode, m_lock, m_ram_enable, m_base; +}; + // device type definition @@ -581,5 +603,6 @@ extern const device_type MD_ROM_TOPF; extern const device_type MD_ROM_RADICA; extern const device_type MD_ROM_BEGGARP; extern const device_type MD_ROM_WUKONG; +extern const device_type MD_ROM_STARODYS; #endif diff --git a/src/devices/bus/ti99x/gromport.cpp b/src/devices/bus/ti99x/gromport.cpp index a9f95d59f51..3eddb6433d9 100644 --- a/src/devices/bus/ti99x/gromport.cpp +++ b/src/devices/bus/ti99x/gromport.cpp @@ -111,7 +111,7 @@ #define TRACE_RPK 0 #define TRACE_CHANGE 0 -#define TRACE_ILLWRITE 0 +#define TRACE_ILLWRITE 1 #define TRACE_CONFIG 0 #define TRACE_READ 0 #define TRACE_WRITE 0 @@ -648,9 +648,15 @@ machine_config_constructor multi_conn_device::device_mconfig_additions() const return MACHINE_CONFIG_NAME( multi_slot ); } +INPUT_CHANGED_MEMBER( multi_conn_device::switch_changed ) +{ + if (TRACE_CHANGE) logerror("Slot changed %d - %d\n", (int)((UINT64)param & 0x07), newval); + m_active_slot = m_fixed_slot = newval - 1; +} + INPUT_PORTS_START(multi_slot) PORT_START( "CARTSLOT" ) - PORT_DIPNAME( 0x0f, 0x00, "Multi-cartridge slot" ) + PORT_DIPNAME( 0x0f, 0x00, "Multi-cartridge slot" ) PORT_CHANGED_MEMBER(DEVICE_SELF, multi_conn_device, switch_changed, 0) PORT_DIPSETTING( 0x00, "Auto" ) PORT_DIPSETTING( 0x01, "Slot 1" ) PORT_DIPSETTING( 0x02, "Slot 2" ) @@ -1123,7 +1129,8 @@ ioport_constructor gkracker_device::device_input_ports() const enum { PCB_STANDARD=1, - PCB_PAGED, + PCB_PAGED12K, + PCB_PAGED16K, PCB_MINIMEM, PCB_SUPER, PCB_MBX, @@ -1137,7 +1144,8 @@ enum static const pcb_type pcbdefs[] = { { PCB_STANDARD, "standard" }, - { PCB_PAGED, "paged" }, + { PCB_PAGED12K, "paged12k" }, + { PCB_PAGED16K, "paged" }, { PCB_MINIMEM, "minimem" }, { PCB_SUPER, "super" }, { PCB_MBX, "mbx" }, @@ -1153,7 +1161,8 @@ static const pcb_type pcbdefs[] = static const pcb_type sw_pcbdefs[] = { { PCB_STANDARD, "standard" }, - { PCB_PAGED, "paged" }, + { PCB_PAGED12K, "paged12k" }, + { PCB_PAGED16K, "paged16k" }, { PCB_MINIMEM, "minimem" }, { PCB_SUPER, "super" }, { PCB_MBX, "mbx" }, @@ -1192,13 +1201,13 @@ void ti99_cartridge_device::prepare_cartridge() for (int i=0; i < 5; i++) m_pcb->m_grom[i] = nullptr; - m_pcb->m_grom_size = m_softlist? get_software_region_length("grom_socket") : m_rpk->get_resource_length("grom_socket"); + m_pcb->m_grom_size = m_softlist? get_software_region_length("grom") : m_rpk->get_resource_length("grom_socket"); if (TRACE_CONFIG) logerror("grom_socket.size=0x%04x\n", m_pcb->m_grom_size); if (m_pcb->m_grom_size > 0) { regg = memregion(CARTGROM_TAG); - grom_ptr = m_softlist? get_software_region("grom_socket") : m_rpk->get_contents_of_socket("grom_socket"); + grom_ptr = m_softlist? get_software_region("grom") : m_rpk->get_contents_of_socket("grom_socket"); memcpy(regg->base(), grom_ptr, m_pcb->m_grom_size); m_pcb->m_grom_ptr = regg->base(); // for gromemu m_pcb->m_grom_address = 0; // for gromemu @@ -1211,25 +1220,29 @@ void ti99_cartridge_device::prepare_cartridge() if (m_pcb->m_grom_size > 0x8000) m_pcb->set_grom_pointer(4, subdevice(GROM7_TAG)); } - m_pcb->m_rom_size = m_softlist? get_software_region_length("rom_socket") : m_rpk->get_resource_length("rom_socket"); + m_pcb->m_rom_size = m_softlist? get_software_region_length("rom") : m_rpk->get_resource_length("rom_socket"); if (m_pcb->m_rom_size > 0) { - if (TRACE_CONFIG) logerror("rom_socket.size=0x%04x\n", m_pcb->m_rom_size); + if (TRACE_CONFIG) logerror("rom size=0x%04x\n", m_pcb->m_rom_size); regr = memregion(CARTROM_TAG); - rom_ptr = m_softlist? get_software_region("rom_socket") : m_rpk->get_contents_of_socket("rom_socket"); + rom_ptr = m_softlist? get_software_region("rom") : m_rpk->get_contents_of_socket("rom_socket"); memcpy(regr->base(), rom_ptr, m_pcb->m_rom_size); // Set both pointers to the same region for now m_pcb->m_rom_ptr = regr->base(); } - rom2_length = m_softlist? get_software_region_length("rom2_socket") : m_rpk->get_resource_length("rom2_socket"); - if (rom2_length > 0) + // Softlist uses only one ROM area, no second socket + if (!m_softlist) { - // sizes do not differ between rom and rom2 - // We use the large cartrom space for the second bank as well - regr = memregion(CARTROM_TAG); - rom_ptr = m_softlist? get_software_region("rom2_socket") : m_rpk->get_contents_of_socket("rom2_socket"); - memcpy(regr->base() + 0x2000, rom_ptr, rom2_length); + rom2_length = m_rpk->get_resource_length("rom2_socket"); + if (rom2_length > 0) + { + // sizes do not differ between rom and rom2 + // We use the large cartrom space for the second bank as well + regr = memregion(CARTROM_TAG); + rom_ptr = m_rpk->get_contents_of_socket("rom2_socket"); + memcpy(regr->base() + 0x2000, rom_ptr, rom2_length); + } } // (NV)RAM cartridges @@ -1326,9 +1339,13 @@ bool ti99_cartridge_device::call_load() if (TRACE_CONFIG) logerror("Standard PCB\n"); m_pcb = new ti99_standard_cartridge(); break; - case PCB_PAGED: - if (TRACE_CONFIG) logerror("Paged PCB\n"); - m_pcb = new ti99_paged_cartridge(); + case PCB_PAGED12K: + if (TRACE_CONFIG) logerror("Paged PCB 12K\n"); + m_pcb = new ti99_paged12k_cartridge(); + break; + case PCB_PAGED16K: + if (TRACE_CONFIG) logerror("Paged PCB 16K\n"); + m_pcb = new ti99_paged16k_cartridge(); break; case PCB_MINIMEM: if (TRACE_CONFIG) logerror("Minimem PCB\n"); @@ -1505,7 +1522,18 @@ const device_type TI99CART = &device_creator<ti99_cartridge_device>; Some cartridges also have RAM, and some allow for switching between ROMs. - Unlike in the previous implementation we do not model it as a full device. + Standard cartridge + + GROM space + 6000 77ff 8000 97ff a000 b7ff c000 d7ff e000 f7ff + |== GROM3 ==|...|== GROM4 ==|...|== GROM5 ==|...|== GROM6 ==|...|== GROM7 ==| + + + ROM space + 6000 7000 7fff + | | | + |========== ROM1 ============| + ***************************************************************************/ ti99_cartridge_pcb::ti99_cartridge_pcb() @@ -1623,15 +1651,83 @@ WRITE_LINE_MEMBER(ti99_cartridge_pcb::gclock_in) /***************************************************************************** - Cartridge type: Paged (Extended Basic) - This cartridge consists of GROM memory and 2 pages of standard ROM. + Cartridge type: Paged (12K, Extended Basic) + + The Extended Basic cartridge consists of several GROMs which are + treated in the usual way, and two ROMs (4K and 8K). + + GROM space + 6000 77ff 8000 97ff a000 b7ff c000 d7ff e000 f7ff + |== GROM3 ==|...|== GROM4 ==|...|== GROM5 ==|...|== GROM6 ==|...|== GROM7 ==| + + ROM space + 6000 7000 7fff + | | | + | |==== ROM2a ===| Bank 0 write to 6000, 6004, ... 7ffc + |=== ROM1 ====| | + |==== ROM2b ===| Bank 1 write to 6002, 6006, ... 7ffe + + The 4K ROM is mapped into the 6000-6FFF space. + The 8K ROM is actually composed of two banks of 4K which are mapped into + the 7000-7FFF space. Bank 0 is visible after a write access to 6000 / 6004 / + 6008 ... , while bank 1 is visible after writing to 6002 / 6006 / 600A / ... + +******************************************************************************/ + +READ8Z_MEMBER(ti99_paged12k_cartridge::readz) +{ + if (m_romspace_selected) + { + // rom_ptr: 0000-0fff = rom1 + // 2000-2fff = rom2a + // 3000-3fff = rom2b + if ((offset & 0x1000)==0) + *value = m_rom_ptr[offset & 0x0fff]; + else + *value = m_rom_ptr[(offset & 0x0fff) | 0x2000 | (m_rom_page << 12)]; + } + else + { + // Will not return anything when not selected (preceding gsq=ASSERT) + gromreadz(space, offset, value, mem_mask); + } +} + +WRITE8_MEMBER(ti99_paged12k_cartridge::write) +{ + if (m_romspace_selected) + { + m_rom_page = (offset >> 1) & 1; + } + else + { + // Will not change anything when not selected (preceding gsq=ASSERT) + gromwrite(space, offset, data, mem_mask); + } +} + +/***************************************************************************** + Cartridge type: Paged (16K) + + GROM space + 6000 77ff 8000 97ff a000 b7ff c000 d7ff e000 f7ff + |== GROM3 ==|...|== GROM4 ==|...|== GROM5 ==|...|== GROM6 ==|...|== GROM7 ==| + + ROM space + 6000 7000 7fff + | | | + |========== ROM1 ===========| Bank 0 write to 6000, 6004, ... 7ffc + | | | + |========== ROM2 ===========| Bank 1 write to 6002, 6006, ... 7ffe + + This cartridge consists of GROM memory and 2 pages of standard ROM. The page is set by writing any value to a location in the address area, where an even word offset sets the page to 0 and an odd word offset sets the page to 1 (e.g. 6000 = bank 0, and 6002 = bank 1). ******************************************************************************/ -READ8Z_MEMBER(ti99_paged_cartridge::readz) +READ8Z_MEMBER(ti99_paged16k_cartridge::readz) { if (m_romspace_selected) { @@ -1644,7 +1740,7 @@ READ8Z_MEMBER(ti99_paged_cartridge::readz) } } -WRITE8_MEMBER(ti99_paged_cartridge::write) +WRITE8_MEMBER(ti99_paged16k_cartridge::write) { if (m_romspace_selected) { @@ -1659,9 +1755,20 @@ WRITE8_MEMBER(ti99_paged_cartridge::write) /***************************************************************************** Cartridge type: Mini Memory - GROM: 6 KiB (occupies G>6000 to G>7800) - ROM: 4 KiB (romfile is actually 8 K long, second half with zeros, 0x6000-0x6fff) - persistent RAM: 4 KiB (0x7000-0x7fff) + GROM: 6 KiB (occupies G>6000 to G>77ff) + ROM: 4 KiB (6000-6fff) + RAM: 4 KiB (7000-7fff, battery-backed) + + GROM space + 6000 77ff + |== GROM3 ==| + + ROM space + 6000 7000 7fff + | | | + |=== ROM1 ====| | + |=== NVRAM ===| + ******************************************************************************/ /* Read function for the minimem cartridge. */ @@ -1717,10 +1824,26 @@ WRITE8_MEMBER(ti99_minimem_cartridge::write) assigns a number in the selection screen. Switching the RAM banks in this cartridge is achieved by setting CRU bits (the system serial interface). - GROM: Editor/Assembler GROM - ROM: none - persistent RAM: 32 KiB (0x6000-0x7fff, 4 banks) - Banking: via CRU write + GROM: Editor/Assembler GROM + ROM: none + RAM: 32 KiB (0x6000-0x7fff, 4 banks) + Banking: via CRU write + + GROM space + 6000 77ff + |==== GROM3 (Editor/Assm) ====| + + ROM space + 6000 7000 7fff + | | | + |======== NVRAM 0 ==========| Bank 0 CRU>0802 + | | | + |======== NVRAM 1 ==========| Bank 1 CRU>0806 + | | | + |======== NVRAM 2 ==========| Bank 2 CRU>080a + | | | + |======== NVRAM 3 ==========| Bank 3 CRU>080e + ******************************************************************************/ /* Read function for the super cartridge. */ @@ -1802,7 +1925,7 @@ WRITE8_MEMBER(ti99_super_cartridge::cruwrite) /***************************************************************************** Cartridge type: MBX - GROM: up to 40 KiB + GROM: up to 5 GROMs (sockets for a maximum of 3 GROMs, but may be stacked) ROM: up to 16 KiB (in up to 2 banks of 8KiB each) RAM: 1022 B (0x6c00-0x6ffd, overrides ROM in that area) ROM mapper: 6ffe @@ -1810,6 +1933,34 @@ WRITE8_MEMBER(ti99_super_cartridge::cruwrite) TODO: Some MBX cartridges assume the presence of the MBX system (special user interface box with speech input/output) and will not run without it. This MBX hardware is not emulated yet. + + GROM space + 6000 77ff 8000 97ff a000 b7ff c000 d7ff e000 f7ff + |== GROM3 ==|...|== GROM4 ==|...|== GROM5 ==|...|== GROM6 ==|...|== GROM7 ==| + + ROM space + 6000 6c00 7000 7fff + | | | | + | | |===== ROM bank 0 ====| 6ffe = 00 + | |= RAM =| | + |=== ROM bank 0 ==| |===== ROM bank 1 ====| 6ffe = 01 + | | + |===== ROM bank 3 ====| 6ffe = 02 + | | + |===== ROM bank 3 ====| 6ffe = 03 + + The 16K ROM is composed of four 4K banks, which can be selected by writing + the bank number to address 6ffe. This also affects the RAM so that the + bank number is stored in RAM and may also be read from there. + + The mapper does not decode the LSB of the address, so it changes value when + a write operation is done on 6FFF. Since the TI console always writes the + odd byte first, then the even byte, the last byte written is actually 6FFE. + + ROM bank 0 (ROM area 0000-0fff) is always visible in the space 6000-6bff. + + RAM is implemented by two 1024x4 RAM circuits and is not affected by banking. + ******************************************************************************/ /* Read function for the mbx cartridge. */ @@ -1817,18 +1968,23 @@ READ8Z_MEMBER(ti99_mbx_cartridge::readz) { if (m_romspace_selected) { - if ((offset & 0x1c00)==0x0c00) + if (m_ram_ptr != nullptr && (offset & 0x1c00)==0x0c00) { - // This is the RAM area which overrides any ROM. There is no - // known banking behavior for the RAM, so we must assume that - // there is only one bank. - if (m_ram_ptr != nullptr) - *value = m_ram_ptr[offset & 0x03ff]; + // Also reads the value of 6ffe + *value = m_ram_ptr[offset & 0x03ff]; + if (TRACE_READ) space.device().logerror("%04x (RAM) -> %02x\n", offset + 0x6000, *value); } else { if (m_rom_ptr!=nullptr) - *value = m_rom_ptr[(offset & 0x1fff) | (m_rom_page<<13)]; + { + if ((offset & 0x1000)==0) // 6000 area + *value = m_rom_ptr[offset]; + else // 7000 area + *value = m_rom_ptr[(offset & 0x0fff) | (m_rom_page << 12)]; + + if (TRACE_READ) space.device().logerror("%04x(%04x) -> %02x\n", offset + 0x6000, offset | (m_rom_page<<13), *value); + } } } else @@ -1842,16 +1998,19 @@ WRITE8_MEMBER(ti99_mbx_cartridge::write) { if (m_romspace_selected) { - if (offset == 0x6ffe) + if ((offset & 0x1c00)==0x0c00) // RAM area { - m_rom_page = data & 1; - return; - } + if ((offset & 0x0ffe) == 0x0ffe) // Mapper, backed by RAM; reacts to bots 6fff and 6ffe + { + // Valid values are 0, 1, 2, 3 + m_rom_page = data & 3; + if (TRACE_WRITE) if ((offset & 1)==0) space.device().logerror("Set ROM page = %d\n", data); + } - if ((offset & 0x1c00)==0x0c00) - { - if (m_ram_ptr == nullptr) return; - m_ram_ptr[offset & 0x03ff] = data; + if (m_ram_ptr != nullptr) + m_ram_ptr[offset & 0x03ff] = data; + else + if (TRACE_ILLWRITE) space.device().logerror("Write access to %04x but no RAM present\n", offset+0x6000); } } else @@ -1890,6 +2049,19 @@ WRITE8_MEMBER(ti99_mbx_cartridge::write) >601E 0 / 0 / 0 / 0 The paged379i cartrige does not have any GROMs. + + ROM space + 6000 7000 7fff + | | | + |========== ROM 1 ==========| Bank 0 Write to 601e + | | | + |========== ROM 2 ==========| Bank 1 Write to 601c + | | | + | ... | + | | | + |========== ROM 16 =========| Bank 15 Write to 6000 + + ******************************************************************************/ /* Read function for the paged379i cartridge. */ @@ -1928,6 +2100,17 @@ WRITE8_MEMBER(ti99_paged379i_cartridge::write) The cartridge may also be used without GROM. + ROM space + 6000 7000 7fff + | | | + |========== ROM 1 ==========| Bank 0 Write to 6000 + | | | + |========== ROM 2 ==========| Bank 1 Write to 6002 + | | | + | ... | + | | | + |========== ROM 64 =========| Bank 63 Write to 607e + ******************************************************************************/ /* Read function for the paged378 cartridge. */ @@ -1953,6 +2136,19 @@ WRITE8_MEMBER(ti99_paged378_cartridge::write) This type is intended for high-capacity cartridges of up to 2 MiB The paged379i cartrige does not have any GROMs. + + ROM space + 6000 7000 7fff + | | | + |========== ROM 1 ==========| Bank 0 Write to 6000 + | | | + |========== ROM 2 ==========| Bank 1 Write to 6002 + | | | + | ... | + | | | + |========== ROM 256 ========| Bank 255 Write to 61fe + + ******************************************************************************/ /* Read function for the paged377 cartridge. */ @@ -1991,6 +2187,18 @@ WRITE8_MEMBER(ti99_paged377_cartridge::write) 7 >8000 = 1000 0000 0000 0000 No GROMs used in this type. + + ROM space + 6000 7000 7fff + | | | + |========= ROM 1 ==========| Bank 0 CRU>0802 + | | | + |========= ROM 2 ==========| Bank 1 CRU>0806 + | | | + ... + | | | + |========= ROM 8 ==========| Bank 7 CRU>081e + ******************************************************************************/ /* Read function for the pagedcru cartridge. */ @@ -2062,13 +2270,29 @@ WRITE8_MEMBER(ti99_pagedcru_cartridge::cruwrite) Super-MiniMemory is also included here. We assume a RAM area at addresses 7000-7fff for this cartridge. + + GROM space + 6000 77ff 8000 97ff a000 b7ff c000 d7ff e000 ffff + |=========================== emulated GROM ================================| + + ROM space + 6000 7000 7fff + | | | + |========== ROM1 ===========| Bank 0 write to 6000, 6004, ... 7ffc + | | | + |========== ROM2 ===========| Bank 1 write to 6002, 6006, ... 7ffe + + ******************************************************************************/ WRITE8_MEMBER(ti99_gromemu_cartridge::set_gromlines) { - m_grom_selected = (data != CLEAR_LINE); - m_grom_read_mode = ((offset & GROM_M_LINE)!=0); - m_grom_address_mode = ((offset & GROM_MO_LINE)!=0); + if (m_grom_ptr != nullptr) + { + m_grom_selected = (data != CLEAR_LINE); + m_grom_read_mode = ((offset & GROM_M_LINE)!=0); + m_grom_address_mode = ((offset & GROM_MO_LINE)!=0); + } } READ8Z_MEMBER(ti99_gromemu_cartridge::readz) diff --git a/src/devices/bus/ti99x/gromport.h b/src/devices/bus/ti99x/gromport.h index e420a595c72..ee56c885b71 100644 --- a/src/devices/bus/ti99x/gromport.h +++ b/src/devices/bus/ti99x/gromport.h @@ -219,6 +219,7 @@ public: void insert(int index, ti99_cartridge_device* cart) override; void remove(int index) override; + DECLARE_INPUT_CHANGED_MEMBER( switch_changed ); protected: virtual void device_start() override; @@ -345,10 +346,20 @@ public: /*********** Paged cartridge (like Extended Basic) ********************/ -class ti99_paged_cartridge : public ti99_cartridge_pcb +class ti99_paged12k_cartridge : public ti99_cartridge_pcb { public: - ~ti99_paged_cartridge() { }; + ~ti99_paged12k_cartridge() { }; + DECLARE_READ8Z_MEMBER(readz) override; + DECLARE_WRITE8_MEMBER(write) override; +}; + +/*********** Paged cartridge (others) ********************/ + +class ti99_paged16k_cartridge : public ti99_cartridge_pcb +{ +public: + ~ti99_paged16k_cartridge() { }; DECLARE_READ8Z_MEMBER(readz) override; DECLARE_WRITE8_MEMBER(write) override; }; diff --git a/src/devices/cpu/drcbex64.cpp b/src/devices/cpu/drcbex64.cpp index 2a09a84a39c..9c8ae6e0bbb 100644 --- a/src/devices/cpu/drcbex64.cpp +++ b/src/devices/cpu/drcbex64.cpp @@ -4300,6 +4300,10 @@ void drcbe_x64::op_add(x86code *&dst, const instruction &inst) if (dstp.is_memory() && dstp == src1p) emit_add_m32_p32(dst, MABS(dstp.memory()), src2p, inst); // add [dstp],src2p + // dstp == src2p in memory + else if (dstp.is_memory() && dstp == src2p) + emit_add_m32_p32(dst, MABS(dstp.memory()), src1p, inst); // add [dstp],src1p + // reg = reg + imm else if (dstp.is_int_register() && src1p.is_int_register() && src2p.is_immediate() && inst.flags() == 0) emit_lea_r32_m32(dst, dstp.ireg(), MBD(src1p.ireg(), src2p.immediate())); // lea dstp,[src1p+src2p] @@ -4324,6 +4328,10 @@ void drcbe_x64::op_add(x86code *&dst, const instruction &inst) if (dstp.is_memory() && dstp == src1p) emit_add_m64_p64(dst, MABS(dstp.memory()), src2p, inst); // add [dstp],src2p + // dstp == src2p in memory + else if (dstp.is_memory() && dstp == src2p) + emit_add_m64_p64(dst, MABS(dstp.memory()), src1p, inst); // add [dstp],src1p + // reg = reg + imm else if (dstp.is_int_register() && src1p.is_int_register() && src2p.is_immediate() && short_immediate(src2p.immediate()) && inst.flags() == 0) emit_lea_r64_m64(dst, dstp.ireg(), MBD(src1p.ireg(), src2p.immediate())); // lea dstp,[src1p+src2p] @@ -5040,6 +5048,10 @@ void drcbe_x64::op_and(x86code *&dst, const instruction &inst) if (dstp.is_memory() && dstp == src1p) emit_and_m32_p32(dst, MABS(dstp.memory()), src2p, inst); // and [dstp],src2p + // dstp == src2p in memory + else if (dstp.is_memory() && dstp == src2p) + emit_and_m32_p32(dst, MABS(dstp.memory()), src1p, inst); // and [dstp],src1p + // AND with immediate 0xff else if (src2p.is_immediate_value(0xff) && inst.flags() == 0) { @@ -5076,6 +5088,10 @@ void drcbe_x64::op_and(x86code *&dst, const instruction &inst) if (dstp.is_memory() && dstp == src1p) emit_and_m64_p64(dst, MABS(dstp.memory()), src2p, inst); // and [dstp],src2p + // dstp == src2p in memory + else if (dstp.is_memory() && dstp == src2p) + emit_and_m64_p64(dst, MABS(dstp.memory()), src1p, inst); // and [dstp],src1p + // AND with immediate 0xff else if (src2p.is_immediate_value(0xff) && inst.flags() == 0) { diff --git a/src/devices/cpu/sm8500/sm85ops.h b/src/devices/cpu/sm8500/sm85ops.h index dacfa02482d..20f31cbcd7f 100644 --- a/src/devices/cpu/sm8500/sm85ops.h +++ b/src/devices/cpu/sm8500/sm85ops.h @@ -80,7 +80,7 @@ break; \ case 0x40: \ s2 = mem_readword( sm8500_b2w[r1 & 0x07] ); \ - mem_writeword( sm8500_b2w[r1 & 0x07], s2 + 1 ); \ + mem_writeword( sm8500_b2w[r1 & 0x07], s2 + 2 ); \ break; \ case 0x80: \ s2 = mem_readword( m_PC ); m_PC += 2; \ @@ -89,8 +89,8 @@ } \ break; \ case 0xC0: \ - s2 = mem_readword( sm8500_b2w[ r1 & 0x07] ); \ - mem_writeword( sm8500_b2w[r1 & 0x07], s2 - 1 ); \ + s2 = mem_readword( sm8500_b2w[ r1 & 0x07])-2; \ + mem_writeword( sm8500_b2w[r1 & 0x07], s2 ); \ break; \ } \ r2 = r1; \ @@ -945,6 +945,7 @@ case 0x31: /* ADD r,@rr / ADD r,(rr)+ / ADD r,@ww / ADD r,ww(rr) / ADD r,-(rr) case 0x32: /* SUB r,@rr / SUB r,(rr)+ / SUB r,@ww / SUB r,ww(rr) / SUB r,-(rr) - 8,13,11,15,13 cycles - Flags affected: CZSV1H-- */ ARG_rmw; OP_SUB8( mem_readbyte( r1 ), mem_readbyte( s2 ) ); + mem_writebyte( r1, res & 0xFF ); switch( r2 & 0xC0 ) { case 0x00: mycycles += 8; break; case 0x40: mycycles += 13; break; @@ -1272,12 +1273,19 @@ case 0x59: /* Invalid - 2? cycles - Flags affected: --------? */ mycycles += 2; break; case 0x5A: /* unk5A - 7,8,12,9,8 cycles */ - logerror( "%04X: unk%02x\n", m_PC-1,op ); -/* NOTE: This unknown command is used in the calculator as a compare instruction - at 0x493A and 0x4941, we set the flags on the 3rd byte, although its real - function remains a mystery */ +/* NOTE: This unknown command is used in the game.com calculator, and in a number of carts. + It appears to compare the contents of the register number contained in the first + parameter, against a literal in the second parameter. + Example: + mov r02, 88 + unk 5a 02 06 (compare contents of memory 88, to literal 06) + The calculator uses this instruction at 0x493A and 0x4941. Defender II (in Williams + Arcade Classics) uses it at 6DC9. */ ARG_iR; - OP_CMP8( 0, r1 ); + s2 = mem_readbyte(r2); + logerror( "%04X: unk%02x (cmp r%02X->(%02X)->%02X to %02X)\n", + m_PC-3,op,r2,s2,mem_readbyte(s2),r1 ); + OP_CMP8( mem_readbyte(s2), r1 ); mycycles += 7; break; case 0x5B: /* unk5B - 6,7,11,8,7 cycles */ diff --git a/src/devices/machine/gt64xxx.cpp b/src/devices/machine/gt64xxx.cpp index 4c096af6a3e..a92326f3c4a 100644 --- a/src/devices/machine/gt64xxx.cpp +++ b/src/devices/machine/gt64xxx.cpp @@ -8,9 +8,9 @@ * *************************************/ #define LOG_GALILEO (0) -#define LOG_REG (0) #define LOG_TIMERS (0) #define LOG_DMA (0) +#define LOG_PCI (0) const device_type GT64XXX = &device_creator<gt64xxx_device>; @@ -28,10 +28,19 @@ gt64xxx_device::gt64xxx_device(const machine_config &mconfig, const char *tag, d m_be(0), m_autoconfig(0), m_irq_num(-1), m_mem_config("memory_space", ENDIANNESS_LITTLE, 32, 32), m_io_config("io_space", ENDIANNESS_LITTLE, 32, 32), - m_region(*this, DEVICE_SELF) + m_romRegion(*this, "rom"), + m_updateRegion(*this, "update"), m_cs_map(4) { } +void gt64xxx_device::set_cs_map(int id, address_map_constructor map, const char *name, device_t *device) +{ + m_cs_map[id].enable = true; + m_cs_map[id].name = name; + m_cs_map[id].device = device; + m_cs_map[id].map = map; +} + const address_space_config *gt64xxx_device::memory_space_config(address_spacenum spacenum) const { return (spacenum == AS_PROGRAM) ? pci_bridge_device::memory_space_config(spacenum) : (spacenum == AS_DATA) ? &m_mem_config : (spacenum == AS_IO) ? &m_io_config : nullptr; @@ -53,11 +62,35 @@ void gt64xxx_device::device_start() io_offset = 0x00000000; status = 0x0; - // ROM size = 4 MB - m_cpu_space->install_rom (0x1fc00000, 0x1fffffff, m_region->base()); + //dma_addr_map.reserve(static_cast<size_t>(proc_addr_bank::ADDR_NUM)); + dma_addr_map.resize(static_cast<size_t>(proc_addr_bank::ADDR_NUM)); + + // DMA timer + m_dma_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::perform_dma), this)); + // Leave the timer disabled. + m_dma_timer->adjust(attotime::never, 0, DMA_TIMER_PERIOD); - // MIPS drc - m_cpu->add_fastram(0x1fc00000, 0x1fffffff, TRUE, m_region->base()); + // ROM + UINT32 romSize = m_romRegion->bytes(); + m_cpu_space->install_rom (0x1fc00000, 0x1fc00000 + romSize - 1, m_romRegion->base()); + // ROM MIPS DRC + m_cpu->add_fastram(0x1fc00000, 0x1fc00000 + romSize - 1, TRUE, m_romRegion->base()); + if (LOG_GALILEO) + logerror("%s: gt64xxx_device::device_start ROM Mapped size: 0x%08X start: 0x1fc00000 end: %08X\n", tag(), romSize, 0x1fc00000 + romSize - 1); + + // Update region address is based on seattle driver + if (m_updateRegion) { + romSize = m_updateRegion->bytes(); + m_cpu_space->install_rom(0x1fd00000, 0x1fd00000 + romSize - 1, m_updateRegion->base()); + if (LOG_GALILEO) + logerror("%s: gt64xxx_device::device_start UPDATE Mapped size: 0x%08X start: 0x1fd00000 end: %08X\n", tag(), romSize, 0x1fd00000 + romSize - 1); + } + + /* allocate timers for the galileo */ + m_timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this)); + m_timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this)); + m_timer[2].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this)); + m_timer[3].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt64xxx_device::timer_callback), this)); } void gt64xxx_device::device_reset() @@ -105,6 +138,19 @@ void gt64xxx_device::device_reset() map_cpu_space(); regenerate_config_mapping(); + + m_pci_stall_state = 0; + m_retry_count = 0; + m_pci_cpu_stalled = 0; + m_cpu_stalled_offset = 0; + m_cpu_stalled_data = 0; + m_cpu_stalled_mem_mask = 0; + + m_dma_active = 0; + m_dma_timer->adjust(attotime::never); + m_last_dma = 0; + + m_prev_addr = 0; } void gt64xxx_device::map_cpu_space() @@ -125,14 +171,40 @@ void gt64xxx_device::map_cpu_space() if (LOG_GALILEO) logerror("%s: map_cpu_space cpu_reg start: %08X end: %08X\n", tag(), winStart, winEnd); - // Ras0 - winStart = (m_reg[GREG_RAS_1_0_LO]<<21) | (m_reg[GREG_RAS0_LO]<<20); - winEnd = (m_reg[GREG_RAS_1_0_LO]<<21) | (m_reg[GREG_RAS0_HI]<<20) | 0xfffff; - m_ram[0].resize((winEnd+1-winStart)/4); - m_cpu_space->install_ram(winStart, winEnd, &m_ram[0][0]); - m_cpu->add_fastram(winStart, m_ram[0].size()*sizeof(m_ram[0][0]), FALSE, &m_ram[0][0]); - if (LOG_GALILEO) - logerror("%s: map_cpu_space ras0 start: %08X end: %08X\n", tag(), winStart, winEnd); + // RAS[0:3] + for (int ramIndex = 0; ramIndex < 4; ++ramIndex) + { + winStart = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex/2)] << 21) | (m_reg[GREG_RAS0_LO + 0x8 / 4 * ramIndex] << 20); + winEnd = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_HI + 0x8 / 4 * ramIndex] << 20) | 0xfffff; + m_ram[ramIndex].resize((winEnd + 1 - winStart) / 4); + m_cpu_space->install_ram(winStart, winEnd, m_ram[ramIndex].data()); + //m_cpu->add_fastram(winStart, m_ram[ramIndex].size() * sizeof(m_ram[ramIndex][0]), FALSE, &m_ram[ramIndex][0]); + //m_cpu->add_fastram(winStart, m_ram[ramIndex].size() * sizeof(UINT32), FALSE, m_ram[ramIndex].data()); + if (LOG_GALILEO) + logerror("%s: map_cpu_space ras[%i] start: %08X end: %08X\n", tag(), ramIndex, winStart, winEnd); + } + + // CS[0:3] + //m_cpu_space->install_device_delegate(0x16000000, 0x17ffffff, machine().root_device(), m_cs_map[3].map); + typedef void (gt64xxx_device::*tramp_t)(::address_map &, device_t &); + static const tramp_t trampolines[4] = { + >64xxx_device::map_trampoline<0>, + >64xxx_device::map_trampoline<1>, + >64xxx_device::map_trampoline<2>, + >64xxx_device::map_trampoline<3> + }; + for (int ramIndex = 0; ramIndex < 4; ++ramIndex) + { + if (m_cs_map[ramIndex].enable) + { + winStart = (m_reg[GREG_CS_2_0_LO + 0x10 / 4 * (ramIndex / 3)] << 21) | (m_reg[GREG_CS0_LO + 0x8 / 4 * ramIndex] << 20); + winEnd = (m_reg[GREG_CS_2_0_LO + 0x10 / 4 * (ramIndex / 3)] << 21) | (m_reg[GREG_CS0_HI + 0x8 / 4 * ramIndex] << 20) | 0xfffff; + install_cs_map(winStart, winEnd, trampolines[ramIndex], m_cs_map[ramIndex].name); + if (LOG_GALILEO) + logerror("%s: map_cpu_space cs[%i] start: %08X end: %08X\n", tag(), ramIndex, winStart, winEnd); + } + } + // PCI IO Window winStart = m_reg[GREG_PCI_IO_LO]<<21; @@ -158,25 +230,79 @@ void gt64xxx_device::map_cpu_space() if (LOG_GALILEO) logerror("%s: map_cpu_space pci_mem1 start: %08X end: %08X\n", tag(), winStart, winEnd); + // Setup the address mapping table for DMA lookups + for (size_t index = 0; index < proc_addr_bank::ADDR_NUM; ++index) + { + if (index < proc_addr_bank::ADDR_PCI_MEM1) { + dma_addr_map[index].low_addr = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * index] << 21); + dma_addr_map[index].high_addr = (dma_addr_map[index].low_addr & 0xf0000000) | (m_reg[GREG_RAS_1_0_HI + 0x10 / 4 * index] << 21) | 0x1fffff; + } + else { + dma_addr_map[index].low_addr = (m_reg[GREG_PCI_MEM1_LO] << 21); + dma_addr_map[index].high_addr = (dma_addr_map[index].low_addr & 0xf0000000) | (m_reg[GREG_PCI_MEM1_HI] << 21) | 0x1fffff; + } + + switch (index) { + case proc_addr_bank::ADDR_PCI_IO: + dma_addr_map[index].space = &this->space(AS_IO); + break; + case proc_addr_bank::ADDR_PCI_MEM0: + case proc_addr_bank::ADDR_PCI_MEM1: + dma_addr_map[index].space = &this->space(AS_DATA); + break; + default: + dma_addr_map[index].space = m_cpu_space; + break; + } + } } void gt64xxx_device::map_extra(UINT64 memory_window_start, UINT64 memory_window_end, UINT64 memory_offset, address_space *memory_space, UINT64 io_window_start, UINT64 io_window_end, UINT64 io_offset, address_space *io_space) { - /* + int ramIndex; UINT32 winStart, winEnd, winSize; - - // PCI Target Window 1 - if (m_cpu_regs[NREG_PCITW1]&0x1000) { - winStart = m_cpu_regs[NREG_PCITW1]&0xffe00000; - winEnd = winStart | (~(0xf0000000 | (((m_cpu_regs[NREG_PCITW1]>>13)&0x7f)<<21))); - winSize = winEnd - winStart + 1; - memory_space->install_read_handler(winStart, winEnd, 0, 0, read32_delegate(FUNC(gt64xxx_device::target1_r), this)); - memory_space->install_write_handler(winStart, winEnd, 0, 0, write32_delegate(FUNC(gt64xxx_device::target1_w), this)); - if (LOG_GALILEO) - logerror("%s: map_extra Target Window 1 start=%08X end=%08X size=%08X laddr=%08X\n", tag(), winStart, winEnd, winSize, m_target1_laddr); - } - */ + + // Not sure if GREG_RAS_1_0_LO should be added on PCI address map side. + // RAS0 + ramIndex = 0; + winStart = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_LO + 0x8 / 4 * ramIndex] << 20); + winEnd = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_HI + 0x8 / 4 * ramIndex] << 20) | 0xfffff; + winSize = winEnd - winStart + 1; + memory_space->install_read_handler(winStart, winEnd, 0, 0, read32_delegate(FUNC(gt64xxx_device::ras_0_r), this)); + memory_space->install_write_handler(winStart, winEnd, 0, 0, write32_delegate(FUNC(gt64xxx_device::ras_0_w), this)); + if (LOG_GALILEO) + logerror("%s: map_extra RAS0 start=%08X end=%08X size=%08X\n", tag(), winStart, winEnd, winSize); + + // RAS1 + ramIndex = 1; + winStart = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_LO + 0x8 / 4 * ramIndex] << 20); + winEnd = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_HI + 0x8 / 4 * ramIndex] << 20) | 0xfffff; + winSize = winEnd - winStart + 1; + memory_space->install_read_handler(winStart, winEnd, 0, 0, read32_delegate(FUNC(gt64xxx_device::ras_1_r), this)); + memory_space->install_write_handler(winStart, winEnd, 0, 0, write32_delegate(FUNC(gt64xxx_device::ras_1_w), this)); + if (LOG_GALILEO) + logerror("%s: map_extra RAS1 start=%08X end=%08X size=%08X\n", tag(), winStart, winEnd, winSize); + + // RAS2 + ramIndex = 2; + winStart = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_LO + 0x8 / 4 * ramIndex] << 20); + winEnd = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_HI + 0x8 / 4 * ramIndex] << 20) | 0xfffff; + winSize = winEnd - winStart + 1; + memory_space->install_read_handler(winStart, winEnd, 0, 0, read32_delegate(FUNC(gt64xxx_device::ras_2_r), this)); + memory_space->install_write_handler(winStart, winEnd, 0, 0, write32_delegate(FUNC(gt64xxx_device::ras_2_w), this)); + if (LOG_GALILEO) + logerror("%s: map_extra RAS2 start=%08X end=%08X size=%08X\n", tag(), winStart, winEnd, winSize); + + // RAS3 + ramIndex = 3; + winStart = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_LO + 0x8 / 4 * ramIndex] << 20); + winEnd = (m_reg[GREG_RAS_1_0_LO + 0x10 / 4 * (ramIndex / 2)] << 21) | (m_reg[GREG_RAS0_HI + 0x8 / 4 * ramIndex] << 20) | 0xfffff; + winSize = winEnd - winStart + 1; + memory_space->install_read_handler(winStart, winEnd, 0, 0, read32_delegate(FUNC(gt64xxx_device::ras_3_r), this)); + memory_space->install_write_handler(winStart, winEnd, 0, 0, write32_delegate(FUNC(gt64xxx_device::ras_3_w), this)); + if (LOG_GALILEO) + logerror("%s: map_extra RAS3 start=%08X end=%08X size=%08X\n", tag(), winStart, winEnd, winSize); } void gt64xxx_device::reset_all_mappings() @@ -184,6 +310,28 @@ void gt64xxx_device::reset_all_mappings() pci_device::reset_all_mappings(); } +// PCI Stalling +WRITE_LINE_MEMBER(gt64xxx_device::pci_stall) +{ + // Reset the retry count once unstalled + if (state==0 && m_pci_stall_state==1) { + m_retry_count = 0; + // Check if it is a stalled cpu access and re-issue + if (m_pci_cpu_stalled) { + m_pci_cpu_stalled = 0; + // master_mem0_w -- Should actually be checking for master_mem1_w as well + this->space(AS_DATA).write_dword((m_reg[GREG_PCI_MEM0_LO] << 21) | (m_cpu_stalled_offset * 4), m_cpu_stalled_data, m_cpu_stalled_mem_mask); + /* resume CPU execution */ + machine().scheduler().trigger(45678); + if (LOG_GALILEO) + logerror("Resuming CPU on PCI Stall offset=0x%08X data=0x%08X\n", m_cpu_stalled_offset * 4, m_cpu_stalled_data); + } + } + + /* set the new state */ + m_pci_stall_state = state; +} + // PCI bus control READ32_MEMBER (gt64xxx_device::pci_config_r) { @@ -201,14 +349,26 @@ WRITE32_MEMBER (gt64xxx_device::pci_config_w) READ32_MEMBER (gt64xxx_device::master_mem0_r) { UINT32 result = this->space(AS_DATA).read_dword((m_reg[GREG_PCI_MEM0_LO]<<21) | (offset*4), mem_mask); - if (LOG_GALILEO) + if (LOG_PCI) logerror("%06X:galileo pci mem0 read from offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_MEM0_LO]<<21) | (offset*4), result, mem_mask); return result; } WRITE32_MEMBER (gt64xxx_device::master_mem0_w) { + if (m_pci_stall_state) { + // Save the write data and stall the cpu + m_pci_cpu_stalled = 1; + m_cpu_stalled_offset = offset; + m_cpu_stalled_data = data; + m_cpu_stalled_mem_mask = mem_mask; + // Stall cpu until trigger + m_cpu_space->device().execute().spin_until_trigger(45678); + if (LOG_GALILEO || LOG_PCI) + logerror("%08X:Stalling CPU on PCI Stall\n", m_cpu_space->device().safe_pc()); + return; + } this->space(AS_DATA).write_dword((m_reg[GREG_PCI_MEM0_LO]<<21) | (offset*4), data, mem_mask); - if (LOG_GALILEO) + if (LOG_PCI) logerror("%06X:galileo pci mem0 write to offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_MEM0_LO]<<21) | (offset*4), data, mem_mask); } @@ -216,14 +376,14 @@ WRITE32_MEMBER (gt64xxx_device::master_mem0_w) READ32_MEMBER (gt64xxx_device::master_mem1_r) { UINT32 result = this->space(AS_DATA).read_dword((m_reg[GREG_PCI_MEM1_LO]<<21) | (offset*4), mem_mask); - if (LOG_GALILEO) + if (LOG_PCI) logerror("%06X:galileo pci mem1 read from offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_MEM1_LO]<<21) | (offset*4), result, mem_mask); return result; } WRITE32_MEMBER (gt64xxx_device::master_mem1_w) { this->space(AS_DATA).write_dword((m_reg[GREG_PCI_MEM1_LO]<<21) | (offset*4), data, mem_mask); - if (LOG_GALILEO) + if (LOG_PCI) logerror("%06X:galileo pci mem1 write to offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_MEM1_LO]<<21) | (offset*4), data, mem_mask); } @@ -231,15 +391,79 @@ WRITE32_MEMBER (gt64xxx_device::master_mem1_w) READ32_MEMBER (gt64xxx_device::master_io_r) { UINT32 result = this->space(AS_IO).read_dword((m_reg[GREG_PCI_IO_LO]<<21) | (offset*4), mem_mask); - if (LOG_GALILEO) - logerror("%06X:galileo pci io read from offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_IO_LO]<<21) | (offset*4), result, mem_mask); + if (LOG_PCI && m_prev_addr != offset) { + m_prev_addr = offset; + logerror("%06X:galileo pci io read from offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_IO_LO] << 21) | (offset * 4), result, mem_mask); + } return result; } WRITE32_MEMBER (gt64xxx_device::master_io_w) { this->space(AS_IO).write_dword((m_reg[GREG_PCI_IO_LO]<<21) | (offset*4), data, mem_mask); - if (LOG_GALILEO) - logerror("%06X:galileo pciio write to offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_IO_LO]<<21) | (offset*4), data, mem_mask); + if (LOG_PCI && m_prev_addr != offset) { + m_prev_addr = offset; + logerror("%06X:galileo pciio write to offset %08X = %08X & %08X\n", space.device().safe_pc(), (m_reg[GREG_PCI_IO_LO] << 21) | (offset * 4), data, mem_mask); + } +} + +READ32_MEMBER(gt64xxx_device::ras_0_r) +{ + UINT32 result = m_ram[0][offset]; + if (LOG_PCI) + logerror("%06X:galileo ras_0 read from offset %08X = %08X & %08X\n", space.device().safe_pc(), offset * 4, result, mem_mask); + return result; +} + +WRITE32_MEMBER(gt64xxx_device::ras_0_w) +{ + COMBINE_DATA(&m_ram[0][offset]); + if (LOG_PCI) + logerror("%06X:galileo ras_0 write to offset %08X = %08X & %08X\n", space.device().safe_pc(), offset * 4, data, mem_mask); +} + +READ32_MEMBER(gt64xxx_device::ras_1_r) +{ + UINT32 result = m_ram[1][offset]; + if (LOG_PCI) + logerror("%06X:galileo ras_0 read from offset %08X = %08X & %08X\n", space.device().safe_pc(), offset * 4, result, mem_mask); + return result; +} + +WRITE32_MEMBER(gt64xxx_device::ras_1_w) +{ + COMBINE_DATA(&m_ram[1][offset]); + if (LOG_PCI) + logerror("%06X:galileo ras_0 write to offset %08X = %08X & %08X\n", space.device().safe_pc(), offset * 4, data, mem_mask); +} + +READ32_MEMBER(gt64xxx_device::ras_2_r) +{ + UINT32 result = m_ram[2][offset]; + if (LOG_PCI) + logerror("%06X:galileo ras_0 read from offset %08X = %08X & %08X\n", space.device().safe_pc(), offset * 4, result, mem_mask); + return result; +} + +WRITE32_MEMBER(gt64xxx_device::ras_2_w) +{ + COMBINE_DATA(&m_ram[2][offset]); + if (LOG_PCI) + logerror("%06X:galileo ras_0 write to offset %08X = %08X & %08X\n", space.device().safe_pc(), offset * 4, data, mem_mask); +} + +READ32_MEMBER(gt64xxx_device::ras_3_r) +{ + UINT32 result = m_ram[3][offset]; + if (LOG_PCI) + logerror("%06X:galileo ras_0 read from offset %08X = %08X & %08X\n", space.device().safe_pc(), offset * 4, result, mem_mask); + return result; +} + +WRITE32_MEMBER(gt64xxx_device::ras_3_w) +{ + COMBINE_DATA(&m_ram[3][offset]); + if (LOG_PCI) + logerror("%06X:galileo ras_0 write to offset %08X = %08X & %08X\n", space.device().safe_pc(), offset * 4, data, mem_mask); } @@ -267,7 +491,7 @@ READ32_MEMBER (gt64xxx_device::cpu_if_r) } /* eat some time for those which poll this register */ - space.device().execute().eat_cycles(100); + //space.device().execute().eat_cycles(100); if (LOG_TIMERS) logerror("%08X:hires_timer_r = %08X\n", space.device().safe_pc(), result); @@ -277,10 +501,15 @@ READ32_MEMBER (gt64xxx_device::cpu_if_r) case GREG_PCI_COMMAND: // code at 40188 loops until this returns non-zero in bit 0 //result = 0x0001; + // bit 0 => byte swap + // bit 2:1 => SyncMode, 00 = PCLK=[0,33], 01 = PCLK>=TClk/2, 10 = PCLK = TCLK/2 + result = (result & ~0x1) | (m_be ^ 0x1); break; case GREG_CONFIG_DATA: result = config_data_r(space, offset); + if (LOG_GALILEO) + logerror("%08X:Galileo GREG_CONFIG_DATA read from offset %03X = %08X\n", space.device().safe_pc(), offset*4, result); break; case GREG_CONFIG_ADDRESS: @@ -295,7 +524,8 @@ READ32_MEMBER (gt64xxx_device::cpu_if_r) break; default: - logerror("%08X:Galileo read from offset %03X = %08X\n", space.device().safe_pc(), offset*4, result); + if (LOG_GALILEO) + logerror("%08X:Galileo read from offset %03X = %08X\n", space.device().safe_pc(), offset*4, result); break; } @@ -332,7 +562,9 @@ WRITE32_MEMBER(gt64xxx_device::cpu_if_w) case GREG_INTERNAL_SPACE: case GREG_PCI_MEM1_LO: case GREG_PCI_MEM1_HI: + case GREG_CS3_HI: map_cpu_space(); + remap_cb(); if (LOG_GALILEO) logerror("%08X:Galileo Memory Map data write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); break; @@ -344,9 +576,6 @@ WRITE32_MEMBER(gt64xxx_device::cpu_if_w) { int which = offset % 4; - if (LOG_DMA) - logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); - /* keep the read only activity bit */ m_reg[offset] &= ~0x4000; m_reg[offset] |= (oldata & 0x4000); @@ -357,8 +586,18 @@ WRITE32_MEMBER(gt64xxx_device::cpu_if_w) m_reg[offset] &= ~0x2000; /* if enabling, start the DMA */ - if (!(oldata & 0x1000) && (data & 0x1000)) - perform_dma(space, which); + if (!(oldata & 0x1000) && (data & 0x1000) && !(m_dma_active & (1<<which))) + { + // Trigger the timer if there are no dma's active + if (m_dma_active==0) + m_dma_timer->adjust(attotime::zero, 0, DMA_TIMER_PERIOD); + m_dma_active |= (1<< which); + //perform_dma(space, which); + if (LOG_DMA) + logerror("%08X:Galileo starting DMA Chan %i\n", space.device().safe_pc(), which); + } + if (LOG_GALILEO) + logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset * 4, data, mem_mask); break; } @@ -428,9 +667,30 @@ WRITE32_MEMBER(gt64xxx_device::cpu_if_w) break; case GREG_CONFIG_ADDRESS: - pci_host_device::config_address_w(space, offset, data); + // Type 0 config transactions signalled by Bus Num = 0 and Device Num != 0 + // Bits 15:11 get mapped into device number for configuration + UINT32 modData; + if (0 && (data & 0xff0000) == 0x0 && (data & 0xf800)) { + // Type 0 transaction + modData = 0; + // Select the device based on one hot bit + for (int i = 11; i<16; i++) { + if ((data >> i) & 0x1) { + // One hot encoding, bit 11 will mean device 1 + modData = i - 10; + break; + } + } + // Re-organize into Type 1 transaction for bus 0 (local bus) + modData = (modData << 11) | (data & 0x7ff) | (0x80000000); + } + else { + // Type 1 transaction, no modification needed + modData = data; + } + pci_host_device::config_address_w(space, offset, modData); if (LOG_GALILEO) - logerror("%08X:Galileo PCI config address write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); + logerror("%08X:Galileo PCI config address write to offset %03X = %08X & %08X origData = %08X\n", space.device().safe_pc(), offset*4, modData, mem_mask, data); break; case GREG_DMA0_COUNT: case GREG_DMA1_COUNT: case GREG_DMA2_COUNT: case GREG_DMA3_COUNT: @@ -443,7 +703,8 @@ WRITE32_MEMBER(gt64xxx_device::cpu_if_w) break; default: - logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); + if (LOG_GALILEO) + logerror("%08X:Galileo write to offset %03X = %08X & %08X\n", space.device().safe_pc(), offset*4, data, mem_mask); break; } } @@ -464,8 +725,8 @@ void gt64xxx_device::update_irqs() if (m_irq_num != -1) m_cpu->set_input_line(m_irq_num, state); - if (LOG_GALILEO) - logerror("Galileo IRQ %s\n", (state == ASSERT_LINE) ? "asserted" : "cleared"); + if (1 && LOG_GALILEO) + logerror("Galileo IRQ %s irqNum: %i state = %08X mask = %08X\n", (state == ASSERT_LINE) ? "asserted" : "cleared", m_irq_num, m_reg[GREG_INT_STATE], m_reg[GREG_INT_MASK]); } @@ -498,6 +759,15 @@ TIMER_CALLBACK_MEMBER(gt64xxx_device::timer_callback) * Galileo DMA handler * *************************************/ +address_space* gt64xxx_device::dma_decode_address(UINT32 &addr) +{ + for (size_t index = 0; index < proc_addr_bank::ADDR_NUM; ++index) + { + if (addr >= dma_addr_map[index].low_addr && addr <= dma_addr_map[index].high_addr) + return dma_addr_map[index].space; + } + return nullptr; +} int gt64xxx_device::dma_fetch_next(address_space &space, int which) { @@ -539,16 +809,33 @@ int gt64xxx_device::dma_fetch_next(address_space &space, int which) } -void gt64xxx_device::perform_dma(address_space &space, int which) +TIMER_CALLBACK_MEMBER (gt64xxx_device::perform_dma) { - do + // Cycle through the channels + int which = -1; + for (int i = 1; i <= 4; i++) + { + which = (m_last_dma + i) % 4; + if ((m_dma_active & (1 << which)) && (m_reg[GREG_DMA0_CONTROL + which] & 0x1000)) + break; + + } + // Save which dma is processed for arbitration next time + m_last_dma = which; + + if (which==-1) + { + logerror("gt64xxx_device::perform_dma Warning! DMA Timer called with no pending DMA. m_dma_active = %08X\n", m_dma_active); + } else { offs_t srcaddr = m_reg[GREG_DMA0_SOURCE + which]; offs_t dstaddr = m_reg[GREG_DMA0_DEST + which]; UINT32 bytesleft = m_reg[GREG_DMA0_COUNT + which] & 0xffff; + address_space* srcSpace = dma_decode_address(srcaddr); + address_space* dstSpace = dma_decode_address(dstaddr); + int srcinc, dstinc; - m_dma_active = which; m_reg[GREG_DMA0_CONTROL + which] |= 0x5000; /* determine src/dst inc */ @@ -570,32 +857,71 @@ void gt64xxx_device::perform_dma(address_space &space, int which) if (LOG_DMA) logerror("Performing DMA%d: src=%08X dst=%08X bytes=%04X sinc=%d dinc=%d\n", which, srcaddr, dstaddr, bytesleft, srcinc, dstinc); + int burstCount = 0; /* standard transfer */ - while (bytesleft > 0) + while (bytesleft > 0 && burstCount < DMA_BURST_SIZE) + { + if (m_pci_stall_state) { + if (LOG_DMA && m_retry_count<4) + logerror("%08X:Stalling DMA on voodoo retry_count: %i\n", m_cpu_space->device().safe_pc(), m_retry_count); + // Save info + m_reg[GREG_DMA0_SOURCE + which] = srcaddr; + m_reg[GREG_DMA0_DEST + which] = dstaddr; + m_reg[GREG_DMA0_COUNT + which] = (m_reg[GREG_DMA0_COUNT + which] & ~0xffff) | bytesleft; + + m_retry_count++; + UINT32 configRetryCount = (m_reg[GREG_PCI_TIMEOUT] >> 16) & 0xff; + if (m_retry_count >= configRetryCount && configRetryCount > 0) { + logerror("gt64xxx_device::perform_dma Error! Too many PCI retries. DMA%d: src=%08X dst=%08X bytes=%04X sinc=%d dinc=%d\n", which, srcaddr, dstaddr, bytesleft, srcinc, dstinc); + // Signal error and abort DMA + m_dma_active &= ~(1 << which); + m_retry_count = 0; + return; + } + else { + // Come back later + return; + } + } + if (bytesleft < 4) { - space.write_byte(dstaddr, space.read_byte(srcaddr)); + dstSpace->write_byte(dstaddr, srcSpace->read_byte(srcaddr)); srcaddr += srcinc; dstaddr += dstinc; bytesleft--; } - + else { + //space.write_byte(dstaddr, space.read_byte(srcaddr)); + dstSpace->write_dword(dstaddr, srcSpace->read_dword(srcaddr)); + srcaddr += srcinc * 4; + dstaddr += dstinc * 4; + bytesleft -= 4; + } + burstCount++; + } /* not verified, but seems logical these should be updated byte the end */ m_reg[GREG_DMA0_SOURCE + which] = srcaddr; m_reg[GREG_DMA0_DEST + which] = dstaddr; m_reg[GREG_DMA0_COUNT + which] = (m_reg[GREG_DMA0_COUNT + which] & ~0xffff) | bytesleft; - m_dma_active = -1; /* if we did not hit zero, punt and return later */ if (bytesleft != 0) + { return; - + } /* interrupt? */ if (!(m_reg[GREG_DMA0_CONTROL + which] & 0x400)) { m_reg[GREG_INT_STATE] |= 1 << (GINT_DMA0COMP_SHIFT + which); update_irqs(); } - } while (dma_fetch_next(space, which)); - m_reg[GREG_DMA0_CONTROL + which] &= ~0x5000; + // Fetch the next dma for this channel (to be performed next scheduled burst) + if (dma_fetch_next(*m_cpu_space, which) == 0) + { + m_dma_active &= ~(1 << which); + // Turn off the timer + m_dma_timer->adjust(attotime::never); + } + } } diff --git a/src/devices/machine/gt64xxx.h b/src/devices/machine/gt64xxx.h index 6653c9ca552..69cde74d34b 100644 --- a/src/devices/machine/gt64xxx.h +++ b/src/devices/machine/gt64xxx.h @@ -3,10 +3,7 @@ // Galileo GT-64xxx System Controller // Skeleton code based off seattle machine driver. // TODO: -// Testing -// Need PCI to be able to have a target delay a dma transfer -// Add PCI target maps -// Add PCI Func 1 calls +// Need PCI to be able to have a target delay (pci bus stall) a dma transfer // Configurable byte swapping on cpu and pci busses. #ifndef GT64XXX_H @@ -16,34 +13,42 @@ #include "cpu/mips/mips3.h" // Supports R4600/4650/4700/R5000 CPUs -#define MCFG_GT64010_ADD(_tag, _cpu_tag, _clock) \ +#define MCFG_GT64010_ADD(_tag, _cpu_tag, _clock, _irq_num) \ MCFG_PCI_HOST_ADD(_tag, GT64XXX, 0x014611ab, 0x03, 0x00000000) \ downcast<gt64xxx_device *>(device)->set_cpu_tag(_cpu_tag); \ - downcast<gt64xxx_device *>(device)->set_clock(_clock); + downcast<gt64xxx_device *>(device)->set_clock(_clock); \ + downcast<gt64xxx_device *>(device)->set_irq_num(_irq_num); // Supports the following 32-bit bus CPUs: // IDT RC4640 and RC4650 (in 32-bit mode) // QED RM523X // NEC/Toshiba VR4300 -#define MCFG_GT64111_ADD(_tag, _cpu_tag, _clock) \ +#define MCFG_GT64111_ADD(_tag, _cpu_tag, _clock, _irq_num) \ MCFG_PCI_DEVICE_ADD(_tag, GT64XXX, 0x414611ab, 0x10, 0x058000, 0x00000000) \ downcast<gt64xxx_device *>(device)->set_cpu_tag(_cpu_tag); \ - downcast<gt64xxx_device *>(device)->set_clock(_clock); + downcast<gt64xxx_device *>(device)->set_clock(_clock); \ + downcast<gt64xxx_device *>(device)->set_irq_num(_irq_num); #define MCFG_GT64XXX_SET_BE_CPU(_be) \ downcast<gt64xxx_device *>(device)->set_be(_be); -#define MCFG_GT64XXX__IRQ_ADD(_irq_num) \ +#define MCFG_GT64XXX_IRQ_ADD(_irq_num) \ downcast<gt64xxx_device *>(device)->set_irq_info(_irq_num); +#define MCFG_GT64XXX_SET_CS(_cs_num, _map) \ + downcast<gt64xxx_device *>(device)->set_cs_map(_cs_num, ADDRESS_MAP_NAME(_map), #_map, owner); + /************************************* * * Galileo constants * *************************************/ -//#define SYSTEM_CLOCK 50000000 #define TIMER_PERIOD attotime::from_hz(m_clock) +#define PCI_BUS_CLOCK 33000000 +// Number of dma words to transfer at a time, real hardware configurable between 8-32 +#define DMA_BURST_SIZE 32 +#define DMA_TIMER_PERIOD attotime::from_hz(PCI_BUS_CLOCK / 48) /* Galileo registers - 0x000-0x3ff */ #define GREG_CPU_CONFIG (0x000/4) @@ -161,6 +166,7 @@ #define GINT_TARABORT_SHIFT (19) #define GINT_RETRYCTR_SHIFT (20) + /************************************* * Structures *************************************/ @@ -171,6 +177,22 @@ struct galileo_timer UINT8 active; }; +struct galileo_addr_map +{ + UINT32 low_addr; + UINT32 high_addr; + address_space* space; + galileo_addr_map() : low_addr(0xffffffff), high_addr(0x0) {} +}; + +struct galileo_device_map +{ + bool enable; + const char *name; + device_t *device; + address_map_constructor map; + galileo_device_map() : enable(false), device(nullptr) {} +}; class gt64xxx_device : public pci_host_device { public: @@ -181,14 +203,14 @@ public: UINT64 io_window_start, UINT64 io_window_end, UINT64 io_offset, address_space *io_space) override; void set_cpu_tag(const char *tag) { cpu_tag = tag;} - void set_cpu_tag(const UINT32 clock) { m_clock = clock;} void set_clock(const UINT32 clock) {m_clock = clock;} void set_be(const int be) {m_be = be;} void set_autoconfig(const int autoconfig) {m_autoconfig = autoconfig;} - void set_irq_info(const int irq_num) {m_irq_num = irq_num;} - + void set_irq_num(const int irq_num) {m_irq_num = irq_num;} virtual DECLARE_ADDRESS_MAP(config_map, 32) override; + DECLARE_WRITE_LINE_MEMBER(pci_stall); + // pci bus DECLARE_READ32_MEMBER( pci_config_r); DECLARE_WRITE32_MEMBER( pci_config_w); @@ -207,14 +229,21 @@ public: DECLARE_WRITE32_MEMBER(master_io_w); // devices - DECLARE_READ32_MEMBER (ras_1_0_r); - DECLARE_WRITE32_MEMBER(ras_1_0_w); - DECLARE_READ32_MEMBER (ras_3_2_r); - DECLARE_WRITE32_MEMBER(ras_3_2_w); - DECLARE_READ32_MEMBER (cs_2_0_r); - DECLARE_WRITE32_MEMBER(cs_2_0_w); - DECLARE_READ32_MEMBER (cs_boot_3_r); - DECLARE_WRITE32_MEMBER(cs_boot_3_w); + DECLARE_READ32_MEMBER (ras_0_r); + DECLARE_WRITE32_MEMBER(ras_0_w); + DECLARE_READ32_MEMBER(ras_1_r); + DECLARE_WRITE32_MEMBER(ras_1_w); + DECLARE_READ32_MEMBER(ras_2_r); + DECLARE_WRITE32_MEMBER(ras_2_w); + DECLARE_READ32_MEMBER(ras_3_r); + DECLARE_WRITE32_MEMBER(ras_3_w); + DECLARE_READ32_MEMBER (cs_0_r); + DECLARE_WRITE32_MEMBER(cs_0_w); + + // Enums + enum proc_addr_bank {ADDR_RAS1_0, ADDR_RAS3_2, ADDR_CS2_0, ADDR_CS3_BCS, ADDR_PCI_IO, ADDR_PCI_MEM0, ADDR_PCI_MEM1, ADDR_NUM}; + + void set_cs_map(int id, address_map_constructor map, const char *name, device_t *device); protected: address_space *m_cpu_space; @@ -222,6 +251,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; + private: mips3_device *m_cpu; const char *cpu_tag; @@ -229,19 +259,29 @@ private: int m_be, m_autoconfig; int m_irq_num; + int m_pci_stall_state; + int m_retry_count; + int m_pci_cpu_stalled; + UINT32 m_cpu_stalled_offset; + UINT32 m_cpu_stalled_data; + UINT32 m_cpu_stalled_mem_mask; + address_space_config m_mem_config, m_io_config; - required_memory_region m_region; + required_memory_region m_romRegion; + optional_memory_region m_updateRegion; DECLARE_ADDRESS_MAP(cpu_map, 32); void map_cpu_space(); + UINT32 m_prev_addr; /* raw register data */ UINT32 m_reg[0xd00/4]; /* timer info */ galileo_timer m_timer[4]; + TIMER_CALLBACK_MEMBER(timer_callback); /* DMA info */ INT8 m_dma_active; @@ -249,10 +289,26 @@ private: // Ram std::vector<UINT32> m_ram[4]; - TIMER_CALLBACK_MEMBER(timer_callback); + // Chip Select + std::vector<galileo_device_map> m_cs_map; + + template<int id> void map_trampoline(::address_map &map, device_t &device) { + m_cs_map[id].map(map, *m_cs_map[id].device); + } + template <typename T> void install_cs_map(offs_t addrstart, offs_t addrend, void (T::*map)(::address_map &map, device_t &device), const char *name) { + //address_map_delegate delegate(map, name, static_cast<T *>(this)); + address_map_delegate delegate(map, name, static_cast<T *>(this)); + m_cpu_space->install_device_delegate(addrstart, addrend, *this, delegate); + } + void update_irqs(); + + int m_last_dma; + emu_timer* m_dma_timer; + std::vector<galileo_addr_map> dma_addr_map; int dma_fetch_next(address_space &space, int which); - void perform_dma(address_space &space, int which); + TIMER_CALLBACK_MEMBER(perform_dma); + address_space* dma_decode_address(UINT32 &addr); }; diff --git a/src/devices/machine/pci-ide.cpp b/src/devices/machine/pci-ide.cpp new file mode 100644 index 00000000000..fe54b7595b5 --- /dev/null +++ b/src/devices/machine/pci-ide.cpp @@ -0,0 +1,157 @@ +// license:BSD-3-Clause +// copyright-holders:Ted Green +#include "pci-ide.h" + +const device_type IDE_PCI = &device_creator<ide_pci_device>; + +ide_pci_device::ide_pci_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : pci_device(mconfig, IDE_PCI, "IDE PCI interface", tag, owner, clock, "ide_pci", __FILE__), + m_ide(*this, "ide"), + m_ide2(*this, "ide2"), + m_irq_num(-1) +{ +} + +DEVICE_ADDRESS_MAP_START(config_map, 32, ide_pci_device) + AM_RANGE(0x10, 0x1f) AM_WRITE(address_base_w) + AM_RANGE(0x40, 0x5f) AM_READWRITE(pcictrl_r, pcictrl_w) + AM_INHERIT_FROM(pci_device::config_map) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START(chan1_data_command_map, 32, ide_pci_device) + AM_RANGE(0x0, 0x7) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, read_cs0, write_cs0) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START(chan1_control_map, 32, ide_pci_device) + AM_RANGE(0x0, 0x3) AM_READWRITE(ide_read_cs1, ide_write_cs1) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START(chan2_data_command_map, 32, ide_pci_device) + AM_RANGE(0x0, 0x7) AM_DEVREADWRITE("ide2", bus_master_ide_controller_device, read_cs0, write_cs0) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START(chan2_control_map, 32, ide_pci_device) + AM_RANGE(0x0, 0x3) AM_READWRITE(ide2_read_cs1, ide2_write_cs1) +ADDRESS_MAP_END + +DEVICE_ADDRESS_MAP_START(bus_master_map, 32, ide_pci_device) + AM_RANGE(0x0, 0x7) AM_DEVREADWRITE("ide", bus_master_ide_controller_device, bmdma_r, bmdma_w) + AM_RANGE(0x8, 0xf) AM_DEVREADWRITE("ide2", bus_master_ide_controller_device, bmdma_r, bmdma_w) +ADDRESS_MAP_END + +static MACHINE_CONFIG_FRAGMENT(pci_ide) + MCFG_BUS_MASTER_IDE_CONTROLLER_ADD("ide", ata_devices, "hdd", nullptr, true) + MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(ide_pci_device, ide_interrupt)) + //MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE(":maincpu", AS_PROGRAM) + MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE(":pci:00.0", AS_DATA) + MCFG_BUS_MASTER_IDE_CONTROLLER_ADD("ide2", ata_devices, nullptr, "cdrom", true) + MCFG_ATA_INTERFACE_IRQ_HANDLER(WRITELINE(ide_pci_device, ide_interrupt)) + //MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE(":maincpu", AS_PROGRAM) + MCFG_BUS_MASTER_IDE_CONTROLLER_SPACE(":pci:00.0", AS_DATA) +MACHINE_CONFIG_END + +machine_config_constructor ide_pci_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(pci_ide); +} + +void ide_pci_device::set_irq_info(const char *tag, const int irq_num) +{ + m_cpu_tag = tag; + m_irq_num = irq_num; +} + +void ide_pci_device::device_start() +{ + m_cpu = machine().device<cpu_device>(m_cpu_tag); + + pci_device::device_start(); + + add_map(8, M_IO, FUNC(ide_pci_device::chan1_data_command_map)); + bank_infos[0].adr = 0x1f0; + add_map(4, M_IO, FUNC(ide_pci_device::chan1_control_map)); + bank_infos[1].adr = 0x3f4; + add_map(8, M_IO, FUNC(ide_pci_device::chan2_data_command_map)); + bank_infos[2].adr = 0x170; + add_map(4, M_IO, FUNC(ide_pci_device::chan2_control_map)); + bank_infos[3].adr = 0x374; + add_map(16, M_IO, FUNC(ide_pci_device::bus_master_map)); + bank_infos[4].adr = 0xf00; +} + +void ide_pci_device::device_reset() +{ + pci_device::device_reset(); +} + +READ32_MEMBER(ide_pci_device::ide_read_cs1) +{ + // PCI offset starts at 0x3f4, idectrl expects 0x3f0 + UINT32 data = 0; + data = m_ide->read_cs1(space, ++offset, mem_mask); + return data; +} + +WRITE32_MEMBER(ide_pci_device::ide_write_cs1) +{ + // PCI offset starts at 0x3f4, idectrl expects 0x3f0 + m_ide->write_cs1(space, ++offset, data, mem_mask); +} + +READ32_MEMBER(ide_pci_device::ide2_read_cs1) +{ + // PCI offset starts at 0x374, idectrl expects 0x370 + UINT32 data = 0; + data = m_ide2->read_cs1(space, ++offset, mem_mask); + return data; +} + +WRITE32_MEMBER(ide_pci_device::ide2_write_cs1) +{ + // PCI offset starts at 0x374, idectrl expects 0x370 + m_ide2->write_cs1(space, ++offset, data, mem_mask); +} + +WRITE_LINE_MEMBER(ide_pci_device::ide_interrupt) +{ + if (m_irq_num != -1) { + m_cpu->set_input_line(m_irq_num, state); + } + if (0) + logerror("%s:ide_interrupt %i set to %i\n", machine().describe_context(), m_irq_num, state); +} + +READ32_MEMBER(ide_pci_device::pcictrl_r) +{ + return m_config_data[offset]; +} + +WRITE32_MEMBER(ide_pci_device::pcictrl_w) +{ + COMBINE_DATA(&m_config_data[offset]); +} + +WRITE32_MEMBER(ide_pci_device::address_base_w) +{ + if (1) { + // Bits 0 (ide) and 2 (ide2) control if the mapping is legacy or BAR + switch (offset) { + case 0: + if ((pclass & 0x1) == 0) + data = (data & 0xfffff000) | 0x1f0; + break; + case 1: + if ((pclass & 0x1) == 0) + data = (data & 0xfffff000) | 0x3f4; + break; + case 2: + if ((pclass & 0x4) == 0) + data = (data & 0xfffff000) | 0x170; + break; + default: + if ((pclass & 0x4) == 0) + data = (data & 0xfffff000) | 0x374; + } + } + pci_device::address_base_w(space, offset, data); +} diff --git a/src/devices/machine/pci-ide.h b/src/devices/machine/pci-ide.h new file mode 100644 index 00000000000..349173ae590 --- /dev/null +++ b/src/devices/machine/pci-ide.h @@ -0,0 +1,64 @@ +// license:BSD-3-Clause +// copyright-holders:Ted Green +/*************************************************************************** + +pci-ide.h + +Generic PCI IDE controller implementation. +Based on datasheet for National Semiconductor PC87415 + +TODO: + Add pci configuration write to PIF byte +***************************************************************************/ + +#ifndef PCI_IDE_H +#define PCI_IDE_H + +#include "pci.h" +#include "idectrl.h" + +#define MCFG_IDE_PCI_ADD(_tag, _main_id, _revision, _subdevice_id) \ + MCFG_PCI_DEVICE_ADD(_tag, IDE_PCI, _main_id, _revision, 0x01018a, _subdevice_id) + +#define MCFG_IDE_PCI_IRQ_ADD(_cpu_tag, _irq_num) \ + downcast<ide_pci_device *>(device)->set_irq_info(_cpu_tag, _irq_num); + +class ide_pci_device : public pci_device { +public: + ide_pci_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + required_device<bus_master_ide_controller_device> m_ide; + required_device<bus_master_ide_controller_device> m_ide2; + virtual DECLARE_ADDRESS_MAP(config_map, 32) override; + DECLARE_WRITE_LINE_MEMBER(ide_interrupt); + DECLARE_READ32_MEMBER(ide_read_cs1); + DECLARE_WRITE32_MEMBER(ide_write_cs1); + DECLARE_READ32_MEMBER(ide2_read_cs1); + DECLARE_WRITE32_MEMBER(ide2_write_cs1); + void set_irq_info(const char *tag, const int irq_num); + +protected: + virtual void device_start() override; + virtual void device_reset() override; + + // optional information overrides + virtual machine_config_constructor device_mconfig_additions() const override; + +private: + const char *m_cpu_tag; + cpu_device *m_cpu; + int m_irq_num; + + UINT32 m_config_data[0x10]; + DECLARE_ADDRESS_MAP(chan1_data_command_map, 32); + DECLARE_ADDRESS_MAP(chan1_control_map, 32); + DECLARE_ADDRESS_MAP(chan2_data_command_map, 32); + DECLARE_ADDRESS_MAP(chan2_control_map, 32); + DECLARE_ADDRESS_MAP(bus_master_map, 32); + DECLARE_READ32_MEMBER(pcictrl_r); + DECLARE_WRITE32_MEMBER(pcictrl_w); + DECLARE_WRITE32_MEMBER(address_base_w); +}; + +extern const device_type IDE_PCI; + +#endif diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp index 3c77de769d7..da324f7b160 100644 --- a/src/devices/video/voodoo.cpp +++ b/src/devices/video/voodoo.cpp @@ -3671,9 +3671,12 @@ WRITE32_MEMBER( voodoo_device::voodoo_w ) return; } - /* if this is a non-FIFO command, let it go to the FIFO, but stall until it completes */ - if (!(access & REGISTER_FIFO)) - stall = TRUE; + // if this is non-FIFO command, execute immediately + if (!(access & REGISTER_FIFO)) { + register_w(this, offset, data); + g_profiler.stop(); + return; + } /* track swap buffers */ if ((offset & 0xff) == swapbufferCMD) @@ -4221,7 +4224,7 @@ READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) */ result = 0x00; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x3c0+offset); break; /* Sequencer access */ @@ -4237,14 +4240,14 @@ READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) result = banshee.vga[0x3da & 0x1f]; banshee.attff = 0; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x3c0+offset); break; /* Miscellaneous output */ case 0x3cc: result = banshee.vga[0x3c2 & 0x1f]; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x3c0+offset); break; /* Graphics controller access */ @@ -4276,13 +4279,13 @@ READ8_MEMBER( voodoo_banshee_device::banshee_vga_r ) */ result = 0x04; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x3c0+offset); break; default: result = banshee.vga[offset]; if (LOG_REGISTERS) - logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x300+offset); + logerror("%s:banshee_vga_r(%X)\n", machine().describe_context(), 0x3c0+offset); break; } return result; @@ -4897,6 +4900,8 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_io_w ) banshee_vga_w(space, offset*4+2, data >> 16, mem_mask >> 16); if (ACCESSING_BITS_24_31) banshee_vga_w(space, offset*4+3, data >> 24, mem_mask >> 24); + if (LOG_REGISTERS) + logerror("%s:banshee_io_w(%s) = %08X & %08X\n", machine().describe_context(), banshee_io_reg_name[offset], data, mem_mask); break; default: diff --git a/src/devices/video/voodoo.h b/src/devices/video/voodoo.h index 6a0625db490..9fc41b6b533 100644 --- a/src/devices/video/voodoo.h +++ b/src/devices/video/voodoo.h @@ -1918,14 +1918,14 @@ public: DECLARE_READ32_MEMBER( banshee_io_r ); DECLARE_WRITE32_MEMBER( banshee_io_w ); DECLARE_READ32_MEMBER( banshee_rom_r ); + DECLARE_READ8_MEMBER(banshee_vga_r); + DECLARE_WRITE8_MEMBER(banshee_vga_w); protected: // device-level overrides virtual void device_start() override; DECLARE_READ32_MEMBER( banshee_agp_r ); DECLARE_WRITE32_MEMBER( banshee_agp_w ); - DECLARE_READ8_MEMBER( banshee_vga_r ); - DECLARE_WRITE8_MEMBER( banshee_vga_w ); }; extern const device_type VOODOO_BANSHEE; diff --git a/src/devices/video/voodoo_pci.cpp b/src/devices/video/voodoo_pci.cpp index 9d34442f08b..5ca7b700569 100644 --- a/src/devices/video/voodoo_pci.cpp +++ b/src/devices/video/voodoo_pci.cpp @@ -56,17 +56,19 @@ DEVICE_ADDRESS_MAP_START(config_map, 32, voodoo_pci_device) AM_INHERIT_FROM(pci_device::config_map) ADDRESS_MAP_END +// VOODOO_1 & VOODOO_2 map DEVICE_ADDRESS_MAP_START(voodoo_reg_map, 32, voodoo_pci_device) AM_RANGE(0x0, 0x00ffffff) AM_DEVREADWRITE("voodoo", voodoo_device, voodoo_r, voodoo_w) ADDRESS_MAP_END - - +// VOODOO_BANSHEE and VOODOO_3 maps DEVICE_ADDRESS_MAP_START(banshee_reg_map, 32, voodoo_pci_device) AM_RANGE(0x0, 0x01ffffff) AM_DEVREADWRITE("voodoo", voodoo_banshee_device, banshee_r, banshee_w) ADDRESS_MAP_END + DEVICE_ADDRESS_MAP_START(lfb_map, 32, voodoo_pci_device) AM_RANGE(0x0, 0x01ffffff) AM_DEVREADWRITE("voodoo", voodoo_banshee_device, banshee_fb_r, banshee_fb_w) ADDRESS_MAP_END + DEVICE_ADDRESS_MAP_START(io_map, 32, voodoo_pci_device) AM_RANGE(0x000, 0x0ff) AM_DEVREADWRITE("voodoo", voodoo_banshee_device, banshee_io_r, banshee_io_w) ADDRESS_MAP_END @@ -90,27 +92,33 @@ void voodoo_pci_device::device_start() switch (m_type) { //void set_ids(UINT32 main_id, UINT8 revision, UINT32 pclass, UINT32 subsystem_id); case TYPE_VOODOO_1: - set_ids(0x121a0001, 0x02, 0x000000, 0x000000); + set_ids(0x121a0001, 0x02, 0x030000, 0x000000); break; case TYPE_VOODOO_2: - set_ids(0x121a0002, 0x02, 0x040000, 0x000000); + set_ids(0x121a0002, 0x02, 0x038000, 0x000000); break; case TYPE_VOODOO_BANSHEE: - set_ids(0x121a0003, 0x02, 0x000003, 0x000000); + set_ids(0x121a0003, 0x02, 0x030000, 0x000000); break; //case TYPE_VOODOO_3 default: - set_ids(0x121a0005, 0x02, 0x000003, 0x000000); + set_ids(0x121a0005, 0x02, 0x030000, 0x000000); break; } pci_device::device_start(); if (m_type<=TYPE_VOODOO_2) { add_map(16*1024*1024, M_MEM | M_PREF, FUNC(voodoo_pci_device::voodoo_reg_map)); + bank_infos[0].adr = 0xff000000; } else { add_map(32*1024*1024, M_MEM, FUNC(voodoo_pci_device::banshee_reg_map)); add_map(32*1024*1024, M_MEM, FUNC(voodoo_pci_device::lfb_map)); add_map(256, M_IO, FUNC(voodoo_pci_device::io_map)); + bank_infos[0].adr = 0xf8000000; + bank_infos[1].adr = 0xf8000008; + bank_infos[2].adr = 0xfffffff0; } + + save_item(NAME(m_pcictrl_reg)); } void voodoo_pci_device::device_reset() @@ -123,32 +131,14 @@ void voodoo_pci_device::map_extra(UINT64 memory_window_start, UINT64 memory_wind UINT64 io_window_start, UINT64 io_window_end, UINT64 io_offset, address_space *io_space) { logerror("%s: map_extra\n", this->tag()); - // Really awkward way of getting vga address space mapped + // Map VGA legacy access // Should really be dependent on voodoo VGAINIT0 bit 8 and IO base + 0xc3 bit 0 - if (1) { - // io map is on bank_infos[2] - bank_info &bi = bank_infos[2]; - if(bi.adr==-1) - return; - if(UINT32(bi.adr) == UINT32(~(bi.size - 1))) - return; - - UINT64 start; - address_space *space; - if(bi.flags & M_IO) { - space = io_space; - start = bi.adr + io_offset; - } else { - space = memory_space; - start = bi.adr + memory_offset; - } - // The mapping needs to only check high address bits - start = (start & 0xFFFF0000) + 0x300; - UINT64 end = (start & 0xFFFF0000) + 0x3ef; - space->install_device_delegate(start, end, *this, bi.map); - logerror("%s: map %s at %0*x-%0*x\n", this->tag(), bi.map.name(), bi.flags & M_IO ? 4 : 8, UINT32(start), bi.flags & M_IO ? 4 : 8, UINT32(end)); + if (m_type>=TYPE_VOODOO_BANSHEE) { + UINT64 start = io_offset + 0x3b0; + UINT64 end = io_offset + 0x3df; + io_space->install_readwrite_handler(start, end, 0, 0, read32_delegate(FUNC(voodoo_pci_device::vga_r), this), write32_delegate(FUNC(voodoo_pci_device::vga_w), this)); + logerror("%s: map %s at %0*x-%0*x\n", this->tag(), "vga_r/w", 4, UINT32(start), 4, UINT32(end)); } - } UINT32 voodoo_pci_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) @@ -178,3 +168,34 @@ WRITE32_MEMBER (voodoo_pci_device::pcictrl_w) break; } } + +// VGA legacy accesses +READ32_MEMBER(voodoo_pci_device::vga_r) +{ + UINT32 result = 0; + if (ACCESSING_BITS_0_7) + result |= downcast<voodoo_banshee_device *>(m_voodoo.target())->banshee_vga_r(space, offset * 4 + 0 + 0xb0, mem_mask >> 0) << 0; + if (ACCESSING_BITS_8_15) + result |= downcast<voodoo_banshee_device *>(m_voodoo.target())->banshee_vga_r(space, offset * 4 + 1 + 0xb0, mem_mask >> 8) << 8; + if (ACCESSING_BITS_16_23) + result |= downcast<voodoo_banshee_device *>(m_voodoo.target())->banshee_vga_r(space, offset * 4 + 2 + 0xb0, mem_mask >> 16) << 16; + if (ACCESSING_BITS_24_31) + result |= downcast<voodoo_banshee_device *>(m_voodoo.target())->banshee_vga_r(space, offset * 4 + 3 + 0xb0, mem_mask >> 24) << 24; + if (0) + logerror("%06X:voodoo_pci_device vga_r from offset %02X = %08X & %08X\n", space.device().safe_pc(), offset * 4, result, mem_mask); + return result; +} +WRITE32_MEMBER(voodoo_pci_device::vga_w) +{ + if (ACCESSING_BITS_0_7) + downcast<voodoo_banshee_device *>(m_voodoo.target())->banshee_vga_w(space, offset * 4 + 0 + 0xb0, data >> 0, mem_mask >> 0); + if (ACCESSING_BITS_8_15) + downcast<voodoo_banshee_device *>(m_voodoo.target())->banshee_vga_w(space, offset * 4 + 1 + 0xb0, data >> 8, mem_mask >> 8); + if (ACCESSING_BITS_16_23) + downcast<voodoo_banshee_device *>(m_voodoo.target())->banshee_vga_w(space, offset * 4 + 2 + 0xb0, data >> 16, mem_mask >> 16); + if (ACCESSING_BITS_24_31) + downcast<voodoo_banshee_device *>(m_voodoo.target())->banshee_vga_w(space, offset * 4 + 3 + 0xb0, data >> 24, mem_mask >> 24); + + if (0) + logerror("%06X:voodoo_pci_device vga_w to offset %04X = %08X & %08X\n", space.device().safe_pc(), offset * 4, data, mem_mask); +} diff --git a/src/devices/video/voodoo_pci.h b/src/devices/video/voodoo_pci.h index 93621cd0fa6..46660ff71d0 100644 --- a/src/devices/video/voodoo_pci.h +++ b/src/devices/video/voodoo_pci.h @@ -34,8 +34,11 @@ public: void set_fbmem(const int fbmem) {m_fbmem = fbmem;} void set_tmumem(const int tmumem0, const int tmumem1) {m_tmumem0 = tmumem0; m_tmumem1 = tmumem1;} - DECLARE_READ32_MEMBER( pcictrl_r); - DECLARE_WRITE32_MEMBER( pcictrl_w); + DECLARE_READ32_MEMBER(pcictrl_r); + DECLARE_WRITE32_MEMBER(pcictrl_w); + + DECLARE_READ32_MEMBER(vga_r); + DECLARE_WRITE32_MEMBER(vga_w); protected: virtual void device_start() override; diff --git a/src/emu/digfx.h b/src/emu/digfx.h index 510656dc253..2883f71acd0 100644 --- a/src/emu/digfx.h +++ b/src/emu/digfx.h @@ -71,7 +71,8 @@ const gfx_layout name = { width, height, RGN_FRAC(1,1), 8, { GFX_RAW }, { 0 }, { #define STEP1024(START,STEP) STEP512(START,STEP),STEP512((START)+512*(STEP),STEP) #define STEP2048(START,STEP) STEP1024(START,STEP),STEP1024((START)+1024*(STEP),STEP) - +#define STEP2_INV(START,STEP) (START)+(STEP),(START) +#define STEP4_INV(START,STEP) STEP2_INV(START+2*STEP,STEP),STEP2_INV(START,STEP) //************************************************************************** // GRAPHICS INFO MACROS diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp index 649be6d8138..11303c67743 100644 --- a/src/emu/emumem.cpp +++ b/src/emu/emumem.cpp @@ -2460,7 +2460,7 @@ void *address_space::install_ram_generic(offs_t addrstart, offs_t addrend, offs_ // delegate handlers for the space //------------------------------------------------- -UINT8 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_delegate handler, UINT64 unitmask) +void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_delegate handler, UINT64 unitmask) { VPRINTF(("address_space::install_read_handler(%s-%s mask=%s mirror=%s, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -2469,10 +2469,9 @@ UINT8 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, off read().handler_map_range(addrstart, addrend, addrmask, addrmirror, unitmask).set_delegate(handler); generate_memdump(machine()); - return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); } -UINT8 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write8_delegate handler, UINT64 unitmask) +void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write8_delegate handler, UINT64 unitmask) { VPRINTF(("address_space::install_write_handler(%s-%s mask=%s mirror=%s, %s, %s)\n", core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars), @@ -2481,13 +2480,12 @@ UINT8 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, of write().handler_map_range(addrstart, addrend, addrmask, addrmirror, unitmask).set_delegate(handler); generate_memdump(machine()); - return reinterpret_cast<UINT8 *>(find_backing_memory(addrstart, addrend)); } -UINT8 *address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_delegate rhandler, write8_delegate whandler, UINT64 unitmask) +void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_delegate rhandler, write8_delegate whandler, UINT64 unitmask) { install_read_handler(addrstart, addrend, addrmask, addrmirror, rhandler, unitmask); - return install_write_handler(addrstart, addrend, addrmask, addrmirror, whandler, unitmask); + install_write_handler(addrstart, addrend, addrmask, addrmirror, whandler, unitmask); } @@ -2496,24 +2494,22 @@ UINT8 *address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend // delegate handlers for the space //------------------------------------------------- -UINT16 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_delegate handler, UINT64 unitmask) +void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_delegate handler, UINT64 unitmask) { read().handler_map_range(addrstart, addrend, addrmask, addrmirror, unitmask).set_delegate(handler); generate_memdump(machine()); - return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); } -UINT16 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write16_delegate handler, UINT64 unitmask) +void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write16_delegate handler, UINT64 unitmask) { write().handler_map_range(addrstart, addrend, addrmask, addrmirror, unitmask).set_delegate(handler); generate_memdump(machine()); - return reinterpret_cast<UINT16 *>(find_backing_memory(addrstart, addrend)); } -UINT16 *address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_delegate rhandler, write16_delegate whandler, UINT64 unitmask) +void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_delegate rhandler, write16_delegate whandler, UINT64 unitmask) { install_read_handler(addrstart, addrend, addrmask, addrmirror, rhandler, unitmask); - return install_write_handler(addrstart, addrend, addrmask, addrmirror, whandler, unitmask); + install_write_handler(addrstart, addrend, addrmask, addrmirror, whandler, unitmask); } @@ -2522,24 +2518,22 @@ UINT16 *address_space::install_readwrite_handler(offs_t addrstart, offs_t addren // delegate handlers for the space //------------------------------------------------- -UINT32 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_delegate handler, UINT64 unitmask) +void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_delegate handler, UINT64 unitmask) { read().handler_map_range(addrstart, addrend, addrmask, addrmirror, unitmask).set_delegate(handler); generate_memdump(machine()); - return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); } -UINT32 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write32_delegate handler, UINT64 unitmask) +void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write32_delegate handler, UINT64 unitmask) { write().handler_map_range(addrstart, addrend, addrmask, addrmirror, unitmask).set_delegate(handler); generate_memdump(machine()); - return reinterpret_cast<UINT32 *>(find_backing_memory(addrstart, addrend)); } -UINT32 *address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_delegate rhandler, write32_delegate whandler, UINT64 unitmask) +void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_delegate rhandler, write32_delegate whandler, UINT64 unitmask) { install_read_handler(addrstart, addrend, addrmask, addrmirror, rhandler, unitmask); - return install_write_handler(addrstart, addrend, addrmask, addrmirror, whandler, unitmask); + install_write_handler(addrstart, addrend, addrmask, addrmirror, whandler, unitmask); } @@ -2548,24 +2542,22 @@ UINT32 *address_space::install_readwrite_handler(offs_t addrstart, offs_t addren // delegate handlers for the space //------------------------------------------------- -UINT64 *address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate handler, UINT64 unitmask) +void address_space::install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate handler, UINT64 unitmask) { read().handler_map_range(addrstart, addrend, addrmask, addrmirror, unitmask).set_delegate(handler); generate_memdump(machine()); - return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); } -UINT64 *address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write64_delegate handler, UINT64 unitmask) +void address_space::install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write64_delegate handler, UINT64 unitmask) { write().handler_map_range(addrstart, addrend, addrmask, addrmirror, unitmask).set_delegate(handler); generate_memdump(machine()); - return reinterpret_cast<UINT64 *>(find_backing_memory(addrstart, addrend)); } -UINT64 *address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate rhandler, write64_delegate whandler, UINT64 unitmask) +void address_space::install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate rhandler, write64_delegate whandler, UINT64 unitmask) { install_read_handler(addrstart, addrend, addrmask, addrmirror, rhandler, unitmask); - return install_write_handler(addrstart, addrend, addrmask, addrmirror, whandler, unitmask); + install_write_handler(addrstart, addrend, addrmask, addrmirror, whandler, unitmask); } diff --git a/src/emu/emumem.h b/src/emu/emumem.h index ac17925370d..bb667c6737a 100644 --- a/src/emu/emumem.h +++ b/src/emu/emumem.h @@ -379,9 +379,9 @@ public: void install_read_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_read_bank(addrstart, addrend, 0, 0, bank); } void install_write_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_write_bank(addrstart, addrend, 0, 0, bank); } void install_readwrite_bank(offs_t addrstart, offs_t addrend, memory_bank *bank) { install_readwrite_bank(addrstart, addrend, 0, 0, bank); } - void *install_rom(offs_t addrstart, offs_t addrend, void *baseptr = nullptr) { return install_rom(addrstart, addrend, 0, 0, baseptr); } - void *install_writeonly(offs_t addrstart, offs_t addrend, void *baseptr = nullptr) { return install_writeonly(addrstart, addrend, 0, 0, baseptr); } - void *install_ram(offs_t addrstart, offs_t addrend, void *baseptr = nullptr) { return install_ram(addrstart, addrend, 0, 0, baseptr); } + void install_rom(offs_t addrstart, offs_t addrend, void *baseptr = nullptr) { install_rom(addrstart, addrend, 0, 0, baseptr); } + void install_writeonly(offs_t addrstart, offs_t addrend, void *baseptr = nullptr) { install_writeonly(addrstart, addrend, 0, 0, baseptr); } + void install_ram(offs_t addrstart, offs_t addrend, void *baseptr = nullptr) { install_ram(addrstart, addrend, 0, 0, baseptr); } // install ports, banks, RAM (with mirror/mask) void install_read_port(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, const char *rtag) { install_readwrite_port(addrstart, addrend, addrmask, addrmirror, rtag, nullptr); } @@ -393,9 +393,9 @@ public: void install_read_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, bank, nullptr); } void install_write_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, nullptr, bank); } void install_readwrite_bank(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, memory_bank *bank) { install_bank_generic(addrstart, addrend, addrmask, addrmirror, bank, bank); } - void *install_rom(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = nullptr) { return install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_READ, baseptr); } - void *install_writeonly(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = nullptr) { return install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_WRITE, baseptr); } - void *install_ram(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = nullptr) { return install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_READWRITE, baseptr); } + void install_rom(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = nullptr) { install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_READ, baseptr); } + void install_writeonly(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = nullptr) { install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_WRITE, baseptr); } + void install_ram(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, void *baseptr = nullptr) { install_ram_generic(addrstart, addrend, addrmask, addrmirror, ROW_READWRITE, baseptr); } // install device memory maps template <typename T> void install_device(offs_t addrstart, offs_t addrend, T &device, void (T::*map)(address_map &map, device_t &device), int bits = 0, UINT64 unitmask = 0) { @@ -406,36 +406,36 @@ public: void install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_delegate &map, int bits = 0, UINT64 unitmask = 0); // install setoffset handler - void install_setoffset_handler(offs_t addrstart, offs_t addrend, setoffset_delegate sohandler, UINT64 unitmask = 0) { return install_setoffset_handler(addrstart, addrend, 0, 0, sohandler, unitmask); } + void install_setoffset_handler(offs_t addrstart, offs_t addrend, setoffset_delegate sohandler, UINT64 unitmask = 0) { install_setoffset_handler(addrstart, addrend, 0, 0, sohandler, unitmask); } void install_setoffset_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, setoffset_delegate sohandler, UINT64 unitmask = 0); // install new-style delegate handlers (short form) - UINT8 *install_read_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, UINT64 unitmask = 0) { return install_read_handler(addrstart, addrend, 0, 0, rhandler, unitmask); } - UINT8 *install_write_handler(offs_t addrstart, offs_t addrend, write8_delegate whandler, UINT64 unitmask = 0) { return install_write_handler(addrstart, addrend, 0, 0, whandler, unitmask); } - UINT8 *install_readwrite_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, write8_delegate whandler, UINT64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, rhandler, whandler, unitmask); } - UINT16 *install_read_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, UINT64 unitmask = 0) { return install_read_handler(addrstart, addrend, 0, 0, rhandler, unitmask); } - UINT16 *install_write_handler(offs_t addrstart, offs_t addrend, write16_delegate whandler, UINT64 unitmask = 0) { return install_write_handler(addrstart, addrend, 0, 0, whandler, unitmask); } - UINT16 *install_readwrite_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, write16_delegate whandler, UINT64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, rhandler, whandler, unitmask); } - UINT32 *install_read_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, UINT64 unitmask = 0) { return install_read_handler(addrstart, addrend, 0, 0, rhandler, unitmask); } - UINT32 *install_write_handler(offs_t addrstart, offs_t addrend, write32_delegate whandler, UINT64 unitmask = 0) { return install_write_handler(addrstart, addrend, 0, 0, whandler, unitmask); } - UINT32 *install_readwrite_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, write32_delegate whandler, UINT64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, rhandler, whandler, unitmask); } - UINT64 *install_read_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, UINT64 unitmask = 0) { return install_read_handler(addrstart, addrend, 0, 0, rhandler, unitmask); } - UINT64 *install_write_handler(offs_t addrstart, offs_t addrend, write64_delegate whandler, UINT64 unitmask = 0) { return install_write_handler(addrstart, addrend, 0, 0, whandler, unitmask); } - UINT64 *install_readwrite_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, write64_delegate whandler, UINT64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, rhandler, whandler, unitmask); } + void install_read_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, UINT64 unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, rhandler, unitmask); } + void install_write_handler(offs_t addrstart, offs_t addrend, write8_delegate whandler, UINT64 unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, whandler, unitmask); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read8_delegate rhandler, write8_delegate whandler, UINT64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, rhandler, whandler, unitmask); } + void install_read_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, UINT64 unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, rhandler, unitmask); } + void install_write_handler(offs_t addrstart, offs_t addrend, write16_delegate whandler, UINT64 unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, whandler, unitmask); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read16_delegate rhandler, write16_delegate whandler, UINT64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, rhandler, whandler, unitmask); } + void install_read_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, UINT64 unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, rhandler, unitmask); } + void install_write_handler(offs_t addrstart, offs_t addrend, write32_delegate whandler, UINT64 unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, whandler, unitmask); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read32_delegate rhandler, write32_delegate whandler, UINT64 unitmask = 0) { return install_readwrite_handler(addrstart, addrend, 0, 0, rhandler, whandler, unitmask); } + void install_read_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, UINT64 unitmask = 0) { install_read_handler(addrstart, addrend, 0, 0, rhandler, unitmask); } + void install_write_handler(offs_t addrstart, offs_t addrend, write64_delegate whandler, UINT64 unitmask = 0) { install_write_handler(addrstart, addrend, 0, 0, whandler, unitmask); } + void install_readwrite_handler(offs_t addrstart, offs_t addrend, read64_delegate rhandler, write64_delegate whandler, UINT64 unitmask = 0) { install_readwrite_handler(addrstart, addrend, 0, 0, rhandler, whandler, unitmask); } // install new-style delegate handlers (with mirror/mask) - UINT8 *install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_delegate rhandler, UINT64 unitmask = 0); - UINT8 *install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write8_delegate whandler, UINT64 unitmask = 0); - UINT8 *install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_delegate rhandler, write8_delegate whandler, UINT64 unitmask = 0); - UINT16 *install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_delegate rhandler, UINT64 unitmask = 0); - UINT16 *install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write16_delegate whandler, UINT64 unitmask = 0); - UINT16 *install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_delegate rhandler, write16_delegate whandler, UINT64 unitmask = 0); - UINT32 *install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_delegate rhandler, UINT64 unitmask = 0); - UINT32 *install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write32_delegate whandler, UINT64 unitmask = 0); - UINT32 *install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_delegate rhandler, write32_delegate whandler, UINT64 unitmask = 0); - UINT64 *install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate rhandler, UINT64 unitmask = 0); - UINT64 *install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write64_delegate whandler, UINT64 unitmask = 0); - UINT64 *install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate rhandler, write64_delegate whandler, UINT64 unitmask = 0); + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_delegate rhandler, UINT64 unitmask = 0); + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write8_delegate whandler, UINT64 unitmask = 0); + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_delegate rhandler, write8_delegate whandler, UINT64 unitmask = 0); + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_delegate rhandler, UINT64 unitmask = 0); + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write16_delegate whandler, UINT64 unitmask = 0); + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_delegate rhandler, write16_delegate whandler, UINT64 unitmask = 0); + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_delegate rhandler, UINT64 unitmask = 0); + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write32_delegate whandler, UINT64 unitmask = 0); + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_delegate rhandler, write32_delegate whandler, UINT64 unitmask = 0); + void install_read_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate rhandler, UINT64 unitmask = 0); + void install_write_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, write64_delegate whandler, UINT64 unitmask = 0); + void install_readwrite_handler(offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_delegate rhandler, write64_delegate whandler, UINT64 unitmask = 0); // setup void prepare_map(); diff --git a/src/emu/ioport.cpp b/src/emu/ioport.cpp index 5a68a76a0ae..971aa51080f 100644 --- a/src/emu/ioport.cpp +++ b/src/emu/ioport.cpp @@ -96,7 +96,6 @@ #include "xmlfile.h" #include "profiler.h" #include "ui/uimain.h" -#include "uiinput.h" #include "osdepend.h" @@ -1516,7 +1515,7 @@ ioport_field::~ioport_field() //------------------------------------------------- // name - return the field name for a given input -// field +// field (this must never return nullptr) //------------------------------------------------- const char *ioport_field::name() const @@ -1583,22 +1582,28 @@ const input_seq &ioport_field::defseq(input_seq_type seqtype) const ioport_type_class ioport_field::type_class() const { + // inputs associated with specific players ioport_group group = manager().type_group(m_type, m_player); - if (group >= IPG_PLAYER1 && group <= IPG_PLAYER8) + if (group >= IPG_PLAYER1 && group <= IPG_PLAYER10) return INPUT_CLASS_CONTROLLER; + // keys (names derived from character codes) if (m_type == IPT_KEYPAD || m_type == IPT_KEYBOARD) return INPUT_CLASS_KEYBOARD; + // configuration settings (specific names required) if (m_type == IPT_CONFIG) return INPUT_CLASS_CONFIG; + // DIP switches (specific names required) if (m_type == IPT_DIPSWITCH) return INPUT_CLASS_DIPSWITCH; + // miscellaneous non-player inputs (named and user-mappable) if (group == IPG_OTHER || (group == IPG_INVALID && m_name != nullptr)) return INPUT_CLASS_MISC; + // internal inputs (these may be anonymous) return INPUT_CLASS_INTERNAL; } @@ -1843,7 +1848,7 @@ void ioport_field::select_next_setting() // digital field //------------------------------------------------- -void ioport_field::frame_update(ioport_value &result, bool mouse_down) +void ioport_field::frame_update(ioport_value &result) { // skip if not enabled if (!enabled()) @@ -1861,7 +1866,7 @@ void ioport_field::frame_update(ioport_value &result, bool mouse_down) return; // if the state changed, look for switch down/switch up - bool curstate = mouse_down || machine().input().seq_pressed(seq()) || m_digital_value; + bool curstate = m_digital_value || machine().input().seq_pressed(seq()); if (m_live->autofire && !machine().ioport().get_autofire_toggle()) { if (curstate) @@ -1928,7 +1933,7 @@ void ioport_field::frame_update(ioport_value &result, bool mouse_down) curstate = false; // additional logic to restrict digital joysticks - if (curstate && !m_digital_value && !mouse_down && m_live->joystick != nullptr && m_way != 16 && !machine().options().joystick_contradictory()) + if (curstate && !m_digital_value && m_live->joystick != nullptr && m_way != 16 && !machine().options().joystick_contradictory()) { UINT8 mask = (m_way == 4) ? m_live->joystick->current4way() : m_live->joystick->current(); if (!(mask & (1 << m_live->joydir))) @@ -2273,14 +2278,14 @@ void ioport_port::write(ioport_value data, ioport_value mem_mask) // frame_update - once/frame update //------------------------------------------------- -void ioport_port::frame_update(ioport_field *mouse_field) +void ioport_port::frame_update() { // start with 0 values for the digital bits m_live->digital = 0; // now loop back and modify based on the inputs for (ioport_field &field : fields()) - field.frame_update(m_live->digital, &field == mouse_field); + field.frame_update(m_live->digital); // hook for MESS's natural keyboard support manager().natkeyboard().frame_update(*this, m_live->digital); @@ -2372,6 +2377,24 @@ void ioport_port::init_live_state() } +//------------------------------------------------- +// update_defvalue - force an update to the input +// port values based on current conditions +//------------------------------------------------- + +void ioport_port::update_defvalue(bool flush_defaults) +{ + // only clear on the first pass + if (flush_defaults) + m_live->defvalue = 0; + + // recompute the default value for the entire port + for (ioport_field &field : m_fieldlist) + if (field.enabled()) + m_live->defvalue = (m_live->defvalue & ~field.mask()) | (field.live().value & field.mask()); +} + + //************************************************************************** // I/O PORT LIVE STATE @@ -2648,10 +2671,10 @@ const char *ioport_manager::type_name(ioport_type type, UINT8 player) { // if we have a machine, use the live state and quick lookup input_type_entry *entry = m_type_to_entry[type][player]; - if (entry != nullptr) + if (entry != nullptr && entry->name() != nullptr) return entry->name(); - // if we find nothing, return an invalid group + // if we find nothing, return a default string (not a null pointer) return "???"; } @@ -2796,32 +2819,6 @@ bool ioport_manager::crosshair_position(int player, float &x, float &y) //------------------------------------------------- -// update_defaults - force an update to the input -// port values based on current conditions -//------------------------------------------------- - -void ioport_manager::update_defaults() -{ - // two passes to catch conditionals properly - for (int loopnum = 0; loopnum < 2; loopnum++) - { - // loop over all input ports - for (ioport_port &port : m_portlist) - { - // only clear on the first pass - if (loopnum == 0) - port.live().defvalue = 0; - - // first compute the default value for the entire port - for (ioport_field &field : port.fields()) - if (field.enabled()) - port.live().defvalue = (port.live().defvalue & ~field.mask()) | (field.live().value & field.mask()); - } - } -} - - -//------------------------------------------------- // frame_update - core logic for per-frame input // port updating //------------------------------------------------- @@ -2873,31 +2870,16 @@ g_profiler.start(PROFILER_INPUT); joystick.frame_update(); // compute default values for all the ports - update_defaults(); - - // perform mouse hit testing - INT32 mouse_target_x, mouse_target_y; - bool mouse_button; - render_target *mouse_target = machine().ui_input().find_mouse(&mouse_target_x, &mouse_target_y, &mouse_button); - - // if the button is pressed, map the point and determine what was hit - ioport_field *mouse_field = nullptr; - if (mouse_button && mouse_target != nullptr) - { - ioport_port *port = nullptr; - ioport_value mask; - float x, y; - if (mouse_target->map_point_input(mouse_target_x, mouse_target_y, port, mask, x, y)) - { - if (port != nullptr) - mouse_field = port->field(mask); - } - } + // two passes to catch conditionals properly + for (ioport_port &port : m_portlist) + port.update_defvalue(true); + for (ioport_port &port : m_portlist) + port.update_defvalue(false); // loop over all input ports for (ioport_port &port : m_portlist) { - port.frame_update(mouse_field); + port.frame_update(); // handle playback/record playback_port(port); diff --git a/src/emu/ioport.h b/src/emu/ioport.h index 3f6a0185337..808bdd3d580 100644 --- a/src/emu/ioport.h +++ b/src/emu/ioport.h @@ -1117,6 +1117,7 @@ public: ioport_condition &condition() { return m_condition; } ioport_type type() const { return m_type; } UINT8 player() const { return m_player; } + bool digital_value() const { return m_digital_value; } void set_value(ioport_value value); bool unused() const { return ((m_flags & FIELD_FLAG_UNUSED) != 0); } @@ -1171,7 +1172,7 @@ public: void select_next_setting(); void crosshair_position(float &x, float &y, bool &gotx, bool &goty); void init_live_state(analog_field *analog); - void frame_update(ioport_value &result, bool mouse_down); + void frame_update(ioport_value &result); void reduce_mask(ioport_value bits_to_remove) { m_mask &= ~bits_to_remove; } // user-controllable settings for a field @@ -1308,8 +1309,9 @@ public: // other operations ioport_field *field(ioport_value mask) const; void collapse_fields(std::string &errorbuf); - void frame_update(ioport_field *mouse_field); + void frame_update(); void init_live_state(); + void update_defvalue(bool flush_defaults); private: void insert_field(ioport_field &newfield, ioport_value &disallowedbits, std::string &errorbuf); @@ -1516,7 +1518,6 @@ private: ioport_port *port(const char *tag) const { return m_portlist.find(tag); } void exit(); input_seq_type token_to_seq_type(const char *string); - void update_defaults(); void load_config(config_type cfg_type, xml_data_node *parentnode); void load_remap_table(xml_data_node *parentnode); diff --git a/src/emu/machine.cpp b/src/emu/machine.cpp index 80867963a0b..12c127f0e03 100644 --- a/src/emu/machine.cpp +++ b/src/emu/machine.cpp @@ -80,6 +80,7 @@ #include "debug/debugvw.h" #include "image.h" #include "network.h" +#include "ui/uimain.h" #include <time.h> #if defined(EMSCRIPTEN) @@ -202,7 +203,7 @@ void running_machine::start() // allocate a soft_reset timer m_soft_reset_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::soft_reset), this)); - // intialize UI input + // initialize UI input m_ui_input = make_unique_clear<ui_input_manager>(*this); // init the osd layer diff --git a/src/emu/ui/uimain.h b/src/emu/ui/uimain.h index 5f045a9d44c..f17b4eb0cfd 100644 --- a/src/emu/ui/uimain.h +++ b/src/emu/ui/uimain.h @@ -14,58 +14,11 @@ #define __BASIC_UI_H__ #include "emu.h" -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -// special menu item for separators -#define MENU_SEPARATOR_ITEM "---" - - -#define SLIDER_NOCHANGE 0x12345678 - - -typedef INT32(*slider_update)(running_machine &machine, void *arg, int id, std::string *str, INT32 newval); - -struct slider_state -{ - slider_state * next; /* pointer to next slider */ - slider_update update; /* callback */ - void * arg; /* argument */ - INT32 minval; /* minimum value */ - INT32 defval; /* default value */ - INT32 maxval; /* maximum value */ - INT32 incval; /* increment value */ - int id; - char description[1]; /* textual description */ -}; - -// types of menu items (TODO: please expand) -enum class ui_menu_item_type -{ - UNKNOWN, - SLIDER, - SEPARATOR -}; - - /*************************************************************************** TYPE DEFINITIONS ***************************************************************************/ -class ui_menu_item -{ -public: - const char *text; - const char *subtext; - UINT32 flags; - void *ref; - ui_menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*) - - inline bool is_selectable() const; -}; - class ui_manager { public: diff --git a/src/emu/uiinput.cpp b/src/emu/uiinput.cpp index 8d710ebcbfc..9707793b2a3 100644 --- a/src/emu/uiinput.cpp +++ b/src/emu/uiinput.cpp @@ -25,17 +25,18 @@ enum //************************************************************************** -// NETWORK MANAGER +// UI INPUT MANAGER //************************************************************************** //------------------------------------------------- -// network_manager - constructor +// ui_input_manager - constructor //------------------------------------------------- ui_input_manager::ui_input_manager(running_machine &machine) : m_machine(machine), m_current_mouse_target(nullptr), m_current_mouse_down(false), + m_current_mouse_field(nullptr), m_events_start(0), m_events_end(0) { @@ -68,6 +69,22 @@ void ui_input_manager::frame_update() if (!pressed || m_seqpressed[code] != SEQ_PRESSED_RESET) m_seqpressed[code] = pressed; } + + // perform mouse hit testing + ioport_field *mouse_field = m_current_mouse_down ? find_mouse_field() : nullptr; + if (m_current_mouse_field != mouse_field) + { + // clear the old field if there was one + if (m_current_mouse_field != nullptr) + m_current_mouse_field->set_value(0); + + // set the new field if it exists and isn't already being pressed + if (mouse_field != nullptr && !mouse_field->digital_value()) + mouse_field->set_value(1); + + // update internal state + m_current_mouse_field = mouse_field; + } } @@ -166,7 +183,7 @@ void ui_input_manager::reset() location of the mouse -------------------------------------------------*/ -render_target *ui_input_manager::find_mouse(INT32 *x, INT32 *y, bool *button) +render_target *ui_input_manager::find_mouse(INT32 *x, INT32 *y, bool *button) const { if (x != nullptr) *x = m_current_mouse_x; @@ -178,6 +195,29 @@ render_target *ui_input_manager::find_mouse(INT32 *x, INT32 *y, bool *button) } +/*------------------------------------------------- + find_mouse_field - retrieves the input field + the mouse is currently pointing at +-------------------------------------------------*/ + +ioport_field *ui_input_manager::find_mouse_field() const +{ + // map the point and determine what was hit + if (m_current_mouse_target != nullptr) + { + ioport_port *port = nullptr; + ioport_value mask; + float x, y; + if (m_current_mouse_target->map_point_input(m_current_mouse_x, m_current_mouse_y, port, mask, x, y)) + { + if (port != nullptr) + return port->field(mask); + } + } + return nullptr; +} + + /*************************************************************************** USER INTERFACE SEQUENCE READING diff --git a/src/emu/uiinput.h b/src/emu/uiinput.h index 2bd715e01aa..e1752f64b19 100644 --- a/src/emu/uiinput.h +++ b/src/emu/uiinput.h @@ -12,8 +12,6 @@ #ifndef __UIINPUT_H__ #define __UIINPUT_H__ -#include "render.h" - /*************************************************************************** CONSTANTS @@ -25,6 +23,8 @@ TYPE DEFINITIONS ***************************************************************************/ +class render_target; + enum ui_event_type { UI_EVENT_NONE, @@ -71,7 +71,8 @@ public: void reset(); /* retrieves the current location of the mouse */ - render_target *find_mouse(INT32 *x, INT32 *y, bool *button); + render_target *find_mouse(INT32 *x, INT32 *y, bool *button) const; + ioport_field *find_mouse_field() const; /* return TRUE if a key down for the given user interface sequence is detected */ bool pressed(int code); @@ -110,6 +111,7 @@ private: INT32 m_current_mouse_x; INT32 m_current_mouse_y; bool m_current_mouse_down; + ioport_field * m_current_mouse_field; /* popped states; ring buffer of ui_events */ ui_event m_events[EVENT_QUEUE_SIZE]; diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index 91f218b9470..f31cd20a8cd 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -872,14 +872,22 @@ void validity_checker::validate_inputs() // verify dip switches if (field.type() == IPT_DIPSWITCH) { - // dip switch fields must have a name - if (field.name() == nullptr) - osd_printf_error("DIP switch has a nullptr name\n"); + // dip switch fields must have a specific name + if (field.specific_name() == nullptr) + osd_printf_error("DIP switch has no specific name\n"); // verify the settings list validate_dip_settings(field); } + // verify config settings + if (field.type() == IPT_CONFIG) + { + // config fields must have a specific name + if (field.specific_name() == nullptr) + osd_printf_error("Config switch has no specific name\n"); + } + // verify names const char *name = field.specific_name(); if (name != nullptr) diff --git a/src/frontend/mame/luaengine.cpp b/src/frontend/mame/luaengine.cpp index 8a4c702b2a5..209795a53d9 100644 --- a/src/frontend/mame/luaengine.cpp +++ b/src/frontend/mame/luaengine.cpp @@ -664,7 +664,7 @@ luabridge::LuaRef lua_engine::l_ioports_port_get_fields(const ioport_port *i) luabridge::LuaRef f_table = luabridge::LuaRef::newTable(L); for (ioport_field &field : p->fields()) { - if(field.name()) + if (field.type_class() != INPUT_CLASS_INTERNAL) f_table[field.name()] = &field; } @@ -1985,7 +1985,7 @@ void lua_engine::update_machine() { for (ioport_field &field : port.fields()) { - if (field.name()) + if (field.type_class() != INPUT_CLASS_INTERNAL) { push(m_lua_state, &field, tname_ioport); lua_setfield(m_lua_state, -2, field.name()); @@ -2214,7 +2214,7 @@ void lua_engine::initialize() .addProperty ("sensitivity", &ioport_field::sensitivity) .addProperty ("way", &ioport_field::way) .addProperty ("is_analog", &ioport_field::is_analog) - .addProperty ("is_digitial_joystick", &ioport_field::is_digital_joystick) + .addProperty ("is_digital_joystick", &ioport_field::is_digital_joystick) .addProperty ("enabled", &ioport_field::enabled) .addProperty ("unused", &ioport_field::unused) .addProperty ("cocktail", &ioport_field::cocktail) diff --git a/src/frontend/mame/ui/cheatopt.cpp b/src/frontend/mame/ui/cheatopt.cpp index ae6a4e9c508..87b748fb3cc 100644 --- a/src/frontend/mame/ui/cheatopt.cpp +++ b/src/frontend/mame/ui/cheatopt.cpp @@ -263,7 +263,7 @@ void ui_menu_autofire::populate() bool is_first_button = true; for (ioport_field &field : port.fields()) { - if ((field.name()) && ((field.type() >= IPT_BUTTON1 && field.type() <= IPT_BUTTON16))) // IPT_BUTTON1 + 15))) + if (field.type() >= IPT_BUTTON1 && field.type() <= IPT_BUTTON16) { menu_items++; ioport_field::user_settings settings; diff --git a/src/frontend/mame/ui/inputmap.cpp b/src/frontend/mame/ui/inputmap.cpp index 919b21b4063..ed0778d9b29 100644 --- a/src/frontend/mame/ui/inputmap.cpp +++ b/src/frontend/mame/ui/inputmap.cpp @@ -167,20 +167,19 @@ void ui_menu_input_specific::populate() port_count++; for (ioport_field &field : port.fields()) { - const char *name = field.name(); + ioport_type_class type_class = field.type_class(); /* add if we match the group and we have a valid name */ - if (name != nullptr && field.enabled() && - ((field.type() == IPT_OTHER && field.name() != nullptr) || machine().ioport().type_group(field.type(), field.player()) != IPG_INVALID)) + if (field.enabled() && (type_class == INPUT_CLASS_CONTROLLER || type_class == INPUT_CLASS_MISC)) { input_seq_type seqtype; UINT32 sortorder; /* determine the sorting order */ - if (field.type() >= IPT_START1 && field.type() < IPT_ANALOG_LAST) + if (type_class == INPUT_CLASS_CONTROLLER) { sortorder = (field.type() << 2) | (field.player() << 12); - if (strcmp(field.device().tag(), ":")) + if (field.device().owner() != nullptr) sortorder |= (port_count & 0xfff) * 0x10000; } else @@ -200,7 +199,7 @@ void ui_menu_input_specific::populate() item->defseq = &field.defseq(seqtype); item->sortorder = sortorder + suborder[seqtype]; item->type = field.is_analog() ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL; - item->name = name; + item->name = field.name(); item->owner_name = field.device().tag(); item->next = itemlist; itemlist = item; diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index 041a409a2a6..c7638925cb0 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -16,7 +16,7 @@ #include "render.h" #include "language.h" #include "ui/ui.h" - +#include "ui/menuitem.h" /*************************************************************************** CONSTANTS diff --git a/src/frontend/mame/ui/menuitem.h b/src/frontend/mame/ui/menuitem.h new file mode 100644 index 00000000000..92ceab86628 --- /dev/null +++ b/src/frontend/mame/ui/menuitem.h @@ -0,0 +1,42 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods + +/*************************************************************************** + + ui/menuitem.h + + Internal data representation for a UI menu item. + +***************************************************************************/ + +#pragma once + +#ifndef __UI_MENUITEM__ +#define __UI_MENUITEM__ + +#include "emu.h" + +// special menu item for separators +#define MENU_SEPARATOR_ITEM "---" + +// types of menu items (TODO: please expand) +enum class ui_menu_item_type +{ + UNKNOWN, + SLIDER, + SEPARATOR +}; + +class ui_menu_item +{ +public: + const char *text; + const char *subtext; + UINT32 flags; + void *ref; + ui_menu_item_type type; // item type (eventually will go away when itemref is proper ui_menu_item class rather than void*) + + inline bool is_selectable() const; +}; + +#endif // __UI_MENUITEM__
\ No newline at end of file diff --git a/src/frontend/mame/ui/slider.h b/src/frontend/mame/ui/slider.h new file mode 100644 index 00000000000..ef3622a0ee5 --- /dev/null +++ b/src/frontend/mame/ui/slider.h @@ -0,0 +1,36 @@ +// license:BSD-3-Clause +// copyright-holders:Nicola Salmoria, Aaron Giles, Nathan Woods + +/*************************************************************************** + + ui/slider.h + + Internal data representation for an adjustment slider. + +***************************************************************************/ + +#pragma once + +#ifndef __UI_SLIDER__ +#define __UI_SLIDER__ + +#include "emu.h" + +#define SLIDER_NOCHANGE 0x12345678 + +typedef INT32(*slider_update)(running_machine &machine, void *arg, int id, std::string *str, INT32 newval); + +struct slider_state +{ + slider_state * next; /* pointer to next slider */ + slider_update update; /* callback */ + void * arg; /* argument */ + INT32 minval; /* minimum value */ + INT32 defval; /* default value */ + INT32 maxval; /* maximum value */ + INT32 incval; /* increment value */ + int id; + char description[1]; /* textual description */ +}; + +#endif // __UI_SLIDER__
\ No newline at end of file diff --git a/src/frontend/mame/ui/sliders.cpp b/src/frontend/mame/ui/sliders.cpp index c466e5aced0..54121bcc400 100644 --- a/src/frontend/mame/ui/sliders.cpp +++ b/src/frontend/mame/ui/sliders.cpp @@ -14,7 +14,7 @@ #include "ui/ui.h" #include "ui/menu.h" #include "ui/sliders.h" - +#include "ui/slider.h" ui_menu_sliders::ui_menu_sliders(mame_ui_manager &mui, render_container *container, bool menuless_mode) : ui_menu(mui, container) { diff --git a/src/frontend/mame/ui/submenu.cpp b/src/frontend/mame/ui/submenu.cpp index 2537ef55a2d..c70d56b0f2c 100644 --- a/src/frontend/mame/ui/submenu.cpp +++ b/src/frontend/mame/ui/submenu.cpp @@ -12,6 +12,7 @@ #include "ui/ui.h" #include "ui/submenu.h" #include "ui/utils.h" +#include "ui/menuitem.h" #include <limits> //------------------------------------------------- diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index fa7ad9daa53..05ba0138210 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -2815,5 +2815,5 @@ void mame_ui_manager::save_main_option() void mame_ui_manager::menu_reset() { - ui_menu::stack_reset(machine()); + ui_menu::stack_reset(machine()); }
\ No newline at end of file diff --git a/src/frontend/mame/ui/ui.h b/src/frontend/mame/ui/ui.h index b59c36671ac..1005b50318e 100644 --- a/src/frontend/mame/ui/ui.h +++ b/src/frontend/mame/ui/ui.h @@ -19,6 +19,8 @@ #include "moptions.h" #include "language.h" #include "ui/uimain.h" +#include "ui/menuitem.h" +#include "ui/slider.h" class ui_menu_item; @@ -171,7 +173,7 @@ public: virtual void popup_time_string(int seconds, std::string message) override; virtual void image_display(const device_type &type, device_image_interface *image) override; - + virtual void menu_reset() override; private: // instance variables diff --git a/src/lib/formats/flopimg.cpp b/src/lib/formats/flopimg.cpp index f8cf7c83780..515ce23c308 100644 --- a/src/lib/formats/flopimg.cpp +++ b/src/lib/formats/flopimg.cpp @@ -1051,7 +1051,7 @@ bool floppy_image_format_t::extension_matches(const char *file_name) const if(rlen == elen && !memcmp(ext, rext, rlen)) return true; if(next_ext) - next_ext = next_ext +1; + rext = next_ext +1; else break; } diff --git a/src/lib/netlist/nl_base.h b/src/lib/netlist/nl_base.h index 208fd966848..4db0fc8142f 100644 --- a/src/lib/netlist/nl_base.h +++ b/src/lib/netlist/nl_base.h @@ -188,12 +188,12 @@ class NETLIB_NAME(_name) : public device_t #define NETLIB_CONSTRUCTOR_DERIVED(_name, _pclass) \ private: family_setter_t m_famsetter; \ - public: template <class _C> ATTR_COLD NETLIB_NAME(_name)(_C &owner, const pstring name) \ + public: template <class _CLASS> ATTR_COLD NETLIB_NAME(_name)(_CLASS &owner, const pstring name) \ : NETLIB_NAME(_pclass)(owner, name) #define NETLIB_CONSTRUCTOR(_name) \ private: family_setter_t m_famsetter; \ - public: template <class _C> ATTR_COLD NETLIB_NAME(_name)(_C &owner, const pstring name) \ + public: template <class _CLASS> ATTR_COLD NETLIB_NAME(_name)(_CLASS &owner, const pstring name) \ : device_t(owner, name) #define NETLIB_DYNAMIC() \ diff --git a/src/mame/audio/cage.cpp b/src/mame/audio/cage.cpp index 62387ef1e0d..5a9818652b6 100644 --- a/src/mame/audio/cage.cpp +++ b/src/mame/audio/cage.cpp @@ -114,12 +114,16 @@ const device_type ATARI_CAGE = &device_creator<atari_cage_device>; atari_cage_device::atari_cage_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, ATARI_CAGE, "Atari CAGE", tag, owner, clock, "atari_cage", __FILE__), + m_cageram(*this, "cageram"), + m_soundlatch(*this, "soundlatch"), m_irqhandler(*this) { } atari_cage_device::atari_cage_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) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), + m_cageram(*this, "cageram"), + m_soundlatch(*this, "soundlatch"), m_irqhandler(*this) { } @@ -147,8 +151,10 @@ void atari_cage_device::device_start() m_timer[0] = subdevice<timer_device>("cage_timer0"); m_timer[1] = subdevice<timer_device>("cage_timer1"); - if (m_speedup) - m_speedup_ram = m_cpu->space(AS_PROGRAM).install_write_handler(m_speedup, m_speedup, write32_delegate(FUNC(atari_cage_device::speedup_w),this)); + if (m_speedup) { + m_cpu->space(AS_PROGRAM).install_write_handler(m_speedup, m_speedup, write32_delegate(FUNC(atari_cage_device::speedup_w),this)); + m_speedup_ram = m_cageram + m_speedup; + } for (chan = 0; chan < DAC_BUFFER_CHANNELS; chan++) { @@ -476,8 +482,7 @@ WRITE32_MEMBER( atari_cage_device::cage_to_main_w ) { if (LOG_COMM) logerror("%06X:Data from CAGE = %04X\n", space.device().safe_pc(), data); - driver_device *drvstate = space.machine().driver_data<driver_device>(); - drvstate->soundlatch_word_w(space, 0, data, mem_mask); + m_soundlatch->write(space, 0, data, mem_mask); m_cage_to_cpu_ready = 1; update_control_lines(); } @@ -498,10 +503,10 @@ UINT16 atari_cage_device::main_r() { driver_device *drvstate = machine().driver_data<driver_device>(); if (LOG_COMM) - logerror("%s:main read data = %04X\n", machine().describe_context(), drvstate->soundlatch_word_r(drvstate->generic_space(), 0, 0)); + logerror("%s:main read data = %04X\n", machine().describe_context(), m_soundlatch->read(drvstate->generic_space(), 0, 0)); m_cage_to_cpu_ready = 0; update_control_lines(); - return drvstate->soundlatch_word_r(drvstate->generic_space(), 0, 0xffff); + return m_soundlatch->read(drvstate->generic_space(), 0, 0xffff); } @@ -594,7 +599,7 @@ WRITE32_MEMBER( atari_cage_device::speedup_w ) *************************************/ static ADDRESS_MAP_START( cage_map, AS_PROGRAM, 32, atari_cage_device ) - AM_RANGE(0x000000, 0x00ffff) AM_RAM + AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_SHARE("cageram") AM_RANGE(0x200000, 0x200000) AM_WRITENOP AM_RANGE(0x400000, 0x47ffff) AM_ROMBANK("bank10") AM_RANGE(0x808000, 0x8080ff) AM_READWRITE(tms32031_io_r, tms32031_io_w) @@ -605,7 +610,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( cage_map_seattle, AS_PROGRAM, 32, atari_cage_seattle_device ) - AM_RANGE(0x000000, 0x00ffff) AM_RAM + AM_RANGE(0x000000, 0x00ffff) AM_RAM AM_SHARE("cageram") AM_RANGE(0x200000, 0x200000) AM_WRITENOP AM_RANGE(0x400000, 0x47ffff) AM_ROMBANK("bank10") AM_RANGE(0x808000, 0x8080ff) AM_READWRITE(tms32031_io_r, tms32031_io_w) @@ -638,6 +643,8 @@ MACHINE_CONFIG_FRAGMENT( cage ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_16_ADD("soundlatch") + #if (DAC_BUFFER_CHANNELS == 4) MCFG_SOUND_ADD("dac1", DMADAC, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.50) diff --git a/src/mame/audio/cage.h b/src/mame/audio/cage.h index ffa43f3522b..16ca29b74cb 100644 --- a/src/mame/audio/cage.h +++ b/src/mame/audio/cage.h @@ -9,6 +9,7 @@ #ifndef __ATARI_CAGE__ #define __ATARI_CAGE__ +#include "machine/gen_latch.h" #include "sound/dmadac.h" #define CAGE_IRQ_REASON_DATA_READY (1) @@ -61,7 +62,9 @@ protected: virtual void device_start() override; private: + required_shared_ptr<UINT32> m_cageram; cpu_device *m_cpu; + required_device<generic_latch_16_device> m_soundlatch; attotime m_cpu_h1_clock_period; UINT8 m_cpu_to_cage_ready; diff --git a/src/mame/audio/dcs.cpp b/src/mame/audio/dcs.cpp index 8cd81f12f44..92ff46c2018 100644 --- a/src/mame/audio/dcs.cpp +++ b/src/mame/audio/dcs.cpp @@ -289,7 +289,7 @@ static ADDRESS_MAP_START( dcs_2k_uart_data_map, AS_DATA, 16, dcs_audio_device ) AM_RANGE(0x3400, 0x3402) AM_NOP /* UART (ignored) */ AM_RANGE(0x3403, 0x3403) AM_READWRITE(input_latch_r, output_latch_w) AM_RANGE(0x3404, 0x3405) AM_NOP /* UART (ignored) */ - AM_RANGE(0x3800, 0x39ff) AM_RAM + AM_RANGE(0x3800, 0x39ff) AM_RAM AM_SHARE("iram") AM_RANGE(0x3fe0, 0x3fff) AM_READWRITE(adsp_control_r, adsp_control_w) ADDRESS_MAP_END @@ -307,7 +307,7 @@ static ADDRESS_MAP_START( dcs_8k_data_map, AS_DATA, 16, dcs_audio_device ) AM_RANGE(0x2000, 0x2fff) AM_ROMBANK("databank") AM_RANGE(0x3000, 0x3000) AM_WRITE(dcs_data_bank_select_w) AM_RANGE(0x3400, 0x3403) AM_READWRITE(input_latch_r, output_latch_w) // mk3 etc. need this - AM_RANGE(0x3800, 0x39ff) AM_RAM + AM_RANGE(0x3800, 0x39ff) AM_RAM AM_SHARE("iram") AM_RANGE(0x3fe0, 0x3fff) AM_READWRITE(adsp_control_r, adsp_control_w) ADDRESS_MAP_END @@ -323,7 +323,7 @@ static ADDRESS_MAP_START( dcs_wpc_data_map, AS_DATA, 16, dcs_audio_wpc_device ) AM_RANGE(0x3000, 0x3000) AM_WRITE(dcs_data_bank_select_w) AM_RANGE(0x3100, 0x3100) AM_WRITE(dcs_data_bank_select2_w) AM_RANGE(0x3300, 0x3303) AM_READWRITE(input_latch_r, output_latch_w) - AM_RANGE(0x3800, 0x39ff) AM_RAM + AM_RANGE(0x3800, 0x39ff) AM_RAM AM_SHARE("iram") AM_RANGE(0x3fe0, 0x3fff) AM_READWRITE(adsp_control_r, adsp_control_w) ADDRESS_MAP_END @@ -352,7 +352,7 @@ static ADDRESS_MAP_START( dcs2_2115_data_map, AS_DATA, 16, dcs_audio_device ) AM_RANGE(0x0403, 0x0403) AM_READ(latch_status_r) AM_RANGE(0x0404, 0x0407) AM_READ(fifo_input_r) AM_RANGE(0x0480, 0x0483) AM_READWRITE(sdrc_r, sdrc_w) - AM_RANGE(0x3800, 0x39ff) AM_RAM + AM_RANGE(0x3800, 0x39ff) AM_RAM AM_SHARE("iram") AM_RANGE(0x3fe0, 0x3fff) AM_READWRITE(adsp_control_r, adsp_control_w) ADDRESS_MAP_END @@ -364,7 +364,7 @@ static ADDRESS_MAP_START( dcs2_2104_data_map, AS_DATA, 16, dcs_audio_device ) AM_RANGE(0x0403, 0x0403) AM_READ(latch_status_r) AM_RANGE(0x0404, 0x0407) AM_READ(fifo_input_r) AM_RANGE(0x0480, 0x0483) AM_READWRITE(sdrc_r, sdrc_w) - AM_RANGE(0x3800, 0x38ff) AM_RAM + AM_RANGE(0x3800, 0x38ff) AM_RAM AM_SHARE("iram") AM_RANGE(0x3fe0, 0x3fff) AM_READWRITE(adsp_control_r, adsp_control_w) ADDRESS_MAP_END @@ -836,7 +836,8 @@ dcs_audio_device::dcs_audio_device(const machine_config &mconfig, device_type ty m_polling_base(nullptr), m_internal_program_ram(nullptr), m_external_program_ram(nullptr), - m_dram_in_mb(0) + m_dram_in_mb(0), + m_iram(*this, "iram") { m_dmadac[0] = m_dmadac[1] = m_dmadac[2] = m_dmadac[3] = m_dmadac[4] = m_dmadac[5] = nullptr; memset(m_control_regs, 0, sizeof(m_control_regs)); @@ -982,9 +983,10 @@ void dcs2_audio_device::device_start() m_auto_ack = FALSE; /* install the speedup handler */ - if (m_polling_offset) - m_polling_base = m_cpu->space(AS_DATA).install_readwrite_handler(m_polling_offset, m_polling_offset, read16_delegate(FUNC(dcs_audio_device::dcs_polling_r),this), write16_delegate(FUNC(dcs_audio_device::dcs_polling_w),this)); - + if (m_polling_offset) { + m_cpu->space(AS_DATA).install_readwrite_handler(m_polling_offset, m_polling_offset, read16_delegate(FUNC(dcs_audio_device::dcs_polling_r),this), write16_delegate(FUNC(dcs_audio_device::dcs_polling_w),this)); + m_polling_base = m_iram + (m_polling_offset - 0x3800); + } /* allocate a watchdog timer for HLE transfers */ m_transfer.hle_enabled = (ENABLE_HLE_TRANSFERS && m_dram_in_mb != 0); if (m_transfer.hle_enabled) @@ -1142,7 +1144,7 @@ void dcs_audio_device::sdrc_remap_memory() /* reinstall the polling hotspot */ if (m_polling_offset) - m_polling_base = m_cpu->space(AS_DATA).install_readwrite_handler(m_polling_offset, m_polling_offset, read16_delegate(FUNC(dcs_audio_device::dcs_polling_r),this), write16_delegate(FUNC(dcs_audio_device::dcs_polling_w),this)); + m_cpu->space(AS_DATA).install_readwrite_handler(m_polling_offset, m_polling_offset, read16_delegate(FUNC(dcs_audio_device::dcs_polling_r),this), write16_delegate(FUNC(dcs_audio_device::dcs_polling_w),this)); } diff --git a/src/mame/audio/dcs.h b/src/mame/audio/dcs.h index dd7eca582b6..3d30e946604 100644 --- a/src/mame/audio/dcs.h +++ b/src/mame/audio/dcs.h @@ -207,6 +207,8 @@ protected: hle_transfer_state m_transfer; int m_dram_in_mb; + + optional_shared_ptr<UINT16> m_iram; }; diff --git a/src/mame/drivers/alpha68k.cpp b/src/mame/drivers/alpha68k.cpp index 72cdad3f1cf..1817a2c4d16 100644 --- a/src/mame/drivers/alpha68k.cpp +++ b/src/mame/drivers/alpha68k.cpp @@ -283,20 +283,20 @@ READ16_MEMBER(alpha68k_state::jongbou_inputs_r) WRITE16_MEMBER(alpha68k_state::kyros_sound_w) { if(ACCESSING_BITS_8_15) - soundlatch_byte_w(space, 0, (data >> 8) & 0xff); + m_soundlatch->write(space, 0, (data >> 8) & 0xff); } WRITE16_MEMBER(alpha68k_state::alpha68k_II_sound_w) { if(ACCESSING_BITS_0_7) - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); } WRITE16_MEMBER(alpha68k_state::alpha68k_V_sound_w) { /* Sound & fix bank select are in the same word */ if(ACCESSING_BITS_0_7) - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); if(ACCESSING_BITS_8_15) alpha68k_V_video_bank_w((data >> 8) & 0xff); } @@ -305,7 +305,7 @@ WRITE16_MEMBER(alpha68k_state::paddlema_soundlatch_w) { if (ACCESSING_BITS_0_7) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(0, HOLD_LINE); } } @@ -314,7 +314,7 @@ WRITE16_MEMBER(alpha68k_state::tnextspc_soundlatch_w) { if (ACCESSING_BITS_0_7) { - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } @@ -735,8 +735,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( kyros_sound_map, AS_PROGRAM, 8, alpha68k_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xc7ff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) - AM_RANGE(0xe002, 0xe002) AM_WRITE(soundlatch_clear_byte_w) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) + AM_RANGE(0xe002, 0xe002) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) AM_RANGE(0xe004, 0xe004) AM_DEVWRITE("dac", dac_device, write_signed8) AM_RANGE(0xe006, 0xe00e) AM_WRITENOP // soundboard I/O's, ignored /* reference only @@ -751,8 +751,8 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sstingry_sound_map, AS_PROGRAM, 8, alpha68k_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0xc100, 0xc100) AM_READ(soundlatch_byte_r) - AM_RANGE(0xc102, 0xc102) AM_WRITE(soundlatch_clear_byte_w) + AM_RANGE(0xc100, 0xc100) AM_DEVREAD("soundlatch", generic_latch_8_device, read) + AM_RANGE(0xc102, 0xc102) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) AM_RANGE(0xc104, 0xc104) AM_DEVWRITE("dac", dac_device, write_signed8) AM_RANGE(0xc106, 0xc10e) AM_WRITENOP // soundboard I/O's, ignored ADDRESS_MAP_END @@ -764,7 +764,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( alpha68k_I_s_map, AS_PROGRAM, 8, alpha68k_state ) AM_RANGE(0x0000, 0x9fff) AM_ROM - AM_RANGE(0xe000, 0xe000) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w) + AM_RANGE(0xe000, 0xe000) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, clear_w) AM_RANGE(0xe800, 0xe800) AM_DEVREADWRITE("ymsnd", ym3812_device, status_port_r, control_port_w) AM_RANGE(0xec00, 0xec00) AM_DEVWRITE("ymsnd", ym3812_device, write_port_w) AM_RANGE(0xf000, 0xf7ff) AM_RAM @@ -775,12 +775,12 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( tnextspc_sound_map, AS_PROGRAM, 8, alpha68k_state ) AM_RANGE(0x0000, 0xefff) AM_ROM AM_RANGE(0xf000, 0xf7ff) AM_RAM - AM_RANGE(0xf800, 0xf800) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w) + AM_RANGE(0xf800, 0xf800) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, clear_w) ADDRESS_MAP_END static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, alpha68k_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READWRITE(soundlatch_byte_r, soundlatch_clear_byte_w) + AM_RANGE(0x00, 0x00) AM_DEVREADWRITE("soundlatch", generic_latch_8_device, read, clear_w) AM_RANGE(0x08, 0x08) AM_DEVWRITE("dac", dac_device, write_signed8) AM_RANGE(0x0a, 0x0b) AM_DEVWRITE("ym2", ym2413_device, write) AM_RANGE(0x0c, 0x0d) AM_DEVWRITE("ym1", ym2203_device, write) @@ -800,7 +800,7 @@ static ADDRESS_MAP_START( jongbou_sound_portmap, AS_IO, 8, alpha68k_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_DEVWRITE("aysnd", ay8910_device, address_w) AM_RANGE(0x01, 0x01) AM_DEVREADWRITE("aysnd", ay8910_device, data_r, data_w) - AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_clear_byte_w) + AM_RANGE(0x02, 0x02) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) AM_RANGE(0x06, 0x06) AM_WRITENOP ADDRESS_MAP_END @@ -1829,7 +1829,7 @@ MACHINE_START_MEMBER(alpha68k_state,common) save_item(NAME(m_trigstate)); save_item(NAME(m_deposits1)); save_item(NAME(m_deposits2)); - save_item(NAME(m_credits)); + save_item(NAME(m_credits)); save_item(NAME(m_coinvalue)); save_item(NAME(m_microcontroller_data)); save_item(NAME(m_latch)); @@ -1954,6 +1954,8 @@ static MACHINE_CONFIG_START( sstingry, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM2203, 3000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35) @@ -2003,6 +2005,8 @@ static MACHINE_CONFIG_START( kyros, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM2203, XTAL_24MHz/12) /* Verified on bootleg PCB */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35) @@ -2051,8 +2055,10 @@ static MACHINE_CONFIG_START( jongbou, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8910, 2000000) - MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) + MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.65) MACHINE_CONFIG_END @@ -2088,6 +2094,8 @@ static MACHINE_CONFIG_START( alpha68k_I, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, 4000000) MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) @@ -2132,9 +2140,11 @@ static MACHINE_CONFIG_START( alpha68k_II, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") MCFG_SOUND_ADD("ym1", YM2203, 3000000) - MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) + MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(alpha68k_state, porta_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.65) @@ -2186,8 +2196,10 @@ static MACHINE_CONFIG_START( alpha68k_II_gm, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM2203, 3000000) - MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) + MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(alpha68k_state, porta_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.65) @@ -2232,8 +2244,10 @@ static MACHINE_CONFIG_START( alpha68k_V, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM2203, 3000000) - MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) + MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(alpha68k_state, porta_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.65) @@ -2278,8 +2292,10 @@ static MACHINE_CONFIG_START( alpha68k_V_sb, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM2203, 3000000) - MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) + MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(alpha68k_state, porta_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.65) @@ -2323,6 +2339,8 @@ static MACHINE_CONFIG_START( tnextspc, alpha68k_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ymsnd", YM3812, 4000000) MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/atarig1.cpp b/src/mame/drivers/atarig1.cpp index 9266b819142..9a8d509e712 100644 --- a/src/mame/drivers/atarig1.cpp +++ b/src/mame/drivers/atarig1.cpp @@ -170,7 +170,8 @@ READ16_MEMBER(atarig1_state::pitfightb_cheap_slapstic_r) void atarig1_state::pitfightb_cheap_slapstic_init() { /* install a read handler */ - m_bslapstic_base = m_maincpu->space(AS_PROGRAM).install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),this)); + m_bslapstic_base = (UINT16 *)(memregion("maincpu")->base() + 0x38000); /* allocate memory for a copy of bank 0 */ m_bslapstic_bank0 = std::make_unique<UINT8[]>(0x2000); @@ -1284,7 +1285,7 @@ ROM_END DRIVER_INIT_MEMBER(atarig1_state,hydra) { - slapstic_configure(*m_maincpu, 0x078000, 0); + slapstic_configure(*m_maincpu, 0x078000, 0, memregion("maincpu")->base() + 0x78000); m_is_pitfight = 0; } @@ -1295,7 +1296,7 @@ DRIVER_INIT_MEMBER(atarig1_state,hydrap) DRIVER_INIT_MEMBER(atarig1_state,pitfight) { - slapstic_configure(*m_maincpu, 0x038000, 0); + slapstic_configure(*m_maincpu, 0x038000, 0, memregion("maincpu")->base() + 0x38000); m_is_pitfight = 1; } diff --git a/src/mame/drivers/atarig42.cpp b/src/mame/drivers/atarig42.cpp index 6f474762482..cf260f481bc 100644 --- a/src/mame/drivers/atarig42.cpp +++ b/src/mame/drivers/atarig42.cpp @@ -781,8 +781,9 @@ DRIVER_INIT_MEMBER(atarig42_state,roadriot) m_playfield_base = 0x400; address_space &main = m_maincpu->space(AS_PROGRAM); - m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),this)); + main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),this)); main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this)); + m_sloop_base = (UINT16 *)memregion("maincpu")->base(); /* Road Riot color MUX @@ -816,8 +817,9 @@ DRIVER_INIT_MEMBER(atarig42_state,guardian) *(UINT16 *)&memregion("maincpu")->base()[0x80000] = 0x4E75; address_space &main = m_maincpu->space(AS_PROGRAM); - m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),this)); + main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),this)); main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this)); + m_sloop_base = (UINT16 *)memregion("maincpu")->base(); /* Guardians color MUX diff --git a/src/mame/drivers/atarisy1.cpp b/src/mame/drivers/atarisy1.cpp index 4eddb67d945..6f304e1f1c8 100644 --- a/src/mame/drivers/atarisy1.cpp +++ b/src/mame/drivers/atarisy1.cpp @@ -2430,7 +2430,7 @@ ROM_END DRIVER_INIT_MEMBER(atarisy1_state,marble) { - slapstic_configure(*m_maincpu, 0x080000, 0); + slapstic_configure(*m_maincpu, 0x080000, 0, memregion("maincpu")->base() + 0x80000); m_joystick_type = 0; /* none */ m_trackball_type = 1; /* rotated */ @@ -2439,7 +2439,7 @@ DRIVER_INIT_MEMBER(atarisy1_state,marble) DRIVER_INIT_MEMBER(atarisy1_state,peterpak) { - slapstic_configure(*m_maincpu, 0x080000, 0); + slapstic_configure(*m_maincpu, 0x080000, 0, memregion("maincpu")->base() + 0x80000); m_joystick_type = 1; /* digital */ m_trackball_type = 0; /* none */ @@ -2448,7 +2448,7 @@ DRIVER_INIT_MEMBER(atarisy1_state,peterpak) DRIVER_INIT_MEMBER(atarisy1_state,indytemp) { - slapstic_configure(*m_maincpu, 0x080000, 0); + slapstic_configure(*m_maincpu, 0x080000, 0, memregion("maincpu")->base() + 0x80000); m_joystick_type = 1; /* digital */ m_trackball_type = 0; /* none */ @@ -2457,7 +2457,7 @@ DRIVER_INIT_MEMBER(atarisy1_state,indytemp) DRIVER_INIT_MEMBER(atarisy1_state,roadrunn) { - slapstic_configure(*m_maincpu, 0x080000, 0); + slapstic_configure(*m_maincpu, 0x080000, 0, memregion("maincpu")->base() + 0x80000); m_joystick_type = 2; /* analog */ m_trackball_type = 0; /* none */ @@ -2466,7 +2466,7 @@ DRIVER_INIT_MEMBER(atarisy1_state,roadrunn) DRIVER_INIT_MEMBER(atarisy1_state,roadblst) { - slapstic_configure(*m_maincpu, 0x080000, 0); + slapstic_configure(*m_maincpu, 0x080000, 0, memregion("maincpu")->base() + 0x80000); m_joystick_type = 3; /* pedal */ m_trackball_type = 2; /* steering wheel */ diff --git a/src/mame/drivers/beathead.cpp b/src/mame/drivers/beathead.cpp index d2b815b2ddb..d39b84cd861 100644 --- a/src/mame/drivers/beathead.cpp +++ b/src/mame/drivers/beathead.cpp @@ -468,8 +468,11 @@ READ32_MEMBER( beathead_state::movie_speedup_r ) DRIVER_INIT_MEMBER(beathead_state,beathead) { /* prepare the speedups */ - m_speedup_data = m_maincpu->space(AS_PROGRAM).install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate(FUNC(beathead_state::speedup_r), this)); - m_movie_speedup_data = m_maincpu->space(AS_PROGRAM).install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate(FUNC(beathead_state::movie_speedup_r), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate(FUNC(beathead_state::speedup_r), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate(FUNC(beathead_state::movie_speedup_r), this)); + + m_speedup_data = m_ram_base + 0xae8/4; + m_movie_speedup_data = m_ram_base + 0x804/4; } diff --git a/src/mame/drivers/champbas.cpp b/src/mame/drivers/champbas.cpp index 604562855ad..79f162f9883 100644 --- a/src/mame/drivers/champbas.cpp +++ b/src/mame/drivers/champbas.cpp @@ -80,6 +80,7 @@ TODO: #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "sound/ay8910.h" #include "includes/champbas.h" @@ -205,7 +206,7 @@ static ADDRESS_MAP_START( champbas_map, AS_PROGRAM, 8, champbas_state ) AM_RANGE(0xa007, 0xa007) AM_WRITENOP // no MCU AM_RANGE(0xa060, 0xa06f) AM_WRITEONLY AM_SHARE("spriteram") - AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_byte_w) + AM_RANGE(0xa080, 0xa080) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE(0xa0c0, 0xa0c0) AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) ADDRESS_MAP_END @@ -259,9 +260,9 @@ ADDRESS_MAP_END // champbas/champbb2 (note: talbot doesn't have audiocpu) static ADDRESS_MAP_START( champbas_sound_map, AS_PROGRAM, 8, champbas_state ) AM_RANGE(0x0000, 0x5fff) AM_ROM - AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_READ(soundlatch_byte_r) + AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x1fff) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x1fff) AM_WRITENOP // 4-bit return code to main CPU (not used) - AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1fff) AM_WRITE(soundlatch_clear_byte_w) + AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x1fff) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fff) AM_WRITE(dac1_w) AM_RANGE(0xe000, 0xe3ff) AM_MIRROR(0x1c00) AM_RAM ADDRESS_MAP_END @@ -272,8 +273,8 @@ static ADDRESS_MAP_START( exctsccr_sound_map, AS_PROGRAM, 8, champbas_state ) AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_RANGE(0xc008, 0xc008) AM_WRITE(dac1_w) AM_RANGE(0xc009, 0xc009) AM_WRITE(dac2_w) - AM_RANGE(0xc00c, 0xc00c) AM_WRITE(soundlatch_clear_byte_w) - AM_RANGE(0xc00d, 0xc00d) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc00c, 0xc00c) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) + AM_RANGE(0xc00d, 0xc00d) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // AM_RANGE(0xc00f, 0xc00f) AM_WRITENOP // ? ADDRESS_MAP_END @@ -548,6 +549,9 @@ static MACHINE_CONFIG_START( talbot, champbas_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, XTAL_18_432MHz/12) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) MACHINE_CONFIG_END @@ -583,6 +587,8 @@ static MACHINE_CONFIG_START( champbas, champbas_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, XTAL_18_432MHz/12) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) @@ -653,6 +659,8 @@ static MACHINE_CONFIG_START( exctsccr, champbas_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + /* AY (melody) clock is specified by a VR (0.9 - 3.9 MHz) */ MCFG_SOUND_ADD("ay1", AY8910, 1940000) /* VR has a factory mark and this is the value read */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08) @@ -707,6 +715,8 @@ static MACHINE_CONFIG_START( exctsccrb, champbas_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ay1", AY8910, XTAL_18_432MHz/12) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30) diff --git a/src/mame/drivers/cyberbal.cpp b/src/mame/drivers/cyberbal.cpp index 9b263dace2b..ead47e3d344 100644 --- a/src/mame/drivers/cyberbal.cpp +++ b/src/mame/drivers/cyberbal.cpp @@ -1002,7 +1002,7 @@ ROM_END DRIVER_INIT_MEMBER(cyberbal_state,cyberbalt) { - slapstic_configure(*m_maincpu, 0x018000, 0); + slapstic_configure(*m_maincpu, 0x018000, 0, memregion("maincpu")->base() + 0x18000); } diff --git a/src/mame/drivers/dec8.cpp b/src/mame/drivers/dec8.cpp index 26abe657ca1..b38624a1ce6 100644 --- a/src/mame/drivers/dec8.cpp +++ b/src/mame/drivers/dec8.cpp @@ -2576,12 +2576,13 @@ ROM_START( lastmisnj ) ROM_END ROM_START( shackled ) - ROM_REGION( 0x48000, "maincpu", 0 ) + ROM_REGION( 0x50000, "maincpu", 0 ) ROM_LOAD( "dk-02.13h", 0x08000, 0x08000, CRC(87f8fa85) SHA1(1cb93a60eefdb453a3cc6ec9c5cc2e367fb8aeb0) ) ROM_LOAD( "dk-06.7h", 0x10000, 0x10000, CRC(69ad62d1) SHA1(1aa23b12ab4f1908cddd25f091e1f9bd70a5113c) ) ROM_LOAD( "dk-05.8h", 0x20000, 0x10000, CRC(598dd128) SHA1(10843c5352eef03c8675df6abaf23c9c9c795aa3) ) ROM_LOAD( "dk-04.10h", 0x30000, 0x10000, CRC(36d305d4) SHA1(17586c316aff405cf20c1467d69c98fa2a3c2630) ) ROM_LOAD( "dk-03.11h", 0x40000, 0x08000, CRC(6fd90fd1) SHA1(2f8db17e5545c82d243a7e23e7bda2c2a9101360) ) + ROM_RELOAD( 0x48000, 0x08000 ) ROM_REGION( 0x10000, "sub", 0 ) /* CPU 2, 1st 16k is empty */ ROM_LOAD( "dk-01.18h", 0x00000, 0x10000, CRC(71fe3bda) SHA1(959cce01362b2c670c2e15b03a78a1ff9cea4ee9) ) @@ -2616,12 +2617,13 @@ ROM_START( shackled ) ROM_END ROM_START( breywood ) - ROM_REGION( 0x48000, "maincpu", 0 ) + ROM_REGION( 0x50000, "maincpu", 0 ) ROM_LOAD( "dj02-2.13h", 0x08000, 0x08000, CRC(c19856b9) SHA1(766994703bb59879c311675353d7231ad27c7c16) ) ROM_LOAD( "dj06-2.7h", 0x10000, 0x10000, CRC(2860ea02) SHA1(7ac090c3ae9d71baa6227ec9555f1c9f2d25ea0d) ) ROM_LOAD( "dj05-2.8h", 0x20000, 0x10000, CRC(0fdd915e) SHA1(262df956dfc727c710ade28af7f33fddaafd7ee2) ) ROM_LOAD( "dj04-2.10h", 0x30000, 0x10000, CRC(71036579) SHA1(c58ff3222b5bcd75d58c5f282554e92103e80916) ) ROM_LOAD( "dj03-2.11h", 0x40000, 0x08000, CRC(308f4893) SHA1(539c138ff01c5718cc8a982482b989468d532699) ) + ROM_RELOAD( 0x48000, 0x08000 ) ROM_REGION( 0x10000, "sub", 0 ) /* CPU 2, 1st 16k is empty */ ROM_LOAD( "dj1-2y.18h", 0x0000, 0x10000, CRC(3d9fb623) SHA1(6e5eaad9bb0a432e2da5da5b18a2ed36617bdde2) ) @@ -3534,7 +3536,7 @@ DRIVER_INIT_MEMBER(dec8_state,lastmisn) DRIVER_INIT_MEMBER(dec8_state,shackled) { UINT8 *ROM = memregion("maincpu")->base(); - membank("bank1")->configure_entries(0, 14, &ROM[0x10000], 0x4000); + membank("bank1")->configure_entries(0, 16, &ROM[0x10000], 0x4000); DRIVER_INIT_CALL(dec8); } diff --git a/src/mame/drivers/eprom.cpp b/src/mame/drivers/eprom.cpp index b6bad2adaf2..96a500dc111 100644 --- a/src/mame/drivers/eprom.cpp +++ b/src/mame/drivers/eprom.cpp @@ -53,6 +53,7 @@ MACHINE_RESET_MEMBER(eprom_state,eprom) { atarigen_state::machine_reset(); scanline_timer_reset(*m_screen, 8); + m_sync_data = 0; } @@ -116,18 +117,16 @@ WRITE16_MEMBER(eprom_state::eprom_latch_w) READ16_MEMBER(eprom_state::sync_r) { - return m_sync_data[offset]; + return m_sync_data; } WRITE16_MEMBER(eprom_state::sync_w) { - int oldword = m_sync_data[offset]; - int newword = oldword; - COMBINE_DATA(&newword); + int oldword = m_sync_data; + COMBINE_DATA(&m_sync_data); - m_sync_data[offset] = newword; - if ((oldword & 0xff00) != (newword & 0xff00)) + if ((oldword & 0xff00) != (m_sync_data & 0xff00)) space.device().execute().yield(); } @@ -142,7 +141,7 @@ WRITE16_MEMBER(eprom_state::sync_w) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, eprom_state ) AM_RANGE(0x000000, 0x09ffff) AM_ROM AM_RANGE(0x0e0000, 0x0e0fff) AM_DEVREADWRITE8("eeprom", atari_eeprom_device, read, write, 0x00ff) - AM_RANGE(0x16cc00, 0x16cc01) AM_RAM AM_SHARE("sync_data") + AM_RANGE(0x16cc00, 0x16cc01) AM_READWRITE(sync_r, sync_w) AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1") AM_RANGE(0x1f0000, 0x1fffff) AM_DEVWRITE("eeprom", atari_eeprom_device, unlock_write) AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000") @@ -167,7 +166,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( guts_map, AS_PROGRAM, 16, eprom_state ) AM_RANGE(0x000000, 0x09ffff) AM_ROM AM_RANGE(0x0e0000, 0x0e0fff) AM_DEVREADWRITE8("eeprom", atari_eeprom_device, read, write, 0x00ff) - AM_RANGE(0x16cc00, 0x16cc01) AM_RAM AM_SHARE("sync_data") + AM_RANGE(0x16cc00, 0x16cc01) AM_READWRITE(sync_r, sync_w) AM_RANGE(0x160000, 0x16ffff) AM_RAM AM_SHARE("share1") AM_RANGE(0x1f0000, 0x1fffff) AM_DEVWRITE("eeprom", atari_eeprom_device, unlock_write) AM_RANGE(0x260000, 0x26000f) AM_READ_PORT("260000") @@ -728,9 +727,6 @@ ROM_END DRIVER_INIT_MEMBER(eprom_state,eprom) { - /* install CPU synchronization handlers */ - m_sync_data = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this)); - m_sync_data = m_extra->space(AS_PROGRAM).install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this)); } diff --git a/src/mame/drivers/equites.cpp b/src/mame/drivers/equites.cpp index 071c92b9cdd..98e58f261d3 100644 --- a/src/mame/drivers/equites.cpp +++ b/src/mame/drivers/equites.cpp @@ -438,7 +438,7 @@ WRITE8_MEMBER(equites_state::equites_c0f8_w) case 7: // c0ff: sound command latch clear // Note: solder pad CP1 on the pcb would allow to disable this - soundlatch_clear_byte_w(space, 0, 0); + m_soundlatch->clear_w(space, 0, 0); break; } } @@ -662,7 +662,7 @@ static ADDRESS_MAP_START( equites_map, AS_PROGRAM, 16, equites_state ) AM_RANGE(0x100000, 0x100001) AM_READ(equites_spriteram_kludge_r) AM_RANGE(0x100000, 0x1001ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0x140000, 0x1407ff) AM_READWRITE8(mcu_ram_r, mcu_ram_w, 0x00ff) - AM_RANGE(0x180000, 0x180001) AM_READ_PORT("IN1") AM_WRITE8(soundlatch_byte_w, 0x00ff) + AM_RANGE(0x180000, 0x180001) AM_READ_PORT("IN1") AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) AM_RANGE(0x184000, 0x184001) AM_MIRROR(0x020000) AM_MASK(0x020000) AM_WRITE(equites_flipw_w) AM_RANGE(0x188000, 0x188001) AM_MIRROR(0x020000) AM_MASK(0x020000) AM_WRITE(mcu_start_w) AM_RANGE(0x18c000, 0x18c001) AM_MIRROR(0x020000) AM_MASK(0x020000) AM_WRITE(mcu_switch_w) @@ -690,7 +690,7 @@ static ADDRESS_MAP_START( splndrbt_map, AS_PROGRAM, 16, equites_state ) AM_RANGE(0x0c8000, 0x0c8001) AM_MIRROR(0x020000) AM_MASK(0x020000) AM_WRITE(mcu_switch_w) AM_RANGE(0x0cc000, 0x0cc001) AM_MIRROR(0x020000) AM_MASK(0x020000) AM_WRITE(splndrbt_selchar_w) AM_RANGE(0x100000, 0x100001) AM_WRITE(splndrbt_bg_scrollx_w) - AM_RANGE(0x140000, 0x140001) AM_WRITE8(soundlatch_byte_w, 0x00ff) + AM_RANGE(0x140000, 0x140001) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) AM_RANGE(0x1c0000, 0x1c0001) AM_WRITE(splndrbt_bg_scrolly_w) AM_RANGE(0x180000, 0x1807ff) AM_READWRITE8(mcu_ram_r, mcu_ram_w, 0x00ff) AM_RANGE(0x200000, 0x200fff) AM_MIRROR(0x001000) AM_READWRITE8(equites_fg_videoram_r, equites_fg_videoram_w, 0x00ff) @@ -703,7 +703,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, equites_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xc000, 0xc000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0xc080, 0xc08d) AM_DEVWRITE("msm", msm5232_device, write) AM_RANGE(0xc0a0, 0xc0a1) AM_DEVWRITE("aysnd", ay8910_device, data_address_w) AM_RANGE(0xc0b0, 0xc0b0) AM_WRITENOP // n.c. @@ -1053,6 +1053,8 @@ static MACHINE_CONFIG_FRAGMENT( common_sound ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("msm", MSM5232, MSM5232_MAX_CLOCK) // will be adjusted at runtime through PORT_ADJUSTER MCFG_MSM5232_SET_CAPACITORS(0.47e-6, 0.47e-6, 0.47e-6, 0.47e-6, 0.47e-6, 0.47e-6, 0.47e-6, 0.47e-6) // verified MCFG_MSM5232_GATE_HANDLER_CB(WRITELINE(equites_state, equites_msm5232_gate)) diff --git a/src/mame/drivers/exidy440.cpp b/src/mame/drivers/exidy440.cpp index 3ac26994742..c85a5b01ba5 100644 --- a/src/mame/drivers/exidy440.cpp +++ b/src/mame/drivers/exidy440.cpp @@ -429,7 +429,7 @@ READ8_MEMBER(exidy440_state::topsecex_input_port_5_r) WRITE8_MEMBER(exidy440_state::topsecex_yscroll_w) { - *m_topsecex_yscroll = data; + m_topsecex_yscroll = data; } @@ -2014,7 +2014,7 @@ DRIVER_INIT_MEMBER(exidy440_state,topsecex) m_maincpu->space(AS_PROGRAM).install_read_port(0x2ec6, 0x2ec6, "AN0"); m_maincpu->space(AS_PROGRAM).install_read_port(0x2ec7, 0x2ec7, "IN4"); - m_topsecex_yscroll = m_maincpu->space(AS_PROGRAM).install_write_handler(0x2ec1, 0x2ec1, write8_delegate(FUNC(exidy440_state::topsecex_yscroll_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x2ec1, 0x2ec1, write8_delegate(FUNC(exidy440_state::topsecex_yscroll_w),this)); } diff --git a/src/mame/drivers/fcrash.cpp b/src/mame/drivers/fcrash.cpp index 06d4f59beb8..ff861f8e385 100644 --- a/src/mame/drivers/fcrash.cpp +++ b/src/mame/drivers/fcrash.cpp @@ -494,7 +494,7 @@ void cps_state::fcrash_render_sprites( screen_device &screen, bitmap_ind16 &bitm UINT16 tileno,flipx,flipy,colour,xpos,ypos; /* if we have separate sprite ram, use it */ - if (m_bootleg_sprite_ram) sprite_ram = m_bootleg_sprite_ram; + if (m_bootleg_sprite_ram) sprite_ram = m_bootleg_sprite_ram.get(); /* get end of sprite list marker */ for (pos = 0x1ffc - base; pos >= 0x0000; pos -= 4) @@ -1929,8 +1929,9 @@ DRIVER_INIT_MEMBER(cps_state, kodb) /* the original game alternates between 2 sprite ram areas to achieve flashing sprites - the bootleg doesn't do the write to the register to achieve this mapping both sprite ram areas to the same bootleg sprite ram - similar to how sf2mdt works */ - m_bootleg_sprite_ram = (UINT16*)m_maincpu->space(AS_PROGRAM).install_ram(0x900000, 0x903fff); - m_maincpu->space(AS_PROGRAM).install_ram(0x904000, 0x907fff, m_bootleg_sprite_ram); /* both of these need to be mapped */ + m_bootleg_sprite_ram = std::make_unique<UINT16[]>(0x2000); + m_maincpu->space(AS_PROGRAM).install_ram(0x900000, 0x903fff, m_bootleg_sprite_ram.get()); + m_maincpu->space(AS_PROGRAM).install_ram(0x904000, 0x907fff, m_bootleg_sprite_ram.get()); /* both of these need to be mapped */ DRIVER_INIT_CALL(cps1); } @@ -2230,7 +2231,8 @@ ROM_END DRIVER_INIT_MEMBER(cps_state, dinopic) { - m_bootleg_sprite_ram = (UINT16*)m_maincpu->space(AS_PROGRAM).install_ram(0x990000, 0x993fff); + m_bootleg_sprite_ram = std::make_unique<UINT16[]>(0x2000); + m_maincpu->space(AS_PROGRAM).install_ram(0x990000, 0x993fff, m_bootleg_sprite_ram.get()); DRIVER_INIT_CALL(cps1); } @@ -2808,8 +2810,9 @@ DRIVER_INIT_MEMBER(cps_state, sf2mdtb) } /* bootleg sprite ram */ - m_bootleg_sprite_ram = (UINT16*)m_maincpu->space(AS_PROGRAM).install_ram(0x700000, 0x703fff); - m_maincpu->space(AS_PROGRAM).install_ram(0x704000, 0x707fff, m_bootleg_sprite_ram); /* both of these need to be mapped */ + m_bootleg_sprite_ram = std::make_unique<UINT16[]>(0x2000); + m_maincpu->space(AS_PROGRAM).install_ram(0x700000, 0x703fff, m_bootleg_sprite_ram.get()); + m_maincpu->space(AS_PROGRAM).install_ram(0x704000, 0x707fff, m_bootleg_sprite_ram.get()); /* both of these need to be mapped */ DRIVER_INIT_CALL(cps1); } @@ -2818,10 +2821,12 @@ DRIVER_INIT_MEMBER(cps_state, sf2mdtb) DRIVER_INIT_MEMBER(cps_state, sf2mdta) { /* bootleg sprite ram */ - m_bootleg_sprite_ram = (UINT16*)m_maincpu->space(AS_PROGRAM).install_ram(0x700000, 0x703fff); - m_maincpu->space(AS_PROGRAM).install_ram(0x704000, 0x707fff, m_bootleg_sprite_ram); /* both of these need to be mapped - see the "Magic Delta Turbo" text on the title screen */ + m_bootleg_sprite_ram = std::make_unique<UINT16[]>(0x2000); + m_maincpu->space(AS_PROGRAM).install_ram(0x700000, 0x703fff, m_bootleg_sprite_ram.get()); + m_maincpu->space(AS_PROGRAM).install_ram(0x704000, 0x707fff, m_bootleg_sprite_ram.get()); /* both of these need to be mapped - see the "Magic Delta Turbo" text on the title screen */ - m_bootleg_work_ram = (UINT16*)m_maincpu->space(AS_PROGRAM).install_ram(0xfc0000, 0xfcffff); /* this has moved */ + m_bootleg_work_ram = std::make_unique<UINT16[]>(0x8000); + m_maincpu->space(AS_PROGRAM).install_ram(0xfc0000, 0xfcffff, m_bootleg_work_ram.get()); /* this has moved */ DRIVER_INIT_CALL(cps1); } @@ -2829,8 +2834,9 @@ DRIVER_INIT_MEMBER(cps_state, sf2mdta) DRIVER_INIT_MEMBER(cps_state, sf2b) { /* bootleg sprite ram */ - m_bootleg_sprite_ram = (UINT16*)m_maincpu->space(AS_PROGRAM).install_ram(0x700000, 0x703fff); - m_maincpu->space(AS_PROGRAM).install_ram(0x704000, 0x707fff, m_bootleg_sprite_ram); + m_bootleg_sprite_ram = std::make_unique<UINT16[]>(0x2000); + m_maincpu->space(AS_PROGRAM).install_ram(0x700000, 0x703fff, m_bootleg_sprite_ram.get()); + m_maincpu->space(AS_PROGRAM).install_ram(0x704000, 0x707fff, m_bootleg_sprite_ram.get()); DRIVER_INIT_CALL(cps1); } diff --git a/src/mame/drivers/firefox.cpp b/src/mame/drivers/firefox.cpp index 6b8a2a0f421..af6d7faac3e 100644 --- a/src/mame/drivers/firefox.cpp +++ b/src/mame/drivers/firefox.cpp @@ -35,6 +35,7 @@ but requires a special level III player for proper control. Video: CAV. Audio: A #include "sound/tms5220.h" #include "machine/ldvp931.h" #include "machine/6532riot.h" +#include "machine/gen_latch.h" #include "machine/watchdog.h" #include "machine/x2212.h" @@ -44,7 +45,7 @@ class firefox_state : public driver_device public: firefox_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_laserdisc(*this, "laserdisc") , + m_laserdisc(*this, "laserdisc") , m_tileram(*this, "tileram"), m_spriteram(*this, "spriteram"), m_sprite_palette(*this, "sprite_palette"), @@ -53,7 +54,9 @@ public: m_audiocpu(*this, "audiocpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), + m_soundlatch2(*this, "soundlatch2") { } required_device<phillips_22vp931_device> m_laserdisc; required_shared_ptr<unsigned char> m_tileram; @@ -116,6 +119,8 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<screen_device> m_screen; required_device<palette_device> m_palette; + required_device<generic_latch_8_device> m_soundlatch; + required_device<generic_latch_8_device> m_soundlatch2; }; @@ -323,13 +328,13 @@ CUSTOM_INPUT_MEMBER(firefox_state::soundflag_r) READ8_MEMBER(firefox_state::sound_to_main_r) { m_sound_to_main_flag = 0; - return soundlatch2_byte_r(space, 0); + return m_soundlatch2->read(space, 0); } WRITE8_MEMBER(firefox_state::main_to_sound_w) { m_main_to_sound_flag = 1; - soundlatch_byte_w(space, 0, data); + m_soundlatch->write(space, 0, data); m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -343,13 +348,13 @@ WRITE8_MEMBER(firefox_state::sound_reset_w) READ8_MEMBER(firefox_state::main_to_sound_r) { m_main_to_sound_flag = 0; - return soundlatch_byte_r(space, 0); + return m_soundlatch->read(space, 0); } WRITE8_MEMBER(firefox_state::sound_to_main_w) { m_sound_to_main_flag = 1; - soundlatch2_byte_w(space, 0, data); + m_soundlatch2->write(space, 0, data); } @@ -744,6 +749,9 @@ static MACHINE_CONFIG_START( firefox, firefox_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_GENERIC_LATCH_8_ADD("soundlatch2") + MCFG_SOUND_ADD("pokey1", POKEY, MASTER_XTAL/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.30) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.30) diff --git a/src/mame/drivers/gamecom.cpp b/src/mame/drivers/gamecom.cpp index 0f5d98dcd63..42a74e077a6 100644 --- a/src/mame/drivers/gamecom.cpp +++ b/src/mame/drivers/gamecom.cpp @@ -2,28 +2,25 @@ // copyright-holders:Wilbert Pol, Robbbert /*************************************************************************** -Driver file to handle emulation of the Tiger Game.com by - Wilbert Pol +Driver file to handle emulation of the Tiger Game.com by Wilbert Pol. +Various improvements by Robbbert. Todo: -- Fix cpu and system problems that prevent the games from working. +- Fix cpu and system problems that prevent the games from working fully. +- RS232 port +- Sound ports 1,2,3 (DAC sound partially works) +- CPU speed can be adjusted by the games. Game Status: -- The DAC sound partially works, sound from ports 1,2,3 not done - Inbuilt ROM and PDA functions all work -- On the screen where the cart goes into the slot there is video flicker +- On the screen where the cart goes into the slot, there are vertical bands of randomness - Due to an irritating message, the NVRAM is commented out in the machine config -- Most of the cart games have severe video issues such as flickering and nonsense gfx -- Lights Out works -- Centipede works -- Wheel of Fortune 1 & 2 are working. -- Frogger works, but it is difficult to capture the female frog or the insect. -- Quiz Wiz works, but the end-of-round score doesn't show -- Jeopardy, playable with bad gfx -- Tiger Web Link & Internet, they look ok, obviously aren't going to connect to anything -- Williams Arcade Classics, Robotron works, the rest are no use. -- Monopoly is starting to show promise. It's playable but the video is terrible. -- The remaining carts are not functional to any useful degree. +- All carts appear to work except: +- - Henry: crash just after "HENRY" button clicked +- - Lost World: freeze just after entering Stage 2 (the nest) +- - Sonic Jam: player's character can fall out of a dip in the path and die. +- Most carts have some flicker, but some are terrible (Monopoly, MK Trilogy, Fighters Megamix, Jeopardy) +- Weblink and Internet are of no use as there is nothing to connect to. ***************************************************************************/ @@ -261,8 +258,8 @@ static MACHINE_CONFIG_START( gamecom, gamecom_state ) MCFG_SCREEN_REFRESH_RATE( 59.732155 ) MCFG_SCREEN_VBLANK_TIME(500) MCFG_SCREEN_UPDATE_DRIVER(gamecom_state, screen_update) - MCFG_SCREEN_SIZE( 208, 160 ) - MCFG_SCREEN_VISIBLE_AREA( 0, 207, 0, 159 ) + MCFG_SCREEN_SIZE( 200, 160 ) + MCFG_SCREEN_VISIBLE_AREA( 0, 199, 0, 159 ) MCFG_SCREEN_PALETTE("palette") MCFG_DEFAULT_LAYOUT(layout_gamecom) diff --git a/src/mame/drivers/gauntlet.cpp b/src/mame/drivers/gauntlet.cpp index 32ceadc4083..2436731958a 100644 --- a/src/mame/drivers/gauntlet.cpp +++ b/src/mame/drivers/gauntlet.cpp @@ -1649,7 +1649,7 @@ void gauntlet_state::swap_memory(void *ptr1, void *ptr2, int bytes) void gauntlet_state::common_init(int vindctr2) { UINT8 *rom = memregion("maincpu")->base(); - slapstic_configure(*m_maincpu, 0x038000, 0); + slapstic_configure(*m_maincpu, 0x038000, 0, memregion("maincpu")->base() + 0x38000); /* swap the top and bottom halves of the main CPU ROM images */ swap_memory(rom + 0x000000, rom + 0x008000, 0x8000); diff --git a/src/mame/drivers/gba.cpp b/src/mame/drivers/gba.cpp index 5998a83d2c2..64620d1f156 100644 --- a/src/mame/drivers/gba.cpp +++ b/src/mame/drivers/gba.cpp @@ -2109,7 +2109,7 @@ void gba_state::machine_start() m_maincpu->space(AS_PROGRAM).install_read_bank(0x08000000, 0x09ffffff, 0, 0, "rom1"); m_maincpu->space(AS_PROGRAM).install_read_bank(0x0a000000, 0x0bffffff, 0, 0, "rom2"); m_maincpu->space(AS_PROGRAM).install_read_bank(0x0c000000, 0x0cffffff, 0, 0, "rom3"); - + std::string region_tag; memory_region *cart_rom = memregion(region_tag.assign(m_cart->tag()).append(GBASLOT_ROM_REGION_TAG).c_str()); @@ -2118,6 +2118,7 @@ void gba_state::machine_start() membank("rom2")->set_base(cart_rom->base()); membank("rom3")->set_base(cart_rom->base()); + // add nvram to save state m_cart->save_nvram(); @@ -2144,6 +2145,13 @@ void gba_state::machine_start() m_maincpu->space(AS_PROGRAM).install_read_handler(0xe000000, 0xe01ffff, read32_delegate(FUNC(gba_cart_slot_device::read_ram),(gba_cart_slot_device*)m_cart)); m_maincpu->space(AS_PROGRAM).install_write_handler(0xe000000, 0xe01ffff, write32_delegate(FUNC(gba_cart_slot_device::write_ram),(gba_cart_slot_device*)m_cart)); } + if (m_cart->get_type() == GBA_3DMATRIX) + { + m_maincpu->space(AS_PROGRAM).install_write_handler(0x08800000, 0x088001ff, write32_delegate(FUNC(gba_cart_slot_device::write_mapper),(gba_cart_slot_device*)m_cart)); + memory_region *cart_romhlp = memregion(region_tag.assign(m_cart->tag()).append(GBAHELP_ROM_REGION_TAG).c_str()); + membank("rom1")->set_base(cart_romhlp->base()); + } + } save_item(NAME(m_DISPSTAT)); @@ -2245,6 +2253,7 @@ static SLOT_INTERFACE_START(gba_cart) SLOT_INTERFACE_INTERNAL("gba_flash", GBA_ROM_FLASH) // Panasonic SLOT_INTERFACE_INTERNAL("gba_flash_512", GBA_ROM_FLASH) // Panasonic SLOT_INTERFACE_INTERNAL("gba_flash_1m", GBA_ROM_FLASH1M) // Sanyo + SLOT_INTERFACE_INTERNAL("gba_3dmatrix", GBA_ROM_3DMATRIX) SLOT_INTERFACE_END diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp index 274f4e12646..aed5c928dbe 100644 --- a/src/mame/drivers/goldstar.cpp +++ b/src/mame/drivers/goldstar.cpp @@ -6910,14 +6910,14 @@ INPUT_PORTS_END static INPUT_PORTS_START( flaming7 ) PORT_START("IN0") /* b800 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1) PORT_NAME("Button Lockout") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2) PORT_NAME("Hold 1 - Big") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3) PORT_NAME("Hold 5") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4) PORT_NAME("Hold 3 - Double-Up") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5) PORT_NAME("Hold 4 - Take Score") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6) PORT_NAME("Bet 1") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7) PORT_NAME("Hold 2 - Low") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8) PORT_NAME("Start") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L) PORT_NAME("Button Lockout") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) PORT_NAME("Hold 1 - Big") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) PORT_NAME("Hold 5") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_POKER_HOLD3 ) PORT_NAME("Hold 3 - Double-Up") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD4 ) PORT_NAME("Hold 4 - Take Score") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_BET ) PORT_NAME("Bet 1") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_POKER_HOLD2 ) PORT_NAME("Hold 2 - Low") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start") PORT_START("IN1") /* b801 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) @@ -6940,123 +6940,118 @@ static INPUT_PORTS_START( flaming7 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("IN3") /* b810 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Z) PORT_NAME("Main Door SW") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_X) PORT_NAME("Change") - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_C) PORT_NAME("Logic Door SW") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_V) PORT_NAME("Cash Door SW") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_B) PORT_NAME("IN3-5 Active") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_N) PORT_NAME("Coin B") // confirmed. - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_M) PORT_NAME("Coin A") // confirmed. - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_L) PORT_NAME("Coin C or Mars") // confirmed. + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_D) PORT_NAME("Main Door SW") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_H) PORT_NAME("Change") + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_F) PORT_NAME("Logic Door SW") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_G) PORT_NAME("Cash Door SW") + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_T) PORT_NAME("IN3-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_NAME("Coin B") // confirmed. + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_NAME("Coin A") // confirmed. + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN ) PORT_NAME("Coin C or Mars") // confirmed. PORT_START("IN4") /* b811 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("WT RXD") - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("COUT RTS") // related to hopper... - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("IN4-3 Active") - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("IN4-4 Active") - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("IN4-5 Active") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("Collect") - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("Reset") - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("Books / Stats / Setup") PORT_TOGGLE + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_A) PORT_NAME("WT RXD") + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_S) PORT_NAME("COUT RTS") // related to hopper... + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_Y) PORT_NAME("IN4-3") + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_U) PORT_NAME("IN4-4 Active") // This one is active in real PCB. + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_CODE(KEYCODE_I) PORT_NAME("IN4-5") + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_GAMBLE_KEYOUT ) PORT_NAME("Collect") + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_R) PORT_NAME("Reset") + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_CODE(KEYCODE_0) PORT_NAME("Books / Stats / Setup") PORT_TOGGLE PORT_START("DSW1") - PORT_DIPNAME( 0x03, 0x03, "Payout" ) + PORT_DIPNAME( 0x03, 0x03, "Payout" ) PORT_DIPLOCATION("DSW1:1,2") PORT_DIPSETTING( 0x03, "Amusement (no credits out)" ) PORT_DIPSETTING( 0x02, "Ticket Printer" ) PORT_DIPSETTING( 0x01, "Hopper Payout" ) PORT_DIPSETTING( 0x00, "Remote Clear" ) - PORT_DIPNAME( 0x04, 0x04, "Reels Speed" ) - PORT_DIPSETTING( 0x04, "Fast" ) - PORT_DIPSETTING( 0x00, "Slow" ) - PORT_DIPNAME( 0x08, 0x08, "DSW1_08" ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x30, 0x30, "Reels Graphics" ) - PORT_DIPSETTING( 0x30, "Regular Fruits" ) - PORT_DIPSETTING( 0x20, "Numbers" ) - PORT_DIPSETTING( 0x10, "Custom 1: Red, White & Blue 7's" ) - PORT_DIPSETTING( 0x00, "Custom 2: Hollywood Nights" ) - PORT_DIPNAME( 0x40, 0x40, "DSW1_40" ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "DSW1_80" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, "Game Speed" ) PORT_DIPLOCATION("DSW1:3") + PORT_DIPSETTING( 0x04, "Fast Game" ) + PORT_DIPSETTING( 0x00, "Slow Game" ) + PORT_DIPNAME( 0x08, 0x08, "Double-Up" ) PORT_DIPLOCATION("DSW1:4") + PORT_DIPSETTING( 0x08, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x30, 0x30, "Graphics Type" ) PORT_DIPLOCATION("DSW1:5,6") + PORT_DIPSETTING( 0x30, "Regular Fruit" ) + PORT_DIPSETTING( 0x20, "Graphics Option 1" ) // Numbers. + PORT_DIPSETTING( 0x10, "Graphics Option 2" ) // Red, White & Blue 7's. + PORT_DIPSETTING( 0x00, "Graphics Option 3" ) // Hollywood Nights. + PORT_DIPNAME( 0xc0, 0xc0, "Paytable" ) PORT_DIPLOCATION("DSW1:7,8") + PORT_DIPSETTING( 0xc0, "9322" ) + PORT_DIPSETTING( 0x80, "9323" ) + PORT_DIPSETTING( 0x40, "9324" ) + PORT_DIPSETTING( 0x00, "9321" ) PORT_START("DSW2") - PORT_DIPNAME( 0x01, 0x01, "DSW2_01" ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "DSW2_02" ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, "DSW2_04" ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "DSW2_08" ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "DSW2_10" ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "DSW2_20" ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "DSW2_40" ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "DSW2_80" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x07, 0x07, "Credits Per Coin A" ) PORT_DIPLOCATION("DSW2:1,2,3") + PORT_DIPSETTING( 0x07, "1" ) + PORT_DIPSETTING( 0x06, "2" ) + PORT_DIPSETTING( 0x05, "4" ) + PORT_DIPSETTING( 0x04, "5" ) + PORT_DIPSETTING( 0x03, "6" ) + PORT_DIPSETTING( 0x02, "10" ) + PORT_DIPSETTING( 0x01, "25" ) + PORT_DIPSETTING( 0x00, "50" ) + PORT_DIPNAME( 0x38, 0x38, "Credits Per Coin B" ) PORT_DIPLOCATION("DSW2:4,5,6") + PORT_DIPSETTING( 0x38, "1" ) + PORT_DIPSETTING( 0x30, "2" ) + PORT_DIPSETTING( 0x28, "4" ) + PORT_DIPSETTING( 0x20, "5" ) + PORT_DIPSETTING( 0x18, "6" ) + PORT_DIPSETTING( 0x10, "10" ) + PORT_DIPSETTING( 0x08, "25" ) + PORT_DIPSETTING( 0x00, "50" ) + PORT_DIPNAME( 0xc0, 0xc0, "Credits Per Bill" ) PORT_DIPLOCATION("DSW2:7,8") + PORT_DIPSETTING( 0xc0, "1" ) + PORT_DIPSETTING( 0x80, "5" ) + PORT_DIPSETTING( 0x40, "10" ) + PORT_DIPSETTING( 0x00, "100" ) PORT_START("DSW3") - PORT_DIPNAME( 0x03, 0x03, "Maximum Bet" ) + PORT_DIPNAME( 0x03, 0x03, "Maximum Bet" ) PORT_DIPLOCATION("DSW3:1,2") PORT_DIPSETTING( 0x03, "8" ) PORT_DIPSETTING( 0x02, "16" ) PORT_DIPSETTING( 0x01, "32" ) - PORT_DIPSETTING( 0x00, "32" ) // should be 64? - PORT_DIPNAME( 0x04, 0x04, "Coin-In Timeout" ) + PORT_DIPSETTING( 0x00, "32" ) // confirmed. + PORT_DIPNAME( 0x04, 0x04, "Coin-In Timeout" ) PORT_DIPLOCATION("DSW3:3") PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "DSW3_08" ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "DSW3_10" ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "DSW3_20" ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "DSW3_40" ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "DSW3_80" ) + PORT_DIPNAME( 0x18, 0x18, "Denomination" ) PORT_DIPLOCATION("DSW3:4,5") + PORT_DIPSETTING( 0x18, "50 Cents" ) + PORT_DIPSETTING( 0x10, "25 Cents" ) + PORT_DIPSETTING( 0x08, "10 Cents" ) + PORT_DIPSETTING( 0x00, "5 Cents" ) + PORT_DIPNAME( 0x60, 0x60, "Progressive Sign" ) PORT_DIPLOCATION("DSW3:6,7") + PORT_DIPSETTING( 0x60, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, "Single Level" ) + PORT_DIPSETTING( 0x20, "Multi Level" ) + PORT_DIPSETTING( 0x00, "Test Mode" ) + PORT_DIPNAME( 0x80, 0x80, "DSW3_80 Unknown" ) PORT_DIPLOCATION("DSW3:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_START("DSW4") - PORT_DIPNAME( 0x01, 0x01, "DSW4_01" ) + PORT_DIPNAME( 0x01, 0x01, "Button Lockout" ) PORT_DIPLOCATION("DSW4:1") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "DSW4_02" ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, "DSW4_04" ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, "DSW4_08" ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, "DSW4_10" ) + PORT_DIPNAME( 0x02, 0x02, "Lockout Polarity" ) PORT_DIPLOCATION("DSW4:2") + PORT_DIPSETTING( 0x02, "Active High" ) + PORT_DIPSETTING( 0x00, "Active Low" ) + PORT_DIPNAME( 0x0c, 0x0c, "Printer Type" ) PORT_DIPLOCATION("DSW4:3,4") + PORT_DIPSETTING( 0x0c, "Epson 267A" ) + PORT_DIPSETTING( 0x08, "Star 300" ) + PORT_DIPSETTING( 0x04, "Ithaca 76" ) + PORT_DIPSETTING( 0x00, "Spare" ) + PORT_DIPNAME( 0x10, 0x10, "DSW4_10 Unknown" ) PORT_DIPLOCATION("DSW4:5") PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, "DSW4_20" ) + PORT_DIPNAME( 0x20, 0x20, "DSW4_20 Unknown" ) PORT_DIPLOCATION("DSW4:6") PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, "DSW4_40" ) + PORT_DIPNAME( 0x40, 0x40, "DSW4_40 Unknown" ) PORT_DIPLOCATION("DSW4:7") PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "DSW4_80" ) + PORT_DIPNAME( 0x80, 0x80, "DSW4_80 Unknown" ) PORT_DIPLOCATION("DSW4:8") PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) diff --git a/src/mame/drivers/harddriv.cpp b/src/mame/drivers/harddriv.cpp index 580a7ca1aa3..d8212707109 100644 --- a/src/mame/drivers/harddriv.cpp +++ b/src/mame/drivers/harddriv.cpp @@ -376,6 +376,7 @@ harddriv_state::harddriv_state(const machine_config &mconfig, const char *tag, d m_ds3sdsp_data_memory(*this, "ds3sdsp_data"), m_ds3sdsp_pgm_memory(*this, "ds3sdsp_pgm"), m_ds3xdsp_pgm_memory(*this, "ds3xdsp_pgm"), + m_dsp32_ram(*this, "dsp32_ram"), m_gsp_protection(nullptr), m_gsp_speedup_pc(0), m_msp_speedup_addr(nullptr), @@ -719,7 +720,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( dsk_dsp32_map, AS_PROGRAM, 32, harddriv_state ) ADDRESS_MAP_UNMAP_HIGH AM_RANGE(0x000000, 0x001fff) AM_RAM - AM_RANGE(0x600000, 0x63ffff) AM_RAM + AM_RANGE(0x600000, 0x63ffff) AM_RAM AM_SHARE("dsp32_ram") AM_RANGE(0xfff800, 0xffffff) AM_RAM ADDRESS_MAP_END @@ -4865,15 +4866,18 @@ void harddriv_state::init_harddriv(void) init_driver_sound(); /* set up gsp speedup handler */ - m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff9fc00, 0xfff9fc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup1_w), this)); - m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfffcfc00, 0xfffcfc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup2_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfff9fc00, 0xfff9fc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup1_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfffcfc00, 0xfffcfc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup2_w), this)); m_gsp->space(AS_PROGRAM).install_read_handler(0xfff9fc00, 0xfff9fc0f, read16_delegate(FUNC(harddriv_state::hdgsp_speedup_r), this)); m_gsp_speedup_pc = 0xffc00f10; + m_gsp_speedup_addr[0] = (UINT16 *)(m_gsp_vram + ((0xfff9fc00 - 0xff800000) >> 3)); // Addresses are in bits. Really. + m_gsp_speedup_addr[1] = (UINT16 *)(m_gsp_vram + ((0xfffcfc00 - 0xff800000) >> 3)); /* set up msp speedup handler */ - m_msp_speedup_addr = m_msp->space(AS_PROGRAM).install_write_handler(0x00751b00, 0x00751b0f, write16_delegate(FUNC(harddriv_state::hdmsp_speedup_w), this)); + m_msp->space(AS_PROGRAM).install_write_handler(0x00751b00, 0x00751b0f, write16_delegate(FUNC(harddriv_state::hdmsp_speedup_w), this)); m_msp->space(AS_PROGRAM).install_read_handler(0x00751b00, 0x00751b0f, read16_delegate(FUNC(harddriv_state::hdmsp_speedup_r), this)); m_msp_speedup_pc = 0x00723b00; + m_msp_speedup_addr = m_msp_ram + ((0x751b00 - 0x700000) >> 4); // Address in bits, plus UINT16 * /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); @@ -4888,15 +4892,18 @@ void harddriv_state::init_harddrivc(void) init_driver_sound(); /* set up gsp speedup handler */ - m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff9fc00, 0xfff9fc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup1_w), this)); - m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfffcfc00, 0xfffcfc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup2_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfff9fc00, 0xfff9fc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup1_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfffcfc00, 0xfffcfc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup2_w), this)); m_gsp->space(AS_PROGRAM).install_read_handler(0xfff9fc00, 0xfff9fc0f, read16_delegate(FUNC(harddriv_state::hdgsp_speedup_r), this)); m_gsp_speedup_pc = 0xfff40ff0; + m_gsp_speedup_addr[0] = (UINT16 *)(m_gsp_vram + ((0xfff9fc00 - 0xffc00000) >> 3)); // Addresses are in bits. Really. + m_gsp_speedup_addr[1] = (UINT16 *)(m_gsp_vram + ((0xfffcfc00 - 0xffc00000) >> 3)); /* set up msp speedup handler */ - m_msp_speedup_addr = m_msp->space(AS_PROGRAM).install_write_handler(0x00751b00, 0x00751b0f, write16_delegate(FUNC(harddriv_state::hdmsp_speedup_w), this)); + m_msp->space(AS_PROGRAM).install_write_handler(0x00751b00, 0x00751b0f, write16_delegate(FUNC(harddriv_state::hdmsp_speedup_w), this)); m_msp->space(AS_PROGRAM).install_read_handler(0x00751b00, 0x00751b0f, read16_delegate(FUNC(harddriv_state::hdmsp_speedup_r), this)); m_msp_speedup_pc = 0x00723b00; + m_msp_speedup_addr = m_msp_ram + ((0x751b00 - 0x700000) >> 4); // Address in bits, plus UINT16 * /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); @@ -4910,10 +4917,12 @@ void harddriv_state::init_stunrun(void) init_adsp(); /* set up gsp speedup handler */ - m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff9fc00, 0xfff9fc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup1_w), this)); - m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfffcfc00, 0xfffcfc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup2_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfff9fc00, 0xfff9fc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup1_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfffcfc00, 0xfffcfc0f, write16_delegate(FUNC(harddriv_state::hdgsp_speedup2_w), this)); m_gsp->space(AS_PROGRAM).install_read_handler(0xfff9fc00, 0xfff9fc0f, read16_delegate(FUNC(harddriv_state::hdgsp_speedup_r), this)); m_gsp_speedup_pc = 0xfff41070; + m_gsp_speedup_addr[0] = (UINT16 *)(m_gsp_vram + ((0xfff9fc00 - 0xffc00000) >> 3)); // Addresses are in bits. Really. + m_gsp_speedup_addr[1] = (UINT16 *)(m_gsp_vram + ((0xfffcfc00 - 0xffc00000) >> 3)); /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); @@ -4930,14 +4939,18 @@ void harddriv_state::init_racedriv(void) /* set up the slapstic */ m_slapstic_device->slapstic_init(); - m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); + m_m68k_slapstic_base = (UINT16 *)(memregion("maincpu")->base() + 0xe0000); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_rddsp32_sync[0] = m_dsp32_ram + ((0x613c00 - 0x600000) >> 2); + m_rddsp32_sync[1] = m_dsp32_ram + ((0x613e00 - 0x600000) >> 2); /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); + } @@ -4951,19 +4964,24 @@ void harddriv_state::racedrivc_init_common(offs_t gsp_protection) /* set up the slapstic */ m_slapstic_device->slapstic_init(); - m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); + m_m68k_slapstic_base = (UINT16 *)(memregion("maincpu")->base() + 0xe0000); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_rddsp32_sync[0] = m_dsp32_ram + ((0x613c00 - 0x600000) >> 2); + m_rddsp32_sync[1] = m_dsp32_ram + ((0x613e00 - 0x600000) >> 2); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM).install_write_handler(gsp_protection, gsp_protection + 0x0f, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(gsp_protection, gsp_protection + 0x0f, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp_protection = (UINT16 *)(m_gsp_vram + ((gsp_protection - 0xffc00000) >> 3)); /* set up gsp speedup handler */ - m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff76f60, 0xfff76f6f, write16_delegate(FUNC(harddriv_state::rdgsp_speedup1_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfff76f60, 0xfff76f6f, write16_delegate(FUNC(harddriv_state::rdgsp_speedup1_w), this)); m_gsp->space(AS_PROGRAM).install_read_handler(0xfff76f60, 0xfff76f6f, read16_delegate(FUNC(harddriv_state::rdgsp_speedup1_r), this)); m_gsp_speedup_pc = 0xfff43a00; + m_gsp_speedup_addr[0] = (UINT16 *)(m_gsp_vram + ((0xfff76f60 - 0xffc00000) >> 3)); /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); @@ -4981,15 +4999,18 @@ void harddriv_state::init_racedrivc_panorama_side() /* set up the slapstic */ m_slapstic_device->slapstic_init(); - m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); + m_m68k_slapstic_base = (UINT16 *)(memregion("maincpu")->base() + 0xe0000); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM).install_write_handler(gsp_protection, gsp_protection + 0x0f, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(gsp_protection, gsp_protection + 0x0f, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp_protection = (UINT16 *)(m_gsp_vram + ((gsp_protection - 0xffc00000) >> 3)); /* set up gsp speedup handler (todo, work these out) */ -// m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff76f60, 0xfff76f6f, write16_delegate(FUNC(harddriv_state::rdgsp_speedup1_w), this)); +// m_gsp->space(AS_PROGRAM).install_write_handler(0xfff76f60, 0xfff76f6f, write16_delegate(FUNC(harddriv_state::rdgsp_speedup1_w), this)); // m_gsp->space(AS_PROGRAM).install_read_handler(0xfff76f60, 0xfff76f6f, read16_delegate(FUNC(harddriv_state::rdgsp_speedup1_r), this)); // m_gsp_speedup_pc = 0xfff43a00; +// m_gsp_speedup_addr[0] = (UINT16 *)(m_gsp_vram + ((0xfff76f60 - 0xffc00000) >> 3)); /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); @@ -5030,14 +5051,18 @@ void harddriv_state::steeltal_init_common(offs_t ds3_transfer_pc, int proto_sloo /* set up the SLOOP */ if (!proto_sloop) { - m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::st68k_sloop_r), this), write16_delegate(FUNC(harddriv_state::st68k_sloop_w), this)); - m_m68k_sloop_alt_base = m_maincpu->space(AS_PROGRAM).install_read_handler(0x4e000, 0x4ffff, read16_delegate(FUNC(harddriv_state::st68k_sloop_alt_r), this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::st68k_sloop_r), this), write16_delegate(FUNC(harddriv_state::st68k_sloop_w), this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x4e000, 0x4ffff, read16_delegate(FUNC(harddriv_state::st68k_sloop_alt_r), this)); } else - m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::st68k_protosloop_r), this), write16_delegate(FUNC(harddriv_state::st68k_protosloop_w), this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::st68k_protosloop_r), this), write16_delegate(FUNC(harddriv_state::st68k_protosloop_w), this)); + + m_m68k_slapstic_base = (UINT16 *)(memregion("maincpu")->base() + 0xe0000); + m_m68k_sloop_alt_base = (UINT16 *)(memregion("maincpu")->base() + 0x4e000); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff965d0, 0xfff965df, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfff965d0, 0xfff965df, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp_protection = (UINT16 *)(m_gsp_vram + ((0xfff965d0 - 0xffc00000) >> 3)); /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); @@ -5048,6 +5073,7 @@ void harddriv_state::steeltal_init_common(offs_t ds3_transfer_pc, int proto_sloo } + void harddriv_state::init_steeltal(void) { steeltal_init_common(0x4fc18, 0); @@ -5073,16 +5099,20 @@ void harddriv_state::init_strtdriv(void) /* set up the slapstic */ m_slapstic_device->slapstic_init(); - m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16_delegate(FUNC(harddriv_state::rd68k_slapstic_r), this), write16_delegate(FUNC(harddriv_state::rd68k_slapstic_w), this)); + m_m68k_slapstic_base = (UINT16 *)(memregion("maincpu")->base() + 0xe0000); m_maincpu->space(AS_PROGRAM).install_read_handler(0xa80000, 0xafffff, read16_delegate(FUNC(harddriv_state::hda68k_port1_r), this)); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_rddsp32_sync[0] = m_dsp32_ram + ((0x613c00 - 0x600000) >> 2); + m_rddsp32_sync[1] = m_dsp32_ram + ((0x613e00 - 0x600000) >> 2); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff960a0, 0xfff960af, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfff960a0, 0xfff960af, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp_protection = (UINT16 *)(m_gsp_vram + ((0xfff960a0 - 0xffc00000) >> 3)); /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); @@ -5103,11 +5133,14 @@ void harddriv_state::init_hdrivair(void) m_maincpu->space(AS_PROGRAM).install_read_handler(0xa80000, 0xafffff, read16_delegate(FUNC(harddriv_state::hda68k_port1_r), this)); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_rddsp32_sync[0] = m_dsp32_ram + ((0x613c00 - 0x600000) >> 2); + m_rddsp32_sync[1] = m_dsp32_ram + ((0x613e00 - 0x600000) >> 2); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff960a0, 0xfff960af, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfff960a0, 0xfff960af, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp_protection = (UINT16 *)(m_gsp_vram + ((0xfff960a0 - 0xffc00000) >> 3)); /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); @@ -5128,11 +5161,14 @@ void harddriv_state::init_hdrivairp(void) m_maincpu->space(AS_PROGRAM).install_read_handler(0xa80000, 0xafffff, read16_delegate(FUNC(harddriv_state::hda68k_port1_r), this)); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613c00, 0x613c03, write32_delegate(FUNC(harddriv_state::rddsp32_sync0_w), this)); + m_dsp32->space(AS_PROGRAM).install_write_handler(0x613e00, 0x613e03, write32_delegate(FUNC(harddriv_state::rddsp32_sync1_w), this)); + m_rddsp32_sync[0] = m_dsp32_ram + ((0x613c00 - 0x600000) >> 2); + m_rddsp32_sync[1] = m_dsp32_ram + ((0x613e00 - 0x600000) >> 2); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM).install_write_handler(0xfff916c0, 0xfff916cf, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp->space(AS_PROGRAM).install_write_handler(0xfff916c0, 0xfff916cf, write16_delegate(FUNC(harddriv_state::hdgsp_protection_w), this)); + m_gsp_protection = (UINT16 *)(m_gsp_vram + ((0xfff916c0 - 0xffc00000) >> 3)); /* set up adsp speedup handlers */ m_adsp->space(AS_DATA).install_read_handler(0x1fff, 0x1fff, read16_delegate(FUNC(harddriv_state::hdadsp_speedup_r), this)); diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp index 76470eeaacc..d86910a77f8 100644 --- a/src/mame/drivers/hh_tms1k.cpp +++ b/src/mame/drivers/hh_tms1k.cpp @@ -150,6 +150,7 @@ #include "mdndclab.lh" // clickable #include "merlin.lh" // clickable #include "mmerlin.lh" // clickable +#include "raisedvl.lh" #include "simon.lh" // clickable #include "ssimon.lh" // clickable #include "splitsec.lh" @@ -2438,8 +2439,6 @@ MACHINE_CONFIG_END 8 = lamp42 18 = lamp73 28 = lamp84 38 = lamp82 9 = lamp43 19 = - 29 = lamp94 39 = lamp83 - NOTE!: MAME external artwork is required - ***************************************************************************/ class raisedvl_state : public hh_tms1k_state @@ -2549,7 +2548,7 @@ static MACHINE_CONFIG_START( raisedvl, raisedvl_state ) MCFG_TMS1XXX_WRITE_O_CB(WRITE16(raisedvl_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) - MCFG_DEFAULT_LAYOUT(layout_hh_tms1k_test) + MCFG_DEFAULT_LAYOUT(layout_raisedvl) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") @@ -3791,6 +3790,19 @@ static MACHINE_CONFIG_START( bship, bship_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") MCFG_SOUND_ADD("sn76477", SN76477, 0) + MCFG_SN76477_NOISE_PARAMS(RES_K(47), RES_K(100), CAP_P(47)) // R18, R17, C8 + MCFG_SN76477_DECAY_RES(RES_M(3.3)) // R16 + MCFG_SN76477_ATTACK_PARAMS(CAP_U(0.47), RES_K(15)) // C7, R20 + MCFG_SN76477_AMP_RES(RES_K(100)) // R19 + MCFG_SN76477_FEEDBACK_RES(RES_K(39)) // R7 + MCFG_SN76477_VCO_PARAMS(5.0 * RES_VOLTAGE_DIVIDER(RES_K(47), RES_K(33)), CAP_U(0.01), RES_K(270)) // R15/R14, C5, switchable R5/R3/R4 + MCFG_SN76477_PITCH_VOLTAGE(5.0) + MCFG_SN76477_SLF_PARAMS(CAP_U(22), RES_K(750)) // switchable C4, switchable R13/R12 + MCFG_SN76477_ONESHOT_PARAMS(0, RES_INF) // NC, switchable R11 + MCFG_SN76477_VCO_MODE(0) // switchable + MCFG_SN76477_MIXER_PARAMS(0, 0, 0) // switchable, GND, GND + MCFG_SN76477_ENVELOPE_PARAMS(1, 0) // Vreg, GND + MCFG_SN76477_ENABLE(0) // switchable MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35) MACHINE_CONFIG_END @@ -6148,7 +6160,7 @@ CONS( 1980, ebball3, 0, 0, ebball3, ebball3, driver_device, 0, "Ent CONS( 1980, einvader, 0, 0, einvader, einvader, driver_device, 0, "Entex", "Space Invader (Entex, TMS1100 version)", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) CONS( 1980, efootb4 , 0, 0, efootb4, efootb4, driver_device, 0, "Entex", "Color Football 4 (Entex)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, ebaskb2 , 0, 0, ebaskb2, ebaskb2, driver_device, 0, "Entex", "Electronic Basketball 2 (Entex)", MACHINE_SUPPORTS_SAVE ) -CONS( 1980, raisedvl, 0, 0, raisedvl, raisedvl, driver_device, 0, "Entex", "Raise The Devil", MACHINE_SUPPORTS_SAVE | MACHINE_REQUIRES_ARTWORK ) +CONS( 1980, raisedvl, 0, 0, raisedvl, raisedvl, driver_device, 0, "Entex", "Raise The Devil", MACHINE_SUPPORTS_SAVE ) CONS( 1979, gpoker, 0, 0, gpoker, gpoker, driver_device, 0, "Gakken", "Poker (Gakken, 1979 version)", MACHINE_SUPPORTS_SAVE ) CONS( 1980, gjackpot, 0, 0, gjackpot, gjackpot, driver_device, 0, "Gakken", "Jackpot: Gin Rummy & Black Jack", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/jaguar.cpp b/src/mame/drivers/jaguar.cpp index b6c9f306dc1..9142840e161 100644 --- a/src/mame/drivers/jaguar.cpp +++ b/src/mame/drivers/jaguar.cpp @@ -1342,7 +1342,7 @@ static ADDRESS_MAP_START( r3000_map, AS_PROGRAM, 32, jaguar_state ) AM_RANGE(0x04f1b000, 0x04f1cfff) AM_RAM AM_SHARE("dspram") AM_RANGE(0x06000000, 0x06000003) AM_READWRITE(misc_control_r, misc_control_w) - AM_RANGE(0x10000000, 0x1007ffff) AM_RAM + AM_RANGE(0x10000000, 0x1007ffff) AM_RAM AM_SHARE("mainram") AM_RANGE(0x12000000, 0x120fffff) AM_RAM // tested in self-test only? AM_RANGE(0x14000004, 0x14000007) AM_DEVWRITE("watchdog", watchdog_timer_device, reset32_w) AM_RANGE(0x16000000, 0x16000003) AM_WRITE(eeprom_enable_w) @@ -1354,7 +1354,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( m68020_map, AS_PROGRAM, 32, jaguar_state ) AM_RANGE(0x000000, 0x7fffff) AM_RAM AM_SHARE("sharedram") AM_RANGE(0x800000, 0x9fffff) AM_ROM AM_REGION("maincpu", 0) AM_SHARE("rom") - AM_RANGE(0xa00000, 0xa1ffff) AM_RAM + AM_RANGE(0xa00000, 0xa1ffff) AM_RAM AM_SHARE("mainram") AM_RANGE(0xa20000, 0xa21fff) AM_READWRITE(eeprom_data_r, eeprom_data_w) AM_SHARE("nvram") AM_RANGE(0xa30000, 0xa30003) AM_DEVWRITE("watchdog", watchdog_timer_device, reset32_w) AM_RANGE(0xa40000, 0xa40003) AM_WRITE(eeprom_enable_w) @@ -2562,7 +2562,8 @@ DRIVER_INIT_MEMBER(jaguar_state,area51a) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ - m_main_speedup = m_maincpu->space(AS_PROGRAM).install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(jaguar_state::area51_main_speedup_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(jaguar_state::area51_main_speedup_w),this)); + m_main_speedup = m_mainram + 0x2030/4; #endif } @@ -2571,11 +2572,11 @@ DRIVER_INIT_MEMBER(jaguar_state,area51) { m_hacks_enabled = true; cojag_common_init(0x0c0, 0x09e); - #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_mainram + 0x62e8/4; #endif } @@ -2590,7 +2591,8 @@ DRIVER_INIT_MEMBER(jaguar_state,maxforce) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_mainram + 0x865c/4; #endif } @@ -2605,7 +2607,8 @@ DRIVER_INIT_MEMBER(jaguar_state,area51mx) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ - m_main_speedup = m_maincpu->space(AS_PROGRAM).install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(jaguar_state::area51mx_main_speedup_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(jaguar_state::area51mx_main_speedup_w),this)); + m_main_speedup = m_mainram + 0x19550/4; #endif } @@ -2621,7 +2624,8 @@ DRIVER_INIT_MEMBER(jaguar_state,a51mxr3k) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_mainram + 0x6f0c/4; #endif } @@ -2634,7 +2638,8 @@ DRIVER_INIT_MEMBER(jaguar_state,fishfren) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 200; - m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_mainram + 0x21b60/4; #endif } @@ -2646,9 +2651,12 @@ void jaguar_state::init_freeze_common(offs_t main_speedup_addr) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 200; - if (main_speedup_addr != 0) - m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r), this)); - m_main_gpu_wait = m_maincpu->space(AS_PROGRAM).install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(jaguar_state::main_gpu_wait_r), this)); + if (main_speedup_addr != 0) { + m_maincpu->space(AS_PROGRAM).install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r), this)); + m_main_speedup = m_mainram + (main_speedup_addr - 0x10000000)/4; + } + m_maincpu->space(AS_PROGRAM).install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(jaguar_state::main_gpu_wait_r), this)); + m_main_gpu_wait = m_shared_ram + 0xd900/4; #endif } @@ -2667,7 +2675,8 @@ DRIVER_INIT_MEMBER(jaguar_state,vcircle) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 50; - m_main_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_mainram + 0x5b34/4; #endif } diff --git a/src/mame/drivers/leland.cpp b/src/mame/drivers/leland.cpp index 7cd0eb7709b..c9483e14e43 100644 --- a/src/mame/drivers/leland.cpp +++ b/src/mame/drivers/leland.cpp @@ -68,7 +68,7 @@ static ADDRESS_MAP_START( master_map_program, AS_PROGRAM, 8, leland_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x9fff) AM_ROMBANK("bank1") AM_RANGE(0xa000, 0xdfff) AM_ROMBANK("bank2") AM_WRITE(leland_battery_ram_w) AM_SHARE("battery") - AM_RANGE(0xe000, 0xefff) AM_RAM + AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE("mainram") AM_RANGE(0xf000, 0xf3ff) AM_READWRITE(leland_gated_paletteram_r, leland_gated_paletteram_w) AM_SHARE("palette") AM_RANGE(0xf800, 0xf801) AM_WRITE(leland_master_video_addr_w) ADDRESS_MAP_END @@ -2047,7 +2047,8 @@ DRIVER_INIT_MEMBER(leland_state,alleymas) /* kludge warning: the game uses location E0CA to determine if the joysticks are available */ /* it gets cleared by the code, but there is no obvious way for the value to be set to a */ /* non-zero value. If the value is zero, the joystick is never read. */ - m_alleymas_kludge_mem = m_master->space(AS_PROGRAM).install_write_handler(0xe0ca, 0xe0ca, write8_delegate(FUNC(leland_state::alleymas_joystick_kludge),this)); + m_master->space(AS_PROGRAM).install_write_handler(0xe0ca, 0xe0ca, write8_delegate(FUNC(leland_state::alleymas_joystick_kludge),this)); + m_alleymas_kludge_mem = m_mainram + (0xe0ca - 0xe000); } diff --git a/src/mame/drivers/lindbergh.cpp b/src/mame/drivers/lindbergh.cpp index e83f0a37d39..9a83ded155f 100644 --- a/src/mame/drivers/lindbergh.cpp +++ b/src/mame/drivers/lindbergh.cpp @@ -113,7 +113,8 @@ SEGA Network Taisen Mahjong MJ4 (rev G) ? ? SEGA-Race TV (EXPORT) 253-5508-0504 ^317-0504-COM ^DVP-0044 StarHorse 2: Fifth Expansion (rev D) ? ? DVP-0082D StarHorse 2: Fifth Expansion (rev E) ? ? DVP-0082E -The House Of The Dead 4 (EXPORT) 253-5508-0427 ^317-0427-COM ^DVP-0003A +The House Of The Dead 4 (EXPORT) (rev A) 253-5508-0427 ^317-0427-COM ^DVP-0003A +The House Of The Dead 4 (EXPORT) (rev B) ? ? DVP-0003B The House Of The Dead EX (JAPAN) 253-5508-0550 ^317-0550-JPN ? The House Of the Dead 4 Special ? ? ? VBIOS Update ? ? ^DVP-0021B @@ -413,6 +414,16 @@ ROM_END ROM_START(hotd4) LINDBERGH_BIOS + ROM_REGION(0x2000, ":pic", 0) + ROM_LOAD("317-0427-com.bin", 0, 0x2000, CRC(ef4a120c) SHA1(fcc0386fa708af9e010e40e1d259a6bd95e8b9e2)) // PIC was added from Rev A + + DISK_REGION("dvd") + DISK_IMAGE_READONLY("dvp-0003b", 0, SHA1(67f2565338f1e8df4c6cfc83447f490f75541b16)) +ROM_END + +ROM_START(hotd4a) + LINDBERGH_BIOS + ROM_REGION(0x2000, ":pic", 0) // PIC security 253-5508-0427 / 317-0427-COM ROM_LOAD("317-0427-com.bin", 0, 0x2000, CRC(ef4a120c) SHA1(fcc0386fa708af9e010e40e1d259a6bd95e8b9e2)) @@ -572,7 +583,8 @@ ROM_START(lbvbiosu) ROM_END GAME(1999, lindbios, 0, lindbergh, 0, driver_device, 0, ROT0, "Sega", "Sega Lindbergh Bios", MACHINE_IS_BIOS_ROOT) -GAME(2005, hotd4, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "House of the Dead 4 (Export)", MACHINE_NOT_WORKING|MACHINE_UNEMULATED_PROTECTION|MACHINE_NO_SOUND) +GAME(2005, hotd4, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "House of the Dead 4 (Export) (Rev B)", MACHINE_NOT_WORKING|MACHINE_UNEMULATED_PROTECTION|MACHINE_NO_SOUND) +GAME(2005, hotd4a, hotd4, lindbergh, 0, driver_device, 0, ROT0, "Sega", "House of the Dead 4 (Export) (Rev A)", MACHINE_NOT_WORKING|MACHINE_UNEMULATED_PROTECTION|MACHINE_NO_SOUND) GAME(2005, vf5, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "Virtua Fighter 5 (Export)", MACHINE_NOT_WORKING|MACHINE_UNEMULATED_PROTECTION|MACHINE_NO_SOUND) GAME(2006, abclimax, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "After Burner Climax (Export)", MACHINE_NOT_WORKING|MACHINE_UNEMULATED_PROTECTION|MACHINE_NO_SOUND) GAME(2006, letsgoju, lindbios, lindbergh, 0, driver_device, 0, ROT0, "Sega", "Let's Go Jungle (Export)", MACHINE_NOT_WORKING|MACHINE_UNEMULATED_PROTECTION|MACHINE_NO_SOUND) diff --git a/src/mame/drivers/megatech.cpp b/src/mame/drivers/megatech.cpp index 447e3d938c6..b5e4f484a02 100644 --- a/src/mame/drivers/megatech.cpp +++ b/src/mame/drivers/megatech.cpp @@ -157,8 +157,8 @@ private: void switch_cart(int gameno); std::unique_ptr<UINT8[]> m_banked_ram; - UINT8* sms_mainram; - UINT8* sms_rom; + std::unique_ptr<UINT8[]> sms_mainram; + std::unique_ptr<UINT8[]> sms_rom; required_device<sega315_5124_device> m_vdp1; required_device<generic_slot_device> m_cart1; @@ -344,18 +344,18 @@ WRITE8_MEMBER( mtech_state::mt_sms_standard_rom_bank_w ) { case 0: logerror("bank w %02x %02x\n", offset, data); - space.install_rom(0x0000, 0xbfff, sms_rom); + space.install_rom(0x0000, 0xbfff, sms_rom.get()); space.unmap_write(0x0000, 0xbfff); //printf("bank ram??\n"); break; case 1: - memcpy(sms_rom+0x0000, m_region_maincpu->base()+bank*0x4000, 0x4000); + memcpy(sms_rom.get()+0x0000, m_region_maincpu->base()+bank*0x4000, 0x4000); break; case 2: - memcpy(sms_rom+0x4000, m_region_maincpu->base()+bank*0x4000, 0x4000); + memcpy(sms_rom.get()+0x4000, m_region_maincpu->base()+bank*0x4000, 0x4000); break; case 3: - memcpy(sms_rom+0x8000, m_region_maincpu->base()+bank*0x4000, 0x4000); + memcpy(sms_rom.get()+0x8000, m_region_maincpu->base()+bank*0x4000, 0x4000); break; } @@ -367,13 +367,15 @@ void mtech_state::set_genz80_as_sms() address_space &io = m_z80snd->space(AS_IO); // main ram area - sms_mainram = (UINT8 *)prg.install_ram(0xc000, 0xdfff, 0, 0x2000); - memset(sms_mainram,0x00,0x2000); + sms_mainram = std::make_unique<UINT8[]>(0x2000); + prg.install_ram(0xc000, 0xdfff, 0, 0x2000, sms_mainram.get()); + memset(sms_mainram.get(), 0x00, 0x2000); // fixed rom bank area - sms_rom = (UINT8 *)prg.install_rom(0x0000, 0xbfff, nullptr); + sms_rom = std::make_unique<UINT8[]>(0xc000); + prg.install_rom(0x0000, 0xbfff, sms_rom.get()); - memcpy(sms_rom, m_region_maincpu->base(), 0xc000); + memcpy(sms_rom.get(), m_region_maincpu->base(), 0xc000); prg.install_write_handler(0xfffc, 0xffff, write8_delegate(FUNC(mtech_state::mt_sms_standard_rom_bank_w),this)); diff --git a/src/mame/drivers/meijinsn.cpp b/src/mame/drivers/meijinsn.cpp index 3d7d386b9b5..0fc1c12a08a 100644 --- a/src/mame/drivers/meijinsn.cpp +++ b/src/mame/drivers/meijinsn.cpp @@ -63,6 +63,7 @@ SOFT PSG & VOICE BY M.C & S.H #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" +#include "machine/gen_latch.h" #include "video/resnet.h" #include "sound/ay8910.h" @@ -72,10 +73,12 @@ public: meijinsn_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), + m_soundlatch(*this, "soundlatch"), m_videoram(*this, "videoram"), m_shared_ram(*this, "shared_ram"){ } required_device<cpu_device> m_maincpu; + required_device<generic_latch_8_device> m_soundlatch; /* memory pointers */ required_shared_ptr<UINT16> m_videoram; required_shared_ptr<UINT16> m_shared_ram; @@ -107,7 +110,7 @@ public: WRITE16_MEMBER(meijinsn_state::sound_w) { if (ACCESSING_BITS_0_7) - soundlatch_byte_w(space, 0, data & 0xff); + m_soundlatch->write(space, 0, data & 0xff); } READ16_MEMBER(meijinsn_state::alpha_mcu_r) @@ -199,7 +202,7 @@ static ADDRESS_MAP_START( meijinsn_sound_io_map, AS_IO, 8, meijinsn_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x01) AM_DEVWRITE("aysnd", ay8910_device, address_data_w) AM_RANGE(0x01, 0x01) AM_DEVREAD("aysnd", ay8910_device, data_r) - AM_RANGE(0x02, 0x02) AM_WRITE(soundlatch_clear_byte_w) + AM_RANGE(0x02, 0x02) AM_DEVWRITE("soundlatch", generic_latch_8_device, clear_w) AM_RANGE(0x06, 0x06) AM_WRITENOP ADDRESS_MAP_END @@ -373,8 +376,10 @@ static MACHINE_CONFIG_START( meijinsn, meijinsn_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("aysnd", AY8910, 2000000) - MCFG_AY8910_PORT_A_READ_CB(READ8(driver_device, soundlatch_byte_r)) + MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("soundlatch", generic_latch_8_device, read)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) MACHINE_CONFIG_END diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp index c200c4da25a..8a57919d4aa 100644 --- a/src/mame/drivers/merit.cpp +++ b/src/mame/drivers/merit.cpp @@ -724,6 +724,43 @@ static INPUT_PORTS_START( rivierab ) PORT_DIPSETTING( 0x01, DEF_STR( On ) ) INPUT_PORTS_END +static INPUT_PORTS_START( iowapp ) + PORT_INCLUDE( meritpoker ) + + PORT_MODIFY("IN0") /* Pins #65 through #58 of J3 in decending order */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_POKER_HOLD1 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_POKER_HOLD5 ) + +// PORT_MODIFY("IN1") /* Pins #57 through #51 of J3 in decending order */ +// PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* If HIGH triggers a "TOKEN LOW" error - Hopper releated */ + + PORT_MODIFY("DSW") + PORT_DIPNAME( 0x01, 0x00, "Auto Hold" ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, "Bonus Jackpot" ) PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, "Cards Dealt" ) PORT_DIPLOCATION("SW1:4") + PORT_DIPSETTING( 0x00, "Slow" ) + PORT_DIPSETTING( 0x08, "Fast" ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:5") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:6") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) +INPUT_PORTS_END + static INPUT_PORTS_START( dodge ) /* Same as "meritpoker" but not verified correct. Will correct / verify when these clones work */ PORT_INCLUDE( meritpoker ) INPUT_PORTS_END @@ -1587,6 +1624,19 @@ ROM_START( misdraw ) ROM_LOAD( "crt-209_2131-16", 0x0000, 0x0800, CRC(34729437) SHA1(f097a1a97d8078d7d6a6af85be416b1d1d09c7f2) ) /* 2816 EEPROM in Z80 epoxy CPU module */ ROM_END +ROM_START( iowapp ) + ROM_REGION( 0x10000, "maincpu", 0 ) + ROM_LOAD( "2131-21_u5-1.u5", 0x0000, 0x8000, CRC(29ce9656) SHA1(24054176f63957883ad9c022644de28684b95623) ) /* 2131-21 U5-1 981221 2131-21B - label shows copyright 1990 */ + + ROM_REGION( 0x6000, "gfx1", 0 ) + ROM_LOAD( "iowa_u39.u39", 0x0000, 0x2000, CRC(8d003bbe) SHA1(06711632f4dea6b794b112525b0e26db698b334b) ) /* lables show copyright 1989 */ + ROM_LOAD( "iowa_u38.u38", 0x2000, 0x2000, CRC(2f2152a8) SHA1(c0a6dd92ef5eb60363ac3855d62fcea07006368e) ) + ROM_LOAD( "iowa_u37.u37", 0x4000, 0x2000, CRC(393c78fe) SHA1(d913d081a7205c19dff6a7c6d604716695de2e98) ) + + ROM_REGION( 0x2000, "gfx2", 0 ) + ROM_LOAD( "iowa_u40.u40", 0x0000, 0x2000, CRC(6d2a1ca8) SHA1(96ef3e0914c2b213ed9c9082fa3e27d75d52a8ec) ) +ROM_END + ROM_START( dodgectya ) ROM_REGION( 0x10000, "maincpu", 0 ) ROM_LOAD( "2131-82_u5-0d.u5", 0x0000, 0x8000, CRC(ef71b268) SHA1(c85f2c8e7e9cd89b4720699814d8fcfbecf4dc1b) ) /* 2131-82 U5-0D 884111 2131 820*/ @@ -2296,6 +2346,7 @@ GAME( 1986, rivierab, riviera, dodge, rivierab, driver_device, 0, ROT0, " GAME( 1986, bigappg, 0, bigappg, bigappg, driver_device, 0, ROT0, "Big Apple Games / Merit", "The Big Apple (2131-13, U5-0)", MACHINE_SUPPORTS_SAVE ) GAME( 1986, misdraw, 0, misdraw, bigappg, driver_device, 0, ROT0, "Big Apple Games / Merit", "Michigan Super Draw (2131-16, U5-2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, iowapp, 0, dodge, iowapp, driver_device, 0, ROT0, "Merit", "Iowa Premium Player (2131-21, U5-1)", MACHINE_SUPPORTS_SAVE ) /* Copyright year based on rom label */ GAME( 1986, dodgectya,dodgecty,dodge, dodge, driver_device, 0, ROT0, "Merit", "Dodge City (2131-82, U5-0D)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) GAME( 1986, dodgectyb,dodgecty,dodge, dodge, driver_device, 0, ROT0, "Merit", "Dodge City (2131-82, U5-50)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_NOT_WORKING ) diff --git a/src/mame/drivers/metlfrzr.cpp b/src/mame/drivers/metlfrzr.cpp index 71ad6a9931b..863f5e3db19 100644 --- a/src/mame/drivers/metlfrzr.cpp +++ b/src/mame/drivers/metlfrzr.cpp @@ -1,9 +1,20 @@ // license:BSD-3-Clause -// copyright-holders:David Haywood -/* +// copyright-holders:Angelo Salese +/**************************************** + Metal Freezer (c) 1989 Seibu + + preliminary driver by Angelo Salese + + HW seems the natural evolution of Dark Mist type HW. + + TODO: + - T5182 hookup, controls sound and coin inputs. With current hookup it accepts coins but not fully, and sound isn't working at all ... + - Sprites, 0xfe00-0xffff? (And why game doesn't actually write at 0xff80-0xffff?) + - Foreground rowscroll / per-tile scroll; + - Writes at 0xb800-0xbfff at attract mode gameplay demo transition? -*/ +****************************************/ #include "emu.h" #include "cpu/z80/z80.h" @@ -16,17 +27,31 @@ public: metlfrzr_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_decrypted_opcodes(*this, "decrypted_opcodes") + m_decrypted_opcodes(*this, "decrypted_opcodes"), + m_work_ram(*this, "wram"), + m_vram(*this, "vram"), + m_palette(*this, "palette"), + m_gfxdecode(*this, "gfxdecode") { } virtual void machine_start() override; virtual void machine_reset() override; virtual void video_start() override; + void legacy_bg_draw(bitmap_ind16 &bitmap, const rectangle &cliprect); + void legacy_obj_draw(bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_metlfrzr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device<cpu_device> m_maincpu; required_shared_ptr<UINT8> m_decrypted_opcodes; + required_shared_ptr<UINT8> m_work_ram; + required_shared_ptr<UINT8> m_vram; + required_device<palette_device> m_palette; + required_device<gfxdecode_device> m_gfxdecode; DECLARE_DRIVER_INIT(metlfrzr); + DECLARE_WRITE8_MEMBER(output_w); + TIMER_DEVICE_CALLBACK_MEMBER(scanline); + UINT8 m_fg_tilebank; }; @@ -34,82 +59,260 @@ void metlfrzr_state::video_start() { } +void metlfrzr_state::legacy_bg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect) +{ + gfx_element *gfx = m_gfxdecode->gfx(m_fg_tilebank); + int count; + + for (count=0;count<32*32;count++) + { + int y = (count % 32); + int x = count / 32; + + UINT16 tile = m_vram[count*2+0] + ((m_vram[count*2+1] & 0xf0) << 4); + UINT8 color = m_vram[count*2+1] & 0xf; + + gfx->transpen(bitmap,cliprect,tile,color,0,0,x*8,y*8,0xf); + } + +} + +void metlfrzr_state::legacy_obj_draw(bitmap_ind16 &bitmap,const rectangle &cliprect) +{ + gfx_element *gfx = m_gfxdecode->gfx(3); + int count; + UINT8 *base_spriteram = m_work_ram + 0xe00; + + for(count=0;count<0x200;count+=4) + { + UINT8 tile_bank = 0;//base_spriteram[count+1] & 3; + UINT16 tile = base_spriteram[count] | (tile_bank << 8); + UINT8 color = base_spriteram[count+1] & 0xf; + int y = base_spriteram[count+2]; + int x = base_spriteram[count+3]; + + gfx->transpen(bitmap,cliprect,tile,color,0,0,x,y,0xf); + } +} + UINT32 metlfrzr_state::screen_update_metlfrzr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { + bitmap.fill(m_palette->black_pen(), cliprect); + + legacy_bg_draw(bitmap,cliprect); + legacy_obj_draw(bitmap,cliprect); return 0; } +WRITE8_MEMBER(metlfrzr_state::output_w) +{ + // bit 7: flip screen + // bit 5: on title screen after coin is inserted + // bit 1-0: unknown purpose, both 1s too generally + m_fg_tilebank = (data & 0x10) >> 4; + membank("bank1")->set_entry((data & 0xc) >> 2); + + popmessage("%02x",data & 3); + if(data & 0x60) + printf("%02x\n",data); +} static ADDRESS_MAP_START( metlfrzr_map, AS_PROGRAM, 8, metlfrzr_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") + AM_RANGE(0xc000, 0xcfff) AM_RAM AM_SHARE("vram") + AM_RANGE(0xd000, 0xd1ff) AM_RAM_DEVWRITE("palette", palette_device, write_indirect) AM_SHARE("palette") + AM_RANGE(0xd200, 0xd3ff) AM_RAM_DEVWRITE("palette", palette_device, write_indirect_ext) AM_SHARE("palette_ext") + + AM_RANGE(0xd400, 0xd47f) AM_DEVREADWRITE("t5182", t5182_device, sharedram_r, sharedram_w) + + AM_RANGE(0xd600, 0xd600) AM_READ_PORT("P1") + AM_RANGE(0xd601, 0xd601) AM_READ_PORT("P2") + AM_RANGE(0xd602, 0xd602) AM_READ_PORT("START") + AM_RANGE(0xd603, 0xd603) AM_READ_PORT("DSW1") + AM_RANGE(0xd604, 0xd604) AM_READ_PORT("DSW2") + // d600-0d61f scroll area? + + AM_RANGE(0xd700, 0xd700) AM_WRITE(output_w) + AM_RANGE(0xd710, 0xd710) AM_DEVWRITE("t5182", t5182_device, sound_irq_w) + AM_RANGE(0xd711, 0xd711) AM_DEVREAD("t5182", t5182_device, sharedram_semaphore_snd_r) + AM_RANGE(0xd712, 0xd712) AM_DEVWRITE("t5182", t5182_device, sharedram_semaphore_main_acquire_w) + AM_RANGE(0xd713, 0xd713) AM_DEVWRITE("t5182", t5182_device, sharedram_semaphore_main_release_w) + + AM_RANGE(0xd800, 0xdfff) AM_RAM + AM_RANGE(0xe000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("wram") ADDRESS_MAP_END static ADDRESS_MAP_START( decrypted_opcodes_map, AS_DECRYPTED_OPCODES, 8, metlfrzr_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_SHARE("decrypted_opcodes") + AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("bank1") + AM_RANGE(0xf000, 0xffff) AM_RAM AM_SHARE("wram") // executes code at 0xf5d5 ADDRESS_MAP_END static INPUT_PORTS_START( metlfrzr ) + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("START") + PORT_DIPNAME( 0x01, 0x01, "2-0" ) + PORT_DIPSETTING( 0x01, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x02, 0x02, "2-1" ) + PORT_DIPSETTING( 0x02, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x04, 0x04, "2-2" ) + PORT_DIPSETTING( 0x04, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x08, 0x08, "2-2" ) + PORT_DIPSETTING( 0x08, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 ) + PORT_DIPNAME( 0x40, 0x40, "2-6" ) + PORT_DIPSETTING( 0x40, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x80, 0x80, "2-7" ) + PORT_DIPSETTING( 0x80, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x00, "SYSA" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_SERVICE_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:2" ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x00, "SYSB" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x02, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x04, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x10, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) INPUT_PORTS_END void metlfrzr_state::machine_start() { + membank("bank1")->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x4000); } void metlfrzr_state::machine_reset() { + membank("bank1")->set_entry(0); + } -static const gfx_layout tiles8x8_layout = +static const gfx_layout tile_layout = { 8,8, RGN_FRAC(1,1), 4, - { 0, 4, 8, 12 }, - { 0, 1, 2, 3, 16, 17, 18, 19 }, -// { 19, 18, 17, 16, 3, 2, 1, 0 }, // maybe display is flipped? -// { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, - { 7*32, 6*32, 5*32, 4*32, 3*32, 2*32, 1*32, 0*32 }, + { STEP4(0,4) }, + { STEP4_INV(16,1), STEP4_INV(0,1) }, + { STEP8(0,32) }, 32*8 }; -static const gfx_layout tiles16x16_layout = +static const gfx_layout sprite_layout = { 16, 16, - RGN_FRAC(1, 1), - 4, - { 0, 4, 8, 12 }, - // { 0, 1, 2, 3, 16, 17, 18, 19, 64*8+0, 64*8+1, 64*8+2, 64*8+3, 64*8+16, 64*8+17, 64*8+18, 64*8+19 }, - { 64 * 8 + 19, 64 * 8 + 18, 64 * 8 + 17, 64 * 8 + 16, 64 * 8 + 3, 64 * 8 + 2, 64 * 8 + 1, 64 * 8 + 0, 19, 18, 17, 16, 3, 2, 1, 0 }, - // { 0*32,1*32,2*32,3*32,4*32,5*32,6*32,7*32, 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 }, - { 15 * 32,14 * 32,13 * 32,12 * 32,11 * 32,10 * 32,9 * 32,8 * 32, 7 * 32, 6 * 32, 5 * 32, 4 * 32, 3 * 32, 2 * 32, 1 * 32, 0 * 32 }, - 128 * 8 + RGN_FRAC(1, 1), + 4, + { STEP4(0,4) }, + { STEP4(0,1), STEP4(16,1), STEP4(64*8,1), STEP4(64*8+16,1) }, + { STEP16(0,32) }, + 128 * 8 }; static GFXDECODE_START(metlfrzr) - GFXDECODE_ENTRY("gfx1", 0, tiles8x8_layout, 0, 16) - GFXDECODE_ENTRY("gfx2", 0, tiles8x8_layout, 0, 16) - GFXDECODE_ENTRY("gfx3", 0, tiles16x16_layout, 0, 16) - GFXDECODE_ENTRY("gfx4", 0, tiles16x16_layout, 0, 16) + GFXDECODE_ENTRY("gfx1", 0, tile_layout, 0x100, 16) + GFXDECODE_ENTRY("gfx2", 0, tile_layout, 0x100, 16) + GFXDECODE_ENTRY("gfx3", 0, sprite_layout, 0, 16) + GFXDECODE_ENTRY("gfx4", 0, sprite_layout, 0, 16) GFXDECODE_END +TIMER_DEVICE_CALLBACK_MEMBER(metlfrzr_state::scanline) +{ + int scanline = param; + + + if(scanline == 240) // vblank-out irq + m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0x10); /* RST 10h */ + + if(scanline == 0) // vblank-in irq + m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0x08); /* RST 08h */ +} + static MACHINE_CONFIG_START(metlfrzr, metlfrzr_state) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 2) MCFG_CPU_PROGRAM_MAP(metlfrzr_map) MCFG_CPU_DECRYPTED_OPCODES_MAP(decrypted_opcodes_map) - // MCFG_CPU_VBLANK_INT_DRIVER("screen", metlfrzr_state, irq0_line_hold) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", metlfrzr_state, scanline, "screen", 0, 1) MCFG_DEVICE_ADD("t5182", T5182, 0) - MCFG_PALETTE_ADD("palette", 0x100) - MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB) - MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG) + MCFG_PALETTE_ADD("palette", 0x200) + MCFG_PALETTE_INDIRECT_ENTRIES(256*2) + MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR) MCFG_GFXDECODE_ADD("gfxdecode", "palette", metlfrzr) @@ -202,4 +405,4 @@ DRIVER_INIT_MEMBER(metlfrzr_state, metlfrzr) -GAME( 1989, metlfrzr, 0, metlfrzr, metlfrzr, metlfrzr_state, metlfrzr, ROT90, "Seibu", "Metal Freezer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) +GAME( 1989, metlfrzr, 0, metlfrzr, metlfrzr, metlfrzr_state, metlfrzr, ROT270, "Seibu", "Metal Freezer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND ) diff --git a/src/mame/drivers/midvunit.cpp b/src/mame/drivers/midvunit.cpp index 33f3df88f68..0f50c0a5362 100644 --- a/src/mame/drivers/midvunit.cpp +++ b/src/mame/drivers/midvunit.cpp @@ -1730,7 +1730,8 @@ void midvunit_state::init_crusnusa_common(offs_t speedup) m_adc_shift = 24; /* speedups */ - m_generic_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this)); + m_generic_speedup = m_ram_base + speedup; } DRIVER_INIT_MEMBER(midvunit_state,crusnusa) { init_crusnusa_common(0xc93e); } DRIVER_INIT_MEMBER(midvunit_state,crusnu40) { init_crusnusa_common(0xc957); } @@ -1753,8 +1754,10 @@ void midvunit_state::init_crusnwld_common(offs_t speedup) m_maincpu->space(AS_PROGRAM).install_write_handler(0x9d0000, 0x9d0000, write32_delegate(FUNC(midvunit_state::bit_reset_w),this)); /* speedups */ - if (speedup) - m_generic_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this)); + if (speedup) { + m_maincpu->space(AS_PROGRAM).install_read_handler(speedup, speedup + 1, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this)); + m_generic_speedup = m_ram_base + speedup; + } } DRIVER_INIT_MEMBER(midvunit_state,crusnwld) { init_crusnwld_common(0xd4c0); } #if 0 @@ -1773,7 +1776,8 @@ DRIVER_INIT_MEMBER(midvunit_state,offroadc) m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x996000, 0x996000, read32_delegate(FUNC(midvunit_state::offroadc_serial_data_r),this), write32_delegate(FUNC(midvunit_state::offroadc_serial_data_w),this)); /* speedups */ - m_generic_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x195aa, 0x195aa, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x195aa, 0x195aa, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this)); + m_generic_speedup = m_ram_base + 0x195aa; } @@ -1796,7 +1800,8 @@ DRIVER_INIT_MEMBER(midvunit_state,wargods) machine().device<midway_ioasic_device>("ioasic")->set_default_nvram(default_nvram); /* speedups */ - m_generic_speedup = m_maincpu->space(AS_PROGRAM).install_read_handler(0x2f4c, 0x2f4c, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x2f4c, 0x2f4c, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this)); + m_generic_speedup = m_ram_base + 0x2f4c; } diff --git a/src/mame/drivers/midwunit.cpp b/src/mame/drivers/midwunit.cpp index 9d7eaeea835..8af8f4d03ed 100644 --- a/src/mame/drivers/midwunit.cpp +++ b/src/mame/drivers/midwunit.cpp @@ -107,7 +107,7 @@ Notes: static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, midwunit_state ) AM_RANGE(0x00000000, 0x003fffff) AM_READWRITE(midtunit_vram_r, midtunit_vram_w) - AM_RANGE(0x01000000, 0x013fffff) AM_RAM + AM_RANGE(0x01000000, 0x013fffff) AM_RAM AM_SHARE("mainram") AM_RANGE(0x01400000, 0x0145ffff) AM_READWRITE(midwunit_cmos_r, midwunit_cmos_w) AM_SHARE("nvram") AM_RANGE(0x01480000, 0x014fffff) AM_WRITE(midwunit_cmos_enable_w) AM_RANGE(0x01600000, 0x0160001f) AM_READWRITE(midwunit_security_r, midwunit_security_w) diff --git a/src/mame/drivers/midyunit.cpp b/src/mame/drivers/midyunit.cpp index 39210556412..3bf9d593def 100644 --- a/src/mame/drivers/midyunit.cpp +++ b/src/mame/drivers/midyunit.cpp @@ -179,7 +179,7 @@ CUSTOM_INPUT_MEMBER(midyunit_state::adpcm_irq_state_r) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, midyunit_state ) AM_RANGE(0x00000000, 0x001fffff) AM_READWRITE(midyunit_vram_r, midyunit_vram_w) - AM_RANGE(0x01000000, 0x010fffff) AM_RAM + AM_RANGE(0x01000000, 0x010fffff) AM_RAM AM_SHARE("mainram") AM_RANGE(0x01400000, 0x0140ffff) AM_READWRITE(midyunit_cmos_r, midyunit_cmos_w) AM_RANGE(0x01800000, 0x0181ffff) AM_RAM_WRITE(midyunit_paletteram_w) AM_SHARE("paletteram") AM_RANGE(0x01a80000, 0x01a8009f) AM_MIRROR(0x00080000) AM_READWRITE(midyunit_dma_r, midyunit_dma_w) diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp index 6c059606247..a61278f77de 100644 --- a/src/mame/drivers/naomi.cpp +++ b/src/mame/drivers/naomi.cpp @@ -325,24 +325,24 @@ Notes: CN1/2/3 - connectors joining to main board Games known to use this PCB include.... - Sticker EPROM FLASHROMs X76F100 EPM7064S 315-5881 -Game on cart IC22# # of SOP56 IC37# IC41# IC42# Notes ----------------------------------------------------------------------------------------------------------------------------------- -Club Kart: European Session (2003, prototype) no cart * 21 (64Mb) present 315-6206 not present * instead of EPROM have tiny PCB with 2 flashroms on it -Crackin' DJ part 2 840-0068C 23674 20 (64Mb) present 315-6206 317-0311-COM PCB have label 840-0068B-01 837-14124, requires regular 837-13551 and 837-13938 rotary JVS boards, and turntable simulation -Ferrari F355 Challenge (twin/deluxe, prototype) no cart 22848P* 21 (64Mb) present 315-6206 317-0267-COM * flash-PCB have CRC 330B A417, the rest is the same as regular cart, not dumped but known to exist -Ferrari F355 Challenge 2 (twin/deluxe) no cart 23399 21 (64Mb) present 315-6206 317-0287-COM content is the same as regular 171-7919A cart -House of the Dead 2 (prototype) no cart A1E2 21 (64Mb) present 315-6206 present no label on IC42 -Inu No Osanpo / Dog Walking (Rev A) 840-0073C 22294A 16 (64Mb) present 315-6206 317-0316-JPN requires 837-13844 JVS IO with DIPSW 1 ON -Samba de Amigo (prototype) no cart * 21*(64Mb) present 315-6206 317-0270-COM * only first 14 flash roms contain game data, instead of EPROM have tiny PCB with 2 flashroms on it -Soul Surfer (Rev A) 840-0095C 23838C 21 (64Mb) present 315-6206 not present -Star Horse (server) 840-0055C 23626 17 (64Mb) present 315-6206 not present requires 837-13785 ARCNET&IO BD -The King of Route 66 (Rev A) 840-0087C 23819A 20 (64Mb) present 315-6206 not present content is the same as regular 171-8132A cart -The Maze of the Kings (prototype) no cart * 21 (64Mb) present 315-6206 FRI * flash-PCB, not dumped but known to exist -Tokyo Bus Guide (Rev A) 840-0045C 23468A 18 (64Mb) present 315-6206 317-0290-COM requires 837-13844 JVS IO -Virtua NBA (prototype) no cart * 21 (64Mb) present 315-6206 317-0271-COM * instead of EPROM have tiny PCB with 2 flashroms on it -Virtua Tennis / Power Smash (prototype) no cart * 21 (64Mb) present 315-6206 317-0263-COM * flash-PCB, title screen have label "SOFT R&D Dept.#3", not dumped but known to exist -Wave Runner GP (original, Rev A) 840-0064C 23725A 12 (64Mb) present 315-6206 317-0306-COM 840-0064B-01 + Sticker EPROM FLASHROMs X76F100 EPM7064S 315-5881 +Game on cart IC22# # of SOP56 IC37# IC41# IC42# Notes +------------------------------------------------------------------------------------------------------------------------------------ +Club Kart: European Session (2003, prototype) no cart * 21 (64Mb) present 315-6206 not present * instead of EPROM have tiny PCB with 2 flashroms on it +Crackin' DJ part 2 840-0068C 23674 20 (64Mb) present 315-6206 317-0311-COM PCB have label 840-0068B-01 837-14124, requires regular 837-13551 and 837-13938 rotary JVS boards, and turntable simulation +Ferrari F355 Challenge (twin/deluxe, prototype) no cart 22848P* 21 (64Mb) present 315-6206 317-0267-COM * flash-PCB have CRC 330B A417, the rest is the same as regular cart, not dumped but known to exist +Ferrari F355 Challenge 2 (twin/deluxe) no cart 23399 21 (64Mb) present 315-6206 317-0287-COM content is the same as regular 171-7919A cart +House of the Dead 2 (prototype) no cart A1E2 21 (64Mb) present 315-6206 present no label on IC42 +Inu No Osanpo / Dog Walking (Rev A) 840-0073C 22294A 16 (64Mb) present 315-6206 317-0316-JPN requires 837-13844 JVS IO with DIPSW 1 ON +Samba de Amigo (prototype) no cart * 21*(64Mb) present 315-6206 317-0270-COM * only first 14 flash roms contain game data, instead of EPROM have tiny PCB with 2 flashroms on it +Soul Surfer (Rev A) 840-0095C 23838C 21 (64Mb) present 315-6206 not present +Star Horse (server) 840-0055C 23626 17 (64Mb) present 315-6206 not present requires 837-13785 ARCNET&IO BD +The King of Route 66 (Rev A) 840-0087C 23819A 20 (64Mb) present 315-6206 not present content is the same as regular 171-8132A cart +The Maze of the Kings (prototype) no cart * 21 (64Mb) present 315-6206 FRI * flash-PCB, not dumped but known to exist +Tokyo Bus Guide (Rev A) 840-0045C 23468A 18 (64Mb) present 315-6206 317-0290-COM requires 837-13844 JVS IO +Virtua NBA (prototype) no cart * 21 (64Mb) present 315-6206 317-0271-COM * instead of EPROM have tiny PCB with 2 flashroms on it +Virtua Tennis / Power Smash (prototype) no cart * 21 (64Mb) present 315-6206 317-0263-COM * flash-PCB, title screen have label "SOFT R&D Dept.#3", not dumped but known to exist +Wave Runner GP (USA, Rev A) 840-0064C-01 23725A 12 (64Mb) present 315-6206 317-0306-COM 837-13668 171-7919A (C) Sega 1998 @@ -400,11 +400,12 @@ Giant Gram: All Japan Pro Wrestling 2 840-0007C 21820 9 (64Mb) Guilty Gear X 841-0013C 23356 14 (64Mb) ? 315-6213 317-5063-COM Gun Spike / Cannon Spike 841-0012C 23210 12 (64Mb) present 315-6213 317-5060-COM Heavy Metal Geomatrix (Rev B) HMG016007 23716A 11 (64Mb) present 315-6213 317-5071-COM joystick + 2 buttons -House of the Dead 2 (original) 834-13636 21385 20 (64Mb) not present 315-6213 not present -House of the Dead 2 834-13636-01 21585 20 (64Mb) not present 315-6213 not present +House of the Dead 2 834-13636 21385 20 (64Mb) not present 315-6213 not present +House of the Dead 2 (USA) 834-13636-01 21585 20 (64Mb) not present 315-6213 not present Idol Janshi Suchie-Pai 3 841-0002C 21979 14 (64Mb) ? 315-6213 317-5047-JPN requires mahjong panel Jambo! Safari (Rev A) 840-0013C 22826A 8 (64Mb) ? 315-6213 317-0264-COM Mars TV 840-0025C 22993 15 (64Mb) present 315-6213 317-0274-JPN +Marvel Vs. Capcom 2 (USA, Rev A) 841-0007C-01 23062A 14 (64Mb) ? 315-6213 ? OutTrigger 840-0017C 22163 19 (64Mb) ? 315-6213 317-0266-COM requires regular 837-13551 and 837-13938 rotary JVS boards, and special panel Power Stone 841-0001C 21597 8 (64Mb) present 315-6213 317-5046-COM joystick + 3 buttons Power Stone 2 841-0008C 23127 9 (64Mb) present 315-6213 317-5054-COM joystick + 3 buttons @@ -422,8 +423,8 @@ The Typing of the Dead 840-0026C 23021 20 (64Mb) The Typing of the Dead (Rev A) 840-0026C 23021A 20 (64Mb) present 315-6213 not present Touch de UNO! / Unou Nouryoku Check Machine 840-0008C 22073 4 (64Mb) present 315-6213 317-0255-JPN requires 837-13844 JVS IO with DIPSW 5 On, ELO AccuTouch-compatible touch screen controller and special printer. Toy Fighter / Waffupu 840-0011C 22035 10 (64Mb) present 315-6212 317-0257-COM joystick + 3 buttons -Virtua NBA 840-0021C-01 23073 21 (64Mb) present 315-6213 not present -Virtua NBA (original) 840-0021C 22949 21 (64Mb) present 315-6213 317-0271-COM +Virtua NBA (USA) 840-0021C-01 23073 21 (64Mb) present 315-6213 not present +Virtua NBA 840-0021C 22949 21 (64Mb) present 315-6213 317-0271-COM Virtua Striker 2 Ver. 2000 (Rev C) 840-0010C 21929C 14 (64Mb)* present 315-6213 317-0258-COM joystick + 3 buttons *(+1x 32Mb) Virtua Tennis / Power Smash 840-0015C 22927 11 (64Mb) present 315-6213 317-0263-COM Virtual On Oratorio Tangram M.S.B.S. ver5.66 840-0028C 23198 13 (64Mb) ? 315-6213 317-0279-COM @@ -530,7 +531,7 @@ Club Kart Prize (Rev A) 840-0129C 24082A Club Kart Prize Ver. B 840-0137C 24149 16 (64Mb) present 317-0368-COM requires 837-14438 "SH I/O BD" hopper controller (not dumped) Giant Gram 2000 840-0039C 23377 20 (64Mb) present 317-0296-COM Kick '4' Cash 840-0140C 24212 16 (64Mb) present 317-0397-COM requires 837-14438 "SH I/O BD" hopper controller (not dumped) -Marvel Vs. Capcom 2 New Age of Heroes (Rev A) 841-0007C-02 23085A 14 (64Mb)* present 317-5058-COM *(+2x 32Mb) +Marvel Vs. Capcom 2 New Age of Heroes (Export, Rev A) 841-0007C-02 23085A 14 (64Mb)* present 317-5058-COM *(+2x 32Mb) MushiKing The King of Beetles 2K3 2ND 840-0150C 24217 6 (64Mb) present 317-0394-COM requires 610-0669 barcode reader, 838-14245-92 "MAPLE/232C CONVERT BD" (MIE-based), 838-14243 "RFID CHIP R/W BD" and RFID chip Quiz Ah Megamisama 840-0030C 23227 16 (64Mb) present 317-0280-JPN Shootout Pool 840-0098C 23844 4 (64Mb) present 317-0336-COM requires regular 837-13551 and 837-13938 rotary JVS boards @@ -646,7 +647,7 @@ Akatsuki Blitzkampf Ausf. Achse 841-0058C not present 4 Dynamite Deka EX / Asian Dynamite 840-0175C not present 4 (512Mb) present 317-0495-COM present IC2# is labeled "VER.2" Illvelo (Illmatic Envelope) 841-0059C not present 4 (512Mb) present 317-5131-JPN present IC2# is labeled "VER.2" - IC#11 is empty Mamoru-kun wa Norowarete Shimatta 841-0060C not present 4 (512Mb) present 317-5132-JPN present IC2# is labeled "VER.2" -Manic Panic Ghost! 840-0170C-01 not present 5 (512Mb) present 317-0461-COM present requires 837-14672 sensor board (SH4 based) +Manic Panic Ghost! (USA) 840-0170C-01 not present 5 (512Mb) present 317-0461-COM present requires 837-14672 sensor board (SH4 based) Melty Blood Actress Again 841-0061C not present 6 (512Mb) present 317-5133-JPN present IC2# is labeled "REV.A" - IC4# is marked "5A" Melty Blood Actress Again Version A (Rev A) 841-0061C 24455 6 (512Mb) present 317-5133-JPN present IC2# is labeled "REV.A" - IC4# is marked "5A" Mushiking - The King Of Beetles II ENG (Ver. 1.001) 840-0164C not present 2 (512Mb) present 317-0437-COM present requires 610-0669 barcode reader, 838-14245-92 "MAPLE/232C CONVERT BD" (MIE-based), 838-14243 "RFID CHIP R/W BD" and RFID chip @@ -9454,6 +9455,7 @@ ROM_END with the lists below it has been assumed that if the title is listed for a region then it is available / works in that region, this has not been confirmed as correct. + -01 after game ID means USA, -02 - Export, if no -0X it can be either Japan or unified World release */ #define GAME_FLAGS (MACHINE_IMPERFECT_GRAPHICS|MACHINE_IMPERFECT_SOUND|MACHINE_NOT_WORKING) @@ -9468,8 +9470,8 @@ ROM_END /* GDROM */ GAME( 2001, naomigd, 0, naomi, naomi, naomi_state, naomi, ROT0, "Sega", "Naomi GD-ROM Bios", GAME_FLAGS|MACHINE_IS_BIOS_ROOT ) /* 834-xxxxx (Sega Naomi cart with game specific BIOS sets) */ -/* 13636-01 */ GAME( 1998, hotd2, hod2bios, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ -/* 13636 */ GAME( 1998, hotd2o, hotd2, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2 (original)", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ +/* 13636-01 */ GAME( 1998, hotd2, hod2bios, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2 (USA)", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ +/* 13636 */ GAME( 1998, hotd2o, hotd2, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ /* none */ GAME( 1998, hotd2p, hotd2, naomim2, hotd2, naomi_state, hotd2, ROT0, "Sega", "House of the Dead 2 (prototype)", GAME_FLAGS ) /* specific BIOS "hod2bios" needed */ /* 13842 */ GAME( 1999, f355, f355dlx, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Ferrari F355 Challenge (deluxe, no link)", GAME_FLAGS ) /* specific BIOS "f355dlx" needed */ /* 13950 */ GAME( 1999, f355twin, f355bios, naomim2, naomi, driver_device, 0, ROT0, "Sega", "Ferrari F355 Challenge (twin/deluxe)", GAME_FLAGS ) /* specific BIOS "f355bios" needed */ @@ -9478,46 +9480,46 @@ ROM_END /* 840-xxxxx (Sega Naomi cart games)*/ /* 0001 */ GAME( 1998, dybbnao, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "Dynamite Baseball NAOMI (JPN)", GAME_FLAGS ) -/* 0002 */ GAME( 1999, crzytaxi, naomi, naomim2, crzytaxi,naomi_state, naomi, ROT0, "Sega", "Crazy Taxi (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0002 */ GAME( 1999, crzytaxi, naomi, naomim2, crzytaxi,naomi_state, naomi, ROT0, "Sega", "Crazy Taxi", GAME_FLAGS ) /* 0003 */ GAME( 1999, zombrvno, zombrvn, naomim2, zombrvn, naomi_state, naomi, ROT0, "Sega", "Zombie Revenge", GAME_FLAGS ) /* 0003 */ GAME( 1999, zombrvn, naomi, naomim2, zombrvn, naomi_state, naomi, ROT0, "Sega", "Zombie Revenge (Rev A)", GAME_FLAGS ) /* 0004 */ GAME( 1999, ringout, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Ring Out 4x4", GAME_FLAGS ) /* 0005 */ GAME( 1999, alpilota, naomi, naomim2, alpilota,naomi_state, naomi, ROT0, "Sega", "Airline Pilots (Rev A)", GAME_FLAGS ) /* specific BIOS "airlbios" needed */ -/* 0007 */ GAME( 1999, ggram2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Giant Gram: All Japan Pro Wrestling 2 (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0007 */ GAME( 1999, ggram2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Giant Gram: All Japan Pro Wrestling 2", GAME_FLAGS ) /* 0008 */ GAME( 1999, tduno, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Touch de Uno! / Unou Nouryoku Check Machine", GAME_FLAGS ) -/* 0010 */ GAME( 1999, vs2_2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Striker 2 Ver. 2000 (JPN, USA, EXP, KOR, AUS) (Rev C)", GAME_FLAGS ) +/* 0010 */ GAME( 1999, vs2_2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Striker 2 Ver. 2000 (Rev C)", GAME_FLAGS ) /* 0011 */ GAME( 1999, toyfight, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Toy Fighter", GAME_FLAGS ) /* 0012 */ GAME( 1999, smlg99, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "Super Major League '99", GAME_FLAGS ) -/* 0013 */ GAME( 1999, jambo, naomi, naomim2, jambo, naomi_state, naomi, ROT0, "Sega", "Jambo! Safari (JPN, USA, EXP, KOR, AUS) (Rev A)", GAME_FLAGS ) +/* 0013 */ GAME( 1999, jambo, naomi, naomim2, jambo, naomi_state, naomi, ROT0, "Sega", "Jambo! Safari (Rev A)", GAME_FLAGS ) /* 0015 */ GAME( 1999, vtennis, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua Tennis (USA, EXP, KOR, AUS) / Power Smash (JPN)", GAME_FLAGS ) /* 0016 */ GAME( 1999, derbyoc, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Derby Owners Club (Japan) (Rev B)", GAME_FLAGS ) -/* 0017 */ GAME( 1999, otrigger, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "OutTrigger (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0017 */ GAME( 1999, otrigger, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "OutTrigger", GAME_FLAGS ) /* 0018 */ GAME( 1999, sgtetris, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Sega Tetris", GAME_FLAGS ) /* 0019 */ GAME( 1999, dybb99, naomi, naomim2, dybbnao, naomi_state, naomi, ROT0, "Sega", "Dynamite Baseball '99 (JPN) / World Series '99 (USA, EXP, KOR, AUS) (Rev B)", GAME_FLAGS ) /* 0020 */ GAME( 1999, samba, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba De Amigo (Rev B)", GAME_FLAGS ) /* none */ GAME( 1999, sambap, samba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba De Amigo (USA, prototype)", GAME_FLAGS ) /* none */ GAME( 2000, virnbap, virnba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA (prototype)", GAME_FLAGS ) -/* 0021 */ GAME( 2000, virnbao, virnba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA (JPN, USA, EXP, KOR, AUS) (original)", GAME_FLAGS ) -/* 0021-01*/GAME( 2000,virnba, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0021 */ GAME( 2000, virnbao, virnba, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA", GAME_FLAGS ) +/* 0021-01*/GAME( 2000,virnba, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtua NBA (USA)", GAME_FLAGS ) /* 0022 */ GAME( 2000, tduno2, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Touch de Uno! 2", GAME_FLAGS ) /* 0023 */ GAME( 2000, 18wheelr, naomi, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (deluxe) (Rev A)", GAME_FLAGS ) /* 0025 */ GAME( 1999, marstv, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Mars TV (JPN)", GAME_FLAGS ) -/* 0026 */ GAME( 2000, totdo, totd, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "The Typing of the Dead (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0026 */ GAME( 2000, totd, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "The Typing of the Dead (JPN, USA, EXP, KOR, AUS) (Rev A)", GAME_FLAGS ) +/* 0026 */ GAME( 2000, totdo, totd, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "The Typing of the Dead", GAME_FLAGS ) +/* 0026 */ GAME( 2000, totd, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "The Typing of the Dead (Rev A)", GAME_FLAGS ) /* 0027 */ GAME( 2000, smarinef, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Sega Marine Fishing", GAME_FLAGS ) /* 0028 */ GAME( 2000, vonot, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Virtual On Oratorio Tangram M.S.B.S. ver5.66 2000 Edition", GAME_FLAGS ) -/* 0030 */ GAME( 2000, qmegamis, naomi, naomim1, naomi, naomi_state, qmegamis,ROT0, "Sega", "Quiz Ah Megamisama (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0030 */ GAME( 2000, qmegamis, naomi, naomim1, naomi, naomi_state, qmegamis,ROT0, "Sega", "Quiz Ah Megamisama", GAME_FLAGS ) /* 0035 */ GAME( 2000, sstrkfgt, naomi, naomim2, sstrkfgt,naomi_state, naomi, ROT0, "Sega", "Sega Strike Fighter (Rev A, set 1)", GAME_FLAGS ) /* 0035 */ GAME( 2000, sstrkfgta,sstrkfgt, naomim2, sstrkfgt,naomi_state, naomi, ROT0, "Sega", "Sega Strike Fighter (Rev A, set 2)", GAME_FLAGS ) /* 0036 */ GAME( 2000, 18wheels, 18wheelr, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (standard)", GAME_FLAGS ) /* 0037 */ GAME( 2000, 18wheelu, 18wheelr, naomim2, 18wheelr,naomi_state, naomi, ROT0, "Sega", "18 Wheeler (upright)", GAME_FLAGS ) -/* 0039 */ GAME( 2000, gram2000, naomi, naomim1, naomi, naomi_state, gram2000,ROT0, "Sega", "Giant Gram 2000 (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0040 */ GAME( 2000, wwfroyal, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "WWF Royal Rumble (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0041 */ GAME( 2000, slasho, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Slashout (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0039 */ GAME( 2000, gram2000, naomi, naomim1, naomi, naomi_state, gram2000,ROT0, "Sega", "Giant Gram 2000", GAME_FLAGS ) +/* 0040 */ GAME( 2000, wwfroyal, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "WWF Royal Rumble", GAME_FLAGS ) +/* 0041 */ GAME( 2000, slasho, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Slashout", GAME_FLAGS ) // 0042 Ferrari F355 Challenge 2 (twin) - identical to 834-????? listed above. /* 0043 */ GAME( 2000, crackndj, naomi, naomim2, crackndj,naomi_state, naomi, ROT0, "Sega", "Crackin' DJ", GAME_FLAGS ) -/* 0044 */ GAME( 2000, csmasho, csmash, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Cosmic Smash (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0044 */ GAME( 2000, csmash, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Cosmic Smash (JPN, USA, EXP, KOR, AUS) (Rev A)", GAME_FLAGS ) +/* 0044 */ GAME( 2000, csmasho, csmash, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Cosmic Smash", GAME_FLAGS ) +/* 0044 */ GAME( 2000, csmash, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Cosmic Smash (Rev A)", GAME_FLAGS ) // 0045 1999, "FortyFive / Sega", "Tokyo Bus Guide" /* 0045 */ GAME( 1999, tokyobus, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Fortyfive", "Tokyo Bus Guide (Rev A)", GAME_FLAGS ) /* 0047 */ GAME( 2000, samba2k, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Samba de Amigo ver. 2000", GAME_FLAGS ) @@ -9527,7 +9529,7 @@ ROM_END /* 0054 */ GAME( 2000, starhrse, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse (big screens)", GAME_FLAGS ) /* 0055 */ GAME( 2000, starhrct, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Star Horse (server)", GAME_FLAGS ) /* 0056 */ GAME( 2000, starhrcl, naomi, naomim2, naomi, naomi_state, naomi, ROT270,"Sega", "Star Horse (satellite)", GAME_FLAGS ) -/* 0064-01*/GAME(2001, wrungpo, wrungp, naomim2, naomi, naomi_state, naomi, ROT0, "CRI / Sega", "Wave Runner GP (original, Rev A)", GAME_FLAGS ) +/* 0064-01*/GAME(2001, wrungpo, wrungp, naomim2, naomi, naomi_state, naomi, ROT0, "CRI / Sega", "Wave Runner GP (USA, Rev A)", GAME_FLAGS ) /* 0064 */ GAME( 2001, wrungp, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "CRI / Sega", "Wave Runner GP", GAME_FLAGS ) /* 0068 */ GAME( 2001, crakndj2, naomi, naomim2, crackndj,naomi_state, naomi, ROT0, "Sega", "Crackin' DJ Part 2", GAME_FLAGS ) /* 0073 */ GAME( 2001, inunoos, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Sega", "Inu No Osanpo / Dog Walking (Rev A)", GAME_FLAGS ) @@ -9547,7 +9549,7 @@ ROM_END /* 0164 */ GAME( 2005, mushi2eo, mushik2e, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "MushiKing II - The King Of Beetle II ENG (Ver. 1.001)", GAME_FLAGS ) /* 0164 */ GAME( 2005, mushik2e, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "MushiKing II - The King Of Beetle II ENG (Ver. 2.001)", GAME_FLAGS ) /* 0166 */ GAME( 2006, zunou, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Touch De Zunou (Rev A)", GAME_FLAGS ) -/* 0170-01*/GAME( 2007,manicpnc, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Manic Panic Ghosts!", GAME_FLAGS ) +/* 0170-01*/GAME( 2007,manicpnc, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Manic Panic Ghosts! (USA)", GAME_FLAGS ) /* 0170 */ GAME( 2007, pokasuka, manicpnc, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Pokasuka Ghost!", GAME_FLAGS ) /* 0175 */ GAME( 2007, asndynmt, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega", "Asian Dynamite / Dynamite Deka EX", GAME_FLAGS ) /* 0177 */ GAME( 2007, rhytngk, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Sega / Nintendo - J.P ROOM", "Rhythm Tengoku", GAME_FLAGS ) @@ -9558,9 +9560,9 @@ ROM_END GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", "Puyo Puyo Fever (prototype ver 0.01)", GAME_FLAGS ) /* 840-xxxxx (Sega Naomi 2 cart games) */ -/* 0046 */ GAME( 2001, wldrider, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0061 */ GAME( 2001, vstrik3co,vstrik3c,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0061 */ GAME( 2001, vstrik3c, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Rev B)", GAME_FLAGS ) +/* 0046 */ GAME( 2001, wldrider, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Wild Riders", GAME_FLAGS ) +/* 0061 */ GAME( 2001, vstrik3co,vstrik3c,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3", GAME_FLAGS ) +/* 0061 */ GAME( 2001, vstrik3c, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (Rev B)", GAME_FLAGS ) /* 0062 */ GAME( 2001, clubkrto, clubkrt, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session", GAME_FLAGS ) /* 0062 */ GAME( 2001, clubkrtc, clubkrt, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev C)", GAME_FLAGS ) /* 0062 */ GAME( 2001, clubkrt, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_FLAGS ) @@ -9575,23 +9577,24 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " /* none */ GAME( 2003, clubk2kp, clubk2k3,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (2003, prototype)", GAME_FLAGS ) /* 841-xxxxx ("Licensed by Sega" Naomi cart games)*/ -/* 0001 */ GAME( 1999, pstone, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Power Stone (JPN, USA, EUR, ASI, AUS)", GAME_FLAGS ) +/* 0001 */ GAME( 1999, pstone, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Power Stone", GAME_FLAGS ) /* 0002 */ GAME( 1999, suchie3, naomi, naomim2, suchie3, naomi_state,naomi_mp,ROT0, "Jaleco", "Idol Janshi Suchie-Pai 3 (JPN)", GAME_FLAGS ) /* 0003 */ GAME( 1999, doa2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 (Rev A)", GAME_FLAGS ) /* 0003 */ GAME( 2000, doa2m, doa2, naomim2, naomi, naomi_state, naomi, ROT0, "Tecmo", "Dead or Alive 2 Millennium", GAME_FLAGS ) -/* 0004 */ GAME( 1999, shangril, naomi, naomim2, naomi_mp,naomi_state,naomi_mp,ROT0, "Marvelous Ent.", "Dengen Tenshi Taisen Janshi Shangri-la (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0005 */ GAME( 1999, spawn, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Todd Mc Farlane / Capcom","Spawn In the Demon's Hand (JPN, USA, EUR, ASI, AUS) (Rev B)", GAME_FLAGS ) +/* 0004 */ GAME( 1999, shangril, naomi, naomim2, naomi_mp,naomi_state,naomi_mp,ROT0, "Marvelous Ent.", "Dengen Tenshi Taisen Janshi Shangri-la", GAME_FLAGS ) +/* 0005 */ GAME( 1999, spawn, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Todd Mc Farlane / Capcom","Spawn In the Demon's Hand (Rev B)", GAME_FLAGS ) /* 0006 */ GAME( 1999, puyoda, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Compile", "Puyo Puyo Da!", GAME_FLAGS ) -/* 0007-02 */ GAME( 2000,mvsc2, naomi, naomim1, naomi, naomi_state, mvsc2, ROT0, "Capcom / Marvel", "Marvel Vs. Capcom 2 New Age of Heroes (JPN, USA, EUR, ASI, AUS) (Rev A)", GAME_FLAGS ) -/* 0008 */ GAME( 2000, pstone2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Power Stone 2 (JPN, USA, EUR, ASI, AUS)", GAME_FLAGS ) -/* 0011 */ GAME( 2000, capsnk, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom / SNK", "Capcom Vs. SNK Millennium Fight 2000 (JPN, USA, EXP, KOR, AUS) (Rev C)", GAME_FLAGS ) -/* 0011 */ GAME( 2000, capsnka, capsnk,naomim2, naomi, naomi_state, naomi, ROT0, "Capcom / SNK", "Capcom Vs. SNK Millennium Fight 2000 (JPN, USA, EXP, KOR, AUS) (Rev A)", GAME_FLAGS ) -/* 0011 */ GAME( 2000, capsnkb, capsnk,naomim2, naomi, naomi_state, naomi, ROT0, "Capcom / SNK", "Capcom Vs. SNK Millennium Fight 2000 (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +// 0007-01 GAME(2000, mvsc2u, mvsc2, naomim2, naomi, naomi_state, mvsc2, ROT0, "Capcom / Marvel", "Marvel Vs. Capcom 2 New Age of Heroes (USA, Rev A)", GAME_FLAGS) +/* 0007-02 */ GAME(2000, mvsc2, naomi, naomim1, naomi, naomi_state, mvsc2, ROT0, "Capcom / Marvel", "Marvel Vs. Capcom 2 New Age of Heroes (Export, Rev A)", GAME_FLAGS) +/* 0008 */ GAME( 2000, pstone2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Power Stone 2", GAME_FLAGS ) +/* 0011 */ GAME( 2000, capsnk, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom / SNK", "Capcom Vs. SNK Millennium Fight 2000 (Rev C)", GAME_FLAGS ) +/* 0011 */ GAME( 2000, capsnka, capsnk,naomim2, naomi, naomi_state, naomi, ROT0, "Capcom / SNK", "Capcom Vs. SNK Millennium Fight 2000 (Rev A)", GAME_FLAGS ) +/* 0011 */ GAME( 2000, capsnkb, capsnk,naomim2, naomi, naomi_state, naomi, ROT0, "Capcom / SNK", "Capcom Vs. SNK Millennium Fight 2000", GAME_FLAGS ) /* 0012 */ GAME( 2000, cspike, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Psikyo / Capcom", "Gun Spike (JPN) / Cannon Spike (USA, EXP, KOR, AUS)", GAME_FLAGS ) /* 0013 */ GAME( 2000, ggx, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Arc System Works","Guilty Gear X (JPN)", GAME_FLAGS ) -/* 0014 */ GAME( 2000, gwing2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Takumi / Capcom", "Giga Wing 2 (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0014 */ GAME( 2000, gwing2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Takumi / Capcom", "Giga Wing 2", GAME_FLAGS ) /* 0015 */ GAME( 2000, pjustic, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Moero! Justice Gakuen (JPN) / Project Justice (USA, EXP, KOR, AUS) (Rev A)", GAME_FLAGS ) -/* 0016 */ GAME( 2000, deathcox, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Ecole Software", "Death Crimson OX (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) +/* 0016 */ GAME( 2000, deathcox, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Ecole Software", "Death Crimson OX", GAME_FLAGS ) /* 0017 */ GAME( 2001, gundmct, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Banpresto / Capcom","Mobile Suit Gundam: Federation Vs. Zeon", GAME_FLAGS ) /* 0020 */ GAME( 2001, zerogu2, naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Psikyo", "Zero Gunner 2", GAME_FLAGS ) /* 0057 */ GAME( 2007, sl2007, naomi, naomim4, naomi, naomi_state, naomi, ROT270,"Triangle Service","Shooting Love 2007", GAME_FLAGS ) @@ -9601,7 +9604,7 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " /* 0061 */ GAME( 2008, mbaao, mbaa, naomim4, naomi, naomi_state, naomi, ROT0, "Type-Moon/Ecole", "Melty Blood Actress Again", GAME_FLAGS ) /* 0061 */ GAME( 2008, mbaa, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Type-Moon/Ecole", "Melty Blood Actress Again Version A (Rev A)", GAME_FLAGS ) /* 0062 */ GAME( 2009, radirgyn, naomi, naomim4, naomi, naomi_state, naomi, ROT0, "Milestone/Lucky", "Radirgy Noa", GAME_FLAGS ) -/* HMG016007 */ GAME( 2001,hmgeo,naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Heavy Metal Geomatrix (JPN, USA, EUR, ASI, AUS) (Rev B)", GAME_FLAGS ) +/* HMG016007 */ GAME( 2001,hmgeo,naomi, naomim2, naomi, naomi_state, naomi, ROT0, "Capcom", "Heavy Metal Geomatrix (Rev B)", GAME_FLAGS ) /* Cart games on Namco custom ROM board */ /* 25209801 */ GAME( 2000, wldkicksa,wldkicks,naomim2,naomi, naomi_state, naomi, ROT0, "Namco", "World Kicks (Asia, WK2 Ver.A)", GAME_FLAGS ) diff --git a/src/mame/drivers/offtwall.cpp b/src/mame/drivers/offtwall.cpp index bf366889bfd..ab1def6cb47 100644 --- a/src/mame/drivers/offtwall.cpp +++ b/src/mame/drivers/offtwall.cpp @@ -256,7 +256,7 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, offtwall_state ) AM_RANGE(0x3f6000, 0x3f7fff) AM_RAM_DEVWRITE("vad", atari_vad_device, playfield_upper_w) AM_SHARE("vad:playfield_ext") AM_RANGE(0x3f8000, 0x3fcfff) AM_RAM AM_RANGE(0x3fd000, 0x3fd7ff) AM_RAM AM_SHARE("vad:mob") - AM_RANGE(0x3fd800, 0x3fffff) AM_RAM + AM_RANGE(0x3fd800, 0x3fffff) AM_RAM AM_SHARE("mainram") ADDRESS_MAP_END @@ -470,18 +470,24 @@ ROM_END DRIVER_INIT_MEMBER(offtwall_state,offtwall) { /* install son-of-slapstic workarounds */ - m_spritecache_count = m_maincpu->space(AS_PROGRAM).install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),this)); - m_bankswitch_base = m_maincpu->space(AS_PROGRAM).install_read_handler(0x037ec2, 0x037f39, read16_delegate(FUNC(offtwall_state::bankswitch_r),this)); - m_unknown_verify_base = m_maincpu->space(AS_PROGRAM).install_read_handler(0x3fdf1e, 0x3fdf1f, read16_delegate(FUNC(offtwall_state::unknown_verify_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x037ec2, 0x037f39, read16_delegate(FUNC(offtwall_state::bankswitch_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x3fdf1e, 0x3fdf1f, read16_delegate(FUNC(offtwall_state::unknown_verify_r),this)); + m_spritecache_count = m_mainram + (0x3fde42 - 0x3fd800)/2; + m_bankswitch_base = (UINT16 *)(memregion("maincpu")->base() + 0x37ec2); + m_unknown_verify_base = m_mainram + (0x3fdf1e - 0x3fd800)/2; } DRIVER_INIT_MEMBER(offtwall_state,offtwalc) { /* install son-of-slapstic workarounds */ - m_spritecache_count = m_maincpu->space(AS_PROGRAM).install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),this)); - m_bankswitch_base = m_maincpu->space(AS_PROGRAM).install_read_handler(0x037eca, 0x037f43, read16_delegate(FUNC(offtwall_state::bankswitch_r),this)); - m_unknown_verify_base = m_maincpu->space(AS_PROGRAM).install_read_handler(0x3fdf24, 0x3fdf25, read16_delegate(FUNC(offtwall_state::unknown_verify_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x3fde42, 0x3fde43, read16_delegate(FUNC(offtwall_state::spritecache_count_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x037eca, 0x037f43, read16_delegate(FUNC(offtwall_state::bankswitch_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x3fdf24, 0x3fdf25, read16_delegate(FUNC(offtwall_state::unknown_verify_r),this)); + m_spritecache_count = m_mainram + (0x3fde42 - 0x3fd800)/2; + m_bankswitch_base = (UINT16 *)(memregion("maincpu")->base() + 0x37eca); + m_unknown_verify_base = m_mainram + (0x3fdf24 - 0x3fd800)/2; } diff --git a/src/mame/drivers/policetr.cpp b/src/mame/drivers/policetr.cpp index 9552120ddac..38de22c781d 100644 --- a/src/mame/drivers/policetr.cpp +++ b/src/mame/drivers/policetr.cpp @@ -678,27 +678,31 @@ ROM_END DRIVER_INIT_MEMBER(policetr_state,policetr) { - m_speedup_data = m_maincpu->space(AS_PROGRAM).install_write_handler(0x00000fc8, 0x00000fcb, write32_delegate(FUNC(policetr_state::speedup_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x00000fc8, 0x00000fcb, write32_delegate(FUNC(policetr_state::speedup_w),this)); m_speedup_pc = 0x1fc028ac; + m_speedup_data = m_rambase + 0xfc8/4; } DRIVER_INIT_MEMBER(policetr_state,plctr13b) { - m_speedup_data = m_maincpu->space(AS_PROGRAM).install_write_handler(0x00000fc8, 0x00000fcb, write32_delegate(FUNC(policetr_state::speedup_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x00000fc8, 0x00000fcb, write32_delegate(FUNC(policetr_state::speedup_w),this)); m_speedup_pc = 0x1fc028bc; + m_speedup_data = m_rambase + 0xfc8/4; } DRIVER_INIT_MEMBER(policetr_state,sshooter) { - m_speedup_data = m_maincpu->space(AS_PROGRAM).install_write_handler(0x00018fd8, 0x00018fdb, write32_delegate(FUNC(policetr_state::speedup_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x00018fd8, 0x00018fdb, write32_delegate(FUNC(policetr_state::speedup_w),this)); m_speedup_pc = 0x1fc03470; + m_speedup_data = m_rambase + 0x18fd8/4; } DRIVER_INIT_MEMBER(policetr_state,sshoot12) { - m_speedup_data = m_maincpu->space(AS_PROGRAM).install_write_handler(0x00018fd8, 0x00018fdb, write32_delegate(FUNC(policetr_state::speedup_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x00018fd8, 0x00018fdb, write32_delegate(FUNC(policetr_state::speedup_w),this)); m_speedup_pc = 0x1fc033e0; + m_speedup_data = m_rambase + 0x18fd8/4; } diff --git a/src/mame/drivers/powerins.cpp b/src/mame/drivers/powerins.cpp index 256666a030f..06953b82de4 100644 --- a/src/mame/drivers/powerins.cpp +++ b/src/mame/drivers/powerins.cpp @@ -33,6 +33,7 @@ TODO: #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" +#include "machine/gen_latch.h" #include "sound/okim6295.h" #include "sound/2203intf.h" #include "includes/powerins.h" @@ -65,7 +66,7 @@ static ADDRESS_MAP_START( powerins_map, AS_PROGRAM, 16, powerins_state ) AM_RANGE(0x100014, 0x100015) AM_WRITE8(flipscreen_w, 0x00ff) AM_RANGE(0x100016, 0x100017) AM_WRITENOP // ? always 1 AM_RANGE(0x100018, 0x100019) AM_WRITE8(tilebank_w, 0x00ff) - AM_RANGE(0x10001e, 0x10001f) AM_WRITE8(soundlatch_byte_w, 0x00ff) + AM_RANGE(0x10001e, 0x10001f) AM_DEVWRITE8("soundlatch", generic_latch_8_device, write, 0x00ff) AM_RANGE(0x120000, 0x120fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x130000, 0x130007) AM_RAM AM_SHARE("vctrl_0") AM_RANGE(0x140000, 0x143fff) AM_RAM_WRITE(vram_0_w) AM_SHARE("vram_0") @@ -84,7 +85,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( powerins_sound_map, AS_PROGRAM, 8, powerins_state ) AM_RANGE(0x0000, 0xbfff) AM_ROM AM_RANGE(0xc000, 0xdfff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_byte_r) + AM_RANGE(0xe000, 0xe000) AM_DEVREAD("soundlatch", generic_latch_8_device, read) // AM_RANGE(0xe000, 0xe000) AM_WRITENOP // ? written only once ? // AM_RANGE(0xe001, 0xe001) AM_WRITENOP // ? ADDRESS_MAP_END @@ -321,6 +322,8 @@ static MACHINE_CONFIG_START( powerins, powerins_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_OKIM6295_ADD("oki1", 4000000, OKIM6295_PIN7_LOW) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) diff --git a/src/mame/drivers/rampart.cpp b/src/mame/drivers/rampart.cpp index ef851b8d323..1a5ae9149f8 100644 --- a/src/mame/drivers/rampart.cpp +++ b/src/mame/drivers/rampart.cpp @@ -483,7 +483,7 @@ DRIVER_INIT_MEMBER(rampart_state,rampart) UINT8 *rom = memregion("maincpu")->base(); memcpy(&rom[0x140000], &rom[0x40000], 0x8000); - slapstic_configure(*m_maincpu, 0x140000, 0x438000); + slapstic_configure(*m_maincpu, 0x140000, 0x438000, memregion("maincpu")->base() + 0x140000); } diff --git a/src/mame/drivers/seattle.cpp b/src/mame/drivers/seattle.cpp index 79b56322995..3d9034e1c7b 100644 --- a/src/mame/drivers/seattle.cpp +++ b/src/mame/drivers/seattle.cpp @@ -2701,7 +2701,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( blitz99, seattle150 ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2115, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(2) - MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0afb) +// MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0afb) -- Not in ram??? MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_BLITZ99) @@ -2713,7 +2713,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( blitz2k, seattle150 ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2115, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(2) - MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) +// MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) -- Not in ram??? MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_BLITZ99) @@ -2725,7 +2725,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( carnevil, seattle150 ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2115, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(2) - MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0af7) +// MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0af7) -- Not in ram??? MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_CARNEVIL) @@ -2737,7 +2737,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( hyprdriv, seattle200_widget ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2115, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(2) - MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0af7) +// MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0af7) -- Not in ram??? MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_HYPRDRIV) diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index 56e906d0938..87c7cf2983a 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -284,6 +284,7 @@ segaxbd_state::segaxbd_state(const machine_config &mconfig, const char *tag, dev m_sprites(*this, "sprites"), m_segaic16vid(*this, "segaic16vid"), m_segaic16road(*this, "segaic16road"), + m_subram0(*this, "subram0"), m_road_priority(1), m_scanline_timer(nullptr), m_timer_irq_state(0), @@ -4763,7 +4764,8 @@ void segaxbd_state::install_loffire(void) m_adc_reverse[1] = m_adc_reverse[3] = true; // install sync hack on core shared memory - m_loffire_sync = m_maincpu->space(AS_PROGRAM).install_write_handler(0x29c000, 0x29c011, write16_delegate(FUNC(segaxbd_state::loffire_sync0_w), this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x29c000, 0x29c011, write16_delegate(FUNC(segaxbd_state::loffire_sync0_w), this)); + m_loffire_sync = m_subram0; } diff --git a/src/mame/drivers/sfkick.cpp b/src/mame/drivers/sfkick.cpp index 8866fcece35..d5df1f84698 100644 --- a/src/mame/drivers/sfkick.cpp +++ b/src/mame/drivers/sfkick.cpp @@ -6,7 +6,7 @@ driver by Tomasz Slanina Hacked MSX2 home computer hardware. Romset contains - modifed ( (c) strings removed and patched boot sequence) + modified ( (c) strings removed and patched boot sequence) MSX2 bios. Yamaha VDP v9938 is hidden in huge epoxy block. There's also an additional Z80 to drive sound. @@ -155,6 +155,7 @@ DIPSW-2 #include "emu.h" #include "cpu/z80/z80.h" #include "video/v9938.h" +#include "machine/gen_latch.h" #include "machine/i8255.h" #include "sound/2203intf.h" @@ -471,7 +472,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sfkick_io_map, AS_IO, 8, sfkick_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE( 0xa0, 0xa7) AM_WRITE(soundlatch_byte_w ) + AM_RANGE( 0xa0, 0xa7) AM_DEVWRITE("soundlatch", generic_latch_8_device, write) AM_RANGE( 0x98, 0x9b) AM_DEVREADWRITE( "v9938", v9938_device, read, write) AM_RANGE( 0xa8, 0xab) AM_DEVREADWRITE("ppi8255", i8255_device, read, write) AM_RANGE( 0xb4, 0xb5) AM_RAM /* loopback ? req by sfkicka (MSX Bios leftover)*/ @@ -484,7 +485,7 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( sfkick_sound_io_map, AS_IO, 8, sfkick_state ) ADDRESS_MAP_GLOBAL_MASK(0xff) - AM_RANGE(0x00, 0x00) AM_READ(soundlatch_byte_r) + AM_RANGE(0x00, 0x00) AM_DEVREAD("soundlatch", generic_latch_8_device, read) AM_RANGE(0x04, 0x05) AM_DEVREADWRITE("ym1", ym2203_device, read, write) ADDRESS_MAP_END @@ -603,8 +604,12 @@ static MACHINE_CONFIG_START( sfkick, sfkick_state ) MCFG_I8255_OUT_PORTC_CB(WRITE8(sfkick_state, ppi_port_c_w)) MCFG_SPEAKER_STANDARD_MONO("mono") + + MCFG_GENERIC_LATCH_8_ADD("soundlatch") + MCFG_SOUND_ADD("ym1", YM2203, MASTER_CLOCK/6) MCFG_YM2203_IRQ_HANDLER(WRITELINE(sfkick_state, irqhandler)) + MCFG_SOUND_ROUTE(0, "mono", 0.25) MCFG_SOUND_ROUTE(1, "mono", 0.25) MCFG_SOUND_ROUTE(2, "mono", 0.25) diff --git a/src/mame/drivers/sprcros2.cpp b/src/mame/drivers/sprcros2.cpp index 18bdde95287..eb137827c2f 100644 --- a/src/mame/drivers/sprcros2.cpp +++ b/src/mame/drivers/sprcros2.cpp @@ -7,7 +7,6 @@ driver by Angelo Salese, based off "wiped off due of not anymore licenseable" driver by insideoutboy. TODO: - - complete rewrite; - scanline renderer; - understand irq 0 source; - output bit 0 might be watchdog armed bit/sprite start DMA instead of irq enable; diff --git a/src/mame/drivers/vegas.cpp b/src/mame/drivers/vegas.cpp index 0e8e393061a..2754a7afe92 100644 --- a/src/mame/drivers/vegas.cpp +++ b/src/mame/drivers/vegas.cpp @@ -2313,7 +2313,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gauntleg, vegas ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(4) - MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) +// MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) -- Not in ram??? MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_CALSPEED) @@ -2326,7 +2326,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( gauntdl, vegas ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(4) - MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) +// MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) -- Not in ram??? MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_GAUNTDL) @@ -2339,7 +2339,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( warfa, vegas250 ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(4) - MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) +// MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0b5d) -- Not in ram??? MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_MACE) @@ -2352,7 +2352,7 @@ MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( tenthdeg, vegas ) MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2104, 0) MCFG_DCS2_AUDIO_DRAM_IN_MB(4) - MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0afb) +// MCFG_DCS2_AUDIO_POLLING_OFFSET(0x0afb) -- Not in ram??? MCFG_DEVICE_ADD("ioasic", MIDWAY_IOASIC, 0) MCFG_MIDWAY_IOASIC_SHUFFLE(MIDWAY_IOASIC_GAUNTDL) diff --git a/src/mame/drivers/williams.cpp b/src/mame/drivers/williams.cpp index 0fbc1ae352e..446404fe8c3 100644 --- a/src/mame/drivers/williams.cpp +++ b/src/mame/drivers/williams.cpp @@ -2997,7 +2997,8 @@ DRIVER_INIT_MEMBER(williams_state,mayday) CONFIGURE_BLITTER(WILLIAMS_BLITTER_NONE, 0x0000); /* install a handler to catch protection checks */ - m_mayday_protection = m_maincpu->space(AS_PROGRAM).install_read_handler(0xa190, 0xa191, read8_delegate(FUNC(williams_state::mayday_protection_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0xa190, 0xa191, read8_delegate(FUNC(williams_state::mayday_protection_r),this)); + m_mayday_protection = m_videoram + 0xa190; } diff --git a/src/mame/drivers/xybots.cpp b/src/mame/drivers/xybots.cpp index 6c265b59611..7f7114075de 100644 --- a/src/mame/drivers/xybots.cpp +++ b/src/mame/drivers/xybots.cpp @@ -393,7 +393,7 @@ ROM_END DRIVER_INIT_MEMBER(xybots_state,xybots) { m_h256 = 0x0400; - slapstic_configure(*m_maincpu, 0x008000, 0); + slapstic_configure(*m_maincpu, 0x008000, 0, memregion("maincpu")->base() + 0x8000); } diff --git a/src/mame/includes/alpha68k.h b/src/mame/includes/alpha68k.h index 22fb75f2d21..1f7be2884f0 100644 --- a/src/mame/includes/alpha68k.h +++ b/src/mame/includes/alpha68k.h @@ -6,6 +6,8 @@ *************************************************************************/ +#include "machine/gen_latch.h" + class alpha68k_state : public driver_device { public: @@ -17,7 +19,8 @@ public: m_audiocpu(*this, "audiocpu"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ optional_shared_ptr<UINT16> m_shared_ram; @@ -121,6 +124,7 @@ public: required_device<cpu_device> m_maincpu; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + required_device<generic_latch_8_device> m_soundlatch; }; /* game_id - used to deal with a few game specific situations */ diff --git a/src/mame/includes/chihiro.h b/src/mame/includes/chihiro.h index 3705299c919..90757bb4cbc 100644 --- a/src/mame/includes/chihiro.h +++ b/src/mame/includes/chihiro.h @@ -356,6 +356,11 @@ public: FRONT_AND_BACK = 0x0408 }; + struct nv2avertex_t : public vertex_t + { + float w; + }; + nv2a_renderer(running_machine &machine) : poly_manager<float, nvidia_object_data, 13, 8192>(machine) { memset(channel, 0, sizeof(channel)); @@ -444,7 +449,7 @@ public: int geforce_exec_method(address_space &space, UINT32 channel, UINT32 subchannel, UINT32 method, UINT32 address, int &countlen); UINT32 texture_get_texel(int number, int x, int y); UINT8 *read_pixel(int x, int y, INT32 c[4]); - void write_pixel(int x, int y, UINT32 color, UINT32 depth); + void write_pixel(int x, int y, UINT32 color, int depth); void combiner_initialize_registers(UINT32 argb8[6]); void combiner_initialize_stage(int stage_number); void combiner_initialize_final(); @@ -483,9 +488,9 @@ public: int read_vertices_0x1808(address_space & space, vertex_nv *destination, UINT32 address, int limit); int read_vertices_0x1810(address_space & space, vertex_nv *destination, int offset, int limit); int read_vertices_0x1818(address_space & space, vertex_nv *destination, UINT32 address, int limit); - void convert_vertices_poly(vertex_nv *source, vertex_t *destination, int count); + void convert_vertices_poly(vertex_nv *source, nv2avertex_t *destination, int count); void assemble_primitive(vertex_nv *source, int count, render_delegate &renderspans); - UINT32 render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const vertex_t &_v1, const vertex_t &_v2, const vertex_t &_v3); + UINT32 render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const nv2avertex_t &_v1, const nv2avertex_t &_v2, const nv2avertex_t &_v3); void clear_render_target(int what, UINT32 value); void clear_depth_buffer(int what, UINT32 value); inline UINT8 *direct_access_ptr(offs_t address); @@ -566,7 +571,7 @@ public: unsigned int vertex_first; int vertex_accumulated; vertex_nv vertex_software[1024+2]; // vertex attributes sent by the software to the 3d accelerator - vertex_t vertex_xy[1024+2]; // vertex attributes computed by the 3d accelerator + nv2avertex_t vertex_xy[1024+2]; // vertex attributes computed by the 3d accelerator vertex_nv persistvertexattr; // persistent vertex attributes render_delegate render_spans_callback; diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h index ca41361bd39..9b8d33a90a1 100644 --- a/src/mame/includes/cps1.h +++ b/src/mame/includes/cps1.h @@ -219,8 +219,8 @@ public: int m_sprite_base; int m_sprite_list_end_marker; int m_sprite_x_offset; - UINT16 *m_bootleg_sprite_ram; - UINT16 *m_bootleg_work_ram; + std::unique_ptr<UINT16[]> m_bootleg_sprite_ram; + std::unique_ptr<UINT16[]> m_bootleg_work_ram; /* devices */ required_device<m68000_base_device> m_maincpu; diff --git a/src/mame/includes/eprom.h b/src/mame/includes/eprom.h index 4ae11d35d18..7d3cdad1aac 100644 --- a/src/mame/includes/eprom.h +++ b/src/mame/includes/eprom.h @@ -28,7 +28,7 @@ public: required_device<atari_jsa_base_device> m_jsa; int m_screen_intensity; int m_video_disable; - UINT16 * m_sync_data; + UINT16 m_sync_data; int m_last_offset; virtual void update_interrupts() override; virtual void scanline_update(screen_device &screen, int scanline) override; diff --git a/src/mame/includes/equites.h b/src/mame/includes/equites.h index a3808e6265a..650b102187a 100644 --- a/src/mame/includes/equites.h +++ b/src/mame/includes/equites.h @@ -7,6 +7,7 @@ *************************************************************************/ #include "machine/alpha8201.h" +#include "machine/gen_latch.h" #include "sound/samples.h" #include "sound/msm5232.h" #include "sound/dac.h" @@ -31,7 +32,8 @@ public: m_fakemcu(*this, "mcu"), m_msm(*this, "msm"), m_dac_1(*this, "dac1"), - m_dac_2(*this, "dac2") + m_dac_2(*this, "dac2"), + m_soundlatch(*this, "soundlatch") { } /* memory pointers */ @@ -77,6 +79,7 @@ public: required_device<msm5232_device> m_msm; required_device<dac_device> m_dac_1; required_device<dac_device> m_dac_2; + required_device<generic_latch_8_device> m_soundlatch; DECLARE_WRITE8_MEMBER(equites_c0f8_w); DECLARE_WRITE8_MEMBER(equites_cymbal_ctrl_w); diff --git a/src/mame/includes/exidy440.h b/src/mame/includes/exidy440.h index e6f7048ac8a..bd14408d774 100644 --- a/src/mame/includes/exidy440.h +++ b/src/mame/includes/exidy440.h @@ -39,7 +39,7 @@ public: UINT8 m_showdown_bank_offset; UINT8 m_firq_vblank; UINT8 m_firq_beam; - UINT8 *m_topsecex_yscroll; + UINT8 m_topsecex_yscroll; UINT8 m_latched_x; std::unique_ptr<UINT8[]> m_local_videoram; std::unique_ptr<UINT8[]> m_local_paletteram; diff --git a/src/mame/includes/gamecom.h b/src/mame/includes/gamecom.h index e9f8829ab79..35cf3dea54f 100644 --- a/src/mame/includes/gamecom.h +++ b/src/mame/includes/gamecom.h @@ -240,6 +240,8 @@ public: DECLARE_PALETTE_INIT(gamecom); INTERRUPT_GEN_MEMBER(gamecom_interrupt); TIMER_CALLBACK_MEMBER(gamecom_clock_timer_callback); + TIMER_CALLBACK_MEMBER(gamecom_sound0_timer_callback); + TIMER_CALLBACK_MEMBER(gamecom_sound1_timer_callback); TIMER_CALLBACK_MEMBER(gamecom_scanline); DECLARE_WRITE8_MEMBER( gamecom_handle_dma ); DECLARE_WRITE8_MEMBER( gamecom_update_timers ); @@ -252,11 +254,15 @@ private: UINT8 m_lcdc_reg; UINT8 m_lch_reg; UINT8 m_lcv_reg; + UINT8 m_sound0_cnt; + UINT8 m_sound1_cnt; UINT16 m_scanline; UINT16 m_base_address; memory_region *m_cart1_rom; memory_region *m_cart2_rom; emu_timer *m_clock_timer; + emu_timer *m_sound0_timer; + emu_timer *m_sound1_timer; emu_timer *m_scanline_timer; GAMECOM_DMA m_dma; GAMECOM_TIMER m_timer[2]; diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index bb722df2700..95dccfd57b2 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -287,6 +287,8 @@ protected: optional_shared_ptr<UINT32> m_ds3sdsp_pgm_memory; optional_shared_ptr<UINT32> m_ds3xdsp_pgm_memory; + optional_shared_ptr<UINT32> m_dsp32_ram; + UINT16 * m_gsp_protection; UINT16 * m_gsp_speedup_addr[2]; @@ -306,7 +308,7 @@ protected: UINT32 m_adsp_speedup_count[4]; UINT8 m_gsp_multisync; - optional_shared_ptr<UINT8> m_gsp_vram; + optional_shared_ptr<UINT8> m_gsp_vram; optional_shared_ptr<UINT16> m_gsp_control_lo; optional_shared_ptr<UINT16> m_gsp_control_hi; optional_shared_ptr<UINT16> m_gsp_paletteram_lo; diff --git a/src/mame/includes/jaguar.h b/src/mame/includes/jaguar.h index ed48210795b..8952d793348 100644 --- a/src/mame/includes/jaguar.h +++ b/src/mame/includes/jaguar.h @@ -44,6 +44,7 @@ public: m_gpu_ram(*this, "gpuram"), m_gpu_clut(*this, "gpuclut"), m_romboard_region(*this, "romboard"), + m_mainram(*this, "mainram"), m_is_r3000(false), m_is_cojag(false), m_hacks_enabled(false), @@ -85,6 +86,7 @@ public: required_shared_ptr<UINT32> m_gpu_ram; required_shared_ptr<UINT32> m_gpu_clut; optional_memory_region m_romboard_region; + optional_shared_ptr<UINT32> m_mainram; // configuration bool m_is_r3000; diff --git a/src/mame/includes/leland.h b/src/mame/includes/leland.h index ab2133cef3b..7abe1e4b6a3 100644 --- a/src/mame/includes/leland.h +++ b/src/mame/includes/leland.h @@ -31,6 +31,7 @@ public: : driver_device(mconfig, type, tag), m_master(*this, "master"), m_slave(*this, "slave"), + m_mainram(*this, "mainram"), m_eeprom(*this, "eeprom"), m_sound(*this, "custom"), m_dac0(*this, "dac0"), @@ -40,6 +41,7 @@ public: required_device<cpu_device> m_master; required_device<cpu_device> m_slave; + required_shared_ptr<UINT8> m_mainram; required_device<eeprom_serial_93cxx_device> m_eeprom; optional_device<leland_80186_sound_device> m_sound; optional_device<dac_device> m_dac0; diff --git a/src/mame/includes/midwunit.h b/src/mame/includes/midwunit.h index c9a210bca9a..04e808763b9 100644 --- a/src/mame/includes/midwunit.h +++ b/src/mame/includes/midwunit.h @@ -15,11 +15,13 @@ public: : midtunit_state(mconfig, type, tag), m_midway_serial_pic(*this, "serial_pic"), m_nvram(*this, "nvram"), + m_mainram(*this, "mainram"), m_ports(*this, wunit_ports) { } required_device<midway_serial_pic_device> m_midway_serial_pic; required_shared_ptr<UINT16> m_nvram; + required_shared_ptr<UINT16> m_mainram; required_ioport_array<4> m_ports; DECLARE_IOPORT_ARRAY(wunit_ports); diff --git a/src/mame/includes/midyunit.h b/src/mame/includes/midyunit.h index b6b03c975bf..9ce2a855954 100644 --- a/src/mame/includes/midyunit.h +++ b/src/mame/includes/midyunit.h @@ -52,6 +52,7 @@ public: m_adpcm_sound(*this, "adpcm"), m_generic_paletteram_16(*this, "paletteram"), m_gfx_rom(*this, "gfx_rom", 16), + m_mainram(*this, "mainram"), m_ports(*this, ports) { } required_device<cpu_device> m_maincpu; @@ -64,7 +65,7 @@ public: required_shared_ptr<UINT16> m_generic_paletteram_16; optional_shared_ptr<UINT8> m_gfx_rom; - + required_shared_ptr<UINT16> m_mainram; optional_ioport_array<6> m_ports; DECLARE_IOPORT_ARRAY(ports); diff --git a/src/mame/includes/offtwall.h b/src/mame/includes/offtwall.h index 1e8ce7c8441..cc10b135c80 100644 --- a/src/mame/includes/offtwall.h +++ b/src/mame/includes/offtwall.h @@ -17,10 +17,12 @@ public: : atarigen_state(mconfig, type, tag), m_jsa(*this, "jsa"), m_vad(*this, "vad"), + m_mainram(*this, "mainram"), m_bankrom_base(*this, "bankrom_base") { } required_device<atari_jsa_iii_device> m_jsa; required_device<atari_vad_device> m_vad; + required_shared_ptr<UINT16> m_mainram; UINT16 *m_bankswitch_base; required_shared_ptr<UINT16> m_bankrom_base; diff --git a/src/mame/includes/segaxbd.h b/src/mame/includes/segaxbd.h index dfc6b503bef..8fe15bdc04a 100644 --- a/src/mame/includes/segaxbd.h +++ b/src/mame/includes/segaxbd.h @@ -106,6 +106,7 @@ protected: required_device<sega_xboard_sprite_device> m_sprites; required_device<segaic16_video_device> m_segaic16vid; required_device<segaic16_road_device> m_segaic16road; + required_shared_ptr<UINT16> m_subram0; // configuration bool m_adc_reverse[8]; diff --git a/src/mame/layout/gamecom.lay b/src/mame/layout/gamecom.lay index 6cb50665d75..76d1e536783 100644 --- a/src/mame/layout/gamecom.lay +++ b/src/mame/layout/gamecom.lay @@ -43,7 +43,7 @@ <bounds x="176" y="0" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x01" > - <bounds x="192" y="0" width="16" height="16" /> + <bounds x="192" y="0" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x02" > @@ -83,7 +83,7 @@ <bounds x="176" y="16" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x02" > - <bounds x="192" y="16" width="16" height="16" /> + <bounds x="192" y="16" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x04" > @@ -123,7 +123,7 @@ <bounds x="176" y="32" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x04" > - <bounds x="192" y="32" width="16" height="16" /> + <bounds x="192" y="32" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x08" > @@ -163,7 +163,7 @@ <bounds x="176" y="48" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x08" > - <bounds x="192" y="48" width="16" height="16" /> + <bounds x="192" y="48" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x10" > @@ -203,7 +203,7 @@ <bounds x="176" y="64" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x10" > - <bounds x="192" y="64" width="16" height="16" /> + <bounds x="192" y="64" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x20" > @@ -243,7 +243,7 @@ <bounds x="176" y="80" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x20" > - <bounds x="192" y="80" width="16" height="16" /> + <bounds x="192" y="80" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x40" > @@ -283,7 +283,7 @@ <bounds x="176" y="96" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x40" > - <bounds x="192" y="96" width="16" height="16" /> + <bounds x="192" y="96" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x80" > @@ -323,7 +323,7 @@ <bounds x="176" y="112" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x80" > - <bounds x="192" y="112" width="16" height="16" /> + <bounds x="192" y="112" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x100" > @@ -363,7 +363,7 @@ <bounds x="176" y="128" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x100" > - <bounds x="192" y="128" width="16" height="16" /> + <bounds x="192" y="128" width="8" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.0" inputmask="0x200" > @@ -403,10 +403,10 @@ <bounds x="176" y="144" width="16" height="16" /> </backdrop> <backdrop element="grid" inputtag="GRID.12" inputmask="0x200" > - <bounds x="192" y="144" width="16" height="16" /> + <bounds x="192" y="144" width="8" height="16" /> </backdrop> <screen index="0"> - <bounds left="0" top="0" right="208" bottom="160" /> + <bounds left="0" top="0" right="200" bottom="160" /> </screen> </view> diff --git a/src/mame/layout/raisedvl.lay b/src/mame/layout/raisedvl.lay new file mode 100644 index 00000000000..d4618cfc29b --- /dev/null +++ b/src/mame/layout/raisedvl.lay @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- define elements --> + + <element name="digit" defstate="0"> + <led7seg><color red="1.0" green="0.20" blue="0.22" /></led7seg> + </element> + + <element name="led" defstate="0"> + <disk state="0"><color red="0.14" green="0.02" blue="0.03" /></disk> + <disk state="1"><color red="1.0" green="0.20" blue="0.22" /></disk> + </element> + + +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="52" right="247" top="6" bottom="342" /> + + <bezel name="digit2" element="digit"><bounds x="121" y="318" width="13" height="20" /></bezel> + <bezel name="digit1" element="digit"><bounds x="134" y="318" width="13" height="20" /></bezel> + <bezel name="digit0" element="digit"><bounds x="147" y="318" width="13" height="20" /></bezel> + <bezel element="digit"><bounds x="160" y="318" width="13" height="20" /></bezel> <!-- unconnected --> + + <bezel name="lamp40" element="led"><bounds x="162" y="12" width="6" height="6" /></bezel> + <bezel name="lamp41" element="led"><bounds x="118" y="12" width="6" height="6" /></bezel> + + <bezel name="lamp42" element="led"><bounds x="63" y="47" width="6" height="6" /></bezel> + <bezel name="lamp43" element="led"><bounds x="99" y="58" width="6" height="6" /></bezel> + <bezel name="lamp44" element="led"><bounds x="140" y="58" width="6" height="6" /></bezel> + <bezel name="lamp45" element="led"><bounds x="184" y="58" width="6" height="6" /></bezel> + <bezel name="lamp34" element="led"><bounds x="217" y="47" width="6" height="6" /></bezel> + + <bezel name="lamp30" element="led"><bounds x="235" y="226" width="6" height="6" /></bezel> + <bezel name="lamp31" element="led"><bounds x="235" y="190" width="6" height="6" /></bezel> + <bezel name="lamp32" element="led"><bounds x="235" y="154" width="6" height="6" /></bezel> + <bezel name="lamp33" element="led"><bounds x="235" y="119" width="6" height="6" /></bezel> + + <bezel name="lamp50" element="led"><bounds x="176" y="98" width="6" height="6" /></bezel> + <bezel name="lamp51" element="led"><bounds x="140" y="110" width="6" height="6" /></bezel> + <bezel name="lamp52" element="led"><bounds x="103" y="98" width="6" height="6" /></bezel> + + <bezel name="lamp72" element="led"><bounds x="126" y="141" width="6" height="6" /></bezel> + <bezel name="lamp73" element="led"><bounds x="153" y="141" width="6" height="6" /></bezel> + <bezel name="lamp54" element="led"><bounds x="103" y="165" width="6" height="6" /></bezel> + <bezel name="lamp74" element="led"><bounds x="140" y="177" width="6" height="6" /></bezel> + <bezel name="lamp53" element="led"><bounds x="176" y="165" width="6" height="6" /></bezel> + + <bezel name="lamp64" element="led"><bounds x="58" y="233" width="6" height="6" /></bezel> + <bezel name="lamp60" element="led"><bounds x="89" y="201" width="6" height="6" /></bezel> + <bezel name="lamp63" element="led"><bounds x="140" y="231" width="6" height="6" /></bezel> + <bezel name="lamp61" element="led"><bounds x="188" y="201" width="6" height="6" /></bezel> + <bezel name="lamp62" element="led"><bounds x="219" y="233" width="6" height="6" /></bezel> + <bezel name="lamp65" element="led"><bounds x="140" y="293" width="6" height="6" /></bezel> + + <bezel name="lamp84" element="led"><bounds x="113" y="250" width="6" height="6" /></bezel> + <bezel name="lamp94" element="led"><bounds x="165" y="250" width="6" height="6" /></bezel> + + <bezel name="lamp70" element="led"><bounds x="96" y="270" width="6" height="6" /></bezel> + <bezel name="lamp81" element="led"><bounds x="108" y="264" width="6" height="6" /></bezel> + <bezel name="lamp80" element="led"><bounds x="120" y="258" width="6" height="6" /></bezel> + <bezel name="lamp91" element="led"><bounds x="158" y="258" width="6" height="6" /></bezel> + <bezel name="lamp90" element="led"><bounds x="170" y="264" width="6" height="6" /></bezel> + <bezel name="lamp71" element="led"><bounds x="180" y="270" width="6" height="6" /></bezel> + + <bezel name="lamp82" element="led"><bounds x="108" y="276" width="6" height="6" /></bezel> + <bezel name="lamp85" element="led"><bounds x="120" y="271" width="6" height="6" /></bezel> + <bezel name="lamp95" element="led"><bounds x="158" y="271" width="6" height="6" /></bezel> + <bezel name="lamp93" element="led"><bounds x="170" y="276" width="6" height="6" /></bezel> + + <bezel name="lamp83" element="led"><bounds x="120" y="282" width="6" height="6" /></bezel> + <bezel name="lamp92" element="led"><bounds x="158" y="282" width="6" height="6" /></bezel> + + </view> +</mamelayout> diff --git a/src/mame/machine/atarigen.cpp b/src/mame/machine/atarigen.cpp index 65440d1a19f..0cd8bac7c0c 100644 --- a/src/mame/machine/atarigen.cpp +++ b/src/mame/machine/atarigen.cpp @@ -1212,7 +1212,7 @@ DIRECT_UPDATE_MEMBER(atarigen_state::slapstic_setdirect) // slapstic and sets the chip number. //------------------------------------------------- -void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t mirror) +void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, UINT8 *mem) { if (!m_slapstic_device.found()) fatalerror("Slapstic device is missing\n"); @@ -1223,8 +1223,9 @@ void atarigen_state::slapstic_configure(cpu_device &device, offs_t base, offs_t // install the memory handlers address_space &program = device.space(AS_PROGRAM); - m_slapstic = program.install_readwrite_handler(base, base + 0x7fff, 0, mirror, read16_delegate(FUNC(atarigen_state::slapstic_r), this), write16_delegate(FUNC(atarigen_state::slapstic_w), this)); + program.install_readwrite_handler(base, base + 0x7fff, 0, mirror, read16_delegate(FUNC(atarigen_state::slapstic_r), this), write16_delegate(FUNC(atarigen_state::slapstic_w), this)); program.set_direct_update_handler(direct_update_delegate(FUNC(atarigen_state::slapstic_setdirect), this)); + m_slapstic = (UINT16 *)mem; // allocate memory for a copy of bank 0 m_slapstic_bank0.resize(0x2000); diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h index 0266d2bd458..78369ddd506 100644 --- a/src/mame/machine/atarigen.h +++ b/src/mame/machine/atarigen.h @@ -355,7 +355,7 @@ public: DECLARE_WRITE16_MEMBER(video_int_ack_w); // slapstic helpers - void slapstic_configure(cpu_device &device, offs_t base, offs_t mirror); + void slapstic_configure(cpu_device &device, offs_t base, offs_t mirror, UINT8 *mem); void slapstic_update_bank(int bank); DECLARE_DIRECT_UPDATE_MEMBER(slapstic_setdirect); DECLARE_WRITE16_MEMBER(slapstic_w); diff --git a/src/mame/machine/gamecom.cpp b/src/mame/machine/gamecom.cpp index ccea541a48c..9246879b274 100644 --- a/src/mame/machine/gamecom.cpp +++ b/src/mame/machine/gamecom.cpp @@ -14,6 +14,46 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_clock_timer_callback) m_maincpu->set_input_line(sm8500_cpu_device::CK_INT, ASSERT_LINE ); } +TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_sound0_timer_callback) +{ + if (m_sound0_cnt > 0x3f) + { + if (m_sound.sg0t > 0) + { + m_sound0_timer->adjust(attotime::from_hz(2764800/m_sound.sg0t), 0, attotime::from_hz(2764800/m_sound.sg0t)); + if ((m_sound.sgc & 0x81) == 0x81) + m_sound0_cnt = 0; + } + } + if (m_sound0_cnt < 0x40) + { + bool which_half = BIT(m_sound0_cnt, 0); + UINT8 sb = m_sound.sg0w[m_sound0_cnt >> 1]; + m_dac->write_unsigned8((which_half ? sb >> 4 : sb & 15)^8); + m_sound0_cnt++; + } +} + +TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_sound1_timer_callback) +{ + if (m_sound1_cnt > 0x3f) + { + if (m_sound.sg1t > 0) + { + m_sound1_timer->adjust(attotime::from_hz(2764800/m_sound.sg1t), 0, attotime::from_hz(2764800/m_sound.sg1t)); + if ((m_sound.sgc & 0x82) == 0x82) + m_sound1_cnt = 0; + } + } + if (m_sound1_cnt < 0x40) + { + bool which_half = BIT(m_sound1_cnt, 0); + UINT8 sb = m_sound.sg1w[m_sound1_cnt >> 1]; + m_dac->write_unsigned8((which_half ? sb >> 4 : sb & 15)^8); + m_sound1_cnt++; + } +} + void gamecom_state::machine_reset() { UINT8 *rom = m_region_kernel->base(); @@ -26,6 +66,8 @@ void gamecom_state::machine_reset() m_lch_reg = 0x07; m_lcv_reg = 0x27; m_lcdc_reg = 0xb0; + m_sound0_cnt = 0x40; + m_sound1_cnt = 0x40; std::string region_tag; m_cart1_rom = memregion(region_tag.assign(m_cart1->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); @@ -561,7 +603,7 @@ WRITE8_MEMBER( gamecom_state::gamecom_update_timers ) if ( m_p_ram[SM8521_TM0D] >= m_timer[0].check_value ) { m_p_ram[SM8521_TM0D] = 0; - m_maincpu->set_input_line(sm8500_cpu_device::TIM0_INT, ASSERT_LINE ); +// m_maincpu->set_input_line(sm8500_cpu_device::TIM0_INT, ASSERT_LINE ); // this causes crazy flickering } } } @@ -584,6 +626,10 @@ WRITE8_MEMBER( gamecom_state::gamecom_update_timers ) DRIVER_INIT_MEMBER(gamecom_state,gamecom) { m_clock_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_clock_timer_callback),this)); + m_sound0_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_sound0_timer_callback),this)); + m_sound1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gamecom_state::gamecom_sound1_timer_callback),this)); + m_sound0_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_sound1_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); m_p_ram = m_region_maincpu->base(); // required here because pio_w gets called before machine_reset } diff --git a/src/mame/machine/midtunit.cpp b/src/mame/machine/midtunit.cpp index 3983d15f9be..0be5b22609e 100644 --- a/src/mame/machine/midtunit.cpp +++ b/src/mame/machine/midtunit.cpp @@ -13,10 +13,6 @@ #include "includes/midtunit.h" -/* compile-time constants */ -#define ENABLE_ALL_JDREDD_LEVELS 0 - - /* constant definitions */ #define SOUND_ADPCM 1 #define SOUND_ADPCM_LARGE 2 @@ -351,21 +347,6 @@ READ16_MEMBER(midtunit_state::jdredd_prot_r) } -#if ENABLE_ALL_JDREDD_LEVELS -static UINT16 *jdredd_hack; -READ16_MEMBER(midtunit_state::jdredd_hack_r) -{ - if (space.device().safe_pc() == 0xFFBA7EB0) - { - fprintf(stderr, "jdredd_hack_r\n"); - return 0; - } - - return jdredd_hack[offset]; -} -#endif - - /************************************* * @@ -466,11 +447,6 @@ DRIVER_INIT_MEMBER(midtunit_state,jdreddp) machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_read_bank(0xfbcf, 0xfbf9, "bank7"); machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_write_bank(0xfbcf, 0xfbf9, "bank9"); membank("adpcm:bank9")->set_base(auto_alloc_array(machine(), UINT8, 0x80)); - -#if ENABLE_ALL_JDREDD_LEVELS - /* how about the final levels? */ - jdredd_hack = m_maincpu->space(AS_PROGRAM).install_read_handler(0xFFBA7FF0, 0xFFBA7FFf, read16_delegate(FUNC(midtunit_state::jdredd_hack_r), this)); -#endif } diff --git a/src/mame/machine/midwunit.cpp b/src/mame/machine/midwunit.cpp index 0c0cf03bec8..98b1f02efe2 100644 --- a/src/mame/machine/midwunit.cpp +++ b/src/mame/machine/midwunit.cpp @@ -218,13 +218,15 @@ DRIVER_INIT_MEMBER(midwunit_state,mk3r10) DRIVER_INIT_MEMBER(midwunit_state,umk3) { init_mk3_common(); - m_umk3_palette = m_maincpu->space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f, write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f, write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this)); + m_umk3_palette = m_mainram + (0x6a060>>4); } DRIVER_INIT_MEMBER(midwunit_state,umk3r11) { init_mk3_common(); - m_umk3_palette = m_maincpu->space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f,write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f,write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this)); + m_umk3_palette = m_mainram + (0x6a060>>4); } diff --git a/src/mame/machine/midyunit.cpp b/src/mame/machine/midyunit.cpp index 979cca8548c..80d4c8efb5c 100644 --- a/src/mame/machine/midyunit.cpp +++ b/src/mame/machine/midyunit.cpp @@ -504,7 +504,8 @@ void midyunit_state::term2_init_common(write16_delegate hack_w) /* HACK: this prevents the freeze on the movies */ /* until we figure what's causing it, this is better than nothing */ - m_t2_hack_mem = m_maincpu->space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x010aa0e0, 0x010aa0ff, hack_w); + m_t2_hack_mem = m_mainram + (0xaa0e0>>4); } DRIVER_INIT_MEMBER(midyunit_state,term2) { term2_init_common(write16_delegate(FUNC(midyunit_state::term2_hack_w),this)); } diff --git a/src/mame/mame.lst b/src/mame/mame.lst index a1946b359b0..89f04812887 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -16913,6 +16913,7 @@ spotty // (c) 2001 Prince Co. abclimax // ghostsev // hotd4 // +hotd4a // hotdex // hummerxt // initiad4 // @@ -19647,6 +19648,7 @@ dodgectya // (c) 1986 Merit dodgectyb // (c) 1986 Merit dodgectyc // (c) 1986 Merit dtrvwz5 // (c) 1987 Merit +iowapp // (c) 1990 Merit misdraw // (c) 1986 Merit / Big Apple Games mroundup // (c) 1984 Merit phrcraze // (c) 1986 Merit @@ -27903,8 +27905,8 @@ confmiss // 2000.10.11 Confidential Mission // Fi crackndj // 2000.10 Crackin' DJ crakndj2 // 2001.06 Crackin' DJ Part 2 crzytaxi // 1999.02 Crazy Taxi -csmash // 2000.?? Cosmic Smash -csmasho // 2000.?? Cosmic Smash (original) +csmash // 2000.?? Cosmic Smash (Rev A) +csmasho // 2000.?? Cosmic Smash cspike // 2000.10 Gun Spike / Cannon Spike cvs2gd // 2001.07.05 Capcom Vs. SNK 2 Millionaire Fighting 2001 (Rev A) cvsgd // 2001.05 Capcom Vs. SNK Millennium Fight 2000 Pro @@ -27950,8 +27952,8 @@ gwing2 // 2000.?? Giga Wing 2 hmgeo // 2001.06 Heavy Metal Geomatrix (Rev B) hod2bios // 1998.11 The House of the Dead 2 (BIOS) hopper // 2002.?? SWP Hopper Board -hotd2 // 1998.11 The House of the Dead 2 -hotd2o // 1998.11 The House of the Dead 2 (original) +hotd2 // 1998.11 The House of the Dead 2 (USA) +hotd2o // 1998.11 The House of the Dead 2 hotd2p // 1998.11 The House of the Dead 2 (prototype) ikaruga // 2001.12 Ikaruga illvelo // 2008.06 Illvelo (Illmatic Envelope) @@ -27982,7 +27984,7 @@ kurucham // 2006.03 Kurukuru Chameleon lupinsho // 2001.12 Lupin the Third: the Shooting luptype // 2002.04 Lupin The Third - The Typing (Rev A) mamonoro // 2008.07 Mamoru-kun wa Norowarete Shimatta! -manicpnc // 2007.07 Manic Panic Ghosts! +manicpnc // 2007.07 Manic Panic Ghosts! (USA) marstv // 1999.12 Mars TV maxspeed // 2002.12 Maximum Speed mazan // 2002.07 Mazan: Flash of the Blade (US, MAZ3 Ver.A) @@ -28001,7 +28003,7 @@ mtkob2 // 2003.02 MushiKing The King Of Beetle mushi2eo // 2005.?? Mushiking The King Of Beetles II ENG (Ver. 1.001) mushi2k5 // 2005.?? MushiKing The King Of Beetle 2K5 1st mushik2e // 2005.?? Mushiking The King Of Beetles II ENG (Ver. 2.001) -mvsc2 // 2000.03 Marvel Vs. Capcom 2 New Age of Heroes (Rev A) +mvsc2 // 2000.03 Marvel Vs. Capcom 2 New Age of Heroes (Export, Rev A) naomi // 1998.?? Naomi BIOS naomi2 // 2001.?? Naomi 2 BIOS naomigd // 2001.?? Naomi GD-ROM Bios @@ -28102,8 +28104,8 @@ vf4tuned // 2004.12 Virtua Fighter 4 Final Tuned (Rev F) vf4tuneda // 2004.09 Virtua Fighter 4 Final Tuned (Rev A) vf4tunedd // 2004.10 Virtua Fighter 4 Final Tuned (Rev D) vfurlong // 2005.03 Net Select Keiba Victory Furlong -virnba // 2000.02 Virtua NBA -virnbao // 2000.02 Virtua NBA (original) +virnba // 2000.02 Virtua NBA (USA) +virnbao // 2000.02 Virtua NBA virnbap // 2000.02 Virtua NBA (prototype) vonot // 2000.06 Virtual-on Oratorio Tangram M.S.B.S. Ver.5.66 2000 Edition vs2_2k // 1999.08 Virtua Striker 2 version 2000 (Rev C) @@ -28125,7 +28127,7 @@ wldkicksa // 2000.03 World Kicks (Asia, WK2 Ver.A) wldkicksj // 2000.03 World Kicks PCB (Japan, WKC1 Ver.A) wldrider // 2001.05 Wild Riders wrungp // 2001.08 Wave Runner GP -wrungpo // 2001.?? Wave Runner GP (original, Rev A) +wrungpo // 2001.?? Wave Runner GP (USA, Rev A) wsbbgd // 2001.06 Super Major League / World Series Baseball wwfroyal // 2000.11 WWF Royal Rumble xtrmhnt2 // 2006.09 Extreme Hunting 2 Tournament Edition diff --git a/src/mame/video/chihiro.cpp b/src/mame/video/chihiro.cpp index 1d6ae58bb90..4430eff2a65 100644 --- a/src/mame/video/chihiro.cpp +++ b/src/mame/video/chihiro.cpp @@ -1306,7 +1306,7 @@ inline UINT8 *nv2a_renderer::read_pixel(int x, int y, INT32 c[4]) return nullptr; } -void nv2a_renderer::write_pixel(int x, int y, UINT32 color, UINT32 depth) +void nv2a_renderer::write_pixel(int x, int y, UINT32 color, int depth) { UINT8 *addr; UINT32 *daddr32; @@ -1317,6 +1317,8 @@ void nv2a_renderer::write_pixel(int x, int y, UINT32 color, UINT32 depth) bool stencil_passed; bool depth_passed; + if ((depth > 0xffffff) || (depth < 0)) + return; fb[3] = fb[2] = fb[1] = fb[0] = 0; addr = nullptr; if (color_mask != 0) @@ -1341,8 +1343,6 @@ void nv2a_renderer::write_pixel(int x, int y, UINT32 color, UINT32 depth) dep = 0xffffff; sten = 0; } - if (depth > 0xffffff) - depth = 0xffffff; c[3] = color >> 24; c[2] = (color >> 16) & 255; c[1] = (color >> 8) & 255; @@ -1914,7 +1914,7 @@ void nv2a_renderer::render_color(INT32 scanline, const extent_t &extent, const n x = extent.stopx - extent.startx - 1; // number of pixels to draw while (x >= 0) { UINT32 a8r8g8b8; - UINT32 z; + int z; int ca, cr, cg, cb; int xp = extent.startx + x; // x coordinate of current pixel @@ -1933,7 +1933,7 @@ void nv2a_renderer::render_texture_simple(INT32 scanline, const extent_t &extent { int x; UINT32 a8r8g8b8; - UINT32 z; + int z; if (!objectdata.data->texture[0].enabled) { return; @@ -1967,8 +1967,8 @@ void nv2a_renderer::render_register_combiners(INT32 scanline, const extent_t &ex int ca, cr, cg, cb; UINT32 color[6]; UINT32 a8r8g8b8; - UINT32 z; - int n;//,m,i,j,k; + int z; + int n; color[0] = color[1] = color[2] = color[3] = color[4] = color[5] = 0; @@ -2356,7 +2356,7 @@ void nv2a_renderer::compute_supersample_factors(float &horizontal, float &vertic vertical = my; } -void nv2a_renderer::convert_vertices_poly(vertex_nv *source, vertex_t *destination, int count) +void nv2a_renderer::convert_vertices_poly(vertex_nv *source, nv2avertex_t *destination, int count) { vertex_nv vert[4]; int m, u; @@ -2384,6 +2384,7 @@ void nv2a_renderer::convert_vertices_poly(vertex_nv *source, vertex_t *destinati for (int i = 0; i < 3; i++) { v[i] += matrix.translate[i]; }*/ + destination[m].w = v[3]; destination[m].x = (v[0] / v[3])*supersample_factor_x; // source[m].attribute[0].fv[0]; destination[m].y = (v[1] / v[3])*supersample_factor_y; // source[m].attribute[0].fv[1]; destination[m].p[(int)VERTEX_PARAMETER::PARAM_Z] = v[2] / v[3]; @@ -2401,6 +2402,7 @@ void nv2a_renderer::convert_vertices_poly(vertex_nv *source, vertex_t *destinati vertexprogram.exec.process(vertexprogram.start_instruction, source, vert, count); // copy data for poly.c for (m = 0; m < count; m++) { + destination[m].w = vert[m].attribute[0].fv[3]; destination[m].x = vert[m].attribute[0].fv[0] * supersample_factor_x; destination[m].y = vert[m].attribute[0].fv[1] * supersample_factor_y; for (u = (int)VERTEX_PARAMETER::PARAM_COLOR_B; u <= (int)VERTEX_PARAMETER::PARAM_COLOR_A; u++) // 0=b 1=g 2=r 3=a @@ -2627,11 +2629,13 @@ void nv2a_renderer::clear_depth_buffer(int what, UINT32 value) } } -UINT32 nv2a_renderer::render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const vertex_t &_v1, const vertex_t &_v2, const vertex_t &_v3) +UINT32 nv2a_renderer::render_triangle_culling(const rectangle &cliprect, render_delegate callback, int paramcount, const nv2avertex_t &_v1, const nv2avertex_t &_v2, const nv2avertex_t &_v3) { float areax2; NV2A_GL_CULL_FACE face = NV2A_GL_CULL_FACE::FRONT; + if ((_v1.w <= 0) || (_v2.w <= 0) || (_v3.w <= 0)) // remove, for now + return 0; if (backface_culling_enabled == false) return render_triangle(cliprect, callback, paramcount, _v1, _v2, _v3); if (backface_culling_culled == NV2A_GL_CULL_FACE::FRONT_AND_BACK) diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp index 94472bde421..be48b07c490 100644 --- a/src/mame/video/exidy440.cpp +++ b/src/mame/video/exidy440.cpp @@ -57,7 +57,7 @@ VIDEO_START_MEMBER(exidy440_state,topsecex) { VIDEO_START_CALL_MEMBER(exidy440); - *m_topsecex_yscroll = 0; + m_topsecex_yscroll = 0; } @@ -442,7 +442,7 @@ UINT32 exidy440_state::screen_update_exidy440(screen_device &screen, bitmap_ind1 UINT32 exidy440_state::screen_update_topsecex(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* redraw the screen */ - update_screen(screen, bitmap, cliprect, *m_topsecex_yscroll, FALSE); + update_screen(screen, bitmap, cliprect, m_topsecex_yscroll, FALSE); return 0; } diff --git a/src/osd/modules/debugger/debugimgui.cpp b/src/osd/modules/debugger/debugimgui.cpp index ee2038da1c6..44cff250869 100644 --- a/src/osd/modules/debugger/debugimgui.cpp +++ b/src/osd/modules/debugger/debugimgui.cpp @@ -4,6 +4,7 @@ #include "emu.h" #include "imgui/imgui.h" +#include "render.h" #include "uiinput.h" #include "debug/debugvw.h" diff --git a/src/osd/modules/ipc/rtc_tcp_connection.cpp b/src/osd/modules/ipc/rtc_tcp_connection.cpp index 861eaa8d247..0a5f27eecff 100644 --- a/src/osd/modules/ipc/rtc_tcp_connection.cpp +++ b/src/osd/modules/ipc/rtc_tcp_connection.cpp @@ -76,7 +76,7 @@ void rtc_tcp_connection::user_on_tcp_connection_read() // the latest parsed frame filled it, then empty the full buffer. if ((m_frame_start + 2 + packet_len) == m_buffer_size) { - osd_printf_error("no more space in the buffer, emptying the buffer data"); + osd_printf_error("no more space in the buffer, emptying the buffer data\n"); m_frame_start = 0; m_buffer_data_len = 0; @@ -92,7 +92,7 @@ void rtc_tcp_connection::user_on_tcp_connection_read() // parse again. Otherwise break here and wait for more data. if (m_buffer_data_len > m_frame_start) { - // osd_printf_error("there is more data after the parsed frame, continue parsing"); + // osd_printf_error("there is more data after the parsed frame, continue parsing\n"); continue; } @@ -110,7 +110,7 @@ void rtc_tcp_connection::user_on_tcp_connection_read() // the buffer, so move the frame to the position 0. if (m_frame_start != 0) { - // osd_printf_error("no more space in the buffer, moving parsed bytes to the beginning of the buffer and wait for more data"); + // osd_printf_error("no more space in the buffer, moving parsed bytes to the beginning of the buffer and wait for more data\n"); std::memmove(m_buffer, m_buffer + m_frame_start, m_buffer_size - m_frame_start); m_buffer_data_len = m_buffer_size - m_frame_start; @@ -120,7 +120,7 @@ void rtc_tcp_connection::user_on_tcp_connection_read() // The frame is too big, so close the connection. else { - osd_printf_error("no more space in the buffer for the unfinished frame being parsed, closing the connection"); + osd_printf_error("no more space in the buffer for the unfinished frame being parsed, closing the connection\n"); // Close the socket. close(); @@ -129,7 +129,7 @@ void rtc_tcp_connection::user_on_tcp_connection_read() // The buffer is not full. else { - osd_printf_verbose("frame not finished yet, waiting for more data"); + osd_printf_verbose("frame not finished yet, waiting for more data\n"); } // Exit the parsing loop. diff --git a/src/osd/modules/ipc/tcp_connection.cpp b/src/osd/modules/ipc/tcp_connection.cpp index fb6af2f976a..bfb8b6d5461 100644 --- a/src/osd/modules/ipc/tcp_connection.cpp +++ b/src/osd/modules/ipc/tcp_connection.cpp @@ -187,7 +187,7 @@ void tcp_connection::write(const uint8_t* data, size_t len) // Error. Should not happen. else if (written < 0) { - osd_printf_warning("uv_try_write() failed, closing the connection: %s", uv_strerror(written)); + osd_printf_warning("uv_try_write() failed, closing the connection: %s\n", uv_strerror(written)); close(); return; @@ -245,7 +245,7 @@ void tcp_connection::write(const uint8_t* data1, size_t len1, const uint8_t* dat // Error. Should not happen. else if (written < 0) { - osd_printf_warning("uv_try_write() failed, closing the connection: %s", uv_strerror(written)); + osd_printf_warning("uv_try_write() failed, closing the connection: %s\n", uv_strerror(written)); close(); return; @@ -301,7 +301,7 @@ bool tcp_connection::set_peer_address() err = uv_tcp_getpeername(m_uv_handle, (struct sockaddr*)&m_peer_addr, &len); if (err) { - osd_printf_error("uv_tcp_getpeername() failed: %s", uv_strerror(err)); + osd_printf_error("uv_tcp_getpeername() failed: %s\n", uv_strerror(err)); return false; } @@ -329,7 +329,7 @@ void tcp_connection::on_uv_read_alloc(size_t suggested_size, uv_buf_t* buf) { buf->len = 0; - osd_printf_warning("no available space in the buffer"); + osd_printf_warning("no available space in the buffer\n"); } } @@ -353,7 +353,7 @@ void tcp_connection::on_uv_read(::ssize_t nread, const uv_buf_t* buf) // Client disconneted. else if (nread == UV_EOF || nread == UV_ECONNRESET) { - osd_printf_info("connection closed by peer, closing server side"); + osd_printf_verbose("connection closed by peer, closing server side\n"); m_is_closed_by_peer = true; @@ -363,7 +363,7 @@ void tcp_connection::on_uv_read(::ssize_t nread, const uv_buf_t* buf) // Some error. else { - osd_printf_info("read error, closing the connection: %s", uv_strerror(nread)); + osd_printf_verbose("read error, closing the connection: %s\n", uv_strerror(nread)); m_has_error = true; @@ -379,11 +379,11 @@ void tcp_connection::on_uv_write_error(int error) if (error == UV_EPIPE || error == UV_ENOTCONN) { - osd_printf_info("write error, closing the connection: %s", uv_strerror(error)); + osd_printf_verbose("write error, closing the connection: %s\n", uv_strerror(error)); } else { - osd_printf_info("write error, closing the connection: %s", uv_strerror(error)); + osd_printf_verbose("write error, closing the connection: %s\n", uv_strerror(error)); m_has_error = true; } @@ -396,9 +396,9 @@ void tcp_connection::on_uv_shutdown(uv_shutdown_t* req, int status) delete req; if (status == UV_EPIPE || status == UV_ENOTCONN || status == UV_ECANCELED) - osd_printf_info("shutdown error: %s", uv_strerror(status)); + osd_printf_verbose("shutdown error: %s\n", uv_strerror(status)); else if (status) - osd_printf_info("shutdown error: %s", uv_strerror(status)); + osd_printf_verbose("shutdown error: %s\n", uv_strerror(status)); // Now do close the handle. uv_close((uv_handle_t*)m_uv_handle, (uv_close_cb)on_close); diff --git a/src/osd/modules/ipc/tcp_server.cpp b/src/osd/modules/ipc/tcp_server.cpp index a4de2df12d9..2c8f11e384b 100644 --- a/src/osd/modules/ipc/tcp_server.cpp +++ b/src/osd/modules/ipc/tcp_server.cpp @@ -94,7 +94,7 @@ void tcp_server::close() // Otherwise close all the connections (but not the TCP server). else { - osd_printf_info("closing %d active connections", (int)m_connections.size()); + osd_printf_verbose("closing %d active connections\n", (int)m_connections.size()); for (auto it = m_connections.begin(); it != m_connections.end(); ++it) { @@ -119,7 +119,7 @@ void tcp_server::terminate() // Otherwise close all the connections (but not the TCP server). else { - osd_printf_info("closing %d active connections", (int)m_connections.size()); + osd_printf_verbose("closing %d active connections\n", (int)m_connections.size()); for (auto it = m_connections.begin(); it != m_connections.end(); ++it) { @@ -144,7 +144,7 @@ void tcp_server::send_to_all(const uint8_t* data, size_t len) void tcp_server::dump() { - osd_printf_info("[TCP, local:%s :%d, status:%s, connections:%d]", + osd_printf_verbose("[TCP, local:%s :%d, status:%s, connections:%d]", m_local_ip.c_str(), (uint16_t)m_local_port, (!m_is_closing) ? "open" : "closed", (int)m_connections.size()); @@ -173,7 +173,7 @@ bool tcp_server::set_local_address() err = uv_tcp_getsockname(m_uv_handle, (struct sockaddr*)&m_local_addr, &len); if (err) { - osd_printf_error("uv_tcp_getsockname() failed: %s", uv_strerror(err)); + osd_printf_error("uv_tcp_getsockname() failed: %s\n", uv_strerror(err)); return false; } @@ -193,7 +193,7 @@ inline void tcp_server::on_uv_connection(int status) if (status) { - osd_printf_error("error while receiving a new TCP connection: %s", uv_strerror(status)); + osd_printf_error("error while receiving a new TCP connection: %s\n", uv_strerror(status)); return; } @@ -201,8 +201,8 @@ inline void tcp_server::on_uv_connection(int status) // Notify the subclass so it provides an allocated derived class of TCPConnection. tcp_connection* connection = nullptr; user_on_tcp_connection_alloc(&connection); - if (connection != nullptr) - osd_printf_error("tcp_server pointer was not allocated by the user"); + if (connection == nullptr) + osd_printf_error("tcp_server pointer was not allocated by the user\n"); try { @@ -217,7 +217,7 @@ inline void tcp_server::on_uv_connection(int status) // Accept the connection. err = uv_accept((uv_stream_t*)m_uv_handle, (uv_stream_t*)connection->get_uv_handle()); if (err) - throw emu_fatalerror("uv_accept() failed: %s", uv_strerror(err)); + throw emu_fatalerror("uv_accept() failed: %s\n", uv_strerror(err)); // Insert the TCPConnection in the set. m_connections.insert(connection); @@ -229,13 +229,13 @@ inline void tcp_server::on_uv_connection(int status) } catch (emu_exception &error) { - osd_printf_error("cannot run the TCP connection, closing the connection: %s", error.what()); + osd_printf_error("cannot run the TCP connection, closing the connection: %s\n", error.what()); connection->close(); // NOTE: Don't return here so the user won't be notified about a "onclose" for a TCP connection // for which there was not a previous "onnew" event. } - osd_printf_info("new TCP connection:"); + osd_printf_verbose("new TCP connection:\n"); connection->dump(); // Notify the subclass. @@ -263,7 +263,7 @@ void tcp_server::on_tcp_connection_closed(tcp_connection* connection, bool is_cl bool wasClosing = m_is_closing; - osd_printf_info("TCP connection closed:"); + osd_printf_verbose("TCP connection closed:\n"); connection->dump(); // Remove the TCPConnection from the set. diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 5c26b55a6d5..d9083815fa0 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -24,8 +24,7 @@ #include "modules/midi/midi_module.h" #include "modules/output/output_module.h" #include "emuopts.h" - -class ui_menu_item; +#include "../frontend/mame/ui/menuitem.h" //============================================================ // Defines diff --git a/src/osd/modules/osdwindow.h b/src/osd/modules/osdwindow.h index a2ab9228454..cd602b089f4 100644 --- a/src/osd/modules/osdwindow.h +++ b/src/osd/modules/osdwindow.h @@ -10,9 +10,9 @@ #define __OSDWINDOW__ #include "emu.h" -#include "ui/uimain.h" #include "render.h" #include "osdhelper.h" +#include "../frontend/mame/ui/menuitem.h" // standard windows headers #ifdef OSD_WINDOWS diff --git a/src/osd/modules/render/bgfx/chainmanager.cpp b/src/osd/modules/render/bgfx/chainmanager.cpp index 8614149b7eb..6a7875547e4 100644 --- a/src/osd/modules/render/bgfx/chainmanager.cpp +++ b/src/osd/modules/render/bgfx/chainmanager.cpp @@ -10,7 +10,7 @@ //============================================================ #include "emu.h" -#include "ui/uimain.h" +#include "../frontend/mame/ui/slider.h" #include "osdcore.h" #include "modules/osdwindow.h" diff --git a/src/osd/modules/render/bgfx/chainmanager.h b/src/osd/modules/render/bgfx/chainmanager.h index 979c487a237..997be246073 100644 --- a/src/osd/modules/render/bgfx/chainmanager.h +++ b/src/osd/modules/render/bgfx/chainmanager.h @@ -21,6 +21,7 @@ #include "texturemanager.h" #include "targetmanager.h" #include "effectmanager.h" +#include "../frontend/mame/ui/menuitem.h" class running_machine; class osd_window; diff --git a/src/osd/modules/render/bgfx/inputpair.cpp b/src/osd/modules/render/bgfx/inputpair.cpp index 4de54404a6b..e19789b89ba 100644 --- a/src/osd/modules/render/bgfx/inputpair.cpp +++ b/src/osd/modules/render/bgfx/inputpair.cpp @@ -9,7 +9,7 @@ // //============================================================ -#include "ui/uimain.h" +#include "../frontend/mame/ui/slider.h" #include "emucore.h" diff --git a/src/osd/modules/render/bgfx/inputpair.h b/src/osd/modules/render/bgfx/inputpair.h index 550595a1c55..1f5c4f59dfc 100644 --- a/src/osd/modules/render/bgfx/inputpair.h +++ b/src/osd/modules/render/bgfx/inputpair.h @@ -16,7 +16,7 @@ #include <string> -#include "ui/uimain.h" +#include "../frontend/mame/ui/menuitem.h" class bgfx_effect; class chain_manager; diff --git a/src/osd/modules/render/bgfx/shadermanager.h b/src/osd/modules/render/bgfx/shadermanager.h index 2beca465918..bee48dcea81 100644 --- a/src/osd/modules/render/bgfx/shadermanager.h +++ b/src/osd/modules/render/bgfx/shadermanager.h @@ -16,7 +16,7 @@ #include <bgfx/bgfx.h> -#include <modules/lib/osdobj_common.h> +#include "modules/lib/osdobj_common.h" #include <map> #include <string> diff --git a/src/osd/modules/render/bgfx/slider.h b/src/osd/modules/render/bgfx/slider.h index 059b895ad8f..fca9d43f6a8 100644 --- a/src/osd/modules/render/bgfx/slider.h +++ b/src/osd/modules/render/bgfx/slider.h @@ -17,7 +17,7 @@ #include <vector> #include "emu.h" -#include "ui/uimain.h" +#include "../frontend/mame/ui/slider.h" class bgfx_slider { diff --git a/src/osd/modules/render/d3d/d3dcomm.h b/src/osd/modules/render/d3d/d3dcomm.h index 2fd7477ac43..5a7a72f2afe 100644 --- a/src/osd/modules/render/d3d/d3dcomm.h +++ b/src/osd/modules/render/d3d/d3dcomm.h @@ -14,6 +14,7 @@ //============================================================ #define MAX_BLOOM_COUNT 15 // shader model 3.0 support up to 16 samplers, but we need the last for the original texture +#define HALF_BLOOM_COUNT 8 //============================================================ // FORWARD DECLARATIONS diff --git a/src/osd/modules/render/d3d/d3dhlsl.cpp b/src/osd/modules/render/d3d/d3dhlsl.cpp index 72c172b898d..464df3b9b11 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.cpp +++ b/src/osd/modules/render/d3d/d3dhlsl.cpp @@ -18,7 +18,6 @@ #include "emu.h" #include "drivenum.h" #include "render.h" -#include "ui/uimain.h" #include "rendutil.h" #include "emuopts.h" #include "aviio.h" @@ -32,6 +31,7 @@ #include "d3dcomm.h" #include "strconv.h" #include "d3dhlsl.h" +#include "../frontend/mame/ui/slider.h" //============================================================ @@ -1383,13 +1383,12 @@ int shaders::post_pass(d3d_render_target *rt, int source_index, poly_info *poly, float yscale = 1.0f / screen_container.yscale(); float xoffset = -screen_container.xoffset(); float yoffset = -screen_container.yoffset(); - float screen_scale[2] = { xscale, yscale }; float screen_offset[2] = { xoffset, yoffset }; - rgb_t back_color_rgb = !machine->first_screen()->has_palette() - ? rgb_t(0, 0, 0) - : machine->first_screen()->palette().palette()->entry_color(0); + rgb_t back_color_rgb = screen->has_palette() + ? screen->palette().palette()->entry_color(0) + : rgb_t(0, 0, 0); back_color_rgb = apply_color_convolution(back_color_rgb); float back_color[3] = { static_cast<float>(back_color_rgb.r()) / 255.0f, @@ -1783,11 +1782,10 @@ bool shaders::add_cache_target(renderer_d3d9* d3d, texture_info* texture, int so return false; } + target->screen_index = screen_index; target->next = cachehead; target->prev = nullptr; - target->screen_index = screen_index; - if (cachehead != nullptr) { cachehead->prev = target; @@ -1802,34 +1800,33 @@ bool shaders::add_cache_target(renderer_d3d9* d3d, texture_info* texture, int so //============================================================ d3d_render_target* shaders::get_texture_target(render_primitive *prim, texture_info *texture) { - if (!vector_enable) - { - return nullptr; - } - auto win = d3d->assert_window(); - bool swap_xy = win->swap_xy(); - int target_width = swap_xy - ? static_cast<int>(prim->get_quad_height() + 0.5f) - : static_cast<int>(prim->get_quad_width() + 0.5f); - int target_height = swap_xy - ? static_cast<int>(prim->get_quad_width() + 0.5f) - : static_cast<int>(prim->get_quad_height() + 0.5f); - + int target_width = int(prim->get_quad_width() + 0.5f); + int target_height = int(prim->get_quad_height() + 0.5f); target_width *= oversampling_enable ? 2 : 1; target_height *= oversampling_enable ? 2 : 1; + if (win->swap_xy()) + { + std::swap(target_width, target_height); + } // find render target and check if the size of the target quad has changed d3d_render_target *target = find_render_target(texture); - if (target != nullptr && target->target_width == target_width && target->target_height == target_height) + if (target != nullptr) { - return target; + if (PRIMFLAG_GET_SCREENTEX(prim->flags)) + { + // check if the size of the screen quad has changed + if (target->target_width != target_width || target->target_height != target_height) + { + osd_printf_verbose("get_texture_target() - invalid size\n"); + return nullptr; + } + } } - osd_printf_verbose("get_texture_target() - invalid size\n"); - - return nullptr; + return target; } d3d_render_target* shaders::get_vector_target(render_primitive *prim) @@ -1841,50 +1838,54 @@ d3d_render_target* shaders::get_vector_target(render_primitive *prim) auto win = d3d->assert_window(); - bool swap_xy = win->swap_xy(); - int target_width = swap_xy - ? static_cast<int>(prim->get_quad_height() + 0.5f) - : static_cast<int>(prim->get_quad_width() + 0.5f); - int target_height = swap_xy - ? static_cast<int>(prim->get_quad_width() + 0.5f) - : static_cast<int>(prim->get_quad_height() + 0.5f); - int source_width = swap_xy ? (float)d3d->get_height() : (float)d3d->get_width(); - int source_height = swap_xy ? (float)d3d->get_width() : (float)d3d->get_height(); - + int source_width = float(d3d->get_width()); + int source_height = float(d3d->get_height()); + int target_width = int(prim->get_quad_width() + 0.5f); + int target_height = int(prim->get_quad_height() + 0.5f); target_width *= oversampling_enable ? 2 : 1; target_height *= oversampling_enable ? 2 : 1; + if (win->swap_xy()) + { + std::swap(source_width, source_height); + std::swap(target_width, target_height); + } - // find render target and check of the size of the target quad has changed + // find render target d3d_render_target *target = find_render_target(source_width, source_height, 0, 0); - if (target != nullptr && target->target_width == target_width && target->target_height == target_height) + if (target != nullptr) { - return target; + if (PRIMFLAG_GET_VECTORBUF(prim->flags)) + { + // check if the size of the screen quad has changed + if (target->target_width != target_width || target->target_height != target_height) + { + osd_printf_verbose("get_vector_target() - invalid size\n"); + return nullptr; + } + } } - osd_printf_verbose("get_vector_target() - invalid size\n"); - - return nullptr; + return target; } void shaders::create_vector_target(render_primitive *prim) { auto win = d3d->assert_window(); - bool swap_xy = win->swap_xy(); - int target_width = swap_xy - ? static_cast<int>(prim->get_quad_height() + 0.5f) - : static_cast<int>(prim->get_quad_width() + 0.5f); - int target_height = swap_xy - ? static_cast<int>(prim->get_quad_width() + 0.5f) - : static_cast<int>(prim->get_quad_height() + 0.5f); - int source_width = swap_xy ? (float)d3d->get_height() : (float)d3d->get_width(); - int source_height = swap_xy ? (float)d3d->get_width() : (float)d3d->get_height(); - + int source_width = float(d3d->get_width()); + int source_height = float(d3d->get_height()); + int target_width = int(prim->get_quad_width() + 0.5f); + int target_height = int(prim->get_quad_height() + 0.5f); target_width *= oversampling_enable ? 2 : 1; target_height *= oversampling_enable ? 2 : 1; + if (win->swap_xy()) + { + std::swap(source_width, source_height); + std::swap(target_width, target_height); + } osd_printf_verbose("create_vector_target() - %d, %d\n", target_width, target_height); - if (!add_render_target(d3d, nullptr, source_width, source_height, target_width, target_height)) + if (!add_render_target(d3d, prim, nullptr, source_width, source_height, target_width, target_height)) { vector_enable = false; } @@ -1895,7 +1896,7 @@ void shaders::create_vector_target(render_primitive *prim) // shaders::add_render_target - register a render target //============================================================ -bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* texture, int source_width, int source_height, int target_width, int target_height) +bool shaders::add_render_target(renderer_d3d9* d3d, render_primitive *prim, texture_info* texture, int source_width, int source_height, int target_width, int target_height) { UINT32 screen_index = 0; UINT32 page_index = 0; @@ -1930,24 +1931,6 @@ bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* texture, int s target->screen_index = screen_index; target->page_index = page_index; - - HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, target->target_surface[0]); - if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); - result = (*d3dintf->device.clear)(d3d->get_device(), 0, nullptr, D3DCLEAR_TARGET, D3DCOLOR_ARGB(0,0,0,0), 0, 0); - if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device clear call\n", (int)result); - result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, backbuffer); - if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result); - - cache_target* cache = find_cache_target(target->screen_index, source_width, source_height); - if (cache == nullptr) - { - if (!add_cache_target(d3d, texture, source_width, source_height, target_width, target_height, target->screen_index)) - { - global_free(target); - return false; - } - } - target->next = targethead; target->prev = nullptr; @@ -1957,6 +1940,20 @@ bool shaders::add_render_target(renderer_d3d9* d3d, texture_info* texture, int s } targethead = target; + // cached target only for screen texture and vector buffer + if (PRIMFLAG_GET_SCREENTEX(prim->flags) || PRIMFLAG_GET_VECTORBUF(prim->flags)) + { + cache_target* cache = find_cache_target(target->screen_index, source_width, source_height); + if (cache == nullptr) + { + if (!add_cache_target(d3d, texture, source_width, source_height, target_width, target_height, target->screen_index)) + { + global_free(target); + return false; + } + } + } + return true; } @@ -1984,19 +1981,17 @@ bool shaders::register_texture(render_primitive *prim, texture_info *texture) auto win = d3d->assert_window(); - bool swap_xy = win->swap_xy(); - int target_width = swap_xy - ? static_cast<int>(prim->get_quad_height() + 0.5f) - : static_cast<int>(prim->get_quad_width() + 0.5f); - int target_height = swap_xy - ? static_cast<int>(prim->get_quad_width() + 0.5f) - : static_cast<int>(prim->get_quad_height() + 0.5f); - + int target_width = int(prim->get_quad_width() + 0.5f); + int target_height = int(prim->get_quad_height() + 0.5f); target_width *= oversampling_enable ? 2 : 1; target_height *= oversampling_enable ? 2 : 1; + if (win->swap_xy()) + { + std::swap(target_width, target_height); + } osd_printf_verbose("register_texture() - %d, %d\n", target_width, target_height); - if (!add_render_target(d3d, texture, texture->get_width(), texture->get_height(), target_width, target_height)) + if (!add_render_target(d3d, prim, texture, texture->get_width(), texture->get_height(), target_width, target_height)) { return false; } @@ -2504,11 +2499,16 @@ std::vector<ui_menu_item> shaders::init_slider_list() } internal_sliders.clear(); + auto first_screen = machine->first_screen(); + if (first_screen == nullptr) + { + return sliders; + } + int screen_type = first_screen->screen_type(); + for (int i = 0; s_sliders[i].name != nullptr; i++) { slider_desc *desc = &s_sliders[i]; - - int screen_type = machine->first_screen()->screen_type(); if ((screen_type == SCREEN_TYPE_VECTOR && (desc->screen_type & SLIDER_SCREEN_TYPE_VECTOR) == SLIDER_SCREEN_TYPE_VECTOR) || (screen_type == SCREEN_TYPE_RASTER && (desc->screen_type & SLIDER_SCREEN_TYPE_RASTER) == SLIDER_SCREEN_TYPE_RASTER) || (screen_type == SCREEN_TYPE_LCD && (desc->screen_type & SLIDER_SCREEN_TYPE_LCD) == SLIDER_SCREEN_TYPE_LCD)) @@ -2625,6 +2625,11 @@ void uniform::update() renderer_d3d9 *d3d = shadersys->d3d; auto win = d3d->assert_window(); + auto first_screen = win->machine().first_screen(); + + bool vector_screen = + first_screen != nullptr && + first_screen->screen_type() == SCREEN_TYPE_VECTOR; switch (m_id) { @@ -2636,8 +2641,6 @@ void uniform::update() } case CU_SOURCE_DIMS: { - bool vector_screen = - win->machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; if (vector_screen) { if (shadersys->curr_render_target) @@ -2690,8 +2693,6 @@ void uniform::update() } case CU_VECTOR_SCREEN: { - bool vector_screen = - win->machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; m_shader->set_bool("VectorScreen", vector_screen); break; } diff --git a/src/osd/modules/render/d3d/d3dhlsl.h b/src/osd/modules/render/d3d/d3dhlsl.h index c7813122308..794045db25b 100644 --- a/src/osd/modules/render/d3d/d3dhlsl.h +++ b/src/osd/modules/render/d3d/d3dhlsl.h @@ -11,6 +11,7 @@ #include <vector> #include "aviio.h" +#include "../frontend/mame/ui/menuitem.h" //============================================================ // CONSTANTS @@ -21,8 +22,6 @@ // TYPE DEFINITIONS //============================================================ -struct slider_state; - class effect; class shaders; @@ -321,7 +320,7 @@ public: bool register_texture(render_primitive *prim, texture_info *texture); d3d_render_target* get_texture_target(render_primitive *prim, texture_info *texture); - bool add_render_target(renderer_d3d9* d3d, texture_info* texture, int source_width, int source_height, int target_width, int target_height); + bool add_render_target(renderer_d3d9* d3d, render_primitive *prim, texture_info* texture, int source_width, int source_height, int target_width, int target_height); bool add_cache_target(renderer_d3d9* d3d, texture_info* texture, int source_width, int source_height, int target_width, int target_height, int screen_index); void window_save(); diff --git a/src/osd/modules/render/drawbgfx.h b/src/osd/modules/render/drawbgfx.h index 5e500fedb1e..76169834760 100644 --- a/src/osd/modules/render/drawbgfx.h +++ b/src/osd/modules/render/drawbgfx.h @@ -15,6 +15,7 @@ #include "bgfx/chain.h" #include "bgfx/chainmanager.h" #include "sliderdirtynotifier.h" +#include "../frontend/mame/ui/menuitem.h" class texture_manager; class target_manager; diff --git a/src/osd/modules/render/drawd3d.cpp b/src/osd/modules/render/drawd3d.cpp index 5e6e7f5b255..86534ee8a9e 100644 --- a/src/osd/modules/render/drawd3d.cpp +++ b/src/osd/modules/render/drawd3d.cpp @@ -672,11 +672,14 @@ void d3d_texture_manager::update_textures() } } } - else if(m_renderer->get_shaders()->vector_enabled() && PRIMFLAG_GET_VECTORBUF(prim.flags)) + else if(PRIMFLAG_GET_VECTORBUF(prim.flags)) { - if (!m_renderer->get_shaders()->get_vector_target(&prim)) + if (m_renderer->get_shaders()->vector_enabled()) { - m_renderer->get_shaders()->create_vector_target(&prim); + if (!m_renderer->get_shaders()->get_vector_target(&prim)) + { + m_renderer->get_shaders()->create_vector_target(&prim); + } } } } @@ -1633,6 +1636,8 @@ void renderer_d3d9::batch_vector(const render_primitive &prim, float line_time) // set the color, Z parameters to standard values for (int i = 0; i < 6; i++) { + m_vectorbatch[m_batchindex + i].x -= 0.5f; + m_vectorbatch[m_batchindex + i].y -= 0.5f; m_vectorbatch[m_batchindex + i].z = 0.0f; m_vectorbatch[m_batchindex + i].rhw = 1.0f; m_vectorbatch[m_batchindex + i].color = color; @@ -2959,11 +2964,15 @@ bool d3d_render_target::init(renderer_d3d9 *d3d, d3d_base *d3dintf, int source_w (*d3dintf->texture.get_surface_level)(target_texture[index], 0, &target_surface[index]); } + auto win = d3d->assert_window(); + + auto first_screen = win->machine().first_screen(); bool vector_screen = - d3d->assert_window()->machine().first_screen()->screen_type() == SCREEN_TYPE_VECTOR; + first_screen != nullptr && + first_screen->screen_type() == SCREEN_TYPE_VECTOR; float scale_factor = 0.75f; - int scale_count = vector_screen ? MAX_BLOOM_COUNT : MAX_BLOOM_COUNT / 2; + int scale_count = vector_screen ? MAX_BLOOM_COUNT : HALF_BLOOM_COUNT; float bloom_width = (float)source_width; float bloom_height = (float)source_height; diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index b6235f7570c..977053ded89 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -16,7 +16,7 @@ #include "emucore.h" #include "osdcore.h" #include "unicode.h" -#include "ui/uimain.h" +#include "../frontend/mame/ui/menuitem.h" #include <memory> #include <string> diff --git a/src/osd/sdl/window.cpp b/src/osd/sdl/window.cpp index 7e24e4a634e..6072eb0ddd0 100644 --- a/src/osd/sdl/window.cpp +++ b/src/osd/sdl/window.cpp @@ -28,6 +28,7 @@ #include "emu.h" #include "emuopts.h" +#include "render.h" #include "ui/uimain.h" // OSD headers diff --git a/src/osd/sdl/window.h b/src/osd/sdl/window.h index 0a99870675f..ed03359d0ae 100644 --- a/src/osd/sdl/window.h +++ b/src/osd/sdl/window.h @@ -25,6 +25,8 @@ // TYPE DEFINITIONS //============================================================ +class render_target; + // forward of SDL_DisplayMode not possible (typedef struct) - define wrapper class SDL_DM_Wrapper; diff --git a/src/osd/windows/window.cpp b/src/osd/windows/window.cpp index 52dfc2434d9..0edca7c79a6 100644 --- a/src/osd/windows/window.cpp +++ b/src/osd/windows/window.cpp @@ -22,6 +22,7 @@ // MAME headers #include "emu.h" #include "uiinput.h" +#include "ui/uimain.h" // MAMEOS headers #include "winmain.h" |