Previous 15994 Revisions Next

r6134 Monday 19th October, 2009 at 02:41:38 UTC by Nathan Woods
[TI99] Added support for two new cartridge types. [Michael Zapf]
[docs]messnew.txt
[src/mess/devices]ti99cart.c ti99cart.h

src/mess/devices/ti99cart.c
r6133r6134
3939struct _ti99_multicart_t
4040{
4141   /* Reserves space for all cartridges. This is also used in the legacy
42       cartridge system, but only for slot 0. */
42   cartridge system, but only for slot 0. */
4343   cartridge_t cartridge[NUMBER_OF_CARTRIDGE_SLOTS];
4444
4545   /* Determines which slot is currently active. This value is changed when there
46    are accesses to other GROM base addresses. */
46   are accesses to other GROM base addresses. */
4747   int active_slot;
4848
4949   /* Used in order to enforce a special slot. This value is retrieved
r6133r6134
886886        int reply = 0;
887887
888888   /* ram_page contains the bank number. We have a maximum of
889       4 banks; the Super Space II manual says:
890
891    Banks are selected by writing a bit pattern to CRU address >0800:
892
893    Bank #   Value
894    0        >02  = 0000 0010
895    1        >08  = 0000 1000
896    2        >20  = 0010 0000
897    3        >80  = 1000 0000
898
899    With the bank number (0, 1, 2, or 3) in R0:
900
901    BNKSW   LI    R12,>0800   Set CRU address
902        LI    R1,2        Load Shift Bit
903        SLA   R0,1        Align Bank Number
904        JEQ   BNKS1       Skip shift if Bank 0
905        SLA   R1,0        Align Shift Bit
906    BNKS1   LDCR  R1,0        Switch Banks
907        SRL   R0,1        Restore Bank Number (optional)
908        RT
909    */
889   4 banks; the Super Space II manual says:
890   
891   Banks are selected by writing a bit pattern to CRU address >0800:
892   
893   Bank #   Value
894   0        >02  = 0000 0010
895   1        >08  = 0000 1000
896   2        >20  = 0010 0000
897   3        >80  = 1000 0000
898   
899   With the bank number (0, 1, 2, or 3) in R0:
900   
901   BNKSW   LI    R12,>0800   Set CRU address
902      LI    R1,2        Load Shift Bit
903      SLA   R0,1        Align Bank Number
904      JEQ   BNKS1       Skip shift if Bank 0
905      SLA   R1,0        Align Shift Bit
906   BNKS1   LDCR  R1,0        Switch Banks
907      SRL   R0,1        Restore Bank Number (optional)
908      RT
909   */
910910   if ((offset & 1) == 0 || offset > 7)
911911      reply = 0;
912912
913913   /* CRU addresses are only 1 bit wide. Bytes are transferred from LSB
914       to MSB. That is, 8 bit are eight consecutive addresses. */
914   to MSB. That is, 8 bit are eight consecutive addresses. */
915915   reply = (cartridge->ram_page == (offset-1)/2);
916916
917917   return reply;
r6133r6134
11701170   return INIT_PASS;
11711171}
11721172
1173/*****************************************************************************
1174  Cartridge type: paged379i
1175    This cartridge consists of one 16 KiB, 32 KiB, or 64 KiB EEPROM which is
1176    organised in 2, 4, or 8 pages of 8 KiB each. We assume there is only one
1177    dump file of the respective size.
1178    The pages are selected by writing a value to some memory locations. Due to
1179    using the inverted outputs of the LS379 latch, setting the inputs of the
1180    latch to all 0 selects the highest bank, while setting to all 1 selects the
1181    lowest.There are some cartridges (16 KiB) which are using this scheme, and
1182    there are new hardware developments mainly relying on this scheme.
1183   
1184    Writing to       selects page (16K/32K/64K)
1185    >6000            1 / 3 / 7
1186    >6002            0 / 2 / 6
1187    >6004            1 / 1 / 5
1188    >6006            0 / 0 / 4
1189    >6008            1 / 3 / 3
1190    >600A            0 / 2 / 2
1191    >600C            1 / 1 / 1
1192    >600E            0 / 0 / 0
11731193
1194******************************************************************************/
1195
1196static DEVICE_START(ti99_pcb_paged379i)
1197{
1198   /* device is ti99_cartslot:cartridge:pcb */
1199//  printf("DEVICE_START(ti99_pcb_paged379i), tag of device=%s\n", device->tag);
1200   set_pointers(device, get_index_from_tagname(device->owner)-1);
1201}
1202
1203/*
1204    Read handler for the CPU address space of the cartridge
1205    Images for this area are found in the rom_sockets.
1206*/
1207static READ16_DEVICE_HANDLER( read_cart_paged379i )
1208{
1209   /* device is pcb, owner is cartslot */
1210   UINT16 value;
1211   ti99_pcb_t *pcb = (ti99_pcb_t *)device->token;
1212   cartridge_t *cartridge = pcb->cartridge;
1213   offs_t boffset;
1214
1215   if (cartridge->rom_ptr==NULL)
1216   {
1217      //      printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot);
1218      //      printf("Cartridge address = %lx\n", (long)pcb->cartridge);
1219      value = 0;
1220   }
1221   else
1222   {
1223      // rom_page is the stored latch value
1224      // 16bit access -> multiply by 0x1000
1225      boffset = cartridge->rom_page * 0x1000 + offset;
1226      value = ((UINT16 *)cartridge->rom_ptr)[boffset];
1227      //      printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value);
1228   }
1229//     printf("accessed cartridge rom[%02x:%04x] = %04x\n", cartridge->rom_page, 0x6000+offset*2, value);
1230   return value;
1231}
1232
1233static void set_paged379i_bank(cartridge_t *cartridge, int rompage)
1234{
1235   int mask = 0;
1236   if (cartridge->rom_size > 16384)
1237   {
1238      if (cartridge->rom_size > 32768)
1239         mask = 7;
1240      else
1241         mask = 3;
1242   }     
1243   else
1244      mask = 1;
1245   
1246   cartridge->rom_page = rompage & mask;   
1247//   printf("setting rompage to %d\n", cartridge->rom_page);   
1248}
1249
1250/*
1251   Handle paging. We use a LS379 latch for storing the page number. On this
1252   PCB, the inverted output of the latch is used, so the order of pages
1253   is reversed. (No problem as long as the memory dump is kept exactly
1254   in the way it is stored in the EPROM.)
1255   The latch can store a value of 4 bits. We adjust the number of
1256   significant bits by the size of the memory dump (16K, 32K, 64K).
1257*/
1258static WRITE16_DEVICE_HANDLER( write_cart_paged379i )
1259{
1260   ti99_pcb_t *pcb = (ti99_pcb_t *)device->token;
1261   cartridge_t *cartridge = pcb->cartridge;
1262/*
1263   >6000            1 / 3 / 7
1264   >6002            0 / 2 / 6
1265   >6004            1 / 1 / 5
1266   >6006            0 / 0 / 4
1267   >6008            1 / 3 / 3
1268   >600A            0 / 2 / 2
1269   >600C            1 / 1 / 1
1270   >600E            0 / 0 / 0
1271   
1272   Bits: 011x xxxx xxxx bbbx
1273   x = don't care, bbb = bank
1274   16bit access -> drop rightmost bit
1275*/
1276   set_paged379i_bank(cartridge, 7 - (offset & 7));
1277}
1278
1279/*
1280    TI-99/8 support:
1281    Read handler for the CPU address space of the cartridge.
1282    Images for this area are found in the rom_sockets.
1283*/
1284static READ8_DEVICE_HANDLER( read_cart_paged379i8 )
1285{
1286   UINT8 value;
1287   ti99_pcb_t *pcb = (ti99_pcb_t *)device->token;
1288   cartridge_t *cartridge = pcb->cartridge;
1289   offs_t boffset;
1290   
1291   if (cartridge->rom_ptr==NULL)
1292   {
1293      //      printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot);
1294      //      printf("Cartridge address = %lx\n", (long)pcb->cartridge);
1295      value = 0;
1296   }
1297   else
1298   {
1299      // rom_page is the stored latch value
1300      // 8bit access -> multiply by 0x2000
1301      boffset = cartridge->rom_page * 0x2000 + offset;
1302      value = ((UINT8 *)cartridge->rom_ptr)[boffset];
1303      //      printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value);
1304   }
1305   //  printf("accessed cartridge rom[%02x:%04x] = %04x\n", cartridge->rom_page, 0x6000+offset*2, value);
1306   return value;
1307
1308}
1309
1310/*
1311    TI-99/8 support: Handle paging.
1312*/
1313static WRITE8_DEVICE_HANDLER( write_cart_paged379i8 )
1314{
1315   ti99_pcb_t *pcb = (ti99_pcb_t *)device->token;
1316   cartridge_t *cartridge = pcb->cartridge;
1317/*
1318   >6000            1 / 3 / 7
1319   >6002            0 / 2 / 6
1320   >6004            1 / 1 / 5
1321   >6006            0 / 0 / 4
1322   >6008            1 / 3 / 3
1323   >600A            0 / 2 / 2
1324   >600C            1 / 1 / 1
1325   >600E            0 / 0 / 0
1326   
1327   Bits: 011x xxxx xxxx bbbx
1328   x = don't care, bbb = bank
1329   16bit access -> drop rightmost bit
1330*/
1331   set_paged379i_bank(cartridge, 7 - ((offset>>1) & 7));
1332}
1333
1334/*
1335    Paged379i modules have one EPROM dump.
1336*/
1337static int assemble_paged379i(const device_config *image)
1338{
1339   cartridge_t *cart;
1340
1341//  printf("assemble_paged379i, %s\n", image->tag);
1342   cart = assemble_common(image);
1343   if (cart->rom_ptr==NULL)
1344   {
1345      logerror("Missing ROM for paged cartridge");
1346      return INIT_FAIL;
1347   }
1348   set_paged379i_bank(cart, 15);
1349   return INIT_PASS;
1350}
1351
11741352/*****************************************************************************
1353  Cartridge type: pagedcru
1354    This cartridge consists of one 16 KiB, 32 KiB, or 64 KiB EEPROM which is
1355    organised in 2, 4, or 8 pages of 8 KiB each. We assume there is only one
1356    dump file of the respective size.
1357    The pages are selected by writing a value to the CRU. This scheme is
1358    similar to the one used for the SuperSpace cartridge, with the exception
1359    that we are using ROM only, and we can have up to 8 pages.
1360   
1361      Bank     Value written to CRU>0800
1362   0      >0002  = 0000 0000 0000 0010
1363   1      >0008  = 0000 0000 0000 1000
1364   2      >0020  = 0000 0000 0010 0000
1365   3      >0080  = 0000 0000 1000 0000
1366   4      >0200  = 0000 0010 0000 0000
1367   5      >0800  = 0000 1000 0000 0000
1368   6      >2000  = 0010 0000 0000 0000
1369   7      >8000  = 1000 0000 0000 0000
1370
1371******************************************************************************/
1372
1373static DEVICE_START(ti99_pcb_pagedcru)
1374{
1375   /* device is ti99_cartslot:cartridge:pcb */
1376//  printf("DEVICE_START(ti99_pcb_paged379i), tag of device=%s\n", device->tag);
1377   set_pointers(device, get_index_from_tagname(device->owner)-1);
1378}
1379
1380/*
1381    Read handler for the CPU address space of the cartridge
1382    Images for this area are found in the rom_sockets.
1383*/
1384static READ16_DEVICE_HANDLER( read_cart_pagedcru )
1385{
1386   /* device is pcb, owner is cartslot */
1387   UINT16 value;
1388   ti99_pcb_t *pcb = (ti99_pcb_t *)device->token;
1389   cartridge_t *cartridge = pcb->cartridge;
1390   offs_t boffset;
1391
1392   if (cartridge->rom_ptr==NULL)
1393   {
1394      //      printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot);
1395      //      printf("Cartridge address = %lx\n", (long)pcb->cartridge);
1396      value = 0;
1397   }
1398   else
1399   {
1400      // rom_page is the stored latch value
1401      // 16bit access -> multiply by 0x1000
1402      boffset = cartridge->rom_page * 0x1000 + offset;
1403      value = ((UINT16 *)cartridge->rom_ptr)[boffset];
1404      //      printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value);
1405   }
1406//     printf("accessed cartridge rom[%02x:%04x] = %04x\n", cartridge->rom_page, 0x6000+offset*2, value);
1407   return value;
1408}
1409
1410/*
1411   This type of cartridge does not support writing to the EPROM address
1412   space.
1413*/
1414static WRITE16_DEVICE_HANDLER( write_cart_pagedcru )
1415{
1416   return;
1417}
1418
1419/*
1420    TI-99/8 support:
1421    Read handler for the CPU address space of the cartridge.
1422    Images for this area are found in the rom_sockets.
1423*/
1424static READ8_DEVICE_HANDLER( read_cart_pagedcru8 )
1425{
1426   UINT8 value;
1427   ti99_pcb_t *pcb = (ti99_pcb_t *)device->token;
1428   cartridge_t *cartridge = pcb->cartridge;
1429   offs_t boffset;
1430   
1431   if (cartridge->rom_ptr==NULL)
1432   {
1433      //      printf("No cartridge ROM in rompage=%d of bank %d\n", rompage, cartslots->active_slot);
1434      //      printf("Cartridge address = %lx\n", (long)pcb->cartridge);
1435      value = 0;
1436   }
1437   else
1438   {
1439      // rom_page is the stored latch value
1440      // 8bit access -> multiply by 0x2000
1441      boffset = cartridge->rom_page * 0x2000 + offset;
1442      value = ((UINT8 *)cartridge->rom_ptr)[boffset];
1443      //      printf("stdcart/read: %4x = %4x\n", 0x6000 + 2*offset, value);
1444   }
1445   //  printf("accessed cartridge rom[%02x:%04x] = %04x\n", cartridge->rom_page, 0x6000+offset*2, value);
1446   return value;
1447
1448}
1449
1450/*
1451    TI-99/8 support: This type of cartridge does not support writing to the
1452    EPROM address space.
1453*/
1454static WRITE8_DEVICE_HANDLER( write_cart_pagedcru8 )
1455{
1456   return;
1457}
1458
1459/*
1460    The CRU read handler. The CRU is a serial interface in the console.
1461    Using the CRU we can switch the banks in the SuperSpace cartridge.
1462    For documentation see the corresponding cru function above. Note we are
1463    using rom_page here.
1464*/
1465static READ8_DEVICE_HANDLER( read_cart_cru_paged )
1466{
1467   ti99_pcb_t *pcb = (ti99_pcb_t *)device->token;
1468   cartridge_t *cartridge = pcb->cartridge;
1469        int reply = 0;
1470
1471   if ((offset & 1) == 0 || offset > 15)
1472      reply = 0;
1473
1474   reply = (cartridge->rom_page == (offset-1)/2);
1475
1476   return reply;
1477}
1478
1479static WRITE8_DEVICE_HANDLER( write_cart_cru_paged )
1480{
1481   ti99_pcb_t *pcb = (ti99_pcb_t *)device->token;
1482   cartridge_t *cartridge = pcb->cartridge;
1483   // data is bit
1484   // offset is address
1485   /* Note that CRU >0F00 also gets in here ... should check
1486   whether it is intended to go somewhere else */
1487        if (offset < 16)
1488   {
1489      if (data != 0)
1490      {
1491         cartridge->rom_page = (offset-1)/2;
1492         printf("Setting bit %4x of CRU base >0800\n", offset);
1493      }
1494   }
1495//   printf("setting rompage to %d\n", cartridge->rom_page);     
1496}
1497
1498/*
1499    Pagedcru modules have one EPROM dump.
1500*/
1501static int assemble_pagedcru(const device_config *image)
1502{
1503   cartridge_t *cart;
1504
1505//  printf("assemble_paged379i, %s\n", image->tag);
1506   cart = assemble_common(image);
1507   if (cart->rom_ptr==NULL)
1508   {
1509      logerror("Missing ROM for pagedcru cartridge");
1510      return INIT_FAIL;
1511   }
1512   cart->rom_page = 0;
1513   return INIT_PASS;
1514}
1515
1516/*****************************************************************************
11751517  Device metadata
11761518******************************************************************************/
11771519
r6133r6134
14161758   }
14171759}
14181760
1761static DEVICE_GET_INFO(ti99_cartridge_pcb_paged379i)
1762{
1763   switch(state)
1764   {
1765      case DEVINFO_FCT_START:
1766         info->start = DEVICE_START_NAME(ti99_pcb_paged379i);
1767         break;
14191768
1769      case TI99CART_FCT_ASSM:
1770         info->f = (genf *) assemble_paged379i; break;
1771
1772      case TI99CARTINFO_FCT_6000_R:
1773         info->f = (genf *) read_cart_paged379i;
1774         break;
1775
1776      case TI99CARTINFO_FCT_6000_W:
1777         info->f = (genf *) write_cart_paged379i;
1778         break;
1779
1780      case TI99CARTINFO_FCT_6000_R8:
1781         info->f = (genf *) read_cart_paged379i8;
1782         break;
1783
1784      case TI99CARTINFO_FCT_6000_W8:
1785         info->f = (genf *) write_cart_paged379i8;
1786         break;
1787
1788      case DEVINFO_STR_NAME:
1789         strcpy(info->s, "TI99 paged379i cartridge pcb");
1790         break;
1791
1792      default:
1793         DEVICE_GET_INFO_CALL(ti99_cart_common);
1794         break;
1795   }
1796}
1797
1798static DEVICE_GET_INFO(ti99_cartridge_pcb_pagedcru)
1799{
1800   switch(state)
1801   {
1802      case DEVINFO_FCT_START:
1803         info->start = DEVICE_START_NAME(ti99_pcb_pagedcru);
1804         break;
1805
1806      case TI99CART_FCT_ASSM:
1807         info->f = (genf *) assemble_pagedcru;
1808         break;
1809
1810      case TI99CARTINFO_FCT_6000_R:
1811         info->f = (genf *) read_cart_pagedcru;
1812         break;
1813
1814      case TI99CARTINFO_FCT_6000_W:
1815         info->f = (genf *) write_cart_pagedcru;
1816         break;
1817
1818      case TI99CARTINFO_FCT_6000_R8:
1819         info->f = (genf *) read_cart_pagedcru8;
1820         break;
1821
1822      case TI99CARTINFO_FCT_6000_W8:
1823         info->f = (genf *) write_cart_pagedcru8;
1824         break;
1825
1826      case TI99CARTINFO_FCT_CRU_R:
1827         info->f = (genf *) read_cart_cru_paged;
1828         break;
1829      case TI99CARTINFO_FCT_CRU_W:
1830         info->f = (genf *) write_cart_cru_paged;
1831         break;
1832         
1833      case DEVINFO_STR_NAME:
1834         strcpy(info->s, "TI99 pagedcru cartridge pcb");
1835         break;
1836
1837      default:
1838         DEVICE_GET_INFO_CALL(ti99_cart_common);
1839         break;
1840   }
1841}
1842
14201843/*****************************************************************************
14211844  The cartridge handling of the multi-cartridge system.
14221845  Every cartridge contains a PCB device. The memory handlers delegate the calls
r6133r6134
14641887
14651888         /* try opening this as a multicart */
14661889         /* This line requires that cartslot_t be included in cartslot.h,
1467            otherwise one cannot make use of multicart handling within such a
1468            custom LOAD function. */
1890         otherwise one cannot make use of multicart handling within such a
1891         custom LOAD function. */
14691892         multicart_open_error me = multicart_open(image_filename(image), image->machine->gamedrv->name, MULTICART_FLAGS_LOAD_RESOURCES, &cart->mc);
14701893
14711894         /* Now that we have loaded the image files, let the PCB put them all
1472            together. This means we put the images in a structure which allows
1473            for a quick access by the memory handlers. Every PCB defines an
1474            own assembly method. */
1895         together. This means we put the images in a structure which allows
1896         for a quick access by the memory handlers. Every PCB defines an
1897         own assembly method. */
14751898         if (me == MCERR_NONE)
14761899            result = pcb->assemble(image);
14771900         else
14781901            fatalerror("Error loading multicart: %s\n", mc_error_text(me));
14791902
14801903         /* This is for legacy support. If we have no multicart left
1481            but there are still legacy dumps, we switch to legacy mode. */
1904         but there are still legacy dumps, we switch to legacy mode. */
14821905         if (result != INIT_FAIL)
14831906            cartslots->multi_slots++;
14841907      }
r6133r6134
15021925   if (image->token == NULL)
15031926   {
15041927      /* This means something went wrong during the pcb
1505           identification (e.g. one of the cartridge files was not
1506           found). We do not need to (and cannot) unload
1507           the cartridge. */
1928      identification (e.g. one of the cartridge files was not
1929      found). We do not need to (and cannot) unload the cartridge. */
15081930      return;
15091931   }
15101932   pcbdev = cartslot_get_pcb(image);
r6133r6134
15211943         pcb->disassemble(image);
15221944
15231945         /* Close the multicart; all RAM resources will be
1524               written to disk */
1946         written to disk */
15251947         multicart_close(cart->mc);
15261948         cart->mc = NULL;
15271949
r6133r6134
15771999   if (cartridge->grom_size>0)
15782000   {
15792001      /* This is the reason why we need the image size: Read
1580        access beyond the image size must be detected. */
2002      access beyond the image size must be detected. */
15812003      if (cart_offset > cartridge->grom_size)
15822004         return 0;
15832005
r6133r6134
16352057      else
16362058         return (((UINT16 *)cartslots->cartridge[slotrom].rom_ptr)[offset]);
16372059   }
1638   /* Super Space is not supported in legacy mode. */
2060   /* SuperSpace, paged379i, and pagedcru are not supported in
2061   legacy mode. */
16392062}
16402063
16412064static WRITE16_DEVICE_HANDLER( ti99_cart_w_legacy )
r6133r6134
17292152      else
17302153         return (((UINT8 *)cartslots->cartridge[slotrom].rom_ptr)[offset]);
17312154   }
1732   /* Super Space is not supported in legacy mode. */
2155   /* Super Space, paged379i, and pagedcru are not supported in
2156   legacy mode. */
17332157}
17342158
17352159/*
r6133r6134
17932217   /* Some comments originally in machine/ti99_4x.c */
17942218
17952219   /* We identify file types according to their extension */
1796   /* Note that if we do not recognize the extension, we revert to the slot location <-> type
1797    scheme. */
2220   /* Note that if we do not recognize the extension, we revert to the
2221   slot location <-> type scheme. */
17982222   int id = 0;
17992223   int i;
18002224   int filesize;
r6133r6134
18172241   type = SLOTC_EMPTY;
18182242
18192243   /* There is a circuitry in TI99/4(a) that resets the console when a
1820    cartridge is inserted or removed.  We emulate this instead of resetting the
1821    emulator (which is the default in MESS). */
2244   cartridge is inserted or removed.  We emulate this instead of resetting
2245   the emulator (which is the default in MESS). */
18222246   /*cpu_set_input_line(machine->firstcpu, INPUT_LINE_RESET, PULSE_LINE);
1823    tms9901_reset(0);
1824    if (! has_evpc)
1825        TMS9928A_reset();
1826    if (has_evpc)
1827        v9938_reset(0);*/
2247   tms9901_reset(0);
2248   if (! has_evpc)
2249      TMS9928A_reset();
2250   if (has_evpc)
2251      v9938_reset(0);*/
18282252
18292253   ch = strrchr(name, '.');
18302254   ch2 = (ch-1 >= name) ? ch-1 : "";
r6133r6134
18882312         maxrom = 0x2000;
18892313         if (cartslots->legacy_slotnumber[SLOTC_MINIMEM] != -1)
18902314         {
1891            /* This means the NVRAM has already been loaded. So we just
1892                load 4K of ROM to avoid overwriting the NVRAM. */
2315            /* This means the NVRAM has already been loaded.
2316            So we just load 4K of ROM to avoid overwriting
2317            the NVRAM. */
18932318            maxrom = 0x1000;
18942319         }
18952320
18962321         if (cartslots->legacy_slotnumber[SLOTC_MBX] != -1)
18972322         {
18982323            /* This means the NVRAM has already been loaded.
1899                We need to temporarily save the RAM contents and
1900                write them back because the RAM overrides the
1901                ROM in an intermediate area. */
2324            We need to temporarily save the RAM contents and
2325            write them back because the RAM overrides the
2326            ROM in an intermediate area. */
19022327            savembx = TRUE;
19032328         }
19042329
r6133r6134
19412366
19422367      case SLOTC_MINIMEM:
19432368         /* Load the NVRAM. Need to BIG_ENDIANIZE it.
1944            MiniMemory has only one cartridge page. */
2369         MiniMemory has only one cartridge page. */
19452370         if (is_99_8())
19462371         {
19472372            // printf("** is 99/8\n");
r6133r6134
20392464         }
20402465         else
20412466         {
2042            /* We BIG_ENDIANIZE before saving. This is consistent
2043                with the cartridge save format. */
2467            /* We BIG_ENDIANIZE before saving. This is
2468            consistent with the cartridge save format. */
20442469            UINT16 *ramcont = (UINT16 *)cartslots->cartridge[slot].ram_ptr;
20452470            for (i = 0; i < 0x0800; i++)
20462471               ramcont[i] = BIG_ENDIANIZE_INT16(ramcont[i]);
r6133r6134
20572482         }
20582483         else
20592484         {
2060            /* We BIG_ENDIANIZE before saving. This is consistent
2061                with the cartridge save format. */
2485            /* We BIG_ENDIANIZE before saving. This is
2486            consistent with the cartridge save format. */
20622487            UINT16 *ramcont = (UINT16 *)cartslots->cartridge[slot].ram_ptr;
20632488            for (i = 0; i < 0x0200; i++)
20642489               ramcont[i] = BIG_ENDIANIZE_INT16(ramcont[i]);
r6133r6134
21042529//  printf("DEVICE_START(ti99_multicart)\n");
21052530   ti99_multicart_t *cartslots = (ti99_multicart_t *)device->token;
21062531
2107   /* Save this in the shortcut; we don't want to look for it each time
2108       that we have a memory access. And currently we do not plan for
2109       multiple multicart instances. */
21102532   cartslots->active_slot = 0;
21112533   cartslots->next_free_slot = 0;
21122534
r6133r6134
21342556{
21352557//  printf("DEVICE_STOP(ti99_multicart)\n");
21362558}
2559
2560static DEVICE_RESET(ti99_multicart)
2561{
2562   /* Consider to propagate RESET to cartridges.
2563      However, schematics do not reveal any pin for resetting a cartridge;
2564      the reset line is an input used when plugging in a cartridge. */
2565//    printf("DEVICE_RESET(ti99_multicart)\n");
2566}
2567
21372568/*
2138    Accesses the ROM regions of the cartridge for reading.
2139    This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible
2140    for all kinds of magic which is done inside this area, like swapping
2141    banks or doing other control actions. These activities beyond simple
2142    reading are cartridge-specific. Each kind of cartridge requires a
2143    new type.
2144    The currently set GROM bank determines which cartridge is actually
2145    accessed, also for ROM reads.
2569   Accesses the ROM regions of the cartridge for reading.
2570   This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible
2571   for all kinds of magic which is done inside this area, like swapping
2572   banks or doing other control actions. These activities beyond simple
2573   reading are cartridge-specific. Each kind of cartridge requires a
2574   new type.
2575   The currently set GROM bank determines which cartridge is actually
2576   accessed, also for ROM reads.
21462577*/
21472578READ16_DEVICE_HANDLER( ti99_multicart_r )
21482579{
r6133r6134
21962627}
21972628
21982629/*
2199    Accesses the ROM regions of the cartridge for writing.
2200    This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible
2201    for all kinds of magic which is done inside this area. Specifically,
2202    writing is often used to swap banks for subsequent reads. The actual
2203    effect of writing (beyond setting values in a RAM chip) are
2204    cartridge-specific and must be handled within the cartridge pcb.
2205    The currently set GROM bank determines which cartridge is actually
2206    accessed, also for ROM reads.
2630   Accesses the ROM regions of the cartridge for writing.
2631   This is the area from 0x6000 to 0x7fff. Each cartridge is reponsible
2632   for all kinds of magic which is done inside this area. Specifically,
2633   writing is often used to swap banks for subsequent reads. The actual
2634   effect of writing (beyond setting values in a RAM chip) are
2635   cartridge-specific and must be handled within the cartridge pcb.
2636   The currently set GROM bank determines which cartridge is actually
2637   accessed, also for ROM reads.
22072638*/
22082639WRITE16_DEVICE_HANDLER( ti99_multicart_w )
22092640{
r6133r6134
22422673}
22432674
22442675/*
2245        CRU interface to cartridges, used only by SuperSpace-style cartridges.
2676   CRU interface to cartridges, used only by SuperSpace and Pagedcru
2677   style cartridges.
22462678        The SuperSpace has a CRU-based memory mapper. It is accessed via the
22472679        cartridge slot on CRU base >0800.
22482680*/
r6133r6134
22732705}
22742706
22752707/*
2276        Write cartridge mapper CRU interface (SuperSpace)
2708        Write cartridge mapper CRU interface (SuperSpace, Pagedcru)
22772709*/
22782710WRITE8_DEVICE_HANDLER( ti99_multicart_cru_w )
22792711{
r6133r6134
23872819   MDRV_CARTSLOT_PCBTYPE(3, "minimem", TI99_CARTRIDGE_PCB_MINIMEM)
23882820   MDRV_CARTSLOT_PCBTYPE(4, "super", TI99_CARTRIDGE_PCB_SUPER)
23892821   MDRV_CARTSLOT_PCBTYPE(5, "mbx", TI99_CARTRIDGE_PCB_MBX)
2822   MDRV_CARTSLOT_PCBTYPE(6, "paged379i", TI99_CARTRIDGE_PCB_PAGED379I)
2823   MDRV_CARTSLOT_PCBTYPE(7, "pagedcru", TI99_CARTRIDGE_PCB_PAGEDCRU)
23902824
23912825   MDRV_CARTSLOT_START(ti99_cartridge)
23922826   MDRV_CARTSLOT_LOAD(ti99_cartridge)
r6133r6134
24002834   MDRV_CARTSLOT_PCBTYPE(3, "minimem", TI99_CARTRIDGE_PCB_MINIMEM)
24012835   MDRV_CARTSLOT_PCBTYPE(4, "super", TI99_CARTRIDGE_PCB_SUPER)
24022836   MDRV_CARTSLOT_PCBTYPE(5, "mbx", TI99_CARTRIDGE_PCB_MBX)
2837   MDRV_CARTSLOT_PCBTYPE(6, "paged379i", TI99_CARTRIDGE_PCB_PAGED379I)
2838   MDRV_CARTSLOT_PCBTYPE(7, "pagedcru", TI99_CARTRIDGE_PCB_PAGEDCRU)
24032839
24042840   MDRV_CARTSLOT_START(ti99_cartridge)
24052841   MDRV_CARTSLOT_LOAD(ti99_cartridge)
r6133r6134
24132849   MDRV_CARTSLOT_PCBTYPE(3, "minimem", TI99_CARTRIDGE_PCB_MINIMEM)
24142850   MDRV_CARTSLOT_PCBTYPE(4, "super", TI99_CARTRIDGE_PCB_SUPER)
24152851   MDRV_CARTSLOT_PCBTYPE(5, "mbx", TI99_CARTRIDGE_PCB_MBX)
2852   MDRV_CARTSLOT_PCBTYPE(6, "paged379i", TI99_CARTRIDGE_PCB_PAGED379I)
2853   MDRV_CARTSLOT_PCBTYPE(7, "pagedcru", TI99_CARTRIDGE_PCB_PAGEDCRU)
24162854
24172855   MDRV_CARTSLOT_START(ti99_cartridge)
24182856   MDRV_CARTSLOT_LOAD(ti99_cartridge)
r6133r6134
24262864   MDRV_CARTSLOT_PCBTYPE(3, "minimem", TI99_CARTRIDGE_PCB_MINIMEM)
24272865   MDRV_CARTSLOT_PCBTYPE(4, "super", TI99_CARTRIDGE_PCB_SUPER)
24282866   MDRV_CARTSLOT_PCBTYPE(5, "mbx", TI99_CARTRIDGE_PCB_MBX)
2867   MDRV_CARTSLOT_PCBTYPE(6, "paged379i", TI99_CARTRIDGE_PCB_PAGED379I)
2868   MDRV_CARTSLOT_PCBTYPE(7, "pagedcru", TI99_CARTRIDGE_PCB_PAGEDCRU)
24292869
24302870   MDRV_CARTSLOT_START(ti99_cartridge)
24312871   MDRV_CARTSLOT_LOAD(ti99_cartridge)
r6133r6134
24702910         info->stop = DEVICE_STOP_NAME(ti99_multicart);
24712911         break;
24722912      case DEVINFO_FCT_RESET:
2473         /* Nothing */
2913         info->reset = DEVICE_RESET_NAME(ti99_multicart);
24742914         break;
24752915   }
24762916}
src/mess/devices/ti99cart.h
r6133r6134
2020#define TI99_CARTRIDGE_PCB_MINIMEM   DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_minimem)
2121#define TI99_CARTRIDGE_PCB_SUPER   DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_super)
2222#define TI99_CARTRIDGE_PCB_MBX      DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_mbx)
23#define TI99_CARTRIDGE_PCB_PAGED379I   DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_paged379i)
24#define TI99_CARTRIDGE_PCB_PAGEDCRU   DEVICE_GET_INFO_NAME(ti99_cartridge_pcb_pagedcru)
2325
2426/* We set the number of slots to 8, although we may have up to 16. From a
2527   logical point of view we could have 256, but the operating system only checks
r6133r6134
8890
8991DEVICE_GET_INFO(ti99_multicart);
9092
91/* cartridge PCB types */
92DEVICE_GET_INFO(ti99_cartridge_pcb_std);
93DEVICE_GET_INFO(ti99_cartridge_pcb_minimem);
94DEVICE_GET_INFO(ti99_cartridge_pcb_mbx);
95
9693READ16_DEVICE_HANDLER(ti99_multicart_r);
9794WRITE16_DEVICE_HANDLER(ti99_multicart_w);
9895
r6133r6134
10097READ8_DEVICE_HANDLER(ti99_multicart8_r);
10198WRITE8_DEVICE_HANDLER(ti99_multicart8_w);
10299
103/* CRU handlers for SuperSpace cartridge */
100/* CRU handlers for SuperSpace and Pagedcru cartridge */
104101READ8_DEVICE_HANDLER( ti99_multicart_cru_r );
105102WRITE8_DEVICE_HANDLER( ti99_multicart_cru_w );
106103
docs/messnew.txt
r6133r6134
6666
6767- [SPECTRUM] Fixed bug #803 48K SNA load routine bad PC. [Miodrag Milanovic]
6868
69- [TI99] Added support for two new cartridge types.  [Michael Zapf]
70
6971- [TRS80] Model 4 and 4P can boot from floppy disk. [Robbbert]
7072
7173- [VTECH1] Added support for the SHRG (super hires graphics)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team