Previous 15994 Revisions Next

r11463 Friday 6th May, 2011 at 21:58:54 UTC by Curt Coder
[C64] Added mapper for the "VizaWrite 64" cartridge. [Curt Coder]
[hash]c64_cart.xml
[src/mess/includes]c64.h
[src/mess/machine]c64.c

hash/c64_cart.xml
r11462r11463
22<!DOCTYPE softwarelist SYSTEM "softwarelist.dtd">
33
44<softwarelist name="c64_cart" description="Commodore 64 Cartridge">
5   <software name="vw64" supported="no">
5   <software name="vw64">
66      <description>VizaWrite 64</description>
77      <year>1984</year>
88      <publisher>Viza Software</publisher>
r11462r11463
1212      |=|                  R      |
1313      |=|                         |
1414      |=|                         |
15      |=|      ROM0  ROM1  ROM2   |
15      |=|      ROM0  ROM2  ROM1   |
1616      |=|                         |
1717      |=|                         |
1818      |=|                         |
1919      |===========================|
2020
2121      ROM0    - Mitsubishi M5L2764K 8Kx8 EPROM "U"
22      ROM1    - Mitsubishi M5L2764K 8Kx8 EPROM "2" (located on solder side)
23      ROM2    - Mitsubishi M5L2764K 8Kx8 EPROM "3"
22      ROM1    - Mitsubishi M5L2764K 8Kx8 EPROM "3"
23      ROM2    - Mitsubishi M5L2764K 8Kx8 EPROM "2" (located on solder side)
2424      R       - 56K
2525      C       - 47uF
2626
2727      data and address lines are scrambled:
2828      data = BITSWAP8(7,6,0,5,1,4,2,3)
2929      address = BITSWAP16(15,14,13,12,7,8,6,9,5,11,4,3,2,10,1,0)
30      GAME:after reset GND for 1.1844s (74LS122 tW=0.45*R*C) then goes to Vcc
3031      EXROM:GND
31      GAME:after reset GND for 1.1844s (74LS122 tW=0.45*R*C) then goes to Vcc
3232      -->
3333      <part name="cart" interface="c64_cart">
34         <feature name="cart_type" value="vizawrite" />
3435         <feature name="game" value="0" />
3536         <feature name="exrom" value="0" />
3637
37         <dataarea name="rom" size="0x6000">
38         <dataarea name="roml" size="0x4000">
3839            <rom name="u" size="0x2000" crc="b0cc7564" sha1="59f7b3a9df26053fdcb720fe07a22f437a7a2241" offset="0x0000" />
39            <rom name="2" size="0x2000" crc="32f2a5df" sha1="5f3e5d416eab59a75ba64131588861991fa571a5" offset="0x2000" />
40            <rom name="3" size="0x2000" crc="ef80b1e7" sha1="80392a04bc9ca2fea006653a507f6f5338a10beb" offset="0x4000" />
40            <rom name="3" size="0x2000" crc="ef80b1e7" sha1="80392a04bc9ca2fea006653a507f6f5338a10beb" offset="0x2000" />
4141         </dataarea>
42
43         <dataarea name="romh" size="0x2000">
44            <rom name="2" size="0x2000" crc="32f2a5df" sha1="5f3e5d416eab59a75ba64131588861991fa571a5" offset="0x0000" />
45         </dataarea>
4246      </part>
4347   </software>
4448
r11462r11463
4953      <!--
5054      -->
5155      <part name="cart" interface="c64_cart">
56         <feature name="cart_type" value="tdos" />
5257         <feature name="game" value="1" />
5358         <feature name="exrom" value="0" />
5459
r11462r11463
7984      SP0256 - General Instruments SP0256A-AL2 Speech Synthesizer
8085      -->
8186      <part name="cart" interface="c64_cart">
87         <feature name="cart_type" value="currah_speech_64" />
8288         <feature name="game" value="1" />
8389         <feature name="exrom" value="0" />
8490         <feature name="vlsi" value="LA05-164" />
r11462r11463
132138      <!--
133139      -->
134140      <part name="cart" interface="c64_cart">
141         <feature name="cart_type" value="epyx_fast_load" />
135142         <feature name="game" value="1" />
136143         <feature name="exrom" value="0" />
137144
r11462r11463
164171      CN1   - connector to C64 video/audio port
165172      -->
166173      <part name="cart" interface="c64_cart">
174         <feature name="cart_type" value="ps64" />
167175         <feature name="game" value="1" />
168176         <feature name="exrom" value="0" />
169177         <feature name="speech" value="SSI-263AP" />
r11462r11463
195203      ROM1  - National Instruments NMC27C256Q 32Kx8 EPROM
196204      -->
197205      <part name="cart" interface="c64_cart">
206         <feature name="cart_type" value="pagefox" />
198207         <feature name="game" value="1" />
199208         <feature name="exrom" value="0" />
200209
r11462r11463
214223      <!--
215224      -->
216225      <part name="cart" interface="c64_cart">
226         <feature name="cart_type" value="calc_result_easy" />
217227         <feature name="game" value="1" />
218228         <feature name="exrom" value="0" />
219229
r11462r11463
221231            <rom name="calc_rom1.bin" size="0x2000" crc="f617bec4" sha1="c5ef2418cf9dba3e14f586d5d6997f271b521a24" offset="0x0000" />
222232         </dataarea>
223233
224         <dataarea name="rom" size="0x4000">
234         <dataarea name="romh" size="0x4000">
225235            <rom name="calc_rom2.bin" size="0x4000" crc="4997dd31" sha1="9820b1e6b90d72f095a2b74438dac3cfc33e80b8" offset="0x0000" />
226236         </dataarea>
227237      </part>
r11462r11463
282292      <!--
283293      -->
284294      <part name="cart" interface="c64_cart">
295         <feature name="cart_type" value="game_saver_card" />
285296         <feature name="game" value="1" />
286297         <feature name="exrom" value="0" />
287298
r11462r11463
326337      ROM6  - not populated
327338      -->
328339      <part name="cart" interface="c64_cart">
340         <feature name="cart_type" value="multiscreen" />
329341         <feature name="game" value="1" />
330342         <feature name="exrom" value="0" />
331343         <feature name="battery" value="CR2325" />
r11462r11463
384396      GAME:Vcc
385397      -->
386398      <part name="cart" interface="c64_cart">
399         <feature name="cart_type" value="4040_fast_hack_em" />
387400         <feature name="game" value="1" />
388401         <feature name="exrom" value="0" />
389402
r11462r11463
421434      latch is cleared to 0 on computer reset
422435      -->
423436      <part name="cart" interface="c64_cart">
437         <feature name="cart_type" value="hugo" />
424438         <feature name="game" value="0" />
425439         <feature name="exrom" value="0" />
426440         <feature name="pcb" value="e9048" />
src/mess/machine/c64.c
r11462r11463
12631263   return IMAGE_INIT_PASS;
12641264}
12651265
1266static DEVICE_IMAGE_LOAD( c64_cart )
1266void load_standard_c64_cartridge(device_image_interface &image)
12671267{
12681268   c64_state *state = image.device().machine().driver_data<c64_state>();
1269   int result = IMAGE_INIT_PASS;
1269   UINT32 size;
12701270
1271   if (image.software_entry() != NULL)
1271   // is there anything to load at 0x8000?
1272   size = image.get_software_region_length("roml");
1273
1274   if (size)
12721275   {
1273      UINT32 size;
1274
1275      state->m_exrom = atol(image.get_feature("exrom"));
1276      state->m_game = atol(image.get_feature("game"));
1276      memcpy(state->m_roml, image.get_software_region("roml"), MIN(0x2000, size));
12771277     
1278      state->m_roml = state->m_c64_roml;
1279      state->m_romh = state->m_c64_romh;
1278      if (size == 0x4000)
1279      {
1280         // continue loading to ROMH region
1281         memcpy(state->m_romh, image.get_software_region("roml") + 0x2000, 0x2000);
1282      }
1283   }
12801284
1281      memset(state->m_roml, 0, 0x2000);
1282      memset(state->m_romh, 0, 0x2000);
1285   // is there anything to load at 0xa000?
1286   size = image.get_software_region_length("romh");
1287   if (size)
1288      memcpy(state->m_romh, image.get_software_region("romh"), size);
1289}
12831290
1284      // is there anything to load at 0x8000?
1285      size = image.get_software_region_length("roml");
1291TIMER_CALLBACK( vizawrite_timer )
1292{
1293   c64_state *state = machine.driver_data<c64_state>();
1294   UINT8 *decrypted = machine.region("user1")->base();
12861295
1287      if (size)
1288      {
1289         memcpy(state->m_roml, image.get_software_region("roml"), MIN(0x2000, size));
1290         
1291         if (size == 0x4000)
1292         {
1293            // continue loading to ROMH region
1294            memcpy(state->m_romh, image.get_software_region("roml") + 0x2000, 0x2000);
1295         }
1296      }
1296   // map cartridge ROMs
1297   memcpy(state->m_roml, decrypted + 0x2000, 0x2000);
1298   memset(state->m_romh, 0, 0x2000);
12971299
1298      // is there anything to load at 0xa000?
1299      size = image.get_software_region_length("romh");
1300      if (size)
1301         memcpy(state->m_romh, image.get_software_region("romh"), size);
1300   // set GAME line
1301   state->m_game = 1;
1302   c64_bankswitch(machine, 0);
1303}
1304
1305void load_vizawrite_cartridge(device_image_interface &image)
1306{
1307   #define DECRYPT_ADDRESS(_offset) \
1308      BITSWAP16(_offset,15,14,13,12,7,8,6,9,5,11,4,3,2,10,1,0)
1309   
1310   #define DECRYPT_DATA(_data) \
1311      BITSWAP8(_data,7,6,0,5,1,4,2,3)
1312
1313   c64_state *state = image.device().machine().driver_data<c64_state>();
1314
1315   UINT8 *roml = image.get_software_region("roml");
1316   UINT8 *romh = image.get_software_region("romh");
1317   UINT8 *decrypted = image.device().machine().region("user1")->base();
1318
1319   // decrypt ROMs
1320   for (offs_t offset = 0; offset < 0x2000; offset++)
1321   {
1322      offs_t address = DECRYPT_ADDRESS(offset);
1323      decrypted[address] = DECRYPT_DATA(roml[offset]);
1324      decrypted[address + 0x2000] = DECRYPT_DATA(roml[offset + 0x2000]);
1325      decrypted[address + 0x4000] = DECRYPT_DATA(romh[offset]);
13021326   }
1327
1328   // map cartridge ROMs
1329   memcpy(state->m_roml, decrypted, 0x2000);
1330   memcpy(state->m_romh, decrypted + 0x4000, 0x2000);
1331
1332   // allocate GAME changing timer
1333   state->m_cartridge_timer = image.device().machine().scheduler().timer_alloc(FUNC(vizawrite_timer));
1334   state->m_cartridge_timer->adjust(attotime::from_msec(1184), 0);
1335}
1336
1337void c64_software_list_cartridge_load(device_image_interface &image)
1338{
1339   c64_state *state = image.device().machine().driver_data<c64_state>();
1340
1341   // initialize ROML and ROMH pointers
1342   state->m_roml = state->m_c64_roml;
1343   state->m_romh = state->m_c64_romh;
1344
1345   // clear ROML and ROMH areas
1346   memset(state->m_roml, 0, 0x2000);
1347   memset(state->m_romh, 0, 0x2000);
1348
1349   // set GAME and EXROM
1350   state->m_game = atol(image.get_feature("game"));
1351   state->m_exrom = atol(image.get_feature("exrom"));
1352
1353   // determine cartridge type
1354   const char *cart_type = image.get_feature("cart_type");
1355
1356   if (cart_type == NULL)
1357   {
1358      load_standard_c64_cartridge(image);
1359   }
13031360   else
1361   {
1362      if (!strcmp(cart_type, "vizawrite"))
1363         load_vizawrite_cartridge(image);
1364   }
1365}
1366
1367static DEVICE_IMAGE_LOAD( c64_cart )
1368{
1369   c64_state *state = image.device().machine().driver_data<c64_state>();
1370   int result = IMAGE_INIT_PASS;
1371
1372   if (image.software_entry() != NULL)
1373   {
1374      c64_software_list_cartridge_load(image);
1375   }
1376   else
13041377      result = c64_crt_load(image);
13051378
13061379   return result;
src/mess/includes/c64.h
r11462r11463
4848   int m_old_game;
4949   UINT8 m_vicirq;
5050   emu_timer *m_datasette_timer;
51   emu_timer *m_cartridge_timer;
5152   UINT8 *m_colorram;
5253   UINT8 *m_basic;
5354   UINT8 *m_kernal;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team