1246
1372
static READ8_DEVICE_HANDLER( mgcs_keys_r )
1248
1374
igs017_state *state = device->machine().driver_data<igs017_state>();
1249
if (~state->m_input_select & 0x08) return input_port_read(device->machine(), "KEY0");
1250
if (~state->m_input_select & 0x10) return input_port_read(device->machine(), "KEY1");
1251
if (~state->m_input_select & 0x20) return input_port_read(device->machine(), "KEY2");
1252
if (~state->m_input_select & 0x40) return input_port_read(device->machine(), "KEY3");
1253
if (~state->m_input_select & 0x80) return input_port_read(device->machine(), "KEY4");
1375
if (~state->m_input_select & 0x08) return state->ioport("KEY0")->read();
1376
if (~state->m_input_select & 0x10) return state->ioport("KEY1")->read();
1377
if (~state->m_input_select & 0x20) return state->ioport("KEY2")->read();
1378
if (~state->m_input_select & 0x40) return state->ioport("KEY3")->read();
1379
if (~state->m_input_select & 0x80) return state->ioport("KEY4")->read();
1255
1381
logerror("%s: warning, reading key with input_select = %02x\n", device->machine().describe_context(), state->m_input_select);
1259
static WRITE16_HANDLER( irq1_enable_w )
1261
igs017_state *state = space->machine().driver_data<igs017_state>();
1262
if (ACCESSING_BITS_0_7)
1263
state->m_irq1_enable = data & 1;
1265
if (data != 0 && data != 0xff)
1266
logerror("PC %06X: irq1_enable = %04x\n",cpu_get_pc(&space->device()),data);
1269
static WRITE16_HANDLER( irq2_enable_w )
1271
igs017_state *state = space->machine().driver_data<igs017_state>();
1272
if (ACCESSING_BITS_0_7)
1273
state->m_irq2_enable = data & 1;
1275
if (data != 0 && data != 0xff)
1276
logerror("PC %06X: irq2_enable = %04x\n",cpu_get_pc(&space->device()),data);
1279
static WRITE16_HANDLER( mgcs_paletteram_w )
1281
COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]);
1283
int bgr = ((space->machine().generic.paletteram.u16[offset/2*2+0] & 0xff) << 8) | (space->machine().generic.paletteram.u16[offset/2*2+1] & 0xff);
1385
WRITE16_MEMBER(igs017_state::irq1_enable_w)
1387
if (ACCESSING_BITS_0_7)
1388
m_irq1_enable = data & 1;
1390
if (data != 0 && data != 0xff)
1391
logerror("%s: irq1_enable = %04x\n", machine().describe_context(), data);
1394
WRITE16_MEMBER(igs017_state::irq2_enable_w)
1396
if (ACCESSING_BITS_0_7)
1397
m_irq2_enable = data & 1;
1399
if (data != 0 && data != 0xff)
1400
logerror("%s: irq2_enable = %04x\n", machine().describe_context(), data);
1403
WRITE16_MEMBER(igs017_state::mgcs_paletteram_w)
1405
COMBINE_DATA(&m_generic_paletteram_16[offset]);
1407
int bgr = ((m_generic_paletteram_16[offset/2*2+0] & 0xff) << 8) | (m_generic_paletteram_16[offset/2*2+1] & 0xff);
1286
1410
bgr = BITSWAP16(bgr, 7,8,9,2,14,3,13,15,12,11,10,0,1,4,5,6);
1288
palette_set_color_rgb(space->machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10));
1412
palette_set_color_rgb(machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10));
1291
static ADDRESS_MAP_START( mgcs, AS_PROGRAM, 16 )
1415
static ADDRESS_MAP_START( mgcs, AS_PROGRAM, 16, igs017_state )
1292
1416
AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
1293
1417
AM_RANGE( 0x300000, 0x303fff ) AM_RAM
1294
AM_RANGE( 0x49c000, 0x49c003 ) AM_WRITE( mgcs_magic_w )
1295
AM_RANGE( 0x49c002, 0x49c003 ) AM_READ ( mgcs_magic_r )
1296
AM_RANGE( 0xa02000, 0xa02fff ) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE_MEMBER(igs017_state, m_spriteram)
1297
AM_RANGE( 0xa03000, 0xa037ff ) AM_RAM_WRITE( mgcs_paletteram_w ) AM_BASE_GENERIC( paletteram )
1298
AM_RANGE( 0xa04020, 0xa04027 ) AM_DEVREAD8( "ppi8255", ppi8255_r, 0x00ff )
1299
AM_RANGE( 0xa04024, 0xa04025 ) AM_WRITE( video_disable_lsb_w )
1300
AM_RANGE( 0xa04028, 0xa04029 ) AM_WRITE( irq2_enable_w )
1301
AM_RANGE( 0xa0402a, 0xa0402b ) AM_WRITE( irq1_enable_w )
1302
AM_RANGE( 0xa08000, 0xa0bfff ) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE_MEMBER(igs017_state, m_fg_videoram )
1303
AM_RANGE( 0xa0c000, 0xa0ffff ) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE_MEMBER(igs017_state, m_bg_videoram )
1304
AM_RANGE( 0xa12000, 0xa12001 ) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff )
1418
AM_RANGE( 0x49c000, 0x49c003 ) AM_WRITE(mgcs_magic_w )
1419
AM_RANGE( 0x49c002, 0x49c003 ) AM_READ(mgcs_magic_r )
1420
AM_RANGE( 0xa02000, 0xa02fff ) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
1421
AM_RANGE( 0xa03000, 0xa037ff ) AM_RAM_WRITE(mgcs_paletteram_w ) AM_SHARE("paletteram")
1422
AM_RANGE( 0xa04020, 0xa04027 ) AM_DEVREAD8("ppi8255", i8255_device, read, 0x00ff)
1423
AM_RANGE( 0xa04024, 0xa04025 ) AM_WRITE(video_disable_lsb_w )
1424
AM_RANGE( 0xa04028, 0xa04029 ) AM_WRITE(irq2_enable_w )
1425
AM_RANGE( 0xa0402a, 0xa0402b ) AM_WRITE(irq1_enable_w )
1426
AM_RANGE( 0xa08000, 0xa0bfff ) AM_READWRITE(fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
1427
AM_RANGE( 0xa0c000, 0xa0ffff ) AM_READWRITE(bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
1428
AM_RANGE( 0xa12000, 0xa12001 ) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
1305
1429
// oki banking through protection (code at $1a350)?
1306
1430
ADDRESS_MAP_END
1311
static WRITE16_HANDLER( sdmg2_paletteram_w )
1436
WRITE16_MEMBER(igs017_state::sdmg2_paletteram_w)
1313
COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]);
1315
int bgr = ((space->machine().generic.paletteram.u16[offset/2*2+1] & 0xff) << 8) | (space->machine().generic.paletteram.u16[offset/2*2+0] & 0xff);
1317
palette_set_color_rgb(space->machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10));
1438
COMBINE_DATA(&m_generic_paletteram_16[offset]);
1440
int bgr = ((m_generic_paletteram_16[offset/2*2+1] & 0xff) << 8) | (m_generic_paletteram_16[offset/2*2+0] & 0xff);
1442
palette_set_color_rgb(machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10));
1320
static READ8_HANDLER( sdmg2_keys_r )
1445
READ8_MEMBER(igs017_state::sdmg2_keys_r)
1322
igs017_state *state = space->machine().driver_data<igs017_state>();
1323
if (~state->m_input_select & 0x01) return input_port_read(space->machine(), "KEY0");
1324
if (~state->m_input_select & 0x02) return input_port_read(space->machine(), "KEY1");
1325
if (~state->m_input_select & 0x04) return input_port_read(space->machine(), "KEY2");
1326
if (~state->m_input_select & 0x08) return input_port_read(space->machine(), "KEY3");
1327
if (~state->m_input_select & 0x10) return input_port_read(space->machine(), "KEY4");
1329
if (state->m_input_select == 0x1f) return input_port_read(space->machine(), "KEY0"); // in joystick mode
1331
logerror("%s: warning, reading key with input_select = %02x\n", space->machine().describe_context(), state->m_input_select);
1447
if (~m_input_select & 0x01) return ioport("KEY0")->read();
1448
if (~m_input_select & 0x02) return ioport("KEY1")->read();
1449
if (~m_input_select & 0x04) return ioport("KEY2")->read();
1450
if (~m_input_select & 0x08) return ioport("KEY3")->read();
1451
if (~m_input_select & 0x10) return ioport("KEY4")->read();
1453
if (m_input_select == 0x1f) return ioport("KEY0")->read(); // in joystick mode
1455
logerror("%s: warning, reading key with input_select = %02x\n", machine().describe_context(), m_input_select);
1335
static WRITE16_HANDLER( sdmg2_magic_w )
1459
WRITE16_MEMBER(igs017_state::sdmg2_magic_w)
1337
igs017_state *state = space->machine().driver_data<igs017_state>();
1338
COMBINE_DATA(&state->m_igs_magic[offset]);
1461
COMBINE_DATA(&m_igs_magic[offset]);
1340
1463
if (offset == 0)
1343
switch(state->m_igs_magic[0])
1466
switch(m_igs_magic[0])
1345
1468
// case 0x00: ? 0x80
1348
1471
if (ACCESSING_BITS_0_7)
1350
state->m_input_select = data & 0x1f;
1351
coin_counter_w(space->machine(), 0, data & 0x20);
1473
m_input_select = data & 0x1f;
1474
coin_counter_w(machine(), 0, data & 0x20);
1352
1475
// coin out data & 0x40
1353
state->m_hopper = data & 0x80;
1476
m_hopper = data & 0x80;
1358
1481
if (ACCESSING_BITS_0_7)
1360
okim6295_device *oki = space->machine().device<okim6295_device>("oki");
1483
okim6295_device *oki = machine().device<okim6295_device>("oki");
1361
1484
oki->set_bank_base((data & 0x80) ? 0x40000 : 0);
1366
logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space->device()), state->m_igs_magic[0], data);
1489
logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data);
1370
static READ16_HANDLER( sdmg2_magic_r )
1493
READ16_MEMBER(igs017_state::sdmg2_magic_r)
1372
igs017_state *state = space->machine().driver_data<igs017_state>();
1373
switch(state->m_igs_magic[0])
1495
switch(m_igs_magic[0])
1377
UINT16 hopper_bit = (state->m_hopper && ((space->machine().primary_screen->frame_number()/10)&1)) ? 0x0000 : 0x0001;
1378
return input_port_read(space->machine(), "COINS") | hopper_bit;
1499
UINT16 hopper_bit = (m_hopper && ((machine().primary_screen->frame_number()/10)&1)) ? 0x0000 : 0x0001;
1500
return ioport("COINS")->read() | hopper_bit;
1382
1504
return sdmg2_keys_r(space, 0);
1385
logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space->device()), state->m_igs_magic[0]);
1507
logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]);
1392
static ADDRESS_MAP_START( sdmg2, AS_PROGRAM, 16 )
1514
static ADDRESS_MAP_START( sdmg2, AS_PROGRAM, 16, igs017_state )
1393
1515
AM_RANGE(0x000000, 0x07ffff) AM_ROM
1394
1516
AM_RANGE(0x1f0000, 0x1fffff) AM_RAM
1395
AM_RANGE(0x202000, 0x202fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE_MEMBER(igs017_state, m_spriteram)
1396
AM_RANGE(0x203000, 0x2037ff) AM_RAM_WRITE( sdmg2_paletteram_w ) AM_BASE_GENERIC( paletteram )
1397
AM_RANGE(0x204020, 0x204027) AM_DEVREAD8( "ppi8255", ppi8255_r, 0x00ff )
1398
AM_RANGE(0x204024, 0x204025) AM_WRITE( video_disable_lsb_w )
1399
AM_RANGE(0x204028, 0x204029) AM_WRITE( irq2_enable_w )
1400
AM_RANGE(0x20402a, 0x20402b) AM_WRITE( irq1_enable_w )
1401
AM_RANGE(0x208000, 0x20bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE_MEMBER(igs017_state, m_fg_videoram )
1402
AM_RANGE(0x20c000, 0x20ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE_MEMBER(igs017_state, m_bg_videoram )
1403
AM_RANGE(0x210000, 0x210001) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff )
1404
AM_RANGE(0x300000, 0x300003) AM_WRITE( sdmg2_magic_w )
1405
AM_RANGE(0x300002, 0x300003) AM_READ ( sdmg2_magic_r )
1517
AM_RANGE(0x202000, 0x202fff) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
1518
AM_RANGE(0x203000, 0x2037ff) AM_RAM_WRITE(sdmg2_paletteram_w ) AM_SHARE("paletteram")
1519
AM_RANGE(0x204020, 0x204027) AM_DEVREAD8("ppi8255", i8255_device, read, 0x00ff)
1520
AM_RANGE(0x204024, 0x204025) AM_WRITE(video_disable_lsb_w )
1521
AM_RANGE(0x204028, 0x204029) AM_WRITE(irq2_enable_w )
1522
AM_RANGE(0x20402a, 0x20402b) AM_WRITE(irq1_enable_w )
1523
AM_RANGE(0x208000, 0x20bfff) AM_READWRITE(fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
1524
AM_RANGE(0x20c000, 0x20ffff) AM_READWRITE(bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
1525
AM_RANGE(0x210000, 0x210001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
1526
AM_RANGE(0x300000, 0x300003) AM_WRITE(sdmg2_magic_w )
1527
AM_RANGE(0x300002, 0x300003) AM_READ(sdmg2_magic_r )
1406
1528
ADDRESS_MAP_END
1411
static READ8_HANDLER( mgdh_keys_r )
1534
READ8_MEMBER(igs017_state::mgdh_keys_r)
1413
igs017_state *state = space->machine().driver_data<igs017_state>();
1414
if (~state->m_input_select & 0x04) return input_port_read(space->machine(), "KEY0");
1415
if (~state->m_input_select & 0x08) return input_port_read(space->machine(), "KEY1");
1416
if (~state->m_input_select & 0x10) return input_port_read(space->machine(), "KEY2");
1417
if (~state->m_input_select & 0x20) return input_port_read(space->machine(), "KEY3");
1418
if (~state->m_input_select & 0x40) return input_port_read(space->machine(), "KEY4");
1420
if ((state->m_input_select & 0xfc) == 0xfc) return input_port_read(space->machine(), "DSW1");
1422
logerror("%s: warning, reading key with input_select = %02x\n", space->machine().describe_context(), state->m_input_select);
1536
if (~m_input_select & 0x04) return ioport("KEY0")->read();
1537
if (~m_input_select & 0x08) return ioport("KEY1")->read();
1538
if (~m_input_select & 0x10) return ioport("KEY2")->read();
1539
if (~m_input_select & 0x20) return ioport("KEY3")->read();
1540
if (~m_input_select & 0x40) return ioport("KEY4")->read();
1542
if ((m_input_select & 0xfc) == 0xfc) return ioport("DSW1")->read();
1544
logerror("%s: warning, reading key with input_select = %02x\n", machine().describe_context(), m_input_select);
1426
static WRITE16_HANDLER( mgdha_magic_w )
1548
WRITE16_MEMBER(igs017_state::mgdha_magic_w)
1428
igs017_state *state = space->machine().driver_data<igs017_state>();
1429
COMBINE_DATA(&state->m_igs_magic[offset]);
1550
COMBINE_DATA(&m_igs_magic[offset]);
1431
1552
if (offset == 0)
1434
switch(state->m_igs_magic[0])
1555
switch(m_igs_magic[0])
1437
1558
if (ACCESSING_BITS_0_7)
1439
1560
// coin out data & 0x40
1440
coin_counter_w(space->machine(), 0, data & 0x80);
1561
coin_counter_w(machine(), 0, data & 0x80);
1443
1564
if ( data & ~0xc0 )
1444
logerror("%06x: warning, unknown bits written to igs_magic 00 = %02x\n", cpu_get_pc(&space->device()), data);
1565
logerror("%s: warning, unknown bits written to igs_magic 00 = %02x\n", machine().describe_context(), data);
1449
1570
if (ACCESSING_BITS_0_7)
1451
state->m_input_select = data & 0xff;
1452
state->m_hopper = data & 0x01;
1572
m_input_select = data & 0xff;
1573
m_hopper = data & 0x01;
1455
if ( state->m_input_select & ~0xfd )
1456
logerror("%06x: warning, unknown bits written in input_select = %02x\n", cpu_get_pc(&space->device()), state->m_input_select);
1576
if ( m_input_select & ~0xfd )
1577
logerror("%s: warning, unknown bits written in input_select = %02x\n", machine().describe_context(), m_input_select);
1478
1599
04ac10: warning, writing to igs_magic 06 = ff
1479
1600
04ac20: warning, writing to igs_magic 07 = 3f
1481
logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space->device()), state->m_igs_magic[0], data);
1602
logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data);
1485
static READ16_HANDLER( mgdha_magic_r )
1606
READ16_MEMBER(igs017_state::mgdha_magic_r)
1487
igs017_state *state = space->machine().driver_data<igs017_state>();
1488
switch(state->m_igs_magic[0])
1608
switch(m_igs_magic[0])
1491
1611
return mgdh_keys_r(space, 0);
1494
return input_port_read(space->machine(), "BUTTONS");
1614
return ioport("BUTTONS")->read();
1497
return BITSWAP8(input_port_read(space->machine(), "DSW2"), 0,1,2,3,4,5,6,7);
1617
return BITSWAP8(ioport("DSW2")->read(), 0,1,2,3,4,5,6,7);
1501
UINT16 hopper_bit = (state->m_hopper && ((space->machine().primary_screen->frame_number()/10)&1)) ? 0x0000 : 0x0001;
1502
return input_port_read(space->machine(), "COINS") | hopper_bit;
1621
UINT16 hopper_bit = (m_hopper && ((machine().primary_screen->frame_number()/10)&1)) ? 0x0000 : 0x0001;
1622
return ioport("COINS")->read() | hopper_bit;
1506
logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space->device()), state->m_igs_magic[0]);
1626
logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]);
1513
static ADDRESS_MAP_START( mgdha_map, AS_PROGRAM, 16 )
1633
static ADDRESS_MAP_START( mgdha_map, AS_PROGRAM, 16, igs017_state )
1514
1634
AM_RANGE(0x000000, 0x07ffff) AM_ROM
1515
1635
AM_RANGE(0x600000, 0x603fff) AM_RAM
1516
AM_RANGE(0x876000, 0x876003) AM_WRITE( mgdha_magic_w )
1517
AM_RANGE(0x876002, 0x876003) AM_READ ( mgdha_magic_r )
1518
AM_RANGE(0xa02000, 0xa02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE_MEMBER(igs017_state, m_spriteram)
1519
AM_RANGE(0xa03000, 0xa037ff) AM_RAM_WRITE( sdmg2_paletteram_w ) AM_BASE_GENERIC( paletteram )
1636
AM_RANGE(0x876000, 0x876003) AM_WRITE(mgdha_magic_w )
1637
AM_RANGE(0x876002, 0x876003) AM_READ(mgdha_magic_r )
1638
AM_RANGE(0xa02000, 0xa02fff) AM_READWRITE(spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
1639
AM_RANGE(0xa03000, 0xa037ff) AM_RAM_WRITE(sdmg2_paletteram_w ) AM_SHARE("paletteram")
1520
1640
// AM_RANGE(0xa04014, 0xa04015) // written with FF at boot
1521
AM_RANGE(0xa04020, 0xa04027) AM_DEVREAD8( "ppi8255", ppi8255_r, 0x00ff )
1522
AM_RANGE(0xa04024, 0xa04025) AM_WRITE( video_disable_lsb_w )
1523
AM_RANGE(0xa04028, 0xa04029) AM_WRITE( irq2_enable_w )
1524
AM_RANGE(0xa0402a, 0xa0402b) AM_WRITE( irq1_enable_w )
1525
AM_RANGE(0xa08000, 0xa0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE_MEMBER(igs017_state, m_fg_videoram )
1526
AM_RANGE(0xa0c000, 0xa0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE_MEMBER(igs017_state, m_bg_videoram )
1527
AM_RANGE(0xa10000, 0xa10001) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff )
1641
AM_RANGE(0xa04020, 0xa04027) AM_DEVREAD8("ppi8255", i8255_device, read, 0x00ff)
1642
AM_RANGE(0xa04024, 0xa04025) AM_WRITE(video_disable_lsb_w )
1643
AM_RANGE(0xa04028, 0xa04029) AM_WRITE(irq2_enable_w )
1644
AM_RANGE(0xa0402a, 0xa0402b) AM_WRITE(irq1_enable_w )
1645
AM_RANGE(0xa08000, 0xa0bfff) AM_READWRITE(fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
1646
AM_RANGE(0xa0c000, 0xa0ffff) AM_READWRITE(bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
1647
AM_RANGE(0xa10000, 0xa10001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
1528
1648
ADDRESS_MAP_END
1533
static WRITE8_HANDLER( tjsb_paletteram_w )
1654
WRITE8_MEMBER(igs017_state::tjsb_paletteram_w)
1535
space->machine().generic.paletteram.u8[offset] = data;
1536
int bgr = (space->machine().generic.paletteram.u8[offset/2*2+1] << 8) | space->machine().generic.paletteram.u8[offset/2*2+0];
1656
m_generic_paletteram_8[offset] = data;
1657
int bgr = (m_generic_paletteram_8[offset/2*2+1] << 8) | m_generic_paletteram_8[offset/2*2+0];
1539
bgr = BITSWAP16(bgr, 15, 12,3,6,10,5, 4,2,9,13,8, 7,11,1,0,14);
1660
bgr = BITSWAP16(bgr, 15,12,3,6,10,5,4,2,9,13,8,7,11,1,0,14);
1541
palette_set_color_rgb(space->machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10));
1662
palette_set_color_rgb(machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10));
1544
static WRITE8_HANDLER( tjsb_output_w )
1665
WRITE8_MEMBER(igs017_state::tjsb_output_w)
1546
igs017_state *state = space->machine().driver_data<igs017_state>();
1547
switch(state->m_input_select)
1667
switch(m_input_select)
1550
coin_counter_w(space->machine(), 0, data & 0x80); // coin in
1670
coin_counter_w(machine(), 0, data & 0x80); // coin in
1551
1671
if (!(data & ~0x80))
1556
coin_counter_w(space->machine(), 1, data & 0x01); // coin out
1676
coin_counter_w(machine(), 1, data & 0x01); // coin out
1557
1677
if (!(data & ~0x01))
1562
space->machine().device<okim6295_device>("oki")->set_bank_base((data & 0x10) ? 0x40000 : 0); // oki bank (0x20/0x30)
1682
machine().device<okim6295_device>("oki")->set_bank_base((data & 0x10) ? 0x40000 : 0); // oki bank (0x20/0x30)
1563
1683
if (!(data & ~0x30))
1568
state->m_hopper = data & 0x40;
1688
m_hopper = data & 0x40;
1569
1689
if (!(data & ~0x40))
1573
logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space->device()), state->m_input_select, data);
1693
logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_input_select, data);
1576
static READ8_HANDLER( tjsb_input_r )
1696
READ8_MEMBER(igs017_state::tjsb_input_r)
1578
igs017_state *state = space->machine().driver_data<igs017_state>();
1579
switch (state->m_input_select)
1698
switch (m_input_select)
1581
case 0x00: return input_port_read(space->machine(), "PLAYER1");
1582
case 0x01: return input_port_read(space->machine(), "PLAYER2");
1583
case 0x02: return input_port_read(space->machine(), "COINS");
1700
case 0x00: return ioport("PLAYER1")->read();
1701
case 0x01: return ioport("PLAYER2")->read();
1702
case 0x02: return ioport("COINS")->read();
1586
UINT8 hopper_bit = (state->m_hopper && ((space->machine().primary_screen->frame_number()/10)&1)) ? 0x00 : 0x20;
1587
return input_port_read(space->machine(), "HOPPER") | hopper_bit;
1705
UINT8 hopper_bit = (m_hopper && ((machine().primary_screen->frame_number()/10)&1)) ? 0x00 : 0x20;
1706
return ioport("HOPPER")->read() | hopper_bit;
1591
logerror("PC %06X: input %02x read\n",cpu_get_pc(&space->device()),state->m_input_select);
1710
logerror("%s: input %02x read\n", machine().describe_context(), m_input_select);
1596
static ADDRESS_MAP_START( tjsb_map, AS_PROGRAM, 8 )
1715
static ADDRESS_MAP_START( tjsb_map, AS_PROGRAM, 8, igs017_state )
1597
1716
AM_RANGE( 0x00000, 0x0dfff ) AM_ROM
1598
AM_RANGE( 0x0e000, 0x0e000 ) AM_WRITE( input_select_w )
1599
AM_RANGE( 0x0e001, 0x0e001 ) AM_READWRITE( tjsb_input_r, tjsb_output_w )
1717
AM_RANGE( 0x0e000, 0x0e000 ) AM_WRITE(input_select_w )
1718
AM_RANGE( 0x0e001, 0x0e001 ) AM_READWRITE(tjsb_input_r, tjsb_output_w )
1600
1719
AM_RANGE( 0x0e002, 0x0efff ) AM_RAM
1601
1720
AM_RANGE( 0x0f000, 0x0ffff ) AM_RAM
1602
1721
AM_RANGE( 0x10000, 0x3ffff ) AM_ROM
1603
1722
ADDRESS_MAP_END
1605
static ADDRESS_MAP_START( tjsb_io, AS_IO, 8 )
1724
static ADDRESS_MAP_START( tjsb_io, AS_IO, 8, igs017_state )
1606
1725
AM_RANGE( 0x0000, 0x003f ) AM_RAM // internal regs
1608
AM_RANGE( 0x1000, 0x17ff ) AM_RAM AM_BASE_MEMBER(igs017_state, m_spriteram)
1609
AM_RANGE( 0x1800, 0x1bff ) AM_RAM_WRITE( tjsb_paletteram_w ) AM_BASE_GENERIC(paletteram)
1727
AM_RANGE( 0x1000, 0x17ff ) AM_RAM AM_SHARE("spriteram")
1728
AM_RANGE( 0x1800, 0x1bff ) AM_RAM_WRITE(tjsb_paletteram_w ) AM_SHARE("paletteram")
1610
1729
AM_RANGE( 0x1c00, 0x1fff ) AM_RAM
1612
1731
// AM_RANGE(0x200a, 0x200a) AM_WRITENOP
1614
AM_RANGE( 0x2010, 0x2013 ) AM_DEVREAD("ppi8255", ppi8255_r)
1615
AM_RANGE( 0x2012, 0x2012 ) AM_WRITE( video_disable_w )
1617
AM_RANGE( 0x2014, 0x2014 ) AM_WRITE( nmi_enable_w )
1618
AM_RANGE( 0x2015, 0x2015 ) AM_WRITE( irq_enable_w )
1620
AM_RANGE( 0x4000, 0x5fff ) AM_RAM_WRITE( fg_w ) AM_BASE_MEMBER(igs017_state, m_fg_videoram )
1621
AM_RANGE( 0x6000, 0x7fff ) AM_RAM_WRITE( bg_w ) AM_BASE_MEMBER(igs017_state, m_bg_videoram )
1623
AM_RANGE( 0x9000, 0x9000 ) AM_DEVREADWRITE_MODERN("oki", okim6295_device, read, write)
1625
AM_RANGE( 0xb000, 0xb001 ) AM_DEVWRITE( "ymsnd", ym2413_w )
1733
AM_RANGE( 0x2010, 0x2013 ) AM_DEVREAD("ppi8255", i8255_device, read)
1734
AM_RANGE( 0x2012, 0x2012 ) AM_WRITE(video_disable_w )
1736
AM_RANGE( 0x2014, 0x2014 ) AM_WRITE(nmi_enable_w )
1737
AM_RANGE( 0x2015, 0x2015 ) AM_WRITE(irq_enable_w )
1739
AM_RANGE( 0x4000, 0x5fff ) AM_RAM_WRITE(fg_w ) AM_SHARE("fg_videoram")
1740
AM_RANGE( 0x6000, 0x7fff ) AM_RAM_WRITE(bg_w ) AM_SHARE("bg_videoram")
1742
AM_RANGE( 0x9000, 0x9000 ) AM_DEVREADWRITE("oki", okim6295_device, read, write)
1744
AM_RANGE( 0xb000, 0xb001 ) AM_DEVWRITE_LEGACY("ymsnd", ym2413_w )
1751
WRITE16_MEMBER(igs017_state::lhzb2_magic_w)
1753
COMBINE_DATA(&m_igs_magic[offset]);
1758
switch(m_igs_magic[0])
1761
if (ACCESSING_BITS_0_7)
1763
m_input_select = data & 0xff;
1766
if ( m_input_select & ~0x1f )
1767
logerror("%s: warning, unknown bits written in input_select = %02x\n", machine().describe_context(), m_input_select);
1771
if (ACCESSING_BITS_0_7)
1773
okim6295_device *oki = machine().device<okim6295_device>("oki");
1774
oki->set_bank_base((data & 0x80) ? 0x40000 : 0);
1777
logerror("%s: warning, unknown bits written in oki bank = %04x\n", machine().describe_context(), data);
1782
logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data);
1786
READ16_MEMBER(igs017_state::lhzb2_magic_r)
1788
switch(m_igs_magic[0])
1792
if (~m_input_select & 0x01) return ioport("KEY0")->read();
1793
if (~m_input_select & 0x02) return ioport("KEY1")->read();
1794
if (~m_input_select & 0x04) return ioport("KEY2")->read();
1795
if (~m_input_select & 0x08) return ioport("KEY3")->read();
1796
if (~m_input_select & 0x10) return ioport("KEY4")->read();
1798
logerror("%s: warning, reading key with input_select = %02x\n", machine().describe_context(), m_input_select);
1803
logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]);
1810
static ADDRESS_MAP_START( lhzb2, AS_PROGRAM, 16, igs017_state )
1811
AM_RANGE(0x000000, 0x07ffff) AM_ROM
1812
AM_RANGE(0x500000, 0x503fff) AM_RAM
1813
AM_RANGE(0x910000, 0x910003) AM_WRITE( lhzb2_magic_w )
1814
AM_RANGE(0x910002, 0x910003) AM_READ( lhzb2_magic_r )
1815
AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
1816
AM_RANGE(0xb03000, 0xb037ff) AM_RAM_WRITE( lhzb2a_paletteram_w ) AM_SHARE("paletteram")
1817
AM_RANGE(0xb04020, 0xb04027) AM_DEVREAD8("ppi8255", i8255_device, read, 0x00ff)
1818
AM_RANGE(0xb04024, 0xb04025) AM_WRITE( video_disable_lsb_w )
1819
AM_RANGE(0xb04028, 0xb04029) AM_WRITE( irq2_enable_w )
1820
AM_RANGE(0xb0402a, 0xb0402b) AM_WRITE( irq1_enable_w )
1821
AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
1822
AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
1823
AM_RANGE(0xb10000, 0xb10001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
1828
// To do: what devices are on this PCB?
1830
/***************************************************************************
1832
LHZB2A Protection (similar to that found in igs011.c)
1834
---- Protection 1 (parametric bitswaps) ----
1836
An address base register (xx = F0 at reset) determines where this protection device,
1837
as well as game inputs and the address base register itself are mapped in memory:
1838
inputs are mapped at xx8000, protection at xx4000 and base register at xxc000.
1840
The protection involves an internal 16-bit value (val), two mode registers
1841
(mode_f = 0..f, mode_3 = 0..3) and 8 x 16-bit registers (word).
1843
The two modes affect the bitswap, and are set by loading the (same) mode-specific value
1844
to all the word registers, and then writing to the mode_f or mode_3 trigger register.
1846
The bitswap of the internal value is then performed writing to one of 8 trigger registers,
1847
according to the modes, trigger register and value written.
1849
The result is read through a fixed bitswap of the internal value.
1851
---- Protection 2 (simple inc,dec + bitswapped read) ----
1853
The chip holds an internal 8-bit value. It is manipulated by issuing commands,
1854
where each command is assigned a specific address range, and is triggered
1855
by writing FF to that range. Possible commands:
1857
- INC: increment value
1858
- DEC: decrement value
1861
The protection value is read from an additional address range:
1863
- READ: read bitswap(value). Only 4 bits are checked.
1865
***************************************************************************/
1867
// Bitswap protection
1869
WRITE16_MEMBER(igs017_state::lhzb2a_prot_w)
1871
COMBINE_DATA(&m_prot_regs[offset]);
1876
switch(m_prot_regs[0])
1878
case 0x40: // prot_word
1880
m_prot_word = (m_prot_word << 8) | (m_prot_regs[1] & 0xff);
1890
// same value as reg 0x40
1893
case 0x48: // mode_f
1895
switch (m_prot_word)
1897
case 0x9a96: m_prot_mf = 0x0; break;
1898
case 0x9a06: m_prot_mf = 0x1; break;
1899
case 0x9a90: m_prot_mf = 0x2; break;
1900
case 0x9a00: m_prot_mf = 0x3; break;
1901
case 0x0a96: m_prot_mf = 0x4; break;
1902
case 0x0a06: m_prot_mf = 0x5; break;
1903
case 0x0a90: m_prot_mf = 0x6; break;
1904
case 0x0a00: m_prot_mf = 0x7; break;
1905
case 0x9096: m_prot_mf = 0x8; break;
1906
case 0x9006: m_prot_mf = 0x9; break;
1907
case 0x9090: m_prot_mf = 0xa; break;
1908
case 0x9000: m_prot_mf = 0xb; break;
1909
case 0x0096: m_prot_mf = 0xc; break;
1910
case 0x0006: m_prot_mf = 0xd; break;
1911
case 0x0090: m_prot_mf = 0xe; break;
1912
case 0x0000: m_prot_mf = 0xf; break;
1915
logerror("%s: warning, setting mode_f with unknown prot_word = %02x\n", machine().describe_context(), m_prot_word);
1919
logerror("%s: mode_f = %02x\n", machine().describe_context(), m_prot_mf);
1923
case 0x50: // mode_3
1925
switch (m_prot_word & 0xff)
1927
case 0x53: m_prot_m3 = 0x0; break;
1928
case 0x03: m_prot_m3 = 0x1; break;
1929
case 0x50: m_prot_m3 = 0x2; break;
1930
case 0x00: m_prot_m3 = 0x3; break;
1933
logerror("%s: warning, setting mode_3 with unknown prot_word = %02x\n", machine().describe_context(), m_prot_word);
1937
logerror("%s: mode_3 = %02x\n", machine().describe_context(), m_prot_m3);
1941
case 0x80: // do bitswap
1950
UINT16 x = m_prot_val;
1951
UINT16 mf = m_prot_mf;
1956
case 0: bit0 = BIT(~x,12) ^ BIT(~x,15) ^ BIT( x, 8) ^ BIT(~x, 3); break;
1957
case 1: bit0 = BIT(~x, 6) ^ BIT(~x,15) ^ BIT(~x, 3) ^ BIT(~x, 9); break;
1958
case 2: bit0 = BIT(~x, 3) ^ BIT(~x,15) ^ BIT(~x, 5) ^ BIT( x, 4); break;
1959
case 3: bit0 = BIT(~x,15) ^ BIT(~x, 9) ^ BIT( x,12) ^ BIT(~x,11); break;
1962
UINT16 xor0 = BIT(m_prot_regs[1], m_prot_regs[0] - 0x80);
1965
m_prot_val = ( BIT( x,14) << 15 ) |
1966
( (BIT(~x,13) ^ BIT(mf,3)) << 14 ) |
1967
( BIT( x,12) << 13 ) |
1968
( BIT(~x,11) << 12 ) |
1969
( (BIT( x,10) ^ BIT(mf,2)) << 11 ) |
1970
( BIT( x, 9) << 10 ) |
1971
( BIT( x, 8) << 9 ) |
1972
( (BIT(~x, 7) ^ BIT(mf,1)) << 8 ) |
1973
( BIT( x, 6) << 7 ) |
1974
( BIT( x, 5) << 6 ) |
1975
( (BIT(~x, 4) ^ BIT(mf,0)) << 5 ) |
1976
( BIT(~x, 3) << 4 ) |
1977
( BIT( x, 2) << 3 ) |
1978
( BIT(~x, 1) << 2 ) |
1979
( BIT( x, 0) << 1 ) |
1982
logerror("%s: exec bitswap - mode_3 %02x, mode_f %02x, xor0 %x, val %04x -> %04x\n", machine().describe_context(), m_prot_m3, m_prot_mf, xor0, x, m_prot_val);
1994
logerror("%s: warning, writing to prot_reg %02x = %02x\n", machine().describe_context(), m_prot_regs[0], m_prot_regs[1]);
1998
READ16_MEMBER(igs017_state::lhzb2a_prot_r)
2000
switch(m_prot_regs[0])
2002
case 0x03: // result
2004
UINT16 x = m_prot_val;
2005
UINT16 res = (BIT(x, 5) << 7) |
2014
logerror("%s: read bitswap - val %04x -> %02x\n", machine().describe_context(), m_prot_val, res);
2021
logerror("%s: warning, reading with prot_reg = %02x\n", machine().describe_context(), m_prot_regs[0]);
2030
WRITE16_MEMBER(igs017_state::lhzb2a_prot2_reset_w)
2033
logerror("%s: prot2 reset -> %02x\n", machine().describe_context(), m_prot2);
2036
WRITE16_MEMBER(igs017_state::lhzb2a_prot2_inc_w)
2039
logerror("%s: prot2 inc -> %02x\n", machine().describe_context(), m_prot2);
2042
WRITE16_MEMBER(igs017_state::lhzb2a_prot2_dec_w)
2045
logerror("%s: prot2 dec -> %02x\n", machine().describe_context(), m_prot2);
2048
READ16_MEMBER(igs017_state::lhzb2a_prot2_r)
2051
UINT8 res = (BIT(x, 0) << 7) |
2056
logerror("%s: prot2 read, %02x -> %02x\n", machine().describe_context(), m_prot2, res);
2062
WRITE16_MEMBER(igs017_state::lhzb2a_paletteram_w)
2064
COMBINE_DATA(&m_generic_paletteram_16[offset]);
2066
int bgr = ((m_generic_paletteram_16[offset/2*2+1] & 0xff) << 8) | (m_generic_paletteram_16[offset/2*2+0] & 0xff);
2069
bgr = BITSWAP16(bgr, 15,9,13,12,11,5,4,8,7,6,0,14,3,2,1,10);
2071
palette_set_color_rgb(machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10));
2074
READ16_MEMBER(igs017_state::lhzb2a_input_r)
2080
if (~m_input_select & 0x01) return ioport("KEY0")->read() << 8;
2081
if (~m_input_select & 0x02) return ioport("KEY1")->read() << 8;
2082
if (~m_input_select & 0x04) return ioport("KEY2")->read() << 8;
2083
if (~m_input_select & 0x08) return ioport("KEY3")->read() << 8;
2084
if (~m_input_select & 0x10) return ioport("KEY4")->read() << 8;
2086
logerror("%s: warning, reading key with input_select = %02x\n", machine().describe_context(), m_input_select);
2092
UINT16 hopper_bit = (m_hopper && ((machine().primary_screen->frame_number()/10)&1)) ? 0x0000 : 0x0002;
2093
return (ioport("DSW1")->read() << 8) | ioport("COINS")->read() | hopper_bit;
2097
return ioport("DSW2")->read();
2103
WRITE16_MEMBER(igs017_state::lhzb2a_input_addr_w)
2105
// Unmap previous address ranges
2106
if (m_input_addr != -1)
2108
space.unmap_readwrite(m_input_addr * 0x10000 + 0x4000, m_input_addr * 0x10000 + 0x4003);
2109
space.unmap_read (m_input_addr * 0x10000 + 0x8000, m_input_addr * 0x10000 + 0x8005);
2110
space.unmap_write (m_input_addr * 0x10000 + 0xc000, m_input_addr * 0x10000 + 0xc001);
2113
m_input_addr = data & 0xff;
2115
// Add new memory ranges
2116
space.install_readwrite_handler (m_input_addr * 0x10000 + 0x4000, m_input_addr * 0x10000 + 0x4003, read16_delegate (FUNC(igs017_state::lhzb2a_prot_r), this), write16_delegate (FUNC(igs017_state::lhzb2a_prot_w), this));
2117
space.install_read_handler (m_input_addr * 0x10000 + 0x8000, m_input_addr * 0x10000 + 0x8005, read16_delegate (FUNC(igs017_state::lhzb2a_input_r), this));
2118
space.install_write_handler (m_input_addr * 0x10000 + 0xc000, m_input_addr * 0x10000 + 0xc001, write16_delegate(FUNC(igs017_state::lhzb2a_input_addr_w), this));
2120
logerror("%s: inputs and protection remapped at %02xxxxx\n", machine().describe_context(), m_input_addr);
2123
WRITE16_MEMBER(igs017_state::lhzb2a_input_select_w)
2125
if (ACCESSING_BITS_0_7)
2127
m_input_select = data & 0x1f; // keys
2128
m_hopper = data & 0x20; // hopper motor
2129
coin_counter_w(machine(), 1, data & 0x40); // coin out counter
2130
coin_counter_w(machine(), 0, data & 0x80); // coin in counter
2132
if (ACCESSING_BITS_8_15)
2134
okim6295_device *oki = machine().device<okim6295_device>("oki");
2135
oki->set_bank_base((data & 0x0100) ? 0x40000 : 0);
2137
if ( data & 0x0fe00 )
2138
logerror("%s: warning, unknown bits written in input_select = %04x\n", machine().describe_context(), data);
2142
static ADDRESS_MAP_START( lhzb2a, AS_PROGRAM, 16, igs017_state )
2144
AM_RANGE(0x003200, 0x003201) AM_WRITE( lhzb2a_prot2_reset_w )
2145
AM_RANGE(0x003202, 0x003203) AM_WRITE( lhzb2a_prot2_dec_w )
2146
AM_RANGE(0x003206, 0x003207) AM_WRITE( lhzb2a_prot2_inc_w )
2147
AM_RANGE(0x00320a, 0x00320b) AM_READ( lhzb2a_prot2_r )
2149
AM_RANGE(0x000000, 0x07ffff) AM_ROM
2150
AM_RANGE(0x500000, 0x503fff) AM_RAM
2151
// AM_RANGE(0x910000, 0x910003) accesses appear to be from leftover code where the final checks were disabled
2152
AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
2153
AM_RANGE(0xb03000, 0xb037ff) AM_RAM_WRITE( lhzb2a_paletteram_w ) AM_SHARE("paletteram")
2154
AM_RANGE(0xb04024, 0xb04025) AM_WRITE( video_disable_lsb_w )
2155
AM_RANGE(0xb04028, 0xb04029) AM_WRITE( irq2_enable_w )
2156
AM_RANGE(0xb0402a, 0xb0402b) AM_WRITE( irq1_enable_w )
2157
AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
2158
AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
2159
AM_RANGE(0xb10000, 0xb10001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
2160
AM_RANGE(0xb12000, 0xb12001) AM_WRITE( lhzb2a_input_select_w )
2161
// Inputs dynamically mapped at xx8000, protection at xx4000 (xx = f0 initially). xx written to xxc000
2168
WRITE16_MEMBER(igs017_state::slqz2_paletteram_w)
2170
COMBINE_DATA(&m_generic_paletteram_16[offset]);
2172
int bgr = ((m_generic_paletteram_16[offset/2*2+1] & 0xff) << 8) | (m_generic_paletteram_16[offset/2*2+0] & 0xff);
2175
bgr = BITSWAP16(bgr, 15,14,9,4,11,10,12,3,7,6,5,8,13,2,1,0);
2177
palette_set_color_rgb(machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10));
2180
WRITE16_MEMBER(igs017_state::slqz2_magic_w)
2182
COMBINE_DATA(&m_igs_magic[offset]);
2187
switch(m_igs_magic[0])
2190
if (ACCESSING_BITS_0_7)
2192
okim6295_device *oki = machine().device<okim6295_device>("oki");
2193
oki->set_bank_base((data & 0x01) ? 0x40000 : 0);
2195
// m_hopper = data & 0x20; // hopper motor
2196
// coin_counter_w(machine(), 1, data & 0x40); // coin out counter
2197
coin_counter_w(machine(), 0, data & 0x80); // coin in counter
2200
logerror("%s: warning, unknown bits written in oki bank = %04x\n", machine().describe_context(), data);
2205
logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data);
2209
READ16_MEMBER(igs017_state::slqz2_magic_r)
2211
switch(m_igs_magic[0])
2214
return ioport("PLAYER2")->read();
2216
return ioport("PLAYER1")->read();
2218
return ioport("BUTTONS")->read();
2221
logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]);
2228
static ADDRESS_MAP_START( slqz2, AS_PROGRAM, 16, igs017_state )
2229
AM_RANGE(0x000000, 0x07ffff) AM_ROM
2230
AM_RANGE(0x100000, 0x103fff) AM_RAM
2231
AM_RANGE(0x602000, 0x602003) AM_WRITE( slqz2_magic_w )
2232
AM_RANGE(0x602002, 0x602003) AM_READ( slqz2_magic_r )
2233
AM_RANGE(0x902000, 0x902fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_SHARE("spriteram")
2234
AM_RANGE(0x903000, 0x9037ff) AM_RAM_WRITE( slqz2_paletteram_w ) AM_SHARE("paletteram")
2235
AM_RANGE(0x904020, 0x904027) AM_DEVREAD8("ppi8255", i8255_device, read, 0x00ff)
2236
AM_RANGE(0x904024, 0x904025) AM_WRITE( video_disable_lsb_w )
2237
AM_RANGE(0x904028, 0x904029) AM_WRITE( irq2_enable_w )
2238
AM_RANGE(0x90402a, 0x90402b) AM_WRITE( irq1_enable_w )
2239
AM_RANGE(0x908000, 0x90bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_SHARE("fg_videoram")
2240
AM_RANGE(0x90c000, 0x90ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_SHARE("bg_videoram")
2241
AM_RANGE(0x910000, 0x910001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff )
1626
2242
ADDRESS_MAP_END
1749
2365
INPUT_PORTS_END
2367
static INPUT_PORTS_START( lhzb2 )
2370
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
2371
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
2372
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
2373
PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) )
2374
PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) )
2375
PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" )
2376
PORT_DIPSETTING( 0x0c, "10" )
2377
PORT_DIPSETTING( 0x08, "20" )
2378
PORT_DIPSETTING( 0x04, "50" )
2379
PORT_DIPSETTING( 0x00, "100" )
2380
PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" )
2381
PORT_DIPSETTING( 0x10, "1000" )
2382
PORT_DIPSETTING( 0x00, "2000" )
2383
PORT_DIPNAME( 0x20, 0x20, "Money Type" )
2384
PORT_DIPSETTING( 0x20, "Coins" )
2385
PORT_DIPSETTING( 0x00, "Notes" )
2386
PORT_DIPNAME( 0x40, 0x40, "Pay Out Type" )
2387
PORT_DIPSETTING( 0x40, "Coins" )
2388
PORT_DIPSETTING( 0x00, "Notes" )
2389
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
2390
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
2391
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
2394
PORT_DIPNAME( 0x03, 0x03, "Min Bet" )
2395
PORT_DIPSETTING( 0x03, "500" )
2396
PORT_DIPSETTING( 0x02, "1000" )
2397
PORT_DIPSETTING( 0x01, "1500" )
2398
PORT_DIPSETTING( 0x00, "2000" )
2399
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )
2400
PORT_DIPSETTING( 0x0c, "1" )
2401
PORT_DIPSETTING( 0x08, "2" )
2402
PORT_DIPSETTING( 0x04, "3" )
2403
PORT_DIPSETTING( 0x00, "5" )
2404
PORT_DIPNAME( 0x10, 0x10, "Bonus Round" )
2405
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
2406
PORT_DIPSETTING( 0x10, DEF_STR( Yes ) )
2407
PORT_DIPNAME( 0x20, 0x20, "Number Type" )
2408
PORT_DIPSETTING( 0x20, "Number" )
2409
PORT_DIPSETTING( 0x00, "Dice" )
2410
PORT_DIPNAME( 0x40, 0x40, "Symbols" )
2411
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
2412
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // pigs, apples
2413
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
2414
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
2415
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
2418
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) // hopper switch (unimplemented)
2419
PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) // service mode (keep pressed during boot too)
2420
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Statistics") // press with the above for sound test
2421
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5) // coin error otherwise
2422
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O)
2423
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 ) // ? (shown in service mode)
2424
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2425
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2428
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
2429
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
2430
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
2431
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
2432
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
2433
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
2434
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2435
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2438
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
2439
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
2440
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
2441
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
2442
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
2443
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
2444
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2445
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2448
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
2449
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
2450
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
2451
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
2452
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
2453
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2454
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2455
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2458
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
2459
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
2460
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
2461
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
2462
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2463
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2464
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2465
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2468
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
2469
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
2470
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
2471
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2472
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
2473
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
2474
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2475
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2479
static INPUT_PORTS_START( lhzb2a )
2482
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
2483
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
2484
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
2485
PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) )
2486
PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) )
2487
PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" )
2488
PORT_DIPSETTING( 0x0c, "10" )
2489
PORT_DIPSETTING( 0x08, "20" )
2490
PORT_DIPSETTING( 0x04, "50" )
2491
PORT_DIPSETTING( 0x00, "100" )
2492
PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" )
2493
PORT_DIPSETTING( 0x10, "1000" )
2494
PORT_DIPSETTING( 0x00, "2000" )
2495
PORT_DIPNAME( 0x20, 0x20, "Money Type" )
2496
PORT_DIPSETTING( 0x20, "Coins" )
2497
PORT_DIPSETTING( 0x00, "Notes" )
2498
PORT_DIPNAME( 0x40, 0x40, "Pay Out Type" )
2499
PORT_DIPSETTING( 0x40, "Coins" )
2500
PORT_DIPSETTING( 0x00, "Notes" )
2501
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
2502
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
2503
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
2506
PORT_DIPNAME( 0x03, 0x03, "Min Bet" )
2507
PORT_DIPSETTING( 0x03, "500" )
2508
PORT_DIPSETTING( 0x02, "1000" )
2509
PORT_DIPSETTING( 0x01, "1500" )
2510
PORT_DIPSETTING( 0x00, "2000" )
2511
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )
2512
PORT_DIPSETTING( 0x0c, "1" )
2513
PORT_DIPSETTING( 0x08, "2" )
2514
PORT_DIPSETTING( 0x04, "3" )
2515
PORT_DIPSETTING( 0x00, "5" )
2516
PORT_DIPNAME( 0x10, 0x10, "Bonus Round" )
2517
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
2518
PORT_DIPSETTING( 0x10, DEF_STR( Yes ) )
2519
PORT_DIPNAME( 0x20, 0x20, "Number Type" )
2520
PORT_DIPSETTING( 0x20, "Number" )
2521
PORT_DIPSETTING( 0x00, "Dice" )
2522
PORT_DIPNAME( 0x40, 0x40, "Symbols" )
2523
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
2524
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // pigs, apples
2525
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
2526
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
2527
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
2530
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
2531
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) // hopper switch
2532
PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW ) // keep pressed while booting
2533
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Statistics") // press with the above for sound test
2534
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
2535
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O)
2536
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) // shown in test mode
2537
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2540
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
2541
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
2542
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
2543
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
2544
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
2545
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
2546
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2547
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2550
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
2551
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
2552
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
2553
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
2554
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
2555
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
2556
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2557
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2560
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
2561
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
2562
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
2563
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
2564
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
2565
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2566
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2567
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2570
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
2571
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
2572
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
2573
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
2574
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2575
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2576
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2577
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2580
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
2581
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
2582
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
2583
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2584
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
2585
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
2586
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2587
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1751
2591
static INPUT_PORTS_START( mgcs )
1753
2593
// DSWs don't work: they are read through a protection device (IGS029? see code at 1CF16)
1921
2761
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O)
1923
2763
// Keyboard mode:
1924
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40) // shown in test mode
2764
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40) // shown in test mode
1925
2765
// Joystick mode:
1926
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
2766
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
1928
2768
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1930
2770
PORT_START("KEY0")
1931
2771
// Keyboard mode:
1932
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40)
1933
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40)
1934
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40)
1935
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40)
1936
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40)
1937
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40)
1938
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40)
1939
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x40)
2772
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40)
2773
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40)
2774
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40)
2775
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40)
2776
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40)
2777
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40)
2778
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40)
2779
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x40,EQUALS,0x40)
1940
2780
// Joystick mode:
1941
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
1942
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
1943
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
1944
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
1945
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
1946
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
1947
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
1948
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x40,PORTCOND_EQUALS,0x00)
2781
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
2782
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
2783
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
2784
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
2785
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
2786
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
2787
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
2788
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x40,EQUALS,0x00)
1950
2790
PORT_START("KEY1")
1951
2791
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
2053
2893
PORT_START("KEY0")
2054
2894
// Keyboard mode:
2055
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x02)
2056
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x02)
2057
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x02)
2058
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x02)
2059
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x02)
2060
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x02)
2061
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x02)
2062
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x02)
2895
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_CONDITION("DSW2",0x02,EQUALS,0x02)
2896
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_CONDITION("DSW2",0x02,EQUALS,0x02)
2897
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_CONDITION("DSW2",0x02,EQUALS,0x02)
2898
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_CONDITION("DSW2",0x02,EQUALS,0x02)
2899
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_CONDITION("DSW2",0x02,EQUALS,0x02)
2900
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW2",0x02,EQUALS,0x02)
2901
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x02,EQUALS,0x02)
2902
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x02,EQUALS,0x02)
2063
2903
// Joystick mode:
2064
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x00)
2065
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x00)
2066
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x00)
2067
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x00)
2068
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x00)
2069
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x00)
2070
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x00)
2071
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x02,PORTCOND_EQUALS,0x00)
2904
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_CONDITION("DSW2",0x02,EQUALS,0x00)
2905
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_CONDITION("DSW2",0x02,EQUALS,0x00)
2906
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_CONDITION("DSW2",0x02,EQUALS,0x00)
2907
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_CONDITION("DSW2",0x02,EQUALS,0x00)
2908
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_CONDITION("DSW2",0x02,EQUALS,0x00)
2909
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CONDITION("DSW2",0x02,EQUALS,0x00)
2910
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x02,EQUALS,0x00)
2911
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSW2",0x02,EQUALS,0x00)
2073
2913
PORT_START("KEY1")
2074
2914
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
2123
2963
INPUT_PORTS_END
2965
static INPUT_PORTS_START( slqz2 )
2968
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
2969
PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
2970
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
2971
PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) )
2972
PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) )
2973
PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" )
2974
PORT_DIPSETTING( 0x0c, "10" )
2975
PORT_DIPSETTING( 0x08, "20" )
2976
PORT_DIPSETTING( 0x04, "50" )
2977
PORT_DIPSETTING( 0x00, "100" )
2978
PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" )
2979
PORT_DIPSETTING( 0x10, "1000" )
2980
PORT_DIPSETTING( 0x00, "2000" )
2981
PORT_DIPNAME( 0x20, 0x20, "Money Type" )
2982
PORT_DIPSETTING( 0x20, "Coins" )
2983
PORT_DIPSETTING( 0x00, "Notes" )
2984
PORT_DIPNAME( 0x40, 0x40, "Pay Out Type" )
2985
PORT_DIPSETTING( 0x40, "Coins" )
2986
PORT_DIPSETTING( 0x00, "Notes" )
2987
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
2988
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
2989
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
2992
PORT_DIPNAME( 0x03, 0x03, "Min Bet" )
2993
PORT_DIPSETTING( 0x03, "500" )
2994
PORT_DIPSETTING( 0x02, "1000" )
2995
PORT_DIPSETTING( 0x01, "1500" )
2996
PORT_DIPSETTING( 0x00, "2000" )
2997
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )
2998
PORT_DIPSETTING( 0x0c, "1" )
2999
PORT_DIPSETTING( 0x08, "2" )
3000
PORT_DIPSETTING( 0x04, "3" )
3001
PORT_DIPSETTING( 0x00, "5" )
3002
PORT_DIPNAME( 0x10, 0x10, "Bonus Round" )
3003
PORT_DIPSETTING( 0x00, DEF_STR( No ) )
3004
PORT_DIPSETTING( 0x10, DEF_STR( Yes ) )
3005
PORT_DIPNAME( 0x20, 0x20, "Number Type" )
3006
PORT_DIPSETTING( 0x20, "Number" )
3007
PORT_DIPSETTING( 0x00, "Dice" )
3008
PORT_DIPNAME( 0x40, 0x40, "Symbols" )
3009
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
3010
PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // pigs, apples
3011
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
3012
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
3013
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
3016
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) // hopper switch (unimplemented)
3017
PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) // service mode (keep pressed during boot too)
3018
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Statistics") // press with the above for sound test
3019
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5) // coin error otherwise
3020
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O)
3021
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
3022
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
3023
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
3025
PORT_START("PLAYER1")
3026
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start / Don Den")
3027
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
3028
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
3029
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
3030
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
3031
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Help / Big" )
3032
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3033
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3035
PORT_START("PLAYER2")
3036
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME( "Bet" )
3037
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
3038
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
3039
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
3040
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
3041
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3042
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3043
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3045
PORT_START("BUTTONS")
3046
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_1_PAD)
3047
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_2_PAD)
3048
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_3_PAD)
3049
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_4_PAD)
3050
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_5_PAD)
3051
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_6_PAD)
3052
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_7_PAD)
3053
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_8_PAD)
2125
3057
static INPUT_PORTS_START( tjsb )
2127
3059
PORT_START("DSW1")