Previous 199869 Revisions Next

r30740 Saturday 31st May, 2014 at 12:02:17 UTC by Dirk Best
Amiga: Add very basic POT counter emulation, enough for Space Ranger to
detect the second button.
[src/mame/includes]amiga.h
[src/mame/machine]amiga.c
[src/mess/drivers]amiga.c

trunk/src/mame/machine/amiga.c
r30739r30740
337337      m_cia_0->tod_w(0);
338338   }
339339
340   // pot counters (start counting at 7 (ntsc) or 8 (pal))
341   if (BIT(CUSTOM_REG(REG_POTGO), 0) && (scanline /2 ) > 7)
342   {
343      m_pot0x += !(m_potgo_port->read() & 0x0100);
344      m_pot0y += !(m_potgo_port->read() & 0x0400);
345      m_pot1x += !(m_potgo_port->read() & 0x1000);
346      m_pot1y += !(m_potgo_port->read() & 0x4000);
347   }
348
340349   // render up to this scanline
341350   if (!m_screen->update_partial(scanline))
342351   {
r30739r30740
12371246         return joy1dat_r();
12381247
12391248      case REG_POTGOR:
1240         if (state->m_potgo_port) return state->m_potgo_port->read();
1241         else return 0x5500;
1249         if (state->m_potgo_port)
1250            return state->m_potgo_port->read();
1251         else
1252            return 0x5500;
12421253
12431254      case REG_POT0DAT:
1244         if (state->m_pot0dat_port) return state->m_pot0dat_port->read();
1245         else return 0x0000;
1255         if (state->m_pot0dat_port)
1256         {
1257            return state->m_pot0dat_port->read();
1258         }
1259         else
1260         {
1261            int scale = m_agnus_id & 0x10 ? 525 : 625;
12461262
1263            m_pot0dat  = (int) ((double) m_pot0x / scale) * 0xff;
1264            m_pot0dat |= (int)(((double) m_pot0y / scale) * 0xff) << 8;
1265
1266            return m_pot0dat;
1267         }
1268
12471269      case REG_POT1DAT:
1248         if (state->m_pot1dat_port) return state->m_pot1dat_port->read();
1249         else return 0x0000;
1270         if (state->m_pot1dat_port)
1271         {
1272            return state->m_pot1dat_port->read();
1273         }
1274         else
1275         {
1276            int scale = m_agnus_id & 0x10 ? 525 : 625;
12501277
1278            m_pot1dat  = (int) ((double) m_pot1x / scale) * 0xff;
1279            m_pot1dat |= (int)(((double) m_pot1y / scale) * 0xff) << 8;
1280
1281            return m_pot1dat;
1282         }
1283
12511284      case REG_DSKBYTR:
12521285         return state->m_fdc->dskbytr_r();
12531286
r30739r30740
13301363         break;
13311364
13321365      case REG_POTGO:
1366         if (BIT(data, 0))
1367         {
1368            // start counters
1369            m_pot0x = 0;
1370            m_pot0y = 0;
1371            m_pot1x = 0;
1372            m_pot1y = 0;
1373         }
13331374         potgo_w(data);
13341375         break;
13351376
trunk/src/mame/includes/amiga.h
r30739r30740
357357   m_chip_ram_mirror(0),
358358   m_cia_0_irq(0),
359359   m_cia_1_irq(0),
360   m_pot0x(0), m_pot1x(0), m_pot0y(0), m_pot1y(0),
361   m_pot0dat(0x0000),
362   m_pot1dat(0x0000),
360363   m_centronics_busy(0),
361364   m_centronics_perror(0),
362365   m_centronics_select(0),
r30739r30740
613616      SERPER_LONG = 0x8000   // 9-bit mode
614617   };
615618
619   // pot counters
620   int m_pot0x, m_pot1x, m_pot0y, m_pot1y;
621
622   UINT16 m_pot0dat;
623   UINT16 m_pot1dat;
624
616625   int m_centronics_busy;
617626   int m_centronics_perror;
618627   int m_centronics_select;
trunk/src/mess/drivers/amiga.c
r30739r30740
11511151   PORT_BIT(0xfcfc, IP_ACTIVE_HIGH, IPT_UNUSED)
11521152
11531153   PORT_START("potgo")
1154   PORT_BIT(0x0100, IP_ACTIVE_LOW, IPT_UNUSED)
1154   PORT_BIT(0x0100, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(1)
11551155   PORT_BIT(0x0400, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(1)
1156   PORT_BIT(0x1000, IP_ACTIVE_LOW, IPT_UNUSED)
1156   PORT_BIT(0x1000, IP_ACTIVE_LOW, IPT_BUTTON3) PORT_PLAYER(2)
11571157   PORT_BIT(0x4000, IP_ACTIVE_LOW, IPT_BUTTON2) PORT_PLAYER(2)
11581158   PORT_BIT(0xaaff, IP_ACTIVE_HIGH, IPT_UNUSED)
11591159

Previous 199869 Revisions Next


© 1997-2024 The MAME Team