Previous 15994 Revisions Next

r2134 Saturday 29th March, 2008 at 07:11:24 UTC by Robbbert
[MBEE] Added snapload for MWB files.
[src/mess/drivers]mbee.c

src/mess/drivers/mbee.c
r2133r2134
5757#include "devices/cassette.h"
5858#include "devices/z80bin.h"
5959
60static size_t mbee_size;
6061
6162static ADDRESS_MAP_START(mbee_mem, ADDRESS_SPACE_PROGRAM, 8)
6263   ADDRESS_MAP_UNMAP_HIGH
64   AM_RANGE(0x0000, 0x3fff) AM_SIZE(&mbee_size)
6365   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK(1)
6466   AM_RANGE(0x1000, 0x3fff) AM_RAM
6567   AM_RANGE(0x4000, 0x7fff) AM_WRITENOP   /* Needed because quickload to here will crash MESS otherwise */
r2133r2134
6971ADDRESS_MAP_END
7072
7173static ADDRESS_MAP_START(mbeeic_mem, ADDRESS_SPACE_PROGRAM, 8)
74   AM_RANGE(0x0000, 0x7fff) AM_SIZE(&mbee_size)
7275   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK(1)
7376   AM_RANGE(0x1000, 0x7fff) AM_RAM
7477   AM_RANGE(0x8000, 0xefff) AM_ROM
r2133r2134
7780ADDRESS_MAP_END
7881
7982static ADDRESS_MAP_START(mbee56_mem, ADDRESS_SPACE_PROGRAM, 8)
83   AM_RANGE(0x0000, 0xdfff) AM_SIZE(&mbee_size)
8084   AM_RANGE(0x0000, 0x0fff) AM_RAMBANK(1)
8185   AM_RANGE(0x1000, 0xdfff) AM_RAM
8286   AM_RANGE(0xe000, 0xefff) AM_ROM
r2133r2134
474478   }
475479}
476480
481static SNAPSHOT_LOAD( mbee )
482{
483   UINT16 i, j;
484   UINT8 data, sw = readinputportbytag("CONFIG") & 1;   /* reading the dipswitch: 1 = autorun */
485
486   for (i = 0; i < snapshot_size; i++)
487   {
488      j = (0x8c0 + i) & 0xffff;
489
490      if (image_fread(image, &data, 1) != 1) return INIT_FAIL;
491
492      if ((j < mbee_size) || (j > 0xefff)) program_write_byte(j, data);
493   }
494
495   if (sw)
496   {
497      program_write_word_16le(0xa2,0x801e);      /* fix warm-start vector to get around some copy-protections */
498      cpunum_set_reg(0, REG_PC, 0x801e);
499   }
500   else
501      program_write_word_16le(0xa2,0x8517);
502
503   return INIT_PASS;
504}
505
506static void mbee_snapshot_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
507{
508   /* snapshot */
509   switch(state)
510   {
511      /* --- the following bits of info are returned as NULL-terminated strings --- */
512      case MESS_DEVINFO_STR_FILE_EXTENSIONS:   strcpy(info->s = device_temp_str(), "mwb"); break;
513
514      /* --- the following bits of info are returned as pointers to data or functions --- */
515      case MESS_DEVINFO_PTR_SNAPSHOT_LOAD:   info->f = (genf *) snapshot_load_mbee; break;
516
517      /* --- the following bits of info are returned as doubles --- */
518      case MESS_DEVINFO_FLOAT_SNAPSHOT_DELAY:   info->d = 0.5; break;
519
520      default:            snapshot_device_getinfo(devclass, state, info); break;
521   }
522}
523
477524static void mbee_cassette_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
478525{
479526   /* cassette */
480527   switch(state)
481528   {
482529      /* --- the following bits of info are returned as 64-bit signed integers --- */
483      case MESS_DEVINFO_INT_COUNT:                     info->i = 1; break;
530      case MESS_DEVINFO_INT_COUNT:      info->i = 1; break;
484531
485      default:                              cassette_device_getinfo(devclass, state, info); break;
532      default:            cassette_device_getinfo(devclass, state, info); break;
486533   }
487534}
488535
r2133r2134
492539   switch(state)
493540   {
494541      /* --- the following bits of info are returned as 64-bit signed integers --- */
495      case MESS_DEVINFO_INT_COUNT:                     info->i = 1; break;
542      case MESS_DEVINFO_INT_COUNT:      info->i = 1; break;
496543
497544      /* --- the following bits of info are returned as pointers to data or functions --- */
498      case MESS_DEVINFO_PTR_LOAD:                     info->load = device_load_mbee_cart; break;
545      case MESS_DEVINFO_PTR_LOAD:      info->load = device_load_mbee_cart; break;
499546
500547      /* --- the following bits of info are returned as NULL-terminated strings --- */
501      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "rom"); break;
548      case MESS_DEVINFO_STR_FILE_EXTENSIONS:   strcpy(info->s = device_temp_str(), "rom"); break;
502549
503      default:                              cartslot_device_getinfo(devclass, state, info); break;
550      default:            cartslot_device_getinfo(devclass, state, info); break;
504551   }
505552}
506553
r2133r2134
510557   switch(state)
511558   {
512559      /* --- the following bits of info are returned as 64-bit signed integers --- */
513      case MESS_DEVINFO_INT_COUNT:                     info->i = 4; break;
560      case MESS_DEVINFO_INT_COUNT:      info->i = 4; break;
514561
515562      /* --- the following bits of info are returned as pointers to data or functions --- */
516      case MESS_DEVINFO_PTR_LOAD:                     info->load = device_load_basicdsk_floppy; break;
563      case MESS_DEVINFO_PTR_LOAD:      info->load = device_load_basicdsk_floppy; break;
517564
518565      /* --- the following bits of info are returned as NULL-terminated strings --- */
519      case MESS_DEVINFO_STR_FILE_EXTENSIONS:            strcpy(info->s = device_temp_str(), "dsk"); break;
566      case MESS_DEVINFO_STR_FILE_EXTENSIONS:   strcpy(info->s = device_temp_str(), "dsk"); break;
520567
521      default:                              legacybasicdsk_device_getinfo(devclass, state, info); break;
568      default:            legacybasicdsk_device_getinfo(devclass, state, info); break;
522569   }
523570}
524571
r2133r2134
527574   CONFIG_DEVICE(mbee_cassette_getinfo)
528575   CONFIG_DEVICE(mbee_cartslot_getinfo)
529576   CONFIG_DEVICE(mbee_quickload_getinfo)
577   CONFIG_DEVICE(mbee_snapshot_getinfo)
530578SYSTEM_CONFIG_END
531579
532580SYSTEM_CONFIG_START(mbeeic)
r2133r2134
534582   CONFIG_DEVICE(mbee_cartslot_getinfo)
535583   CONFIG_DEVICE(mbee_floppy_getinfo)
536584   CONFIG_DEVICE(mbee_quickload_getinfo)
585   CONFIG_DEVICE(mbee_snapshot_getinfo)
537586SYSTEM_CONFIG_END
538587
539588

Previous 15994 Revisions Next


© 1998-2018 The MESS Team