Previous 15994 Revisions Next

r12440 Monday 1st August, 2011 at 11:24:15 UTC by Sandro Ronco
[KC] Fixed snapshots loading. (no whatsnew)
[src/mess/drivers]kc.c
[src/mess/machine]kc.c

src/mess/machine/kc.c
r12439r12440
5757   if (datasize!=0)
5858   {
5959      /* malloc memory for this data */
60      data = (unsigned char *)malloc(datasize);
60      data = (unsigned char *)auto_alloc_array(image.device().machine(), unsigned char, datasize);
6161
6262      if (data!=NULL)
6363      {
r12439r12440
8383   unsigned char   anzahl;
8484   unsigned char   load_address_l;
8585   unsigned char   load_address_h;
86   unsigned char   length_l;
87   unsigned char   length_h;
88   unsigned short   execution_address;
86   unsigned char   end_address_l;
87   unsigned char   end_address_h;
88   unsigned char   execution_address_l;
89   unsigned char   execution_address_h;
8990   unsigned char   pad[128-2-2-2-1-16];
9091};
9192
r12439r12440
100101   struct kcc_header *header;
101102   int addr;
102103   int datasize;
104   int execution_address;
103105   int i;
104106
105107   if (!kc_load(image, &data))
106108      return IMAGE_INIT_FAIL;
107109
108110   header = (struct kcc_header *) data;
109   datasize = (header->length_l & 0x0ff) | ((header->length_h & 0x0ff)<<8);
110   datasize = datasize-128;
111111   addr = (header->load_address_l & 0x0ff) | ((header->load_address_h & 0x0ff)<<8);
112   datasize = ((header->end_address_l & 0x0ff) | ((header->end_address_h & 0x0ff)<<8)) - addr;
113   execution_address = (header->execution_address_l & 0x0ff) | ((header->execution_address_h & 0x0ff)<<8);
112114
115   if (datasize + 128 > image.length())
116   {
117      mame_printf_info("Invalid snapshot size: expected 0x%04x, found 0x%04x\n", datasize, (UINT32)image.length() - 128);
118      datasize = image.length() - 128;
119   }
120
113121   for (i=0; i<datasize; i++)
114122      ram_get_ptr(image.device().machine().device(RAM_TAG))[(addr+i) & 0x0ffff] = data[i+128];
123
124   auto_free(image.device().machine(), data);
125
126   logerror("Snapshot loaded at: 0x%04x-0x%04x, execution address: 0x%04x\n", addr, addr + datasize - 1, execution_address);
127
115128   return IMAGE_INIT_PASS;
116129}
117130
src/mess/drivers/kc.c
r12439r12440
284284   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
285285
286286   /* devices */
287   MCFG_QUICKLOAD_ADD("quickload", kc, "kcc", 0)
287   MCFG_QUICKLOAD_ADD("quickload", kc, "kcc", 1)
288288
289289   MCFG_CASSETTE_ADD( CASSETTE_TAG, default_cassette_interface )
290290

Previous 15994 Revisions Next


© 1998-2018 The MESS Team