Previous 199869 Revisions Next

r19940 Sunday 30th December, 2012 at 08:20:30 UTC by Sandro Ronco
(MESS) uzebox: added support for loading .uze images. (nw)
[src/mess/drivers]uzebox.c

trunk/src/mess/drivers/uzebox.c
r19939r19940
4444   virtual void machine_start();
4545   virtual void machine_reset();
4646   void line_update();
47   int cart_load(device_image_interface &image);
4748   UINT32 screen_update_uzebox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
4849
4950private:
r19939r19940
255256   return 0;
256257}
257258
259int uzebox_state::cart_load(device_image_interface &image)
260{
261   UINT8* rom = (UINT8*)(*memregion("maincpu"));
262
263   memset(rom, 0xff, memregion("maincpu")->bytes());
264
265   if (image.software_entry() == NULL)
266   {
267      UINT32 size = image.length();
268      UINT8* data = (UINT8*)auto_alloc_array(machine(), UINT8, size);
269
270      image.fread(data, size);
271
272      if (!strncmp((const char*)data, "UZEBOX", 6))
273         memcpy(rom, data + 0x200, size - 0x200);
274      else
275         memcpy(rom, data, size);
276
277      auto_free(machine(), data);
278   }
279   else
280   {
281      memcpy(rom, image.get_software_region("rom"), image.get_software_region_length("rom"));
282   }
283
284   return IMAGE_INIT_PASS;
285}
286
287static DEVICE_IMAGE_LOAD(uzebox_cart)
288{
289   return image.device().machine().driver_data<uzebox_state>()->cart_load(image);
290}
291
258292/****************************************************\
259293* Machine definition                                 *
260294\****************************************************/
r19939r19940
287321   MCFG_SOUND_ROUTE(0, "avr8", 1.00)
288322
289323   MCFG_CARTSLOT_ADD("cart1")
324   MCFG_CARTSLOT_EXTENSION_LIST("bin,uze")
290325   MCFG_CARTSLOT_MANDATORY
326   MCFG_CARTSLOT_LOAD(uzebox_cart)
291327   MCFG_CARTSLOT_INTERFACE("uzebox")
292328   MCFG_SOFTWARE_LIST_ADD("eprom_list","uzebox")
293329MACHINE_CONFIG_END
294330
295331ROM_START( uzebox )
296332   ROM_REGION( 0x10000, "maincpu", ROMREGION_ERASEFF )  /* Main program store */
297   ROM_CART_LOAD("cart1", 0x0000, 0x10000, ROM_OPTIONAL | ROM_FILL_FF)
298333
299   ROM_REGION( 0x200, "eeprom", ROMREGION_ERASE00 )  /* on-die eeprom */
334   ROM_REGION( 0x800, "eeprom", ROMREGION_ERASE00 )  /* on-die eeprom */
300335ROM_END
301336
302337/*   YEAR  NAME      PARENT    COMPAT    MACHINE   INPUT     INIT      COMPANY   FULLNAME */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team