Previous 199869 Revisions Next

r36811 Monday 30th March, 2015 at 19:41:10 UTC by hap
tmtron, kingman WIP
[src/mess/drivers]hh_hmcs40.c

trunk/src/mess/drivers/hh_hmcs40.c
r245322r245323
130130   DECLARE_WRITE8_MEMBER(pbqbert_plate_w);
131131   DECLARE_WRITE16_MEMBER(pbqbert_grid_w);
132132
133   void kingman_display();
134   DECLARE_WRITE8_MEMBER(kingman_plate_w);
135   DECLARE_WRITE16_MEMBER(kingman_grid_w);
136   void kingman_update_int0();
137   DECLARE_INPUT_CHANGED_MEMBER(kingman_input_changed);
138
139   void tmtron_display();
140   DECLARE_WRITE8_MEMBER(tmtron_plate_w);
141   DECLARE_WRITE16_MEMBER(tmtron_grid_w);
142   void tmtron_update_int1();
143   DECLARE_INPUT_CHANGED_MEMBER(tmtron_input_changed);
144
133145protected:
134146   virtual void machine_start();
135147   virtual void machine_reset();
r245322r245323
12471259
12481260***************************************************************************/
12491261
1262void hh_hmcs40_state::kingman_display()
1263{
1264   UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8);
1265   UINT32 plate = BITSWAP24(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12);
1266
1267   display_matrix(23, 9, plate, grid);
1268}
1269
1270WRITE8_MEMBER(hh_hmcs40_state::kingman_plate_w)
1271{
1272   // R0x-R3x: vfd matrix plate
1273   int shift = offset * 4;
1274   m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
1275   
1276   //                               14,13
1277   //          12,11,10, 9, 8, 2, 3, 1, 0, 6, 7, 5, 4,21,22,20,19,18,17,16,15
1278   // 23,22,21,20,19,18,17,16,15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
1279   // 23, 6, 7, 5, 4, 3, 2, 1, 0,13,12,20,19,18,17,16,10,11, 9, 8,14,15,13,12
1280   
1281   kingman_display();
1282}
1283
1284WRITE16_MEMBER(hh_hmcs40_state::kingman_grid_w)
1285{
1286   // D6: speaker out
1287   m_speaker->level_w(data >> 6 & 1);
1288
1289   // D12-D15: input mux
1290   UINT8 inp_mux = data >> 12 & 0xf;
1291   if (inp_mux != m_inp_mux)
1292   {
1293      m_inp_mux = inp_mux;
1294      kingman_update_int0();
1295   }
1296   
1297   // D7-D15: vfd matrix grid
1298   m_grid = data >> 7 & 0x1ff;
1299   
1300   // D0-D4: more plates
1301   m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x1f0000);
1302   kingman_display();
1303}
1304
1305void hh_hmcs40_state::kingman_update_int0()
1306{
1307   // INT0 on multiplexed inputs
1308   set_interrupt(0, read_inputs(4));
1309}
1310
1311
1312INPUT_CHANGED_MEMBER(hh_hmcs40_state::kingman_input_changed)
1313{
1314   kingman_update_int0();
1315}
1316
12501317static INPUT_PORTS_START( kingman )
1318   PORT_START("IN.0") // D12 INT0
1319   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, kingman_input_changed, NULL)
1320
1321   PORT_START("IN.1") // D13 INT0
1322   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, kingman_input_changed, NULL)
1323
1324   PORT_START("IN.2") // D14 INT0
1325   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, kingman_input_changed, NULL)
1326
1327   PORT_START("IN.3") // D15 INT0
1328   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, kingman_input_changed, NULL)
1329
1330   PORT_START("IN.4") // INT1
1331   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)1)
1332
1333
12511334INPUT_PORTS_END
12521335
12531336
r245322r245323
12551338
12561339   /* basic machine hardware */
12571340   MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc.
1341   MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, kingman_plate_w))
1342   MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, kingman_plate_w))
1343   MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, kingman_plate_w))
1344   MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, kingman_plate_w))
1345   MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, kingman_grid_w))
12581346
1259//  MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1))
1347   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1))
12601348   MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test)
12611349
12621350   /* no video! */
r245322r245323
12821370
12831371***************************************************************************/
12841372
1373void hh_hmcs40_state::tmtron_display()
1374{
1375   UINT16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0);
1376   UINT32 plate = BITSWAP24(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15);
1377
1378   display_matrix(23, 10, plate, grid);
1379}
1380
1381WRITE8_MEMBER(hh_hmcs40_state::tmtron_plate_w)
1382{
1383   // R0x-R3x: vfd matrix plate
1384   int shift = offset * 4;
1385   m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
1386   
1387   
1388   //       20                                                     7
1389   //       13,sp,11, 6, 5, 4, 0, 1, 2, 3,14,15,16, 8,17,18,22, 9,10,21,19,12
1390   // 23,22,21,20,19,18,17,16,15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
1391   // 23, 5, 2,21, 1, 6, 7, 9,10,11,21, 0,19, 3, 4, 8, 3,18,17,16,12,13,14,15
1392   
1393
1394   
1395   tmtron_display();
1396}
1397
1398WRITE16_MEMBER(hh_hmcs40_state::tmtron_grid_w)
1399{
1400   // D4: speaker out
1401   m_speaker->level_w(data >> 4 & 1);
1402
1403   // D12-D15: input mux
1404   UINT8 inp_mux = data >> 12 & 0xf;
1405   if (inp_mux != m_inp_mux)
1406   {
1407      m_inp_mux = inp_mux;
1408      tmtron_update_int1();
1409   }
1410   
1411   // D6-D15: vfd matrix grid
1412   m_grid = data >> 6 & 0x3ff;
1413   
1414   //                   1,2,3,4,5,6,7,8,9,0
1415   //                   9,8,7,6,5,4,3,2,1,0
1416   // 15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0
1417
1418   // D0-D3,D5: more plates
1419   m_plate = (m_plate & 0x00ffff) | (data << 16 & 0x2f0000);
1420   tmtron_display();
1421}
1422
1423void hh_hmcs40_state::tmtron_update_int1()
1424{
1425   // INT1 on multiplexed inputs
1426   set_interrupt(1, read_inputs(4));
1427}
1428
1429
1430INPUT_CHANGED_MEMBER(hh_hmcs40_state::tmtron_input_changed)
1431{
1432   tmtron_update_int1();
1433}
1434
12851435static INPUT_PORTS_START( tmtron )
1436   PORT_START("IN.0") // D12 INT1
1437   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, tmtron_input_changed, NULL)
1438
1439   PORT_START("IN.1") // D13 INT1
1440   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, tmtron_input_changed, NULL)
1441
1442   PORT_START("IN.2") // D14 INT1
1443   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, tmtron_input_changed, NULL)
1444
1445   PORT_START("IN.3") // D15 INT1
1446   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, tmtron_input_changed, NULL)
1447
1448   PORT_START("IN.4") // INT0
1449   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, hh_hmcs40_state, single_interrupt_line, (void *)0)
1450
1451
12861452INPUT_PORTS_END
12871453
12881454
r245322r245323
12901456
12911457   /* basic machine hardware */
12921458   MCFG_CPU_ADD("maincpu", HD38800, 400000) // approximation - RC osc.
1459   MCFG_HMCS40_WRITE_R_CB(0, WRITE8(hh_hmcs40_state, tmtron_plate_w))
1460   MCFG_HMCS40_WRITE_R_CB(1, WRITE8(hh_hmcs40_state, tmtron_plate_w))
1461   MCFG_HMCS40_WRITE_R_CB(2, WRITE8(hh_hmcs40_state, tmtron_plate_w))
1462   MCFG_HMCS40_WRITE_R_CB(3, WRITE8(hh_hmcs40_state, tmtron_plate_w))
1463   MCFG_HMCS40_WRITE_D_CB(WRITE16(hh_hmcs40_state, tmtron_grid_w))
12931464
1294//  MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1))
1465   MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_hmcs40_state, display_decay_tick, attotime::from_msec(1))
12951466   MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test)
12961467
12971468   /* no video! */


Previous 199869 Revisions Next


© 1997-2024 The MAME Team