diff options
author | 2013-04-14 11:10:54 +0000 | |
---|---|---|
committer | 2013-04-14 11:10:54 +0000 | |
commit | 3957fc386f0eff085e2eff309bd71c08b8d32c3f (patch) | |
tree | 7764dfa3b31eb63d0a29c88c6e6f252247962c6f /src/mess/machine | |
parent | 3543d57a98efff89d343f358c925ffbed4966556 (diff) |
more cleanup (nw)
Diffstat (limited to 'src/mess/machine')
-rw-r--r-- | src/mess/machine/gamecom.c | 38 | ||||
-rw-r--r-- | src/mess/machine/pce.c | 35 | ||||
-rw-r--r-- | src/mess/machine/sms.c | 90 | ||||
-rw-r--r-- | src/mess/machine/vtech2.c | 18 | ||||
-rw-r--r-- | src/mess/machine/wswan.c | 4 |
5 files changed, 89 insertions, 96 deletions
diff --git a/src/mess/machine/gamecom.c b/src/mess/machine/gamecom.c index aac7e9f99b5..e1f8393f126 100644 --- a/src/mess/machine/gamecom.c +++ b/src/mess/machine/gamecom.c @@ -562,11 +562,10 @@ DRIVER_INIT_MEMBER(gamecom_state,gamecom) DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 ) { - gamecom_state *state = image.device().machine().driver_data<gamecom_state>(); UINT32 filesize; UINT32 load_offset = 0; - state->m_cartridge1 = state->memregion("cart1")->base(); + m_cartridge1 = memregion("cart1")->base(); if (image.software_entry() == NULL) filesize = image.length(); @@ -589,31 +588,30 @@ DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart1 ) if (image.software_entry() == NULL) { - if (image.fread( state->m_cartridge1 + load_offset, filesize) != filesize) + if (image.fread( m_cartridge1 + load_offset, filesize) != filesize) { image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to load all of the cart"); return IMAGE_INIT_FAIL; } } else - memcpy(state->m_cartridge1 + load_offset, image.get_software_region("rom"), filesize); - - if (filesize < 0x010000) { memcpy(state->m_cartridge1 + 0x008000, state->m_cartridge1, 0x008000); } /* ->64KB */ - if (filesize < 0x020000) { memcpy(state->m_cartridge1 + 0x010000, state->m_cartridge1, 0x010000); } /* ->128KB */ - if (filesize < 0x040000) { memcpy(state->m_cartridge1 + 0x020000, state->m_cartridge1, 0x020000); } /* ->256KB */ - if (filesize < 0x080000) { memcpy(state->m_cartridge1 + 0x040000, state->m_cartridge1, 0x040000); } /* ->512KB */ - if (filesize < 0x100000) { memcpy(state->m_cartridge1 + 0x080000, state->m_cartridge1, 0x080000); } /* ->1MB */ - if (filesize < 0x1c0000) { memcpy(state->m_cartridge1 + 0x100000, state->m_cartridge1, 0x100000); } /* -> >=1.8MB */ + memcpy(m_cartridge1 + load_offset, image.get_software_region("rom"), filesize); + + if (filesize < 0x010000) { memcpy(m_cartridge1 + 0x008000, m_cartridge1, 0x008000); } /* ->64KB */ + if (filesize < 0x020000) { memcpy(m_cartridge1 + 0x010000, m_cartridge1, 0x010000); } /* ->128KB */ + if (filesize < 0x040000) { memcpy(m_cartridge1 + 0x020000, m_cartridge1, 0x020000); } /* ->256KB */ + if (filesize < 0x080000) { memcpy(m_cartridge1 + 0x040000, m_cartridge1, 0x040000); } /* ->512KB */ + if (filesize < 0x100000) { memcpy(m_cartridge1 + 0x080000, m_cartridge1, 0x080000); } /* ->1MB */ + if (filesize < 0x1c0000) { memcpy(m_cartridge1 + 0x100000, m_cartridge1, 0x100000); } /* -> >=1.8MB */ return IMAGE_INIT_PASS; } DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 ) { - gamecom_state *state = image.device().machine().driver_data<gamecom_state>(); UINT32 filesize; UINT32 load_offset = 0; - state->m_cartridge2 = state->memregion("cart2")->base(); + m_cartridge2 = memregion("cart2")->base(); // if (image.software_entry() == NULL) filesize = image.length(); @@ -636,7 +634,7 @@ DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 ) // if (image.software_entry() == NULL) { - if (image.fread( state->m_cartridge2 + load_offset, filesize) != filesize) + if (image.fread( m_cartridge2 + load_offset, filesize) != filesize) { image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to load all of the cart"); return IMAGE_INIT_FAIL; @@ -645,11 +643,11 @@ DEVICE_IMAGE_LOAD_MEMBER( gamecom_state, gamecom_cart2 ) // else // memcpy(state->m_cartridge2 + load_offset, image.get_software_region("rom"), filesize); - if (filesize < 0x010000) { memcpy(state->m_cartridge2 + 0x008000, state->m_cartridge2, 0x008000); } /* ->64KB */ - if (filesize < 0x020000) { memcpy(state->m_cartridge2 + 0x010000, state->m_cartridge2, 0x010000); } /* ->128KB */ - if (filesize < 0x040000) { memcpy(state->m_cartridge2 + 0x020000, state->m_cartridge2, 0x020000); } /* ->256KB */ - if (filesize < 0x080000) { memcpy(state->m_cartridge2 + 0x040000, state->m_cartridge2, 0x040000); } /* ->512KB */ - if (filesize < 0x100000) { memcpy(state->m_cartridge2 + 0x080000, state->m_cartridge2, 0x080000); } /* ->1MB */ - if (filesize < 0x1c0000) { memcpy(state->m_cartridge2 + 0x100000, state->m_cartridge2, 0x100000); } /* -> >=1.8MB */ + if (filesize < 0x010000) { memcpy(m_cartridge2 + 0x008000, m_cartridge2, 0x008000); } /* ->64KB */ + if (filesize < 0x020000) { memcpy(m_cartridge2 + 0x010000, m_cartridge2, 0x010000); } /* ->128KB */ + if (filesize < 0x040000) { memcpy(m_cartridge2 + 0x020000, m_cartridge2, 0x020000); } /* ->256KB */ + if (filesize < 0x080000) { memcpy(m_cartridge2 + 0x040000, m_cartridge2, 0x040000); } /* ->512KB */ + if (filesize < 0x100000) { memcpy(m_cartridge2 + 0x080000, m_cartridge2, 0x080000); } /* ->1MB */ + if (filesize < 0x1c0000) { memcpy(m_cartridge2 + 0x100000, m_cartridge2, 0x100000); } /* -> >=1.8MB */ return IMAGE_INIT_PASS; } diff --git a/src/mess/machine/pce.c b/src/mess/machine/pce.c index 5316de36876..e98bdaea90d 100644 --- a/src/mess/machine/pce.c +++ b/src/mess/machine/pce.c @@ -136,7 +136,6 @@ WRITE8_MEMBER(pce_state::pce_cartridge_ram_w) DEVICE_IMAGE_LOAD_MEMBER(pce_state,pce_cart) { - pce_state *state = image.device().machine().driver_data<pce_state>(); UINT32 size; int split_rom = 0, offset = 0; const char *extrainfo = NULL; @@ -144,7 +143,7 @@ DEVICE_IMAGE_LOAD_MEMBER(pce_state,pce_cart) logerror("*** DEVICE_IMAGE_LOAD(pce_cart) : %s\n", image.filename()); /* open file to get size */ - ROM = state->memregion("user1")->base(); + ROM = memregion("user1")->base(); if (image.software_entry() == NULL) size = image.length(); @@ -225,39 +224,39 @@ DEVICE_IMAGE_LOAD_MEMBER(pce_state,pce_cart) memcpy(ROM + 0x080000, ROM, 0x080000); } - state->membank("bank1")->set_base(ROM); - state->membank("bank2")->set_base(ROM + 0x080000); - state->membank("bank3")->set_base(ROM + 0x088000); - state->membank("bank4")->set_base(ROM + 0x0d0000); + membank("bank1")->set_base(ROM); + membank("bank2")->set_base(ROM + 0x080000); + membank("bank3")->set_base(ROM + 0x088000); + membank("bank4")->set_base(ROM + 0x0d0000); /* Check for Street fighter 2 */ if (size == PCE_ROM_MAXSIZE) { - image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01ff0, 0x01ff3, write8_delegate(FUNC(pce_state::pce_sf2_banking_w),state)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x01ff0, 0x01ff3, write8_delegate(FUNC(pce_state::pce_sf2_banking_w),this)); } /* Check for Populous */ if (!memcmp(ROM + 0x1F26, "POPULOUS", 8)) { - state->m_cartridge_ram = auto_alloc_array(image.device().machine(), UINT8, 0x8000); - state->membank("bank2")->set_base(state->m_cartridge_ram); - image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x080000, 0x087FFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),state)); + m_cartridge_ram = auto_alloc_array(machine(), UINT8, 0x8000); + membank("bank2")->set_base(m_cartridge_ram); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x080000, 0x087FFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),this)); } /* Check for CD system card */ - state->m_sys3_card = 0; + m_sys3_card = 0; if (!memcmp(ROM + 0x3FFB6, "PC Engine CD-ROM SYSTEM", 23)) { /* Check if 192KB additional system card ram should be used */ - if(!memcmp(ROM + 0x29D1, "VER. 3.", 7)) { state->m_sys3_card = 1; } // JP version - else if(!memcmp(ROM + 0x29C4, "VER. 3.", 7 )) { state->m_sys3_card = 3; } // US version + if(!memcmp(ROM + 0x29D1, "VER. 3.", 7)) { m_sys3_card = 1; } // JP version + else if(!memcmp(ROM + 0x29C4, "VER. 3.", 7 )) { m_sys3_card = 3; } // US version - if(state->m_sys3_card) + if(m_sys3_card) { - state->m_cartridge_ram = auto_alloc_array(image.device().machine(), UINT8, 0x30000); - state->membank("bank4")->set_base(state->m_cartridge_ram); - image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0D0000, 0x0FFFFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),state)); - image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087FFF, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),state),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),state)); + m_cartridge_ram = auto_alloc_array(machine(), UINT8, 0x30000); + membank("bank4")->set_base(m_cartridge_ram); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x0D0000, 0x0FFFFF, write8_delegate(FUNC(pce_state::pce_cartridge_ram_w),this)); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x080000, 0x087FFF, read8_delegate(FUNC(pce_state::pce_cd_acard_wram_r),this),write8_delegate(FUNC(pce_state::pce_cd_acard_wram_w),this)); } } return 0; diff --git a/src/mess/machine/sms.c b/src/mess/machine/sms.c index 48725c6ae69..ce838e3f47c 100644 --- a/src/mess/machine/sms.c +++ b/src/mess/machine/sms.c @@ -1580,8 +1580,6 @@ void sms_state::setup_sms_cart() DEVICE_IMAGE_LOAD_MEMBER( sms_state, sms_cart ) { - running_machine &machine = image.device().machine(); - sms_state *state = machine.driver_data<sms_state>(); int size, index = 0, offset = 0; if (strcmp(image.device().tag(), ":cart1") == 0) @@ -1617,7 +1615,7 @@ DEVICE_IMAGE_LOAD_MEMBER( sms_state, sms_cart ) if (strcmp(image.device().tag(), ":cart16") == 0) index = 15; - state->m_cartridge[index].features = 0; + m_cartridge[index].features = 0; if (image.software_entry() == NULL) { @@ -1641,21 +1639,21 @@ DEVICE_IMAGE_LOAD_MEMBER( sms_state, sms_cart ) /* Create a new memory region to hold the ROM. */ /* Make sure the region holds only complete (0x4000) rom banks */ - state->m_cartridge[index].size = (size & 0x3fff) ? (((size >> 14) + 1) << 14) : size; - state->m_cartridge[index].ROM = auto_alloc_array(machine, UINT8, state->m_cartridge[index].size); - state->m_cartridge[index].cartSRAM = auto_alloc_array(machine, UINT8, NVRAM_SIZE); + m_cartridge[index].size = (size & 0x3fff) ? (((size >> 14) + 1) << 14) : size; + m_cartridge[index].ROM = auto_alloc_array(machine(), UINT8, m_cartridge[index].size); + m_cartridge[index].cartSRAM = auto_alloc_array(machine(), UINT8, NVRAM_SIZE); /* Load ROM banks */ if (image.software_entry() == NULL) { image.fseek(offset, SEEK_SET); - if (image.fread( state->m_cartridge[index].ROM, size) != size) + if (image.fread( m_cartridge[index].ROM, size) != size) return IMAGE_INIT_FAIL; } else { - memcpy(state->m_cartridge[index].ROM, image.get_software_region("rom") + offset, size); + memcpy(m_cartridge[index].ROM, image.get_software_region("rom") + offset, size); const char *pcb = image.get_feature("pcb"); const char *mapper = image.get_feature("mapper"); @@ -1665,62 +1663,62 @@ DEVICE_IMAGE_LOAD_MEMBER( sms_state, sms_cart ) // Check for special mappers (or lack of mappers) if ( pcb && !strcmp(pcb, "korean_nobank")) { - state->m_cartridge[index].features |= CF_KOREAN_NOBANK_MAPPER; + m_cartridge[index].features |= CF_KOREAN_NOBANK_MAPPER; } if ( mapper ) { if ( ! strcmp( mapper, "codemasters" ) ) { - state->m_cartridge[index].features |= CF_CODEMASTERS_MAPPER; + m_cartridge[index].features |= CF_CODEMASTERS_MAPPER; } else if ( ! strcmp( mapper, "korean" ) ) { - state->m_cartridge[index].features |= CF_KOREAN_MAPPER; + m_cartridge[index].features |= CF_KOREAN_MAPPER; } else if ( ! strcmp( mapper, "zemina" ) ) { - state->m_cartridge[index].features |= CF_KOREAN_ZEMINA_MAPPER; + m_cartridge[index].features |= CF_KOREAN_ZEMINA_MAPPER; } else if ( ! strcmp( mapper, "nemesis" ) ) { - state->m_cartridge[index].features |= CF_KOREAN_ZEMINA_MAPPER; - state->m_cartridge[index].features |= CF_KOREAN_ZEMINA_NEMESIS; + m_cartridge[index].features |= CF_KOREAN_ZEMINA_MAPPER; + m_cartridge[index].features |= CF_KOREAN_ZEMINA_NEMESIS; } else if ( ! strcmp( mapper, "4pak" ) ) { - state->m_cartridge[index].features |= CF_4PAK_MAPPER; + m_cartridge[index].features |= CF_4PAK_MAPPER; } else if ( ! strcmp( mapper, "janggun" ) ) { - state->m_cartridge[index].features |= CF_JANGGUN_MAPPER; + m_cartridge[index].features |= CF_JANGGUN_MAPPER; } } // Check for gamegear cartridges with PIN 42 set to SMS mode if ( pin_42 && ! strcmp(pin_42, "sms_mode")) { - state->m_cartridge[index].features |= CF_GG_SMS_MODE; + m_cartridge[index].features |= CF_GG_SMS_MODE; } // Check for presence of 93c46 eeprom if ( eeprom && ! strcmp( eeprom, "93c46" ) ) { - state->m_cartridge[index].features |= CF_93C46_EEPROM; + m_cartridge[index].features |= CF_93C46_EEPROM; } } /* check the image */ - if (!state->m_has_bios) + if (!m_has_bios) { - if (sms_verify_cart(state->m_cartridge[index].ROM, size) == IMAGE_VERIFY_FAIL) + if (sms_verify_cart(m_cartridge[index].ROM, size) == IMAGE_VERIFY_FAIL) { logerror("Warning loading image: sms_verify_cart failed\n"); } } // If no mapper bits are set attempt to autodetect the mapper - if ( ! ( state->m_cartridge[index].features & CF_MAPPER_BITS ) ) + if ( ! ( m_cartridge[index].features & CF_MAPPER_BITS ) ) { /* If no extrainfo information is available try to find special information out on our own */ /* Check for special cartridge features (new routine, courtesy of Omar Cornut, from MEKA) */ @@ -1729,9 +1727,9 @@ DEVICE_IMAGE_LOAD_MEMBER( sms_state, sms_cart ) int c0002 = 0, c8000 = 0, cA000 = 0, cFFFF = 0, c3FFE = 0, c4000 = 0, c6000 = 0, i; for (i = 0; i < 0x8000; i++) { - if (state->m_cartridge[index].ROM[i] == 0x32) // Z80 opcode for: LD (xxxx), A + if (m_cartridge[index].ROM[i] == 0x32) // Z80 opcode for: LD (xxxx), A { - UINT16 addr = (state->m_cartridge[index].ROM[i + 2] << 8) | state->m_cartridge[index].ROM[i + 1]; + UINT16 addr = (m_cartridge[index].ROM[i + 2] << 8) | m_cartridge[index].ROM[i + 1]; if (addr == 0xFFFF) { i += 2; cFFFF++; continue; } if (addr == 0x0002 || addr == 0x0003 || addr == 0x0004) @@ -1754,64 +1752,64 @@ DEVICE_IMAGE_LOAD_MEMBER( sms_state, sms_cart ) // 2 is a security measure, although tests on existing ROM showed it was not needed if (c0002 > cFFFF + 2 || (c0002 > 0 && cFFFF == 0)) { - UINT8 *rom = state->m_cartridge[index].ROM; + UINT8 *rom = m_cartridge[index].ROM; - state->m_cartridge[index].features |= CF_KOREAN_ZEMINA_MAPPER; + m_cartridge[index].features |= CF_KOREAN_ZEMINA_MAPPER; // Check for special bank 0 signature if ( size == 0x20000 && rom[0] == 0x00 && rom[1] == 0x00 && rom[2] == 0x00 && rom[0x1e000] == 0xF3 && rom[0x1e001] == 0xED && rom[0x1e002] == 0x56 ) { - state->m_cartridge[index].features |= CF_KOREAN_ZEMINA_NEMESIS; + m_cartridge[index].features |= CF_KOREAN_ZEMINA_NEMESIS; } } else if (c8000 > cFFFF + 2 || (c8000 > 0 && cFFFF == 0)) { - state->m_cartridge[index].features |= CF_CODEMASTERS_MAPPER; + m_cartridge[index].features |= CF_CODEMASTERS_MAPPER; } else if (cA000 > cFFFF + 2 || (cA000 > 0 && cFFFF == 0)) { - state->m_cartridge[index].features |= CF_KOREAN_MAPPER; + m_cartridge[index].features |= CF_KOREAN_MAPPER; } else if ( c3FFE > cFFFF + 2 || (c3FFE > 0) ) { - state->m_cartridge[index].features |= CF_4PAK_MAPPER; + m_cartridge[index].features |= CF_4PAK_MAPPER; } else if ( c4000 > 0 && c6000 > 0 && c8000 > 0 && cA000 > 0 ) { - state->m_cartridge[index].features |= CF_JANGGUN_MAPPER; + m_cartridge[index].features |= CF_JANGGUN_MAPPER; } } } - if (state->m_cartridge[index].features & CF_CODEMASTERS_MAPPER) + if (m_cartridge[index].features & CF_CODEMASTERS_MAPPER) { - state->m_cartridge[index].ram_size = 0x10000; - state->m_cartridge[index].cartRAM = auto_alloc_array(machine, UINT8, state->m_cartridge[index].ram_size); - state->m_cartridge[index].ram_page = 0; + m_cartridge[index].ram_size = 0x10000; + m_cartridge[index].cartRAM = auto_alloc_array(machine(), UINT8, m_cartridge[index].ram_size); + m_cartridge[index].ram_page = 0; } /* For Light Phaser games, we have to detect the x offset */ - state->m_lphaser_x_offs = detect_lphaser_xoffset(machine, state->m_cartridge[index].ROM); + m_lphaser_x_offs = detect_lphaser_xoffset(machine(), m_cartridge[index].ROM); /* Terebi Oekaki (TV Draw) is a SG1000 game with special input device which is compatible with SG1000 Mark III */ - if ((detect_tvdraw(state->m_cartridge[index].ROM)) && state->m_is_region_japan) + if ((detect_tvdraw(m_cartridge[index].ROM)) && m_is_region_japan) { - state->m_cartridge[index].features |= CF_TVDRAW; + m_cartridge[index].features |= CF_TVDRAW; } - if (state->m_cartridge[index].features & CF_JANGGUN_MAPPER) + if (m_cartridge[index].features & CF_JANGGUN_MAPPER) { // Reverse bytes when bit 6 in the mapper is set - if ( state->m_cartridge[index].size <= 0x40 * 0x4000 ) + if ( m_cartridge[index].size <= 0x40 * 0x4000 ) { - UINT8 *new_rom = auto_alloc_array(machine, UINT8, 0x80 * 0x4000); + UINT8 *new_rom = auto_alloc_array(machine(), UINT8, 0x80 * 0x4000); UINT32 dest = 0; while ( dest < 0x40 * 0x4000 ) { - memcpy( new_rom + dest, state->m_cartridge[index].ROM, state->m_cartridge[index].size ); - dest += state->m_cartridge[index].size; + memcpy( new_rom + dest, m_cartridge[index].ROM, m_cartridge[index].size ); + dest += m_cartridge[index].size; } for ( dest = 0; dest < 0x40 * 0x4000; dest++ ) @@ -1819,15 +1817,15 @@ DEVICE_IMAGE_LOAD_MEMBER( sms_state, sms_cart ) new_rom[ 0x40 * 0x4000 + dest ] = BITSWAP8( new_rom[ dest ], 0, 1, 2, 3, 4, 5, 6, 7); } - state->m_cartridge[index].ROM = new_rom; - state->m_cartridge[index].size = 0x80 * 0x4000; + m_cartridge[index].ROM = new_rom; + m_cartridge[index].size = 0x80 * 0x4000; } } - LOG(("Cart Features: %x\n", state->m_cartridge[index].features)); + LOG(("Cart Features: %x\n", m_cartridge[index].features)); /* Load battery backed RAM, if available */ - image.battery_load(state->m_cartridge[index].cartSRAM, sizeof(UINT8) * NVRAM_SIZE, 0x00); + image.battery_load(m_cartridge[index].cartSRAM, sizeof(UINT8) * NVRAM_SIZE, 0x00); return IMAGE_INIT_PASS; } diff --git a/src/mess/machine/vtech2.c b/src/mess/machine/vtech2.c index 307cd0038b9..60a8e2845eb 100644 --- a/src/mess/machine/vtech2.c +++ b/src/mess/machine/vtech2.c @@ -314,29 +314,27 @@ void vtech2_state::mwa_bank(int bank, int offs, int data) DEVICE_IMAGE_LOAD_MEMBER( vtech2_state, laser_cart ) { - vtech2_state *state = image.device().machine().driver_data<vtech2_state>(); int size = 0; - size = image.fread(&state->m_mem[0x30000], 0x10000); - state->m_laser_bank_mask &= ~0xf000; + size = image.fread(&m_mem[0x30000], 0x10000); + m_laser_bank_mask &= ~0xf000; if( size > 0 ) - state->m_laser_bank_mask |= 0x1000; + m_laser_bank_mask |= 0x1000; if( size > 0x4000 ) - state->m_laser_bank_mask |= 0x2000; + m_laser_bank_mask |= 0x2000; if( size > 0x8000 ) - state->m_laser_bank_mask |= 0x4000; + m_laser_bank_mask |= 0x4000; if( size > 0xc000 ) - state->m_laser_bank_mask |= 0x8000; + m_laser_bank_mask |= 0x8000; return size > 0 ? IMAGE_INIT_PASS : IMAGE_INIT_FAIL; } DEVICE_IMAGE_UNLOAD_MEMBER( vtech2_state, laser_cart ) { - vtech2_state *state = image.device().machine().driver_data<vtech2_state>(); - state->m_laser_bank_mask &= ~0xf000; + m_laser_bank_mask &= ~0xf000; /* wipe out the memory contents to be 100% sure */ - memset(&state->m_mem[0x30000], 0xff, 0x10000); + memset(&m_mem[0x30000], 0xff, 0x10000); } static device_t *laser_file(running_machine &machine) diff --git a/src/mess/machine/wswan.c b/src/mess/machine/wswan.c index c5d52d2126d..27c2ce09c11 100644 --- a/src/mess/machine/wswan.c +++ b/src/mess/machine/wswan.c @@ -1367,7 +1367,7 @@ DEVICE_IMAGE_LOAD_MEMBER(wswan_state,wswan_cart) for (ii = 0; ii < m_ROMBanks; ii++) { - if ((m_ROMMap[ii] = auto_alloc_array(image.device().machine(), UINT8, 0x10000))) + if ((m_ROMMap[ii] = auto_alloc_array(machine(), UINT8, 0x10000))) { if (image.software_entry() == NULL) { @@ -1423,7 +1423,7 @@ DEVICE_IMAGE_LOAD_MEMBER(wswan_state,wswan_cart) if (m_eeprom.size != 0) { - m_eeprom.data = auto_alloc_array(image.device().machine(), UINT8, m_eeprom.size); + m_eeprom.data = auto_alloc_array(machine(), UINT8, m_eeprom.size); image.battery_load(m_eeprom.data, m_eeprom.size, 0x00); m_eeprom.page = m_eeprom.data; } |