trunk/src/emu/bus/vboy/slot.c
| r32518 | r32519 | |
| 171 | 171 | seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); |
| 172 | 172 | return IMAGE_INIT_FAIL; |
| 173 | 173 | } |
| 174 | | |
| 175 | | m_cart->rom_alloc(len, tag()); |
| 174 | |
| 175 | // always alloc 0x200000 so to be able to directly map the region |
| 176 | // to the address map (speeding up emulation a bit) |
| 177 | m_cart->rom_alloc(0x200000, tag()); |
| 176 | 178 | if (has_eeprom) |
| 177 | 179 | m_cart->eeprom_alloc(get_software_region_length("eeprom")); |
| 178 | 180 | |
| r32518 | r32519 | |
| 183 | 185 | else |
| 184 | 186 | memcpy(ROM, get_software_region("rom"), len); |
| 185 | 187 | |
| 188 | if (len < 0x080000) { memcpy(ROM + 0x040000, ROM, 0x040000); } |
| 189 | if (len < 0x100000) { memcpy(ROM + 0x080000, ROM, 0x080000); } |
| 190 | if (len < 0x200000) { memcpy(ROM + 0x100000, ROM, 0x100000); } |
| 191 | |
| 186 | 192 | if (software_entry() == NULL) |
| 187 | 193 | m_type = vboy_get_pcb_id("vb_rom"); |
| 188 | 194 | else |
trunk/src/mess/drivers/vboy.c
| r32518 | r32519 | |
| 157 | 157 | required_device<vboy_cart_slot_device> m_cart; |
| 158 | 158 | required_device<timer_device> m_maintimer; |
| 159 | 159 | required_device<palette_device> m_palette; |
| 160 | memory_region *m_cart_rom; |
| 160 | 161 | |
| 161 | 162 | DECLARE_READ32_MEMBER(io_r); |
| 162 | 163 | DECLARE_WRITE32_MEMBER(io_w); |
| r32518 | r32519 | |
| 1111 | 1112 | //AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area |
| 1112 | 1113 | AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram")// Main RAM - 64K mask 0xffff |
| 1113 | 1114 | AM_RANGE( 0x06000000, 0x06003fff ) AM_DEVREADWRITE("cartslot", vboy_cart_slot_device, read_eeprom, write_eeprom) // Cart RAM - 8K NVRAM |
| 1114 | | AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ |
| 1115 | // AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ |
| 1115 | 1116 | ADDRESS_MAP_END |
| 1116 | 1117 | |
| 1117 | 1118 | static ADDRESS_MAP_START( vboy_io, AS_IO, 32, vboy_state ) |
| r32518 | r32519 | |
| 1140 | 1141 | // AM_RANGE( 0x04000000, 0x04ffffff ) // Expansion area |
| 1141 | 1142 | AM_RANGE( 0x05000000, 0x0500ffff ) AM_MIRROR(0x0ff0000) AM_RAM AM_SHARE("wram") // Main RAM - 64K mask 0xffff |
| 1142 | 1143 | AM_RANGE( 0x06000000, 0x06003fff ) AM_NOP // Cart RAM - 8K NVRAM ? |
| 1143 | | AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ |
| 1144 | // AM_RANGE( 0x07000000, 0x071fffff ) AM_MIRROR(0x0e00000) AM_DEVREAD("cartslot", vboy_cart_slot_device, read_cart) /* ROM */ |
| 1144 | 1145 | ADDRESS_MAP_END |
| 1145 | 1146 | |
| 1146 | 1147 | /* Input ports */ |
| r32518 | r32519 | |
| 1167 | 1168 | |
| 1168 | 1169 | void vboy_state::machine_start() |
| 1169 | 1170 | { |
| 1171 | // install the cart ROM as a bank into the address map. |
| 1172 | // this speeds up the rom access, by skipping the m_cart->read_rom |
| 1173 | // trampoline (but forces us to alloc always a 0x200000-wide region) |
| 1170 | 1174 | if (m_cart->exists()) |
| 1175 | { |
| 1176 | astring region_tag; |
| 1177 | m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(VBOYSLOT_ROM_REGION_TAG)); |
| 1178 | |
| 1179 | m_maincpu->space(AS_PROGRAM).install_read_bank(0x07000000, 0x071fffff, 0, 0x0e00000, "prog_cart_bank"); |
| 1180 | m_maincpu->space(AS_IO).install_read_bank(0x07000000, 0x071fffff, 0, 0x0e00000, "io_cart_bank"); |
| 1181 | membank("prog_cart_bank")->set_base(m_cart_rom->base()); |
| 1182 | membank("io_cart_bank")->set_base(m_cart_rom->base()); |
| 1183 | |
| 1171 | 1184 | m_cart->save_eeprom(); |
| 1185 | } |
| 1172 | 1186 | } |
| 1173 | 1187 | |
| 1174 | 1188 | void vboy_state::machine_reset() |