Previous 15994 Revisions Next

r15594 Saturday 14th July, 2012 at 05:02:20 UTC by Barry Rodewald
amstrad: Re-arranged ASIC register handlers to fix horrid slowdown, and made FDC, cassette, printer and expansion devices optional as these don't exist on the GX4000 (no whatsnew)
[src/mess/includes]amstrad.h
[src/mess/machine]amstrad.c

src/mess/machine/amstrad.c
r15593r15594
11971197   }
11981198   else  // CPC+/GX4000
11991199   {
1200      address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
1200      //address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
12011201
1202      if ( state->m_asic.enabled && ( state->m_asic.rmr2 & 0x18 ) == 0x18 )
1202/*      if ( state->m_asic.enabled && ( state->m_asic.rmr2 & 0x18 ) == 0x18 )
12031203      {
12041204         space->install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),state));
12051205         space->install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),state));
r15593r15594
12131213         space->install_write_bank(0x4000, 0x5fff, "bank11");
12141214         space->install_write_bank(0x6000, 0x7fff, "bank12");
12151215      }
1216
1216*/
12171217      if(state->m_AmstradCPC_RamBanks[0] != NULL)
12181218      {
12191219         state->membank("bank1")->set_base(state->m_AmstradCPC_RamBanks[0]);
r15593r15594
14071407WRITE8_MEMBER(amstrad_state::amstrad_plus_asic_4000_w)
14081408{
14091409//  logerror("ASIC: Write to register at &%04x\n",offset+0x4000);
1410   m_asic.ram[offset] = data & 0x0f;
1410   if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 )
1411      m_asic.ram[offset] = data & 0x0f;
1412   else
1413   {
1414      UINT8* RAM = (UINT8*)membank("bank11")->base();
1415      RAM[offset] = data;
1416   }
14111417}
14121418
14131419
14141420WRITE8_MEMBER(amstrad_state::amstrad_plus_asic_6000_w)
14151421{
1416   m_asic.ram[offset+0x2000] = data;
1417   if(offset >= 0x0400 && offset < 0x440 && ( offset & 0x01 ) ) // ASIC palette
1422   if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 )
14181423   {
1419      m_asic.ram[ offset + 0x2000 ] = data & 0x0f;
1420   }
1421   if(offset == 0x0800)  // Programmable raster interrupt
1422   {
1423//      logerror("ASIC: Wrote %02x to PRI\n",data);
1424      m_asic.pri = data;
1425   }
1426   if(offset >= 0x0801 && offset <= 0x0803)  // Split screen registers
1427   {
1428      logerror("ASIC: Split screen at line %i, address &%04x\n",m_asic.ram[0x2801],m_asic.ram[0x2803] + (m_asic.ram[0x2802] << 8));
1429   }
1430   if(offset == 0x0804)  // Soft scroll register
1431   {
1432   }
1433   if(offset == 0x0805)  // Interrupt vector register (for IM 2, used by Pang)
1434   {
1435      // high 5 bits go to interrupt vector
1436      int vector;
1437
1438      if ( m_asic.enabled )
1424      m_asic.ram[offset+0x2000] = data;
1425      if(offset >= 0x0400 && offset < 0x440 && ( offset & 0x01 ) ) // ASIC palette
14391426      {
1440         vector = (data & 0xf8) + (m_plus_irq_cause);
1441         device_set_input_line_vector(m_maincpu, 0, vector);
1442         logerror("ASIC: IM 2 vector write %02x, data = &%02x\n",vector,data);
1427         m_asic.ram[ offset + 0x2000 ] = data & 0x0f;
14431428      }
1444      m_asic.dma_clear = data & 0x01;
1445   }
1446   // DMA channels
1447   switch(offset)
1448   {
1449   case 0x0c00:
1450   case 0x0c01:
1451      m_asic.dma_addr[0] = (m_asic.ram[0x2c01] << 8) + m_asic.ram[0x2c00];
1452      m_asic.dma_status &= ~0x01;
1453      logerror("ASIC: DMA 0 address set to &%04x\n",m_asic.dma_addr[0]);
1454      break;
1455   case 0x0c04:
1456   case 0x0c05:
1457      m_asic.dma_addr[1] = (m_asic.ram[0x2c05] << 8) + m_asic.ram[0x2c04];
1458      m_asic.dma_status &= ~0x02;
1459      logerror("ASIC: DMA 1 address set to &%04x\n",m_asic.dma_addr[1]);
1460      break;
1461   case 0x0c08:
1462   case 0x0c09:
1463      m_asic.dma_addr[2] = (m_asic.ram[0x2c09] << 8) + m_asic.ram[0x2c08];
1464      m_asic.dma_status &= ~0x04;
1465      logerror("ASIC: DMA 2 address set to &%04x\n",m_asic.dma_addr[2]);
1466      break;
1467   case 0x0c02:
1468      m_asic.dma_prescaler[0] = data + 1;
1469      logerror("ASIC: DMA 0 pause prescaler set to %i\n",data);
1470      break;
1471   case 0x0c06:
1472      m_asic.dma_prescaler[1] = data + 1;
1473      logerror("ASIC: DMA 1 pause prescaler set to %i\n",data);
1474      break;
1475   case 0x0c0a:
1476      m_asic.dma_prescaler[2] = data + 1;
1477      logerror("ASIC: DMA 2 pause prescaler set to %i\n",data);
1478      break;
1479   case 0x0c0f:
1480      m_asic.dma_status = data;
1481      logerror("ASIC: DMA status write - %02x\n",data);
1482      if(data & 0x40)
1429      if(offset == 0x0800)  // Programmable raster interrupt
14831430      {
1484         logerror("ASIC: DMA 0 IRQ acknowledge\n");
1485         cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
1486         m_plus_irq_cause = 0x06;
1487         m_asic.ram[0x2c0f] &= ~0x40;
1431   //      logerror("ASIC: Wrote %02x to PRI\n",data);
1432         m_asic.pri = data;
14881433      }
1489      if(data & 0x20)
1434      if(offset >= 0x0801 && offset <= 0x0803)  // Split screen registers
14901435      {
1491         logerror("ASIC: DMA 1 IRQ acknowledge\n");
1492         cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
1493         m_plus_irq_cause = 0x06;
1494         m_asic.ram[0x2c0f] &= ~0x20;
1436         logerror("ASIC: Split screen at line %i, address &%04x\n",m_asic.ram[0x2801],m_asic.ram[0x2803] + (m_asic.ram[0x2802] << 8));
14951437      }
1496      if(data & 0x10)
1438      if(offset == 0x0804)  // Soft scroll register
14971439      {
1498         logerror("ASIC: DMA 2 IRQ acknowledge\n");
1499         cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
1500         m_plus_irq_cause = 0x06;
1501         m_asic.ram[0x2c0f] &= ~0x10;
15021440      }
1503      m_asic.ram[0x2c0f] = (m_asic.ram[0x2c0f] & 0xf8) | (data & 0x07);
1504      break;
1441      if(offset == 0x0805)  // Interrupt vector register (for IM 2, used by Pang)
1442      {
1443         // high 5 bits go to interrupt vector
1444         int vector;
1445
1446         if ( m_asic.enabled )
1447         {
1448            vector = (data & 0xf8) + (m_plus_irq_cause);
1449            device_set_input_line_vector(m_maincpu, 0, vector);
1450            logerror("ASIC: IM 2 vector write %02x, data = &%02x\n",vector,data);
1451         }
1452         m_asic.dma_clear = data & 0x01;
1453      }
1454      // DMA channels
1455      switch(offset)
1456      {
1457      case 0x0c00:
1458      case 0x0c01:
1459         m_asic.dma_addr[0] = (m_asic.ram[0x2c01] << 8) + m_asic.ram[0x2c00];
1460         m_asic.dma_status &= ~0x01;
1461         logerror("ASIC: DMA 0 address set to &%04x\n",m_asic.dma_addr[0]);
1462         break;
1463      case 0x0c04:
1464      case 0x0c05:
1465         m_asic.dma_addr[1] = (m_asic.ram[0x2c05] << 8) + m_asic.ram[0x2c04];
1466         m_asic.dma_status &= ~0x02;
1467         logerror("ASIC: DMA 1 address set to &%04x\n",m_asic.dma_addr[1]);
1468         break;
1469      case 0x0c08:
1470      case 0x0c09:
1471         m_asic.dma_addr[2] = (m_asic.ram[0x2c09] << 8) + m_asic.ram[0x2c08];
1472         m_asic.dma_status &= ~0x04;
1473         logerror("ASIC: DMA 2 address set to &%04x\n",m_asic.dma_addr[2]);
1474         break;
1475      case 0x0c02:
1476         m_asic.dma_prescaler[0] = data + 1;
1477         logerror("ASIC: DMA 0 pause prescaler set to %i\n",data);
1478         break;
1479      case 0x0c06:
1480         m_asic.dma_prescaler[1] = data + 1;
1481         logerror("ASIC: DMA 1 pause prescaler set to %i\n",data);
1482         break;
1483      case 0x0c0a:
1484         m_asic.dma_prescaler[2] = data + 1;
1485         logerror("ASIC: DMA 2 pause prescaler set to %i\n",data);
1486         break;
1487      case 0x0c0f:
1488         m_asic.dma_status = data;
1489         logerror("ASIC: DMA status write - %02x\n",data);
1490         if(data & 0x40)
1491         {
1492            logerror("ASIC: DMA 0 IRQ acknowledge\n");
1493            cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
1494            m_plus_irq_cause = 0x06;
1495            m_asic.ram[0x2c0f] &= ~0x40;
1496         }
1497         if(data & 0x20)
1498         {
1499            logerror("ASIC: DMA 1 IRQ acknowledge\n");
1500            cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
1501            m_plus_irq_cause = 0x06;
1502            m_asic.ram[0x2c0f] &= ~0x20;
1503         }
1504         if(data & 0x10)
1505         {
1506            logerror("ASIC: DMA 2 IRQ acknowledge\n");
1507            cputag_set_input_line(machine(), "maincpu", 0, CLEAR_LINE);
1508            m_plus_irq_cause = 0x06;
1509            m_asic.ram[0x2c0f] &= ~0x10;
1510         }
1511         m_asic.ram[0x2c0f] = (m_asic.ram[0x2c0f] & 0xf8) | (data & 0x07);
1512         break;
1513      }
15051514   }
1515   else
1516   {
1517      UINT8* RAM = (UINT8*)membank("bank12")->base();
1518      RAM[offset] = data;
1519   }
15061520}
15071521
15081522
15091523READ8_MEMBER(amstrad_state::amstrad_plus_asic_4000_r)
15101524{
15111525//  logerror("RAM: read from &%04x\n",offset+0x4000);
1512   return m_asic.ram[offset];
1526   if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 )
1527      return m_asic.ram[offset];
1528   else
1529   {
1530      UINT8* RAM = (UINT8*)membank("bank3")->base();
1531      return RAM[offset];
1532   }
15131533}
15141534
15151535
15161536READ8_MEMBER(amstrad_state::amstrad_plus_asic_6000_r)
15171537{
15181538//  logerror("RAM: read from &%04x\n",offset+0x6000);
1519   // Analogue ports
1520   if(offset == 0x0808)
1539   if ( m_asic.enabled && ( m_asic.rmr2 & 0x18 ) == 0x18 )
15211540   {
1522      return (ioport("analog1")->read() & 0x3f);
1541      // Analogue ports
1542      if(offset == 0x0808)
1543      {
1544         return (ioport("analog1")->read() & 0x3f);
1545      }
1546      if(offset == 0x0809)
1547      {
1548         return (ioport("analog2")->read() & 0x3f);
1549      }
1550      if(offset == 0x080a)
1551      {
1552         return (ioport("analog3")->read() & 0x3f);
1553      }
1554      if(offset == 0x080b)
1555      {
1556         return (ioport("analog4")->read() & 0x3f);
1557      }
1558      if(offset == 0x080c || offset == 0x080e)
1559      {
1560         return 0x3f;
1561      }
1562      if(offset == 0x080d || offset == 0x080f)
1563      {
1564         return 0x00;
1565      }
1566   #if 0
1567      if(offset == 0x0c0f)  // DMA status and control
1568      {
1569         int result = 0;
1570         if(m_plus_irq_cause == 0x00)
1571            result |= 0x40;
1572         if(m_plus_irq_cause == 0x02)
1573            result |= 0x20;
1574         if(m_plus_irq_cause == 0x04)
1575            result |= 0x10;
1576         if(m_plus_irq_cause == 0x06)
1577            result |= 0x80;
1578         return result;
1579      }
1580   #endif
1581      return m_asic.ram[offset+0x2000];
15231582   }
1524   if(offset == 0x0809)
1583   else
15251584   {
1526      return (ioport("analog2")->read() & 0x3f);
1585      UINT8* RAM = (UINT8*)membank("bank4")->base();
1586      return RAM[offset];
15271587   }
1528   if(offset == 0x080a)
1529   {
1530      return (ioport("analog3")->read() & 0x3f);
1531   }
1532   if(offset == 0x080b)
1533   {
1534      return (ioport("analog4")->read() & 0x3f);
1535   }
1536   if(offset == 0x080c || offset == 0x080e)
1537   {
1538      return 0x3f;
1539   }
1540   if(offset == 0x080d || offset == 0x080f)
1541   {
1542      return 0x00;
1543   }
1544#if 0
1545   if(offset == 0x0c0f)  // DMA status and control
1546   {
1547      int result = 0;
1548      if(m_plus_irq_cause == 0x00)
1549         result |= 0x40;
1550      if(m_plus_irq_cause == 0x02)
1551         result |= 0x20;
1552      if(m_plus_irq_cause == 0x04)
1553         result |= 0x10;
1554      if(m_plus_irq_cause == 0x06)
1555         result |= 0x80;
1556      return result;
1557   }
1558#endif
1559   return m_asic.ram[offset+0x2000];
15601588}
15611589
15621590
r15593r15594
29542982MACHINE_RESET( plus )
29552983{
29562984   amstrad_state *state = machine.driver_data<amstrad_state>();
2985   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
29572986   int i;
29582987   UINT8 *rom = state->memregion("maincpu")->base();
29592988
r15593r15594
29863015   AmstradCPC_GA_SetRamConfiguration(machine);
29873016   amstrad_GateArray_write(machine, 0x081); // Epyx World of Sports requires upper ROM to be enabled by default
29883017
3018   space->install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),state));
3019   space->install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),state));
3020   space->install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),state));
3021   space->install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),state));
3022
29893023   //  multiface_init();
29903024   machine.scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution));
29913025}
r15593r15594
30003034MACHINE_RESET( gx4000 )
30013035{
30023036   amstrad_state *state = machine.driver_data<amstrad_state>();
3037   address_space *space = state->m_maincpu->memory().space(AS_PROGRAM);
30033038   int i;
30043039   UINT8 *rom = state->memregion("maincpu")->base();
30053040
r15593r15594
30323067   AmstradCPC_GA_SetRamConfiguration(machine);
30333068   amstrad_GateArray_write(machine, 0x081); // Epyx World of Sports requires upper ROM to be enabled by default
30343069   //  multiface_init();
3070   space->install_read_handler(0x4000, 0x5fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_r),state));
3071   space->install_read_handler(0x6000, 0x7fff, read8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_r),state));
3072   space->install_write_handler(0x4000, 0x5fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_4000_w),state));
3073   space->install_write_handler(0x6000, 0x7fff, write8_delegate(FUNC(amstrad_state::amstrad_plus_asic_6000_w),state));
30353074
30363075   machine.scheduler().timer_set( attotime::zero, FUNC(cb_set_resolution));
30373076}
src/mess/includes/amstrad.h
r15593r15594
108108
109109   required_device<cpu_device> m_maincpu;
110110   required_device<device_t> m_ay;
111   required_device<device_t> m_fdc;
111   optional_device<device_t> m_fdc;  // not on a GX4000
112112   required_device<mc6845_device> m_crtc;
113113   required_device<screen_device> m_screen;
114114   required_device<i8255_device> m_ppi;
115   required_device<centronics_device> m_centronics;
116   required_device<cassette_image_device> m_cassette;
115   optional_device<centronics_device> m_centronics;  // not on a GX4000
116   optional_device<cassette_image_device> m_cassette; // not on a GX4000, (or technically, the 6128+)
117117   required_device<ram_device> m_ram;
118   required_device<cpc_expansion_slot_device> m_exp;
118   optional_device<cpc_expansion_slot_device> m_exp; // not on a GX4000
119119   optional_device<mc146818_device> m_rtc;  // Aleste 520EX only
120120
121121   int m_system_type;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team