trunk/src/mess/drivers/hh_hmcs40.c
r245322 | r245323 | |
130 | 130 | DECLARE_WRITE8_MEMBER(pbqbert_plate_w); |
131 | 131 | DECLARE_WRITE16_MEMBER(pbqbert_grid_w); |
132 | 132 | |
| 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 | |
133 | 145 | protected: |
134 | 146 | virtual void machine_start(); |
135 | 147 | virtual void machine_reset(); |
r245322 | r245323 | |
1247 | 1259 | |
1248 | 1260 | ***************************************************************************/ |
1249 | 1261 | |
| 1262 | void 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 | |
| 1270 | WRITE8_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 | |
| 1284 | WRITE16_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 | |
| 1305 | void hh_hmcs40_state::kingman_update_int0() |
| 1306 | { |
| 1307 | // INT0 on multiplexed inputs |
| 1308 | set_interrupt(0, read_inputs(4)); |
| 1309 | } |
| 1310 | |
| 1311 | |
| 1312 | INPUT_CHANGED_MEMBER(hh_hmcs40_state::kingman_input_changed) |
| 1313 | { |
| 1314 | kingman_update_int0(); |
| 1315 | } |
| 1316 | |
1250 | 1317 | static 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 | |
1251 | 1334 | INPUT_PORTS_END |
1252 | 1335 | |
1253 | 1336 | |
r245322 | r245323 | |
1255 | 1338 | |
1256 | 1339 | /* basic machine hardware */ |
1257 | 1340 | 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)) |
1258 | 1346 | |
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)) |
1260 | 1348 | MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) |
1261 | 1349 | |
1262 | 1350 | /* no video! */ |
r245322 | r245323 | |
1282 | 1370 | |
1283 | 1371 | ***************************************************************************/ |
1284 | 1372 | |
| 1373 | void 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 | |
| 1381 | WRITE8_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 | |
| 1398 | WRITE16_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 | |
| 1423 | void hh_hmcs40_state::tmtron_update_int1() |
| 1424 | { |
| 1425 | // INT1 on multiplexed inputs |
| 1426 | set_interrupt(1, read_inputs(4)); |
| 1427 | } |
| 1428 | |
| 1429 | |
| 1430 | INPUT_CHANGED_MEMBER(hh_hmcs40_state::tmtron_input_changed) |
| 1431 | { |
| 1432 | tmtron_update_int1(); |
| 1433 | } |
| 1434 | |
1285 | 1435 | static 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 | |
1286 | 1452 | INPUT_PORTS_END |
1287 | 1453 | |
1288 | 1454 | |
r245322 | r245323 | |
1290 | 1456 | |
1291 | 1457 | /* basic machine hardware */ |
1292 | 1458 | 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)) |
1293 | 1464 | |
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)) |
1295 | 1466 | MCFG_DEFAULT_LAYOUT(layout_hh_hmcs40_test) |
1296 | 1467 | |
1297 | 1468 | /* no video! */ |