src/mame/drivers/namcos10.c
| r14862 | r14863 | |
| 269 | 269 | #include "video/psx.h" |
| 270 | 270 | #include "includes/psx.h" |
| 271 | 271 | |
| 272 | | WRITE32_HANDLER( namcos10_bank_w ) |
| 273 | | { |
| 274 | | memory_set_bank( space->machine(), "bank1", data & 0xf ); |
| 275 | | } |
| 276 | | |
| 277 | 272 | class namcos10_state : public psx_state |
| 278 | 273 | { |
| 279 | 274 | public: |
| 280 | 275 | namcos10_state(const machine_config &mconfig, device_type type, const char *tag) |
| 281 | 276 | : psx_state(mconfig, type, tag) { } |
| 277 | |
| 278 | // memm variant interface |
| 279 | DECLARE_WRITE32_MEMBER(key_w); |
| 280 | DECLARE_READ32_MEMBER(range_r); |
| 281 | DECLARE_WRITE32_MEMBER(bank_w); |
| 282 | |
| 283 | // memn variant interface |
| 284 | DECLARE_READ32_MEMBER (nand_status_r); |
| 285 | DECLARE_WRITE32_MEMBER(nand_address1_w); |
| 286 | DECLARE_WRITE32_MEMBER(nand_address2_w); |
| 287 | DECLARE_WRITE32_MEMBER(nand_address3_w); |
| 288 | DECLARE_WRITE32_MEMBER(nand_address4_w); |
| 289 | DECLARE_READ32_MEMBER (nand_data_r); |
| 290 | DECLARE_WRITE32_MEMBER(watchdog_w); |
| 291 | DECLARE_WRITE32_MEMBER(nand_block_w); |
| 292 | DECLARE_READ32_MEMBER (nand_block_r); |
| 293 | |
| 294 | UINT8 *nand_base; |
| 295 | void nand_copy( UINT32 *dst, UINT32 address, int len ); |
| 296 | |
| 297 | private: |
| 298 | UINT16 key; |
| 299 | UINT8 cnt; |
| 300 | UINT32 bank_base; |
| 301 | UINT32 nand_address; |
| 302 | UINT32 block[0x1ff]; |
| 303 | |
| 304 | UINT16 nand_read( UINT32 address ); |
| 305 | UINT16 nand_read2( UINT32 address ); |
| 282 | 306 | }; |
| 283 | 307 | |
| 308 | |
| 284 | 309 | static ADDRESS_MAP_START( namcos10_map, AS_PROGRAM, 32, namcos10_state ) |
| 285 | 310 | AM_RANGE(0x00000000, 0x00ffffff) AM_RAM AM_SHARE("share1") /* ram */ |
| 286 | 311 | AM_RANGE(0x1fc00000, 0x1fffffff) AM_ROM AM_SHARE("share2") AM_REGION("user1", 0) /* bios */ |
| r14862 | r14863 | |
| 291 | 316 | AM_RANGE(0xfffe0130, 0xfffe0133) AM_WRITENOP |
| 292 | 317 | ADDRESS_MAP_END |
| 293 | 318 | |
| 319 | |
| 320 | // memm variant interface |
| 321 | // |
| 322 | // banked view with dynamic decryption over the flash. Access to the |
| 323 | // nand is unknown, but may just be using the memn interface. Won't |
| 324 | // know until the decryption is done. |
| 325 | // |
| 326 | // bios copies 62000-37ffff from the flash to 80012000 in ram through the |
| 327 | // decryption in range_r then jumps there (and dies horribly, of course) |
| 328 | |
| 329 | WRITE32_MEMBER(namcos10_state::key_w ) |
| 330 | { |
| 331 | key = (data >> 15) | (data << 1); |
| 332 | cnt = 0; |
| 333 | } |
| 334 | |
| 335 | WRITE32_MEMBER(namcos10_state::bank_w) |
| 336 | { |
| 337 | bank_base = 0x80000*(offset*2 + (ACCESSING_BITS_16_31 ? 1 : 0)); |
| 338 | } |
| 339 | |
| 340 | READ32_MEMBER(namcos10_state::range_r) |
| 341 | { |
| 342 | UINT32 data32 = ((const UINT32 *)(machine().region("user1")->base()))[offset+bank_base]; |
| 343 | |
| 344 | UINT16 d16; |
| 345 | if(ACCESSING_BITS_16_31) |
| 346 | d16 = data32 >> 16; |
| 347 | else |
| 348 | d16 = data32; |
| 349 | |
| 350 | /* This is not entirely correct, but not entirely incorrect either... |
| 351 | It's also specific to mrdriller2, it seems. |
| 352 | */ |
| 353 | |
| 354 | UINT16 dd16 = d16 ^ key; |
| 355 | |
| 356 | key = |
| 357 | (( BIT(d16, 3) ^ (BIT(cnt, 0) & !BIT(cnt, 2))) << 15) | |
| 358 | ((1 ^ BIT(key, 13) ^ BIT(cnt, 0)) << 14) | |
| 359 | ((1 ^ BIT(key, 11) ^ BIT(d16, 5) ^ BIT(d16, 2)) << 13) | |
| 360 | (( BIT(key, 9) ^ BIT(cnt, 3)) << 12) | |
| 361 | ((1 ^ BIT(key, 2)) << 11) | |
| 362 | (( BIT(key, 10) ^ (BIT(d16, 4) & BIT(cnt, 1))) << 10) | |
| 363 | ((1 ^ BIT(key, 6) ^ BIT(cnt, 4)) << 9) | |
| 364 | ((1 ^ BIT(d16, 6) ^ BIT(key, 5)) << 8) | |
| 365 | (( BIT(key, 1) ^ (BIT(d16, 5) | BIT(d16, 4))) << 7) | |
| 366 | (( BIT(key, 15)) << 6) | |
| 367 | ((1 ^ BIT(key, 4) ^ BIT(cnt, 3) ^ BIT(d16, 2)) << 5) | |
| 368 | ((1 ^ BIT(key, 7) ^ BIT(cnt, 5)) << 4) | |
| 369 | ((1 ^ BIT(key, 8) ^ (BIT(cnt, 7) | BIT(d16, 3))) << 3) | |
| 370 | (( BIT(key, 14) ^ (BIT(cnt, 1) | BIT(d16, 7))) << 2) | |
| 371 | ((1 ^ BIT(key, 12) ^ (BIT(cnt, 7) & BIT(d16, 7))) << 1) | |
| 372 | (( (BIT(cnt, 0) | BIT(cnt, 2))) << 0); |
| 373 | |
| 374 | cnt++; |
| 375 | |
| 376 | if(ACCESSING_BITS_16_31) |
| 377 | return dd16 << 16; |
| 378 | else |
| 379 | return dd16; |
| 380 | } |
| 381 | |
| 382 | static ADDRESS_MAP_START( namcos10_memm_map, AS_PROGRAM, 32, namcos10_state ) |
| 383 | AM_RANGE(0x1f300000, 0x1f300003) AM_WRITE(key_w) |
| 384 | AM_RANGE(0x1f400000, 0x1f5fffff) AM_READ (range_r) |
| 385 | AM_RANGE(0x1fb40000, 0x1fb4000f) AM_WRITE(bank_w) |
| 386 | |
| 387 | AM_IMPORT_FROM(namcos10_map) |
| 388 | ADDRESS_MAP_END |
| 389 | |
| 390 | |
| 294 | 391 | static void memm_driver_init( running_machine &machine ) |
| 295 | 392 | { |
| 296 | 393 | psx_driver_init(machine); |
| 297 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1f300000, 0x1f300003, FUNC(namcos10_bank_w) ); |
| 298 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank( 0x1f400000, 0x1f7fffff, "bank1" ); |
| 299 | | memory_configure_bank( machine, "bank1", 0, 16, machine.region( "user2" )->base(), 4 * 1024 * 1024 ); |
| 300 | 394 | } |
| 301 | 395 | |
| 302 | | UINT8 *nand_base; |
| 303 | | UINT32 nand_address = 0; |
| 304 | 396 | |
| 305 | | READ32_HANDLER( nand_status_r ) |
| 397 | // memn variant interface |
| 398 | // |
| 399 | // Block access to the nand. Something strange is going on with the |
| 400 | // status port. Interaction with the decryption is unclear at best. |
| 401 | |
| 402 | READ32_MEMBER(namcos10_state::nand_status_r ) |
| 306 | 403 | { |
| 307 | 404 | return 0; |
| 308 | 405 | } |
| 309 | 406 | |
| 310 | | WRITE32_HANDLER( nand_address1_w ) |
| 407 | WRITE32_MEMBER(namcos10_state::nand_address1_w ) |
| 311 | 408 | { |
| 409 | logerror("nand_a1_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); |
| 312 | 410 | nand_address = ( nand_address & 0x00ffffff ) | ( ( data & 0xff ) << 24 ); |
| 313 | 411 | } |
| 314 | 412 | |
| 315 | | WRITE32_HANDLER( nand_address2_w ) |
| 413 | WRITE32_MEMBER(namcos10_state::nand_address2_w ) |
| 316 | 414 | { |
| 415 | logerror("nand_a2_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); |
| 317 | 416 | nand_address = ( nand_address & 0xff00ffff ) | ( ( data & 0xff ) << 16 ); |
| 318 | 417 | } |
| 319 | 418 | |
| 320 | | WRITE32_HANDLER( nand_address3_w ) |
| 419 | WRITE32_MEMBER(namcos10_state::nand_address3_w ) |
| 321 | 420 | { |
| 421 | logerror("nand_a3_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); |
| 322 | 422 | nand_address = ( nand_address & 0xffff00ff ) | ( ( data & 0xff ) << 8 ); |
| 323 | 423 | } |
| 324 | 424 | |
| 325 | | WRITE32_HANDLER( nand_address4_w ) |
| 425 | WRITE32_MEMBER(namcos10_state::nand_address4_w ) |
| 326 | 426 | { |
| 427 | logerror("nand_a4_w %08x (%08x)\n", data, cpu_get_pc(&space.device())); |
| 327 | 428 | nand_address = ( nand_address & 0xffffff00 ) | ( ( data & 0xff ) << 0 ); |
| 328 | 429 | } |
| 329 | 430 | |
| 330 | | UINT16 nand_read( UINT32 address ) |
| 431 | UINT16 namcos10_state::nand_read( UINT32 address ) |
| 331 | 432 | { |
| 332 | 433 | int index = ( ( address / 512 ) * 528 ) + ( address % 512 ); |
| 333 | 434 | return nand_base[ index ] | ( nand_base[ index + 1 ] << 8 ); |
| 334 | 435 | } |
| 335 | 436 | |
| 336 | | UINT16 nand_read2( UINT32 address ) |
| 437 | UINT16 namcos10_state::nand_read2( UINT32 address ) |
| 337 | 438 | { |
| 338 | 439 | int index = ( ( address / 512 ) * 528 ) + ( address % 512 ); |
| 339 | 440 | return nand_base[ index + 1 ] | ( nand_base[ index ] << 8 ); |
| 340 | 441 | } |
| 341 | 442 | |
| 342 | | READ32_HANDLER( nand_data_r ) |
| 443 | READ32_MEMBER(namcos10_state::nand_data_r ) |
| 343 | 444 | { |
| 344 | 445 | UINT32 data = nand_read2( nand_address * 2 ); |
| 345 | 446 | |
| 447 | logerror("read %08x = %04x\n", nand_address*2, data); |
| 448 | |
| 346 | 449 | /* printf( "data<-%08x (%08x)\n", data, nand_address ); */ |
| 347 | 450 | nand_address++; |
| 348 | 451 | |
| 349 | 452 | return data; |
| 350 | 453 | } |
| 351 | 454 | |
| 352 | | static void nand_copy( UINT32 *dst, UINT32 address, int len ) |
| 455 | void namcos10_state::nand_copy( UINT32 *dst, UINT32 address, int len ) |
| 353 | 456 | { |
| 354 | 457 | while( len > 0 ) |
| 355 | 458 | { |
| r14862 | r14863 | |
| 359 | 462 | } |
| 360 | 463 | } |
| 361 | 464 | |
| 362 | | UINT32 block[ 0x1ff ]; |
| 363 | | |
| 364 | | WRITE32_HANDLER( nand_block_w ) |
| 465 | WRITE32_MEMBER(namcos10_state::nand_block_w) |
| 365 | 466 | { |
| 366 | | COMBINE_DATA( &block[ offset ] ); |
| 367 | | /* printf( "block %d %08x\n", offset, data ); */ |
| 467 | COMBINE_DATA( &block[offset] ); |
| 368 | 468 | } |
| 369 | 469 | |
| 370 | | READ32_HANDLER( nand_block_r ) |
| 470 | READ32_MEMBER(namcos10_state::nand_block_r) |
| 371 | 471 | { |
| 372 | 472 | return block[ offset ]; |
| 373 | 473 | } |
| 374 | 474 | |
| 375 | | WRITE32_HANDLER( watchdog_w ) |
| 475 | WRITE32_MEMBER(namcos10_state::watchdog_w) |
| 376 | 476 | { |
| 377 | 477 | } |
| 378 | 478 | |
| 479 | static ADDRESS_MAP_START( namcos10_memn_map, AS_PROGRAM, 32, namcos10_state ) |
| 480 | AM_RANGE(0x1f400000, 0x1f400003) AM_READ (nand_status_r) |
| 481 | AM_RANGE(0x1f410000, 0x1f410003) AM_WRITE(nand_address1_w) |
| 482 | AM_RANGE(0x1f420000, 0x1f420003) AM_WRITE(nand_address1_w) |
| 483 | AM_RANGE(0x1f430000, 0x1f430003) AM_WRITE(nand_address1_w) |
| 484 | AM_RANGE(0x1f440000, 0x1f440003) AM_WRITE(nand_address1_w) |
| 485 | AM_RANGE(0x1f450000, 0x1f450003) AM_READ (nand_data_r) |
| 486 | AM_RANGE(0x1fb60000, 0x1fb60003) AM_READWRITE(nand_block_r, nand_block_w) |
| 487 | |
| 488 | AM_IMPORT_FROM(namcos10_map) |
| 489 | ADDRESS_MAP_END |
| 490 | |
| 379 | 491 | static void memn_driver_init( running_machine &machine ) |
| 380 | 492 | { |
| 493 | namcos10_state *state = machine.driver_data<namcos10_state>(); |
| 381 | 494 | UINT8 *BIOS = (UINT8 *)machine.region( "user1" )->base(); |
| 382 | | nand_base = (UINT8 *)machine.region( "user2" )->base(); |
| 495 | state->nand_base = (UINT8 *)machine.region( "user2" )->base(); |
| 383 | 496 | |
| 384 | | nand_copy( (UINT32 *)( BIOS + 0x0000000 ), 0x08000, 0x001c000 ); |
| 385 | | nand_copy( (UINT32 *)( BIOS + 0x0020000 ), 0x24000, 0x03e0000 ); |
| 497 | state->nand_copy( (UINT32 *)( BIOS + 0x0000000 ), 0x08000, 0x001c000 ); |
| 498 | state->nand_copy( (UINT32 *)( BIOS + 0x0020000 ), 0x24000, 0x03e0000 ); |
| 386 | 499 | |
| 387 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1f400000, 0x1f400003, FUNC(nand_status_r) ); |
| 388 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1f410000, 0x1f410003, FUNC(nand_address1_w) ); |
| 389 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1f420000, 0x1f420003, FUNC(nand_address2_w) ); |
| 390 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1f430000, 0x1f430003, FUNC(nand_address3_w) ); |
| 391 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1f440000, 0x1f440003, FUNC(nand_address4_w) ); |
| 392 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0x1f450000, 0x1f450003, FUNC(nand_data_r) ); |
| 393 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0x1fb60000, 0x1fb60003, FUNC(watchdog_w) ); |
| 394 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler( 0xbf500000, 0xbf5007d7, FUNC(nand_block_w) ); |
| 395 | | machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler( 0xbf500000, 0xbf5007d7, FUNC(nand_block_r) ); |
| 396 | | |
| 397 | 500 | psx_driver_init(machine); |
| 398 | 501 | } |
| 399 | 502 | |
| 400 | | static void decrypt_bios( running_machine &machine, int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8, |
| 503 | static void decrypt_bios( running_machine &machine, int start, int end, int b15, int b14, int b13, int b12, int b11, int b10, int b9, int b8, |
| 401 | 504 | int b7, int b6, int b5, int b4, int b3, int b2, int b1, int b0 ) |
| 402 | 505 | { |
| 403 | | UINT16 *BIOS = (UINT16 *)machine.region( "user1" )->base(); |
| 404 | | int len = machine.region( "user1" )->bytes() / 2; |
| 405 | | int i; |
| 506 | UINT16 *BIOS = (UINT16 *)(machine.region( "user1" )->base() + start); |
| 507 | int len = (end - start)/2; |
| 406 | 508 | |
| 407 | | for( i = 0; i < len; i++ ) |
| 509 | for( int i = 0; i < len; i++ ) |
| 408 | 510 | { |
| 409 | 511 | BIOS[ i ] = BITSWAP16( BIOS[ i ] ^ 0xaaaa, |
| 410 | 512 | b15, b14, b13, b12, b11, b10, b9, b8, b7, b6, b5, b4, b3, b2, b1, b0 ); |
| r14862 | r14863 | |
| 414 | 516 | static DRIVER_INIT( mrdrilr2 ) |
| 415 | 517 | { |
| 416 | 518 | memm_driver_init(machine); |
| 417 | | decrypt_bios( machine, 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 ); |
| 519 | decrypt_bios( machine, 0x000000, 0x041000, 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 ); |
| 520 | decrypt_bios( machine, 0x060000, 0x062000, 0xc, 0xd, 0xf, 0xe, 0xb, 0xa, 0x9, 0x8, 0x7, 0x6, 0x4, 0x1, 0x2, 0x5, 0x0, 0x3 ); |
| 418 | 521 | } |
| 419 | 522 | |
| 420 | 523 | static DRIVER_INIT( gjspace ) |
| 421 | 524 | { |
| 422 | 525 | memn_driver_init(machine); |
| 423 | | decrypt_bios( machine, 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb ); |
| 526 | decrypt_bios( machine, 0x000000, 0x400000, 0x0, 0x2, 0xe, 0xd, 0xf, 0x6, 0xc, 0x7, 0x5, 0x1, 0x9, 0x8, 0xa, 0x3, 0x4, 0xb ); |
| 424 | 527 | } |
| 425 | 528 | |
| 426 | 529 | static DRIVER_INIT( mrdrilrg ) |
| 427 | 530 | { |
| 428 | 531 | memn_driver_init(machine); |
| 429 | | decrypt_bios( machine, 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa ); |
| 532 | decrypt_bios( machine, 0x000000, 0x400000, 0x6, 0x4, 0x7, 0x5, 0x2, 0x1, 0x0, 0x3, 0xc, 0xd, 0xe, 0xf, 0x8, 0x9, 0xb, 0xa ); |
| 430 | 533 | } |
| 431 | 534 | |
| 432 | 535 | static DRIVER_INIT( knpuzzle ) |
| 433 | 536 | { |
| 434 | 537 | memn_driver_init(machine); |
| 435 | | decrypt_bios( machine, 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa ); |
| 538 | decrypt_bios( machine, 0x000000, 0x400000, 0x6, 0x7, 0x4, 0x5, 0x2, 0x0, 0x3, 0x1, 0xc, 0xd, 0xe, 0xf, 0x9, 0xb, 0x8, 0xa ); |
| 436 | 539 | } |
| 437 | 540 | |
| 438 | 541 | static DRIVER_INIT( startrgn ) |
| 439 | 542 | { |
| 440 | 543 | memn_driver_init(machine); |
| 441 | | decrypt_bios( machine, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); |
| 544 | decrypt_bios( machine, 0x000000, 0x400000, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); |
| 442 | 545 | } |
| 443 | 546 | |
| 444 | 547 | static DRIVER_INIT( gamshara ) |
| 445 | 548 | { |
| 446 | 549 | memn_driver_init(machine); |
| 447 | | decrypt_bios( machine, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb ); |
| 550 | decrypt_bios( machine, 0x000000, 0x400000, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x8, 0x9, 0xa, 0xb ); |
| 448 | 551 | } |
| 449 | 552 | |
| 450 | 553 | static DRIVER_INIT( gunbalna ) |
| 451 | 554 | { |
| 452 | 555 | memn_driver_init(machine); |
| 453 | | decrypt_bios( machine, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x9, 0x8, 0xa, 0xb ); |
| 556 | decrypt_bios( machine, 0x000000, 0x400000, 0x5, 0x4, 0x7, 0x6, 0x0, 0x1, 0x3, 0x2, 0xd, 0xf, 0xc, 0xe, 0x9, 0x8, 0xa, 0xb ); |
| 454 | 557 | } |
| 455 | 558 | |
| 456 | 559 | static DRIVER_INIT( chocovdr ) |
| r14862 | r14863 | |
| 459 | 562 | // NOTE: none of the possible permutations show the Sony Computer Entertainment string at BIOS[0x84], very likely a bad dump |
| 460 | 563 | // BAD? 0 or 9 1 or 8 0 or 9 |
| 461 | 564 | // ok! ok! ok! ok! ok! ok! ok! ok! ok! ok! ok! ok! |
| 462 | | decrypt_bios( machine, 0x5, 0x4, 0x6, 0x7, 0x1, 0x0, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x8, 0xb, 0xa, 0x9 ); |
| 565 | decrypt_bios( machine, 0x000000, 0x400000, 0x5, 0x4, 0x6, 0x7, 0x1, 0x0, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x8, 0xb, 0xa, 0x9 ); |
| 463 | 566 | } |
| 464 | 567 | |
| 465 | 568 | static DRIVER_INIT( panikuru ) |
| 466 | 569 | { |
| 467 | 570 | memn_driver_init(machine); |
| 468 | | decrypt_bios( machine, 0x6, 0x4, 0x7, 0x5, 0x0, 0x1, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x9, 0x8, 0xb, 0xa ); |
| 571 | decrypt_bios( machine, 0x000000, 0x400000, 0x6, 0x4, 0x7, 0x5, 0x0, 0x1, 0x2, 0x3, 0xc, 0xf, 0xe, 0xd, 0x9, 0x8, 0xb, 0xa ); |
| 469 | 572 | } |
| 470 | 573 | |
| 471 | 574 | static DRIVER_INIT( nflclsfb ) |
| 472 | 575 | { |
| 473 | 576 | memn_driver_init(machine); |
| 474 | | decrypt_bios( machine, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); |
| 577 | decrypt_bios( machine, 0x000000, 0x400000, 0x6, 0x5, 0x4, 0x7, 0x1, 0x3, 0x0, 0x2, 0xc, 0xd, 0xe, 0xf, 0x8, 0xb, 0xa, 0x9 ); |
| 475 | 578 | } |
| 476 | 579 | |
| 477 | 580 | |
| r14862 | r14863 | |
| 479 | 582 | { |
| 480 | 583 | } |
| 481 | 584 | |
| 482 | | static MACHINE_CONFIG_START( namcos10, namcos10_state ) |
| 585 | static MACHINE_CONFIG_START( namcos10_memm, namcos10_state ) |
| 483 | 586 | /* basic machine hardware */ |
| 484 | 587 | MCFG_CPU_ADD( "maincpu", CXD8606BQ, XTAL_101_4912MHz ) |
| 485 | | MCFG_CPU_PROGRAM_MAP( namcos10_map ) |
| 588 | MCFG_CPU_PROGRAM_MAP( namcos10_memm_map ) |
| 486 | 589 | |
| 487 | 590 | MCFG_MACHINE_RESET( namcos10 ) |
| 488 | 591 | |
| r14862 | r14863 | |
| 493 | 596 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 494 | 597 | MACHINE_CONFIG_END |
| 495 | 598 | |
| 599 | static MACHINE_CONFIG_START( namcos10_memn, namcos10_state ) |
| 600 | /* basic machine hardware */ |
| 601 | MCFG_CPU_ADD( "maincpu", CXD8606BQ, XTAL_101_4912MHz ) |
| 602 | MCFG_CPU_PROGRAM_MAP( namcos10_memn_map ) |
| 603 | |
| 604 | MCFG_MACHINE_RESET( namcos10 ) |
| 605 | |
| 606 | /* video hardware */ |
| 607 | MCFG_PSXGPU_ADD( "maincpu", "gpu", CXD8561CQ, 0x200000, XTAL_53_693175MHz ) |
| 608 | |
| 609 | /* sound hardware */ |
| 610 | MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") |
| 611 | MACHINE_CONFIG_END |
| 612 | |
| 496 | 613 | static INPUT_PORTS_START( namcos10 ) |
| 497 | 614 | /* IN 0 */ |
| 498 | 615 | PORT_START("SYSTEM") |
| r14862 | r14863 | |
| 665 | 782 | ROM_END |
| 666 | 783 | |
| 667 | 784 | |
| 668 | | GAME( 2000, mrdrilr2, 0, namcos10, namcos10, mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR21 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) // PORT_4WAY joysticks |
| 669 | | GAME( 2000, mrdrlr2a, mrdrilr2, namcos10, namcos10, mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR22 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) // PORT_4WAY joysticks |
| 670 | | GAME( 2000, ptblank3, 0, namcos10, namcos10, gunbalna, ROT0, "Namco", "Point Blank 3 (GNN2 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 671 | | GAME( 2000, gunbalina, ptblank3, namcos10, namcos10, gunbalna, ROT0, "Namco", "Gunbalina (GNN1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 672 | | GAME( 2001, gjspace, 0, namcos10, namcos10, gjspace, ROT0, "Namco / Metro", "Gekitoride-Jong Space (10011 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 673 | | GAME( 2001, mrdrilrg, 0, namcos10, namcos10, mrdrilrg, ROT0, "Namco", "Mr. Driller G (Japan, DRG1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) // PORT_4WAY joysticks |
| 674 | | GAME( 2001, knpuzzle, 0, namcos10, namcos10, knpuzzle, ROT0, "Namco", "Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 675 | | GAME( 2002, chocovdr, 0, namcos10, namcos10, chocovdr, ROT0, "Namco", "Uchuu Daisakusen: Chocovader Contactee (Japan, CVC1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 676 | | GAME( 2002, startrgn, 0, namcos10, namcos10, startrgn, ROT0, "Namco", "Star Trigon (Japan, STT1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 677 | | GAME( 2002, panikuru, 0, namcos10, namcos10, panikuru, ROT0, "Namco", "Panicuru Panekuru (Japan, PPA1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 678 | | GAME( 2003, nflclsfb, 0, namcos10, namcos10, nflclsfb, ROT0, "Namco", "NFL Classic Football (NCF3 Ver.A.)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 679 | | GAME( 2003, gamshara, 0, namcos10, namcos10, gamshara, ROT0, "Mitchell", "Gamshara (10021 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 785 | GAME( 2000, mrdrilr2, 0, namcos10_memm, namcos10, mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR21 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) // PORT_4WAY joysticks |
| 786 | GAME( 2000, mrdrlr2a, mrdrilr2, namcos10_memm, namcos10, mrdrilr2, ROT0, "Namco", "Mr. Driller 2 (Japan, DR22 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) // PORT_4WAY joysticks |
| 787 | GAME( 2000, ptblank3, 0, namcos10_memn, namcos10, gunbalna, ROT0, "Namco", "Point Blank 3 (GNN2 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 788 | GAME( 2000, gunbalina, ptblank3, namcos10_memn, namcos10, gunbalna, ROT0, "Namco", "Gunbalina (GNN1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 789 | GAME( 2001, gjspace, 0, namcos10_memn, namcos10, gjspace, ROT0, "Namco / Metro", "Gekitoride-Jong Space (10011 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 790 | GAME( 2001, mrdrilrg, 0, namcos10_memn, namcos10, mrdrilrg, ROT0, "Namco", "Mr. Driller G (Japan, DRG1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) // PORT_4WAY joysticks |
| 791 | GAME( 2001, knpuzzle, 0, namcos10_memn, namcos10, knpuzzle, ROT0, "Namco", "Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 792 | GAME( 2002, chocovdr, 0, namcos10_memn, namcos10, chocovdr, ROT0, "Namco", "Uchuu Daisakusen: Chocovader Contactee (Japan, CVC1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 793 | GAME( 2002, startrgn, 0, namcos10_memn, namcos10, startrgn, ROT0, "Namco", "Star Trigon (Japan, STT1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 794 | GAME( 2002, panikuru, 0, namcos10_memn, namcos10, panikuru, ROT0, "Namco", "Panicuru Panekuru (Japan, PPA1 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 795 | GAME( 2003, nflclsfb, 0, namcos10_memn, namcos10, nflclsfb, ROT0, "Namco", "NFL Classic Football (NCF3 Ver.A.)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
| 796 | GAME( 2003, gamshara, 0, namcos10_memn, namcos10, gamshara, ROT0, "Mitchell", "Gamshara (10021 Ver.A)", GAME_NOT_WORKING | GAME_NO_SOUND ) |
src/mame/drivers/igs017.c
| r14862 | r14863 | |
| 34 | 34 | Notes: |
| 35 | 35 | |
| 36 | 36 | - iqblocka: keep start or test pressed during boot to enter test mode A or B. |
| 37 | | - mgcs, tjsb: press service + stats during test mode for sound test. |
| 37 | - lhzb2, mgcs, tjsb: press service + stats during test mode for sound test. |
| 38 | 38 | - mgdh: press A + B during test mode for sound test (B1+B2+B3 when using a joystick). |
| 39 | 39 | - mgdh: test mode is accessed by keeping test pressed during boot (as usual), but pressing F2+F3 in MAME |
| 40 | 40 | does not actually work. It does work if F2 is pressed in the debug window at boot, and held while closing it. |
| r14862 | r14863 | |
| 54 | 54 | public: |
| 55 | 55 | igs017_state(const machine_config &mconfig, device_type type, const char *tag) |
| 56 | 56 | : driver_device(mconfig, type, tag), |
| 57 | m_input_addr(-1), |
| 57 | 58 | m_maincpu(*this, "maincpu") |
| 58 | 59 | { } |
| 59 | 60 | |
| r14862 | r14863 | |
| 70 | 71 | int m_nmi_enable; |
| 71 | 72 | int m_irq_enable; |
| 72 | 73 | UINT8 m_input_select; |
| 74 | int m_input_addr; |
| 73 | 75 | UINT8 m_hopper; |
| 74 | 76 | UINT16 m_igs_magic[2]; |
| 75 | 77 | UINT8 m_scramble_data; |
| 78 | UINT8 m_prot[2]; |
| 76 | 79 | int m_irq1_enable; |
| 77 | 80 | int m_irq2_enable; |
| 78 | 81 | UINT8 *m_spriteram; |
| r14862 | r14863 | |
| 107 | 110 | DECLARE_WRITE8_MEMBER(tjsb_paletteram_w); |
| 108 | 111 | DECLARE_WRITE8_MEMBER(tjsb_output_w); |
| 109 | 112 | DECLARE_READ8_MEMBER(tjsb_input_r); |
| 113 | DECLARE_WRITE16_MEMBER(lhzb2a_paletteram_w); |
| 114 | DECLARE_READ16_MEMBER(lhzb2a_input_r); |
| 115 | DECLARE_WRITE16_MEMBER(lhzb2a_input_addr_w); |
| 116 | DECLARE_WRITE16_MEMBER(lhzb2a_input_select_w); |
| 117 | DECLARE_WRITE16_MEMBER(lhzb2a_magic_w); |
| 118 | DECLARE_READ16_MEMBER(lhzb2a_magic_r); |
| 119 | DECLARE_WRITE16_MEMBER(lhzb2_magic_w); |
| 120 | DECLARE_READ16_MEMBER(lhzb2_magic_r); |
| 121 | DECLARE_WRITE16_MEMBER(slqz2_paletteram_w); |
| 122 | DECLARE_WRITE16_MEMBER(slqz2_magic_w); |
| 123 | DECLARE_READ16_MEMBER(slqz2_magic_r); |
| 110 | 124 | }; |
| 111 | 125 | |
| 112 | 126 | |
| r14862 | r14863 | |
| 119 | 133 | { |
| 120 | 134 | m_video_disable = data & 1; |
| 121 | 135 | if (data & (~1)) |
| 122 | | logerror("PC %06X: unknown bits of video_disable written = %02x\n",cpu_get_pc(&space.device()),data); |
| 136 | logerror("%s: unknown bits of video_disable written = %02x\n", machine().describe_context(), data); |
| 123 | 137 | // popmessage("VIDEO %02X",data); |
| 124 | 138 | } |
| 125 | 139 | WRITE16_MEMBER(igs017_state::video_disable_lsb_w) |
| r14862 | r14863 | |
| 198 | 212 | |
| 199 | 213 | |
| 200 | 214 | |
| 201 | | // Eeach 16 bit word in the sprites gfx roms contains three 5 bit pens: x-22222-11111-00000. |
| 215 | // Eeach 16 bit word in the sprites gfx roms contains three 5 bit pens: x-22222-11111-00000 (little endian!). |
| 202 | 216 | // This routine expands each word into three bytes. |
| 203 | 217 | static void expand_sprites(running_machine &machine) |
| 204 | 218 | { |
| r14862 | r14863 | |
| 338 | 352 | if (machine.input().code_pressed(KEYCODE_Y)) w -= 8; |
| 339 | 353 | |
| 340 | 354 | if (machine.input().code_pressed(KEYCODE_RIGHT)) a += 1; |
| 341 | | if (machine.input().code_pressed(KEYCODE_LEFT)) a -= 1; |
| 355 | if (machine.input().code_pressed(KEYCODE_LEFT)) a -= 1; |
| 342 | 356 | |
| 343 | | if (machine.input().code_pressed(KEYCODE_DOWN)) a += w; |
| 357 | if (machine.input().code_pressed(KEYCODE_DOWN)) a += w; |
| 344 | 358 | if (machine.input().code_pressed(KEYCODE_UP)) a -= w; |
| 345 | 359 | |
| 346 | | if (machine.input().code_pressed(KEYCODE_PGDN)) a += w * h; |
| 347 | | if (machine.input().code_pressed(KEYCODE_PGUP)) a -= w * h; |
| 360 | if (machine.input().code_pressed(KEYCODE_PGDN)) a += w * h; |
| 361 | if (machine.input().code_pressed(KEYCODE_PGUP)) a -= w * h; |
| 348 | 362 | |
| 349 | 363 | if (a < 0) a = 0; |
| 350 | 364 | if (a > state->m_sprites_gfx_size) a = state->m_sprites_gfx_size; |
| r14862 | r14863 | |
| 356 | 370 | |
| 357 | 371 | draw_sprite(machine, bitmap, cliprect, 0,0, w,h, 0,0, 0, a); |
| 358 | 372 | |
| 359 | | popmessage("a: %08X w: %03X p: %02X-%02x-%02x",a,w,state->m_sprites_gfx[a/3*3+0],state->m_sprites_gfx[a/3*3+1],state->m_sprites_gfx[a/3*3+2]); |
| 373 | popmessage("a: %08X w: %03X p: %02x-%02x-%02x",a,w,state->m_sprites_gfx[a/3*3+0],state->m_sprites_gfx[a/3*3+1],state->m_sprites_gfx[a/3*3+2]); |
| 360 | 374 | state->m_debug_addr = a; |
| 361 | 375 | state->m_debug_width = w; |
| 362 | 376 | osd_sleep(200000); |
| r14862 | r14863 | |
| 504 | 518 | UINT8 *tmp = auto_alloc_array(machine, UINT8, length); |
| 505 | 519 | int i, addr; |
| 506 | 520 | |
| 507 | | // address lines swap (to do: collapse into one bitswap) |
| 521 | // address lines swap |
| 508 | 522 | memcpy(tmp, rom, length); |
| 509 | 523 | for (i = 0; i < length; i++) |
| 510 | 524 | { |
| 511 | | addr = (i & ~0xff) | BITSWAP8(i,7,6,5,4,1,2,3,0); |
| 525 | addr = (i & ~0xff) | BITSWAP8(i,7,6,5,2,1,4,3,0); |
| 512 | 526 | rom[i] = tmp[addr]; |
| 513 | 527 | } |
| 514 | 528 | |
| 515 | | memcpy(tmp, rom, length); |
| 516 | | for (i = 0; i < length; i++) |
| 517 | | { |
| 518 | | addr = (i & ~0xff) | BITSWAP8(i,7,6,5,2,4,3,1,0); |
| 519 | | rom[i] = tmp[addr]; |
| 520 | | } |
| 521 | | |
| 522 | | memcpy(tmp, rom, length); |
| 523 | | for (i = 0; i < length; i++) |
| 524 | | { |
| 525 | | addr = (i & ~0xff) | BITSWAP8(i,7,6,5,3,4,2,1,0); |
| 526 | | rom[i] = tmp[addr]; |
| 527 | | } |
| 528 | | |
| 529 | 529 | // data lines swap |
| 530 | 530 | for (i = 0; i < length; i += 2) |
| 531 | 531 | { |
| 532 | | // x-22222-11111-00000 |
| 533 | | UINT16 data = (rom[i+1] << 8) | rom[i+0]; |
| 532 | UINT16 data = (rom[i+1] << 8) | rom[i+0]; // x-22222-11111-00000 |
| 534 | 533 | data = BITSWAP16(data, 15, 14,13,12,11,10, 9,1,7,6,5, 4,3,2,8,0); |
| 534 | rom[i+0] = data; |
| 535 | 535 | rom[i+1] = data >> 8; |
| 536 | | rom[i+0] = data; |
| 537 | 536 | } |
| 538 | 537 | } |
| 539 | 538 | |
| r14862 | r14863 | |
| 708 | 707 | |
| 709 | 708 | // starzan |
| 710 | 709 | |
| 711 | | // decryption is incomplete, data encryption is correct but opcodes are encrypted differently. |
| 710 | // decryption is incomplete: data decryption is correct but opcodes are encrypted differently. |
| 712 | 711 | |
| 713 | 712 | static void starzan_decrypt(UINT8 *ROM, int size, bool isOpcode) |
| 714 | 713 | { |
| r14862 | r14863 | |
| 881 | 880 | |
| 882 | 881 | // lhzb2 |
| 883 | 882 | |
| 883 | |
| 884 | static void lhzb2_patch_rom(running_machine &machine) |
| 885 | { |
| 886 | UINT16 *rom = (UINT16 *)machine.region("maincpu")->base(); |
| 887 | |
| 888 | // Prot. checks: |
| 889 | rom[0x14786/2] = 0x6044; // 014786: 6744 beq $147cc |
| 890 | |
| 891 | // ROM check: |
| 892 | rom[0x0b48a/2] = 0x604e; // 00B48A: 674E beq $b4da |
| 893 | } |
| 894 | |
| 895 | static void lhzb2_decrypt_tiles(running_machine &machine) |
| 896 | { |
| 897 | int length = machine.region("tilemaps")->bytes(); |
| 898 | UINT8 *rom = machine.region("tilemaps")->base(); |
| 899 | UINT8 *tmp = auto_alloc_array(machine, UINT8, length); |
| 900 | int i; |
| 901 | |
| 902 | int addr; |
| 903 | memcpy(tmp, rom, length); |
| 904 | for (i = 0; i < length; i++) |
| 905 | { |
| 906 | addr = (i & ~0xffffff) | BITSWAP24(i,23,22,21,20,19,18,17,1,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0); |
| 907 | rom[i] = tmp[addr]; |
| 908 | } |
| 909 | |
| 910 | auto_free(machine, tmp); |
| 911 | } |
| 912 | |
| 913 | static void lhzb2_decrypt_sprites(running_machine &machine) |
| 914 | { |
| 915 | int length = machine.region("sprites")->bytes(); |
| 916 | UINT8 *rom = machine.region("sprites")->base(); |
| 917 | UINT8 *tmp = auto_alloc_array(machine, UINT8, length); |
| 918 | int i, addr; |
| 919 | |
| 920 | // address lines swap |
| 921 | memcpy(tmp, rom, length); |
| 922 | for (i = 0; i < length; i++) |
| 923 | { |
| 924 | addr = (i & ~0xffff) | BITSWAP16(i,15,14,13,6,7,10,9,8,11,12,5,4,3,2,1,0); |
| 925 | rom[i] = tmp[addr]; |
| 926 | } |
| 927 | |
| 928 | // data lines swap |
| 929 | for (i = 0;i < length;i+=2) |
| 930 | { |
| 931 | UINT16 data = (rom[i+1] << 8) | rom[i+0]; // x-22222-11111-00000 |
| 932 | data = BITSWAP16(data, 15, 7,6,5,4,3, 2,1,0,14,13, 12,11,10,9,8); |
| 933 | rom[i+0] = data; |
| 934 | rom[i+1] = data >> 8; |
| 935 | } |
| 936 | } |
| 937 | |
| 884 | 938 | static DRIVER_INIT( lhzb2 ) |
| 885 | 939 | { |
| 886 | 940 | int i; |
| r14862 | r14863 | |
| 966 | 1020 | |
| 967 | 1021 | src[i] = x; |
| 968 | 1022 | } |
| 1023 | |
| 1024 | lhzb2_decrypt_tiles(machine); |
| 1025 | lhzb2_decrypt_sprites(machine); |
| 1026 | lhzb2_patch_rom(machine); |
| 969 | 1027 | } |
| 970 | 1028 | |
| 971 | 1029 | |
| 972 | 1030 | //lhzb2a |
| 973 | 1031 | |
| 1032 | static void lhzb2a_patch_rom(running_machine &machine) |
| 1033 | { |
| 1034 | UINT16 *rom = (UINT16 *)machine.region("maincpu")->base(); |
| 1035 | |
| 1036 | // Prot. checks: |
| 1037 | rom[0x09c52/2] = 0x6026; // 009C52: 6726 beq $9c7a |
| 1038 | rom[0x0c62c/2] = 0x6026; // 00C62C: 6726 beq $c654 |
| 1039 | rom[0x0ea10/2] = 0x6030; // 00EA10: 6730 beq $ea42 |
| 1040 | rom[0x23472/2] = 0x6026; // 023472: 6726 beq $2349a |
| 1041 | rom[0x6601a/2] = 0x6024; // 06601A: 6724 beq $66040 |
| 1042 | |
| 1043 | // ROM check: |
| 1044 | rom[0x32ab6/2] = 0x604e; // 032AB6: 674E beq $32b06 |
| 1045 | } |
| 1046 | |
| 974 | 1047 | static DRIVER_INIT( lhzb2a ) |
| 975 | 1048 | { |
| 976 | 1049 | int i; |
| r14862 | r14863 | |
| 1028 | 1101 | |
| 1029 | 1102 | src[i] = x; |
| 1030 | 1103 | } |
| 1104 | |
| 1105 | lhzb2_decrypt_tiles(machine); |
| 1106 | lhzb2_decrypt_sprites(machine); |
| 1107 | lhzb2a_patch_rom(machine); |
| 1031 | 1108 | } |
| 1032 | 1109 | |
| 1033 | 1110 | |
| 1034 | 1111 | //slqz2 |
| 1035 | 1112 | |
| 1113 | static void slqz2_patch_rom(running_machine &machine) |
| 1114 | { |
| 1115 | UINT16 *rom = (UINT16 *)machine.region("maincpu")->base(); |
| 1116 | |
| 1117 | // Prot. checks: |
| 1118 | rom[0x1489c/2] = 0x6044; // 01489C: 6744 beq $148e2 |
| 1119 | |
| 1120 | // ROM check: |
| 1121 | rom[0x0b77a/2] = 0x604e; // 00B77A: 674E beq $b7ca |
| 1122 | } |
| 1123 | |
| 1124 | static void slqz2_decrypt_tiles(running_machine &machine) |
| 1125 | { |
| 1126 | int length = machine.region("tilemaps")->bytes(); |
| 1127 | UINT8 *rom = machine.region("tilemaps")->base(); |
| 1128 | UINT8 *tmp = auto_alloc_array(machine, UINT8, length); |
| 1129 | int i; |
| 1130 | |
| 1131 | memcpy(tmp,rom,length); |
| 1132 | for (i = 0;i < length;i++) |
| 1133 | { |
| 1134 | int addr = (i & ~0xff) | BITSWAP8(i,7,4,5,6,3,2,1,0); |
| 1135 | rom[i] = tmp[addr]; |
| 1136 | } |
| 1137 | |
| 1138 | auto_free(machine, tmp); |
| 1139 | } |
| 1140 | |
| 1036 | 1141 | static DRIVER_INIT( slqz2 ) |
| 1037 | 1142 | { |
| 1038 | 1143 | int i; |
| r14862 | r14863 | |
| 1108 | 1213 | |
| 1109 | 1214 | src[i] = x; |
| 1110 | 1215 | } |
| 1216 | |
| 1217 | slqz2_decrypt_tiles(machine); |
| 1218 | lhzb2_decrypt_sprites(machine); |
| 1219 | slqz2_patch_rom(machine); |
| 1111 | 1220 | } |
| 1112 | 1221 | |
| 1113 | 1222 | /*************************************************************************** |
| 1114 | 1223 | Memory Maps |
| 1115 | 1224 | ***************************************************************************/ |
| 1116 | 1225 | |
| 1226 | |
| 1227 | // iqblocka |
| 1228 | |
| 1229 | |
| 1117 | 1230 | static ADDRESS_MAP_START( iqblocka_map, AS_PROGRAM, 8, igs017_state ) |
| 1118 | 1231 | AM_RANGE( 0x00000, 0x0dfff ) AM_ROM |
| 1119 | 1232 | AM_RANGE( 0x0e000, 0x0efff ) AM_RAM |
| r14862 | r14863 | |
| 1125 | 1238 | { |
| 1126 | 1239 | m_nmi_enable = data & 1; |
| 1127 | 1240 | if (data & (~1)) |
| 1128 | | logerror("PC %06X: nmi_enable = %02x\n",cpu_get_pc(&space.device()),data); |
| 1241 | logerror("%s: nmi_enable = %02x\n", machine().describe_context(), data); |
| 1129 | 1242 | } |
| 1130 | 1243 | |
| 1131 | 1244 | WRITE8_MEMBER(igs017_state::irq_enable_w) |
| 1132 | 1245 | { |
| 1133 | 1246 | m_irq_enable = data & 1; |
| 1134 | 1247 | if (data & (~1)) |
| 1135 | | logerror("PC %06X: irq_enable = %02x\n",cpu_get_pc(&space.device()),data); |
| 1248 | logerror("%s: irq_enable = %02x\n", machine().describe_context(), data); |
| 1136 | 1249 | } |
| 1137 | 1250 | |
| 1138 | 1251 | WRITE8_MEMBER(igs017_state::input_select_w) |
| r14862 | r14863 | |
| 1173 | 1286 | case 0x34: return 0x32; |
| 1174 | 1287 | |
| 1175 | 1288 | default: |
| 1176 | | logerror("PC %06X: input %02x read\n",cpu_get_pc(&space.device()),m_input_select); |
| 1289 | logerror("%s: input %02x read\n", machine().describe_context(), m_input_select); |
| 1177 | 1290 | return 0xff; |
| 1178 | 1291 | } |
| 1179 | 1292 | } |
| r14862 | r14863 | |
| 1226 | 1339 | } |
| 1227 | 1340 | |
| 1228 | 1341 | if ( m_input_select & ~0xf8 ) |
| 1229 | | logerror("%06x: warning, unknown bits written in input_select = %02x\n", cpu_get_pc(&space.device()), m_input_select); |
| 1342 | logerror("%s: warning, unknown bits written in input_select = %02x\n", machine().describe_context(), m_input_select); |
| 1230 | 1343 | break; |
| 1231 | 1344 | |
| 1232 | 1345 | case 0x01: |
| r14862 | r14863 | |
| 1240 | 1353 | // case 0x03: ? |
| 1241 | 1354 | |
| 1242 | 1355 | default: |
| 1243 | | logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0], data); |
| 1356 | logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data); |
| 1244 | 1357 | } |
| 1245 | 1358 | } |
| 1246 | 1359 | |
| r14862 | r14863 | |
| 1252 | 1365 | return BITSWAP8(m_scramble_data, 4,5,6,7, 0,1,2,3); |
| 1253 | 1366 | |
| 1254 | 1367 | default: |
| 1255 | | logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0]); |
| 1368 | logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]); |
| 1256 | 1369 | break; |
| 1257 | 1370 | } |
| 1258 | 1371 | |
| r14862 | r14863 | |
| 1278 | 1391 | m_irq1_enable = data & 1; |
| 1279 | 1392 | |
| 1280 | 1393 | if (data != 0 && data != 0xff) |
| 1281 | | logerror("PC %06X: irq1_enable = %04x\n",cpu_get_pc(&space.device()),data); |
| 1394 | logerror("%s: irq1_enable = %04x\n", machine().describe_context(), data); |
| 1282 | 1395 | } |
| 1283 | 1396 | |
| 1284 | 1397 | WRITE16_MEMBER(igs017_state::irq2_enable_w) |
| r14862 | r14863 | |
| 1287 | 1400 | m_irq2_enable = data & 1; |
| 1288 | 1401 | |
| 1289 | 1402 | if (data != 0 && data != 0xff) |
| 1290 | | logerror("PC %06X: irq2_enable = %04x\n",cpu_get_pc(&space.device()),data); |
| 1403 | logerror("%s: irq2_enable = %04x\n", machine().describe_context(), data); |
| 1291 | 1404 | } |
| 1292 | 1405 | |
| 1293 | 1406 | WRITE16_MEMBER(igs017_state::mgcs_paletteram_w) |
| r14862 | r14863 | |
| 1322 | 1435 | |
| 1323 | 1436 | // sdmg2 |
| 1324 | 1437 | |
| 1438 | |
| 1325 | 1439 | WRITE16_MEMBER(igs017_state::sdmg2_paletteram_w) |
| 1326 | 1440 | { |
| 1327 | 1441 | COMBINE_DATA(&m_generic_paletteram_16[offset]); |
| r14862 | r14863 | |
| 1375 | 1489 | break; |
| 1376 | 1490 | |
| 1377 | 1491 | default: |
| 1378 | | logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0], data); |
| 1492 | logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data); |
| 1379 | 1493 | } |
| 1380 | 1494 | } |
| 1381 | 1495 | |
| r14862 | r14863 | |
| 1393 | 1507 | return sdmg2_keys_r(space, 0); |
| 1394 | 1508 | |
| 1395 | 1509 | default: |
| 1396 | | logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0]); |
| 1510 | logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]); |
| 1397 | 1511 | break; |
| 1398 | 1512 | } |
| 1399 | 1513 | |
| r14862 | r14863 | |
| 1419 | 1533 | |
| 1420 | 1534 | // mgdh, mgdha |
| 1421 | 1535 | |
| 1536 | |
| 1422 | 1537 | READ8_MEMBER(igs017_state::mgdh_keys_r) |
| 1423 | 1538 | { |
| 1424 | 1539 | if (~m_input_select & 0x04) return input_port_read(machine(), "KEY0"); |
| r14862 | r14863 | |
| 1450 | 1565 | } |
| 1451 | 1566 | |
| 1452 | 1567 | if ( data & ~0xc0 ) |
| 1453 | | logerror("%06x: warning, unknown bits written to igs_magic 00 = %02x\n", cpu_get_pc(&space.device()), data); |
| 1568 | logerror("%s: warning, unknown bits written to igs_magic 00 = %02x\n", machine().describe_context(), data); |
| 1454 | 1569 | |
| 1455 | 1570 | break; |
| 1456 | 1571 | |
| r14862 | r14863 | |
| 1462 | 1577 | } |
| 1463 | 1578 | |
| 1464 | 1579 | if ( m_input_select & ~0xfd ) |
| 1465 | | logerror("%06x: warning, unknown bits written in input_select = %02x\n", cpu_get_pc(&space.device()), m_input_select); |
| 1580 | logerror("%s: warning, unknown bits written in input_select = %02x\n", machine().describe_context(), m_input_select); |
| 1466 | 1581 | |
| 1467 | 1582 | break; |
| 1468 | 1583 | |
| r14862 | r14863 | |
| 1487 | 1602 | 04ac10: warning, writing to igs_magic 06 = ff |
| 1488 | 1603 | 04ac20: warning, writing to igs_magic 07 = 3f |
| 1489 | 1604 | */ |
| 1490 | | logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0], data); |
| 1605 | logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data); |
| 1491 | 1606 | } |
| 1492 | 1607 | } |
| 1493 | 1608 | |
| r14862 | r14863 | |
| 1511 | 1626 | } |
| 1512 | 1627 | |
| 1513 | 1628 | default: |
| 1514 | | logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(&space.device()), m_igs_magic[0]); |
| 1629 | logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]); |
| 1515 | 1630 | break; |
| 1516 | 1631 | } |
| 1517 | 1632 | |
| r14862 | r14863 | |
| 1538 | 1653 | |
| 1539 | 1654 | // tjsb |
| 1540 | 1655 | |
| 1656 | |
| 1541 | 1657 | WRITE8_MEMBER(igs017_state::tjsb_paletteram_w) |
| 1542 | 1658 | { |
| 1543 | 1659 | m_generic_paletteram_8[offset] = data; |
| 1544 | 1660 | int bgr = (m_generic_paletteram_8[offset/2*2+1] << 8) | m_generic_paletteram_8[offset/2*2+0]; |
| 1545 | 1661 | |
| 1546 | 1662 | // bitswap |
| 1547 | | bgr = BITSWAP16(bgr, 15, 12,3,6,10,5, 4,2,9,13,8, 7,11,1,0,14); |
| 1663 | bgr = BITSWAP16(bgr, 15,12,3,6,10,5,4,2,9,13,8,7,11,1,0,14); |
| 1548 | 1664 | |
| 1549 | 1665 | palette_set_color_rgb(machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10)); |
| 1550 | 1666 | } |
| r14862 | r14863 | |
| 1577 | 1693 | return; |
| 1578 | 1694 | break; |
| 1579 | 1695 | } |
| 1580 | | logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(&space.device()), m_input_select, data); |
| 1696 | logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_input_select, data); |
| 1581 | 1697 | } |
| 1582 | 1698 | |
| 1583 | 1699 | READ8_MEMBER(igs017_state::tjsb_input_r) |
| r14862 | r14863 | |
| 1594 | 1710 | } |
| 1595 | 1711 | |
| 1596 | 1712 | default: |
| 1597 | | logerror("PC %06X: input %02x read\n",cpu_get_pc(&space.device()),m_input_select); |
| 1713 | logerror("%s: input %02x read\n", machine().describe_context(), m_input_select); |
| 1598 | 1714 | return 0xff; |
| 1599 | 1715 | } |
| 1600 | 1716 | } |
| r14862 | r14863 | |
| 1632 | 1748 | ADDRESS_MAP_END |
| 1633 | 1749 | |
| 1634 | 1750 | |
| 1751 | // lhzb2 |
| 1752 | |
| 1753 | |
| 1754 | WRITE16_MEMBER(igs017_state::lhzb2_magic_w) |
| 1755 | { |
| 1756 | COMBINE_DATA(&m_igs_magic[offset]); |
| 1757 | |
| 1758 | if (offset == 0) |
| 1759 | return; |
| 1760 | |
| 1761 | switch(m_igs_magic[0]) |
| 1762 | { |
| 1763 | case 0x00: |
| 1764 | if (ACCESSING_BITS_0_7) |
| 1765 | { |
| 1766 | m_input_select = data & 0xff; |
| 1767 | } |
| 1768 | |
| 1769 | if ( m_input_select & ~0x1f ) |
| 1770 | logerror("%s: warning, unknown bits written in input_select = %02x\n", machine().describe_context(), m_input_select); |
| 1771 | break; |
| 1772 | |
| 1773 | case 0x01: |
| 1774 | if (ACCESSING_BITS_0_7) |
| 1775 | { |
| 1776 | okim6295_device *oki = machine().device<okim6295_device>("oki"); |
| 1777 | oki->set_bank_base((data & 0x80) ? 0x40000 : 0); |
| 1778 | |
| 1779 | if ( data & 0x7f ) |
| 1780 | logerror("%s: warning, unknown bits written in oki bank = %04x\n", machine().describe_context(), data); |
| 1781 | } |
| 1782 | break; |
| 1783 | |
| 1784 | default: |
| 1785 | logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data); |
| 1786 | } |
| 1787 | } |
| 1788 | |
| 1789 | READ16_MEMBER(igs017_state::lhzb2_magic_r) |
| 1790 | { |
| 1791 | switch(m_igs_magic[0]) |
| 1792 | { |
| 1793 | case 0x01: |
| 1794 | { |
| 1795 | if (~m_input_select & 0x01) return input_port_read(machine(), "KEY0"); |
| 1796 | if (~m_input_select & 0x02) return input_port_read(machine(), "KEY1"); |
| 1797 | if (~m_input_select & 0x04) return input_port_read(machine(), "KEY2"); |
| 1798 | if (~m_input_select & 0x08) return input_port_read(machine(), "KEY3"); |
| 1799 | if (~m_input_select & 0x10) return input_port_read(machine(), "KEY4"); |
| 1800 | |
| 1801 | logerror("%s: warning, reading key with input_select = %02x\n", machine().describe_context(), m_input_select); |
| 1802 | return 0xffff; |
| 1803 | } |
| 1804 | |
| 1805 | default: |
| 1806 | logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]); |
| 1807 | break; |
| 1808 | } |
| 1809 | |
| 1810 | return 0xffff; |
| 1811 | } |
| 1812 | |
| 1813 | static ADDRESS_MAP_START( lhzb2, AS_PROGRAM, 16, igs017_state ) |
| 1814 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 1815 | AM_RANGE(0x500000, 0x503fff) AM_RAM |
| 1816 | AM_RANGE(0x910000, 0x910003) AM_WRITE( lhzb2_magic_w ) |
| 1817 | AM_RANGE(0x910002, 0x910003) AM_READ( lhzb2_magic_r ) |
| 1818 | AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE( m_spriteram ) |
| 1819 | AM_RANGE(0xb03000, 0xb037ff) AM_RAM_WRITE( lhzb2a_paletteram_w ) AM_SHARE("paletteram") |
| 1820 | AM_RANGE(0xb04020, 0xb04027) AM_DEVREAD8_LEGACY( "ppi8255", ppi8255_r, 0x00ff ) |
| 1821 | AM_RANGE(0xb04024, 0xb04025) AM_WRITE( video_disable_lsb_w ) |
| 1822 | AM_RANGE(0xb04028, 0xb04029) AM_WRITE( irq2_enable_w ) |
| 1823 | AM_RANGE(0xb0402a, 0xb0402b) AM_WRITE( irq1_enable_w ) |
| 1824 | AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE( m_fg_videoram ) |
| 1825 | AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE( m_bg_videoram ) |
| 1826 | AM_RANGE(0xb10000, 0xb10001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff ) |
| 1827 | ADDRESS_MAP_END |
| 1828 | |
| 1829 | |
| 1830 | // lhzb2a |
| 1831 | // To do: what devices are on this PCB? |
| 1832 | |
| 1833 | |
| 1834 | WRITE16_MEMBER(igs017_state::lhzb2a_magic_w) |
| 1835 | { |
| 1836 | COMBINE_DATA(&m_igs_magic[offset]); |
| 1837 | |
| 1838 | if (offset == 0) |
| 1839 | return; |
| 1840 | |
| 1841 | switch(m_igs_magic[0]) |
| 1842 | { |
| 1843 | // to do: m_prot values |
| 1844 | default: |
| 1845 | logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data); |
| 1846 | } |
| 1847 | } |
| 1848 | |
| 1849 | READ16_MEMBER(igs017_state::lhzb2a_magic_r) |
| 1850 | { |
| 1851 | switch(m_igs_magic[0]) |
| 1852 | { |
| 1853 | case 0x03: |
| 1854 | { |
| 1855 | UINT8 a = BITSWAP8(m_prot[0], 9,9,1,9,2,5,4,7); // 9 means 0 value |
| 1856 | UINT8 b = BITSWAP8(m_prot[1], 5,2,9,7,9,9,9,9); |
| 1857 | return a | b; |
| 1858 | } |
| 1859 | |
| 1860 | default: |
| 1861 | logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]); |
| 1862 | break; |
| 1863 | } |
| 1864 | |
| 1865 | return 0xffff; |
| 1866 | } |
| 1867 | |
| 1868 | WRITE16_MEMBER(igs017_state::lhzb2a_paletteram_w) |
| 1869 | { |
| 1870 | COMBINE_DATA(&m_generic_paletteram_16[offset]); |
| 1871 | |
| 1872 | int bgr = ((m_generic_paletteram_16[offset/2*2+1] & 0xff) << 8) | (m_generic_paletteram_16[offset/2*2+0] & 0xff); |
| 1873 | |
| 1874 | // bitswap |
| 1875 | bgr = BITSWAP16(bgr, 15,9,13,12,11,5,4,8,7,6,0,14,3,2,1,10); |
| 1876 | |
| 1877 | palette_set_color_rgb(machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10)); |
| 1878 | } |
| 1879 | |
| 1880 | READ16_MEMBER(igs017_state::lhzb2a_input_r) |
| 1881 | { |
| 1882 | switch (offset*2) |
| 1883 | { |
| 1884 | case 0x00: // Keys |
| 1885 | { |
| 1886 | if (~m_input_select & 0x01) return input_port_read(machine(), "KEY0") << 8; |
| 1887 | if (~m_input_select & 0x02) return input_port_read(machine(), "KEY1") << 8; |
| 1888 | if (~m_input_select & 0x04) return input_port_read(machine(), "KEY2") << 8; |
| 1889 | if (~m_input_select & 0x08) return input_port_read(machine(), "KEY3") << 8; |
| 1890 | if (~m_input_select & 0x10) return input_port_read(machine(), "KEY4") << 8; |
| 1891 | |
| 1892 | logerror("%s: warning, reading key with input_select = %02x\n", machine().describe_context(), m_input_select); |
| 1893 | return 0xffff; |
| 1894 | } |
| 1895 | |
| 1896 | case 0x02: |
| 1897 | { |
| 1898 | UINT16 hopper_bit = (m_hopper && ((machine().primary_screen->frame_number()/10)&1)) ? 0x0000 : 0x0002; |
| 1899 | return (input_port_read(machine(), "DSW1") << 8) | input_port_read(machine(), "COINS") | hopper_bit; |
| 1900 | } |
| 1901 | |
| 1902 | case 0x04: |
| 1903 | return input_port_read(machine(), "DSW2"); |
| 1904 | } |
| 1905 | |
| 1906 | return 0xffff; |
| 1907 | } |
| 1908 | |
| 1909 | WRITE16_MEMBER(igs017_state::lhzb2a_input_addr_w) |
| 1910 | { |
| 1911 | // Unmap previous address ranges |
| 1912 | if (m_input_addr != -1) |
| 1913 | { |
| 1914 | space.unmap_readwrite(m_input_addr * 0x10000 + 0x4000, m_input_addr * 0x10000 + 0x4003); |
| 1915 | space.unmap_read (m_input_addr * 0x10000 + 0x8000, m_input_addr * 0x10000 + 0x8005); |
| 1916 | space.unmap_write (m_input_addr * 0x10000 + 0xc000, m_input_addr * 0x10000 + 0xc001); |
| 1917 | } |
| 1918 | |
| 1919 | m_input_addr = data & 0xff; |
| 1920 | |
| 1921 | // Add new memory ranges |
| 1922 | space.install_readwrite_handler (m_input_addr * 0x10000 + 0x4000, m_input_addr * 0x10000 + 0x4003, read16_delegate (FUNC(igs017_state::lhzb2a_magic_r), this), write16_delegate (FUNC(igs017_state::lhzb2a_magic_w), this)); |
| 1923 | space.install_read_handler (m_input_addr * 0x10000 + 0x8000, m_input_addr * 0x10000 + 0x8005, read16_delegate (FUNC(igs017_state::lhzb2a_input_r), this)); |
| 1924 | space.install_write_handler (m_input_addr * 0x10000 + 0xc000, m_input_addr * 0x10000 + 0xc001, write16_delegate(FUNC(igs017_state::lhzb2a_input_addr_w), this)); |
| 1925 | } |
| 1926 | |
| 1927 | WRITE16_MEMBER(igs017_state::lhzb2a_input_select_w) |
| 1928 | { |
| 1929 | if (ACCESSING_BITS_0_7) |
| 1930 | { |
| 1931 | m_input_select = data & 0x1f; // keys |
| 1932 | m_hopper = data & 0x20; // hopper motor |
| 1933 | coin_counter_w(machine(), 1, data & 0x40); // coin out counter |
| 1934 | coin_counter_w(machine(), 0, data & 0x80); // coin in counter |
| 1935 | } |
| 1936 | if (ACCESSING_BITS_8_15) |
| 1937 | { |
| 1938 | okim6295_device *oki = machine().device<okim6295_device>("oki"); |
| 1939 | oki->set_bank_base((data & 0x0100) ? 0x40000 : 0); |
| 1940 | |
| 1941 | if ( data & 0x0fe00 ) |
| 1942 | logerror("%s: warning, unknown bits written in input_select = %04x\n", machine().describe_context(), data); |
| 1943 | } |
| 1944 | } |
| 1945 | |
| 1946 | static ADDRESS_MAP_START( lhzb2a, AS_PROGRAM, 16, igs017_state ) |
| 1947 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 1948 | AM_RANGE(0x500000, 0x503fff) AM_RAM |
| 1949 | // AM_RANGE(0x910000, 0x910003) protection |
| 1950 | AM_RANGE(0xb02000, 0xb02fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE( m_spriteram ) |
| 1951 | AM_RANGE(0xb03000, 0xb037ff) AM_RAM_WRITE( lhzb2a_paletteram_w ) AM_SHARE("paletteram") |
| 1952 | AM_RANGE(0xb04024, 0xb04025) AM_WRITE( video_disable_lsb_w ) |
| 1953 | AM_RANGE(0xb04028, 0xb04029) AM_WRITE( irq2_enable_w ) |
| 1954 | AM_RANGE(0xb0402a, 0xb0402b) AM_WRITE( irq1_enable_w ) |
| 1955 | AM_RANGE(0xb08000, 0xb0bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE( m_fg_videoram ) |
| 1956 | AM_RANGE(0xb0c000, 0xb0ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE( m_bg_videoram ) |
| 1957 | AM_RANGE(0xb10000, 0xb10001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff ) |
| 1958 | AM_RANGE(0xb12000, 0xb12001) AM_WRITE( lhzb2a_input_select_w ) |
| 1959 | // Inputs dynamically mapped at xx8000, protection at xx4000 (xx = f0 initially). xx written to xxc000 |
| 1960 | ADDRESS_MAP_END |
| 1961 | |
| 1962 | |
| 1963 | // slqz2 |
| 1964 | |
| 1965 | |
| 1966 | WRITE16_MEMBER(igs017_state::slqz2_paletteram_w) |
| 1967 | { |
| 1968 | COMBINE_DATA(&m_generic_paletteram_16[offset]); |
| 1969 | |
| 1970 | int bgr = ((m_generic_paletteram_16[offset/2*2+1] & 0xff) << 8) | (m_generic_paletteram_16[offset/2*2+0] & 0xff); |
| 1971 | |
| 1972 | // bitswap |
| 1973 | bgr = BITSWAP16(bgr, 15,14,9,4,11,10,12,3,7,6,5,8,13,2,1,0); |
| 1974 | |
| 1975 | palette_set_color_rgb(machine(), offset/2, pal5bit(bgr >> 0), pal5bit(bgr >> 5), pal5bit(bgr >> 10)); |
| 1976 | } |
| 1977 | |
| 1978 | WRITE16_MEMBER(igs017_state::slqz2_magic_w) |
| 1979 | { |
| 1980 | COMBINE_DATA(&m_igs_magic[offset]); |
| 1981 | |
| 1982 | if (offset == 0) |
| 1983 | return; |
| 1984 | |
| 1985 | switch(m_igs_magic[0]) |
| 1986 | { |
| 1987 | case 0x00: |
| 1988 | if (ACCESSING_BITS_0_7) |
| 1989 | { |
| 1990 | okim6295_device *oki = machine().device<okim6295_device>("oki"); |
| 1991 | oki->set_bank_base((data & 0x01) ? 0x40000 : 0); |
| 1992 | |
| 1993 | // m_hopper = data & 0x20; // hopper motor |
| 1994 | // coin_counter_w(machine(), 1, data & 0x40); // coin out counter |
| 1995 | coin_counter_w(machine(), 0, data & 0x80); // coin in counter |
| 1996 | |
| 1997 | if ( data & 0x7e ) |
| 1998 | logerror("%s: warning, unknown bits written in oki bank = %04x\n", machine().describe_context(), data); |
| 1999 | } |
| 2000 | break; |
| 2001 | |
| 2002 | default: |
| 2003 | logerror("%s: warning, writing to igs_magic %02x = %02x\n", machine().describe_context(), m_igs_magic[0], data); |
| 2004 | } |
| 2005 | } |
| 2006 | |
| 2007 | READ16_MEMBER(igs017_state::slqz2_magic_r) |
| 2008 | { |
| 2009 | switch(m_igs_magic[0]) |
| 2010 | { |
| 2011 | case 0x00: |
| 2012 | return input_port_read(machine(), "PLAYER2"); |
| 2013 | case 0x01: |
| 2014 | return input_port_read(machine(), "PLAYER1"); |
| 2015 | case 0x02: |
| 2016 | return input_port_read(machine(), "BUTTONS"); |
| 2017 | |
| 2018 | default: |
| 2019 | logerror("%s: warning, reading with igs_magic = %02x\n", machine().describe_context(), m_igs_magic[0]); |
| 2020 | break; |
| 2021 | } |
| 2022 | |
| 2023 | return 0xffff; |
| 2024 | } |
| 2025 | |
| 2026 | static ADDRESS_MAP_START( slqz2, AS_PROGRAM, 16, igs017_state ) |
| 2027 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 2028 | AM_RANGE(0x100000, 0x103fff) AM_RAM |
| 2029 | AM_RANGE(0x602000, 0x602003) AM_WRITE( slqz2_magic_w ) |
| 2030 | AM_RANGE(0x602002, 0x602003) AM_READ( slqz2_magic_r ) |
| 2031 | AM_RANGE(0x902000, 0x902fff) AM_READWRITE( spriteram_lsb_r, spriteram_lsb_w ) AM_BASE( m_spriteram ) |
| 2032 | AM_RANGE(0x903000, 0x9037ff) AM_RAM_WRITE( slqz2_paletteram_w ) AM_SHARE("paletteram") |
| 2033 | AM_RANGE(0x904020, 0x904027) AM_DEVREAD8_LEGACY( "ppi8255", ppi8255_r, 0x00ff ) |
| 2034 | AM_RANGE(0x904024, 0x904025) AM_WRITE( video_disable_lsb_w ) |
| 2035 | AM_RANGE(0x904028, 0x904029) AM_WRITE( irq2_enable_w ) |
| 2036 | AM_RANGE(0x90402a, 0x90402b) AM_WRITE( irq1_enable_w ) |
| 2037 | AM_RANGE(0x908000, 0x90bfff) AM_READWRITE( fg_lsb_r, fg_lsb_w ) AM_BASE( m_fg_videoram ) |
| 2038 | AM_RANGE(0x90c000, 0x90ffff) AM_READWRITE( bg_lsb_r, bg_lsb_w ) AM_BASE( m_bg_videoram ) |
| 2039 | AM_RANGE(0x910000, 0x910001) AM_DEVREADWRITE8("oki", okim6295_device, read, write, 0x00ff ) |
| 2040 | ADDRESS_MAP_END |
| 2041 | |
| 2042 | |
| 1635 | 2043 | /*************************************************************************** |
| 1636 | 2044 | Input Ports |
| 1637 | 2045 | ***************************************************************************/ |
| r14862 | r14863 | |
| 1754 | 2162 | |
| 1755 | 2163 | INPUT_PORTS_END |
| 1756 | 2164 | |
| 2165 | static INPUT_PORTS_START( lhzb2 ) |
| 2166 | |
| 2167 | PORT_START("DSW1") |
| 2168 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) |
| 2169 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) |
| 2170 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 2171 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) ) |
| 2172 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) |
| 2173 | PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" ) |
| 2174 | PORT_DIPSETTING( 0x0c, "10" ) |
| 2175 | PORT_DIPSETTING( 0x08, "20" ) |
| 2176 | PORT_DIPSETTING( 0x04, "50" ) |
| 2177 | PORT_DIPSETTING( 0x00, "100" ) |
| 2178 | PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" ) |
| 2179 | PORT_DIPSETTING( 0x10, "1000" ) |
| 2180 | PORT_DIPSETTING( 0x00, "2000" ) |
| 2181 | PORT_DIPNAME( 0x20, 0x20, "Money Type" ) |
| 2182 | PORT_DIPSETTING( 0x20, "Coins" ) |
| 2183 | PORT_DIPSETTING( 0x00, "Notes" ) |
| 2184 | PORT_DIPNAME( 0x40, 0x40, "Pay Out Type" ) |
| 2185 | PORT_DIPSETTING( 0x40, "Coins" ) |
| 2186 | PORT_DIPSETTING( 0x00, "Notes" ) |
| 2187 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) ) |
| 2188 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 2189 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 2190 | |
| 2191 | PORT_START("DSW2") |
| 2192 | PORT_DIPNAME( 0x03, 0x03, "Min Bet" ) |
| 2193 | PORT_DIPSETTING( 0x03, "500" ) |
| 2194 | PORT_DIPSETTING( 0x02, "1000" ) |
| 2195 | PORT_DIPSETTING( 0x01, "1500" ) |
| 2196 | PORT_DIPSETTING( 0x00, "2000" ) |
| 2197 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) ) |
| 2198 | PORT_DIPSETTING( 0x0c, "1" ) |
| 2199 | PORT_DIPSETTING( 0x08, "2" ) |
| 2200 | PORT_DIPSETTING( 0x04, "3" ) |
| 2201 | PORT_DIPSETTING( 0x00, "5" ) |
| 2202 | PORT_DIPNAME( 0x10, 0x10, "Bonus Round" ) |
| 2203 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 2204 | PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) |
| 2205 | PORT_DIPNAME( 0x20, 0x20, "Number Type" ) |
| 2206 | PORT_DIPSETTING( 0x20, "Number" ) |
| 2207 | PORT_DIPSETTING( 0x00, "Dice" ) |
| 2208 | PORT_DIPNAME( 0x40, 0x40, "Symbols" ) |
| 2209 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2210 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // pigs, apples |
| 2211 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 2212 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2213 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2214 | |
| 2215 | PORT_START("COINS") |
| 2216 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) // hopper switch (unimplemented) |
| 2217 | PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) // service mode (keep pressed during boot too) |
| 2218 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Statistics") // press with the above for sound test |
| 2219 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5) // coin error otherwise |
| 2220 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O) |
| 2221 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 ) // ? (shown in service mode) |
| 2222 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2223 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2224 | |
| 2225 | PORT_START("KEY0") |
| 2226 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| 2227 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) |
| 2228 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) |
| 2229 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) |
| 2230 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) |
| 2231 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| 2232 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2233 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2234 | |
| 2235 | PORT_START("KEY1") |
| 2236 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) |
| 2237 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) |
| 2238 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J ) |
| 2239 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) |
| 2240 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) |
| 2241 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) |
| 2242 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2243 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2244 | |
| 2245 | PORT_START("KEY2") |
| 2246 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) |
| 2247 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) |
| 2248 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) |
| 2249 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) |
| 2250 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) |
| 2251 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2252 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2253 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2254 | |
| 2255 | PORT_START("KEY3") |
| 2256 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) |
| 2257 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) |
| 2258 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) |
| 2259 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) |
| 2260 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2261 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2262 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2263 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2264 | |
| 2265 | PORT_START("KEY4") |
| 2266 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) |
| 2267 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) |
| 2268 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) |
| 2269 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2270 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) |
| 2271 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) |
| 2272 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2273 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2274 | |
| 2275 | INPUT_PORTS_END |
| 2276 | |
| 2277 | static INPUT_PORTS_START( lhzb2a ) |
| 2278 | |
| 2279 | PORT_START("DSW1") |
| 2280 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) |
| 2281 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) |
| 2282 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 2283 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) ) |
| 2284 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) |
| 2285 | PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" ) |
| 2286 | PORT_DIPSETTING( 0x0c, "10" ) |
| 2287 | PORT_DIPSETTING( 0x08, "20" ) |
| 2288 | PORT_DIPSETTING( 0x04, "50" ) |
| 2289 | PORT_DIPSETTING( 0x00, "100" ) |
| 2290 | PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" ) |
| 2291 | PORT_DIPSETTING( 0x10, "1000" ) |
| 2292 | PORT_DIPSETTING( 0x00, "2000" ) |
| 2293 | PORT_DIPNAME( 0x20, 0x20, "Money Type" ) |
| 2294 | PORT_DIPSETTING( 0x20, "Coins" ) |
| 2295 | PORT_DIPSETTING( 0x00, "Notes" ) |
| 2296 | PORT_DIPNAME( 0x40, 0x40, "Pay Out Type" ) |
| 2297 | PORT_DIPSETTING( 0x40, "Coins" ) |
| 2298 | PORT_DIPSETTING( 0x00, "Notes" ) |
| 2299 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) ) |
| 2300 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 2301 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 2302 | |
| 2303 | PORT_START("DSW2") |
| 2304 | PORT_DIPNAME( 0x03, 0x03, "Min Bet" ) |
| 2305 | PORT_DIPSETTING( 0x03, "500" ) |
| 2306 | PORT_DIPSETTING( 0x02, "1000" ) |
| 2307 | PORT_DIPSETTING( 0x01, "1500" ) |
| 2308 | PORT_DIPSETTING( 0x00, "2000" ) |
| 2309 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) ) |
| 2310 | PORT_DIPSETTING( 0x0c, "1" ) |
| 2311 | PORT_DIPSETTING( 0x08, "2" ) |
| 2312 | PORT_DIPSETTING( 0x04, "3" ) |
| 2313 | PORT_DIPSETTING( 0x00, "5" ) |
| 2314 | PORT_DIPNAME( 0x10, 0x10, "Bonus Round" ) |
| 2315 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 2316 | PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) |
| 2317 | PORT_DIPNAME( 0x20, 0x20, "Number Type" ) |
| 2318 | PORT_DIPSETTING( 0x20, "Number" ) |
| 2319 | PORT_DIPSETTING( 0x00, "Dice" ) |
| 2320 | PORT_DIPNAME( 0x40, 0x40, "Symbols" ) |
| 2321 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2322 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // pigs, apples |
| 2323 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 2324 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2325 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2326 | |
| 2327 | PORT_START("COINS") |
| 2328 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE2 ) // shown in test mode |
| 2329 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) // hopper switch |
| 2330 | PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW ) // keep pressed while booting |
| 2331 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Statistics") // press with the above for sound test |
| 2332 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) |
| 2333 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O) |
| 2334 | |
| 2335 | PORT_START("KEY0") |
| 2336 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A ) |
| 2337 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E ) |
| 2338 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I ) |
| 2339 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M ) |
| 2340 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) |
| 2341 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) |
| 2342 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2343 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2344 | |
| 2345 | PORT_START("KEY1") |
| 2346 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B ) |
| 2347 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F ) |
| 2348 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J ) |
| 2349 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N ) |
| 2350 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) |
| 2351 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) |
| 2352 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2353 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2354 | |
| 2355 | PORT_START("KEY2") |
| 2356 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C ) |
| 2357 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G ) |
| 2358 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K ) |
| 2359 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) |
| 2360 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) |
| 2361 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2362 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2363 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2364 | |
| 2365 | PORT_START("KEY3") |
| 2366 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D ) |
| 2367 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H ) |
| 2368 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L ) |
| 2369 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) |
| 2370 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2371 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2372 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2373 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2374 | |
| 2375 | PORT_START("KEY4") |
| 2376 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) |
| 2377 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) |
| 2378 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) |
| 2379 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2380 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) |
| 2381 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) |
| 2382 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2383 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2384 | |
| 2385 | INPUT_PORTS_END |
| 2386 | |
| 1757 | 2387 | static INPUT_PORTS_START( mgcs ) |
| 1758 | 2388 | |
| 1759 | 2389 | // DSWs don't work: they are read through a protection device (IGS029? see code at 1CF16) |
| r14862 | r14863 | |
| 2128 | 2758 | |
| 2129 | 2759 | INPUT_PORTS_END |
| 2130 | 2760 | |
| 2761 | static INPUT_PORTS_START( slqz2 ) |
| 2762 | |
| 2763 | PORT_START("DSW1") |
| 2764 | PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) |
| 2765 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) |
| 2766 | PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) ) |
| 2767 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) ) |
| 2768 | PORT_DIPSETTING( 0x00, DEF_STR( 1C_5C ) ) |
| 2769 | PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" ) |
| 2770 | PORT_DIPSETTING( 0x0c, "10" ) |
| 2771 | PORT_DIPSETTING( 0x08, "20" ) |
| 2772 | PORT_DIPSETTING( 0x04, "50" ) |
| 2773 | PORT_DIPSETTING( 0x00, "100" ) |
| 2774 | PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" ) |
| 2775 | PORT_DIPSETTING( 0x10, "1000" ) |
| 2776 | PORT_DIPSETTING( 0x00, "2000" ) |
| 2777 | PORT_DIPNAME( 0x20, 0x20, "Money Type" ) |
| 2778 | PORT_DIPSETTING( 0x20, "Coins" ) |
| 2779 | PORT_DIPSETTING( 0x00, "Notes" ) |
| 2780 | PORT_DIPNAME( 0x40, 0x40, "Pay Out Type" ) |
| 2781 | PORT_DIPSETTING( 0x40, "Coins" ) |
| 2782 | PORT_DIPSETTING( 0x00, "Notes" ) |
| 2783 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) ) |
| 2784 | PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) |
| 2785 | PORT_DIPSETTING( 0x80, DEF_STR( On ) ) |
| 2786 | |
| 2787 | PORT_START("DSW2") |
| 2788 | PORT_DIPNAME( 0x03, 0x03, "Min Bet" ) |
| 2789 | PORT_DIPSETTING( 0x03, "500" ) |
| 2790 | PORT_DIPSETTING( 0x02, "1000" ) |
| 2791 | PORT_DIPSETTING( 0x01, "1500" ) |
| 2792 | PORT_DIPSETTING( 0x00, "2000" ) |
| 2793 | PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) ) |
| 2794 | PORT_DIPSETTING( 0x0c, "1" ) |
| 2795 | PORT_DIPSETTING( 0x08, "2" ) |
| 2796 | PORT_DIPSETTING( 0x04, "3" ) |
| 2797 | PORT_DIPSETTING( 0x00, "5" ) |
| 2798 | PORT_DIPNAME( 0x10, 0x10, "Bonus Round" ) |
| 2799 | PORT_DIPSETTING( 0x00, DEF_STR( No ) ) |
| 2800 | PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) |
| 2801 | PORT_DIPNAME( 0x20, 0x20, "Number Type" ) |
| 2802 | PORT_DIPSETTING( 0x20, "Number" ) |
| 2803 | PORT_DIPSETTING( 0x00, "Dice" ) |
| 2804 | PORT_DIPNAME( 0x40, 0x40, "Symbols" ) |
| 2805 | PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) |
| 2806 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) // pigs, apples |
| 2807 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) |
| 2808 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
| 2809 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 2810 | |
| 2811 | PORT_START("COINS") |
| 2812 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) // hopper switch (unimplemented) |
| 2813 | PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) // service mode (keep pressed during boot too) |
| 2814 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Statistics") // press with the above for sound test |
| 2815 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5) // coin error otherwise |
| 2816 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O) |
| 2817 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2818 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) |
| 2819 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) |
| 2820 | |
| 2821 | PORT_START("PLAYER1") |
| 2822 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) PORT_NAME("Start / Don Den") |
| 2823 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) |
| 2824 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) |
| 2825 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) |
| 2826 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) |
| 2827 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Help / Big" ) |
| 2828 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2829 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 2830 | |
| 2831 | PORT_START("PLAYER2") |
| 2832 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 ) PORT_NAME( "Bet" ) |
| 2833 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) |
| 2834 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) |
| 2835 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) |
| 2836 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) |
| 2837 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) |
| 2838 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) |
| 2839 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) |
| 2840 | |
| 2841 | PORT_START("BUTTONS") |
| 2842 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_1_PAD) |
| 2843 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_2_PAD) |
| 2844 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_3_PAD) |
| 2845 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_4_PAD) |
| 2846 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_5_PAD) |
| 2847 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_6_PAD) |
| 2848 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_7_PAD) |
| 2849 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("0") PORT_CODE(KEYCODE_8_PAD) |
| 2850 | |
| 2851 | INPUT_PORTS_END |
| 2852 | |
| 2131 | 2853 | static INPUT_PORTS_START( tjsb ) |
| 2132 | 2854 | |
| 2133 | 2855 | PORT_START("DSW1") |
| r14862 | r14863 | |
| 2414 | 3136 | |
| 2415 | 3137 | |
| 2416 | 3138 | |
| 3139 | // lhzb2 |
| 3140 | |
| 3141 | static const ppi8255_interface lhzb2_ppi8255_intf = |
| 3142 | { |
| 3143 | DEVCB_INPUT_PORT("COINS"), // Port A read |
| 3144 | DEVCB_INPUT_PORT("DSW1"), // Port B read |
| 3145 | DEVCB_INPUT_PORT("DSW2"), // Port C read |
| 3146 | |
| 3147 | DEVCB_NULL, // Port A write |
| 3148 | DEVCB_NULL, // Port B write |
| 3149 | DEVCB_NULL // Port C write |
| 3150 | }; |
| 3151 | |
| 3152 | static MACHINE_CONFIG_START( lhzb2, igs017_state ) |
| 3153 | MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz / 2) |
| 3154 | MCFG_CPU_PROGRAM_MAP(lhzb2) |
| 3155 | MCFG_TIMER_ADD_SCANLINE("scantimer", mgcs_interrupt, "screen", 0, 1) |
| 3156 | |
| 3157 | MCFG_MACHINE_RESET(mgcs) |
| 3158 | |
| 3159 | MCFG_PPI8255_ADD( "ppi8255", lhzb2_ppi8255_intf ) |
| 3160 | |
| 3161 | /* video hardware */ |
| 3162 | MCFG_SCREEN_ADD("screen", RASTER) |
| 3163 | MCFG_SCREEN_REFRESH_RATE(60) |
| 3164 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 3165 | MCFG_SCREEN_SIZE(512, 256) |
| 3166 | MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1) |
| 3167 | MCFG_SCREEN_UPDATE_STATIC(igs017) |
| 3168 | |
| 3169 | MCFG_GFXDECODE(igs017_swapped) |
| 3170 | MCFG_PALETTE_LENGTH(0x100*2) |
| 3171 | |
| 3172 | MCFG_VIDEO_START(igs017) |
| 3173 | MCFG_VIDEO_RESET(igs017) |
| 3174 | |
| 3175 | /* sound hardware */ |
| 3176 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 3177 | MCFG_OKIM6295_ADD("oki", XTAL_8MHz / 8, OKIM6295_PIN7_HIGH) |
| 3178 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) |
| 3179 | MACHINE_CONFIG_END |
| 3180 | |
| 3181 | |
| 3182 | |
| 3183 | // lhzb2a |
| 3184 | |
| 3185 | static MACHINE_RESET( lhzb2a ) |
| 3186 | { |
| 3187 | igs017_state *state = machine.driver_data<igs017_state>(); |
| 3188 | MACHINE_RESET_CALL( mgcs ); |
| 3189 | state->lhzb2a_input_addr_w(*state->m_maincpu->memory().space(AS_PROGRAM), 0, 0xf0); |
| 3190 | } |
| 3191 | |
| 3192 | static MACHINE_CONFIG_START( lhzb2a, igs017_state ) |
| 3193 | MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz/2) |
| 3194 | MCFG_CPU_PROGRAM_MAP(lhzb2a) |
| 3195 | MCFG_TIMER_ADD_SCANLINE("scantimer", mgcs_interrupt, "screen", 0, 1) |
| 3196 | |
| 3197 | MCFG_MACHINE_RESET(lhzb2a) |
| 3198 | |
| 3199 | // MCFG_PPI8255_ADD( "ppi8255", sdmg2_ppi8255_intf ) |
| 3200 | |
| 3201 | /* video hardware */ |
| 3202 | MCFG_SCREEN_ADD("screen", RASTER) |
| 3203 | MCFG_SCREEN_REFRESH_RATE(60) // VSync 60Hz, HSync 15.3kHz |
| 3204 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 3205 | MCFG_SCREEN_SIZE(512, 256) |
| 3206 | MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-16-1) |
| 3207 | MCFG_SCREEN_UPDATE_STATIC(igs017) |
| 3208 | |
| 3209 | MCFG_GFXDECODE(igs017_swapped) |
| 3210 | MCFG_PALETTE_LENGTH(0x100*2) |
| 3211 | |
| 3212 | MCFG_VIDEO_START(igs017) |
| 3213 | MCFG_VIDEO_RESET(igs017) |
| 3214 | |
| 3215 | /* sound hardware */ |
| 3216 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 3217 | MCFG_OKIM6295_ADD("oki", XTAL_22MHz / 22, OKIM6295_PIN7_HIGH) |
| 3218 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) |
| 3219 | MACHINE_CONFIG_END |
| 3220 | |
| 3221 | |
| 3222 | |
| 3223 | // slqz2 |
| 3224 | |
| 3225 | static MACHINE_CONFIG_START( slqz2, igs017_state ) |
| 3226 | MCFG_CPU_ADD("maincpu", M68000, XTAL_22MHz / 2) |
| 3227 | MCFG_CPU_PROGRAM_MAP(slqz2) |
| 3228 | MCFG_TIMER_ADD_SCANLINE("scantimer", mgcs_interrupt, "screen", 0, 1) |
| 3229 | |
| 3230 | MCFG_MACHINE_RESET(mgcs) |
| 3231 | |
| 3232 | MCFG_PPI8255_ADD( "ppi8255", lhzb2_ppi8255_intf ) |
| 3233 | |
| 3234 | /* video hardware */ |
| 3235 | MCFG_SCREEN_ADD("screen", RASTER) |
| 3236 | MCFG_SCREEN_REFRESH_RATE(60) |
| 3237 | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) |
| 3238 | MCFG_SCREEN_SIZE(512, 256) |
| 3239 | MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1) |
| 3240 | MCFG_SCREEN_UPDATE_STATIC(igs017) |
| 3241 | |
| 3242 | MCFG_GFXDECODE(igs017) |
| 3243 | MCFG_PALETTE_LENGTH(0x100*2) |
| 3244 | |
| 3245 | MCFG_VIDEO_START(igs017) |
| 3246 | MCFG_VIDEO_RESET(igs017) |
| 3247 | |
| 3248 | /* sound hardware */ |
| 3249 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 3250 | MCFG_OKIM6295_ADD("oki", XTAL_8MHz / 8, OKIM6295_PIN7_HIGH) |
| 3251 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) |
| 3252 | MACHINE_CONFIG_END |
| 3253 | |
| 3254 | |
| 3255 | |
| 2417 | 3256 | // sdmg2 |
| 2418 | 3257 | |
| 2419 | 3258 | static const ppi8255_interface sdmg2_ppi8255_intf = |
| r14862 | r14863 | |
| 2793 | 3632 | ROM_LOAD16_WORD_SWAP( "p0900.u25", 0x00000, 0x80000,CRC(43366f51) SHA1(48dd965dceff7de15b43c2140226a8b17a792dbc) ) |
| 2794 | 3633 | |
| 2795 | 3634 | ROM_REGION( 0x280000, "sprites", 0 ) |
| 2796 | | ROM_LOAD( "m0901.u5", 0x000000, 0x200000, CRC(9699db24) SHA1(50fc2f173c20b48d10595f01f1e9545f1b13a61b) ) |
| 2797 | | ROM_LOAD( "m0902.u4", 0x200000, 0x080000, CRC(3298b13b) SHA1(13b21ddeed368b7f4fea1408c8fc511244342faf) ) |
| 3635 | ROM_LOAD( "m0901.u5", 0x000000, 0x200000, CRC(9699db24) SHA1(50fc2f173c20b48d10595f01f1e9545f1b13a61b) ) // FIXED BITS (xxxxxxxx0xxxxxxx) |
| 3636 | ROM_LOAD( "m0902.u4", 0x200000, 0x080000, CRC(3298b13b) SHA1(13b21ddeed368b7f4fea1408c8fc511244342faf) ) // FIXED BITS (xxxxxxxx0xxxxxxx) |
| 2798 | 3637 | |
| 2799 | 3638 | ROM_REGION( 0x20000, "tilemaps", 0 ) |
| 2800 | 3639 | ROM_LOAD( "text.u6", 0x000000, 0x020000, CRC(cb34cbc0) SHA1(ceedbdda085fd1acc9a575502bdf7cf998f54f05) ) |
| r14862 | r14863 | |
| 2853 | 3692 | ROM_REGION( 0x10000, "igs022", 0 ) // INTERNATIONAL GAMES SYSTEM CO.,LTD |
| 2854 | 3693 | ROM_LOAD( "m1104.u11",0x0000, 0x10000, CRC(794d0276) SHA1(ac903d2faa3fb315438dc8da22c5337611a8790d) ) |
| 2855 | 3694 | |
| 2856 | | ROM_REGION( 0x200000, "sprites", 0 ) // adddress scrambling |
| 2857 | | ROM_LOAD16_WORD_SWAP( "m1101.u6", 0x000000, 0x200000, CRC(fed09cd6) SHA1(0658a97983f8ba408126e79889cc58323f2d99ba) ) |
| 3695 | ROM_REGION( 0x400000, "sprites", 0 ) // adddress scrambling |
| 3696 | ROM_LOAD16_WORD_SWAP( "m1101.u6", 0x000000, 0x400000, CRC(0114e9d1) SHA1(5b16170d3cd8b8e1662c949b7234fbdd2ca927f7) ) // FIXED BITS (0xxxxxxxxxxxxxxx) |
| 2858 | 3697 | |
| 2859 | | ROM_REGION( 0x40000, "tilemaps", 0 ) // adddress scrambling |
| 2860 | | ROM_LOAD( "m1103.u8", 0x00000, 0x40000, CRC(89d0b81c) SHA1(b8d294a143e5cc9466b544cb70e43a7ce3450ace) ) |
| 3698 | ROM_REGION( 0x80000, "tilemaps", 0 ) // adddress scrambling |
| 3699 | ROM_LOAD( "m1103.u8", 0x00000, 0x80000, CRC(4d3776b4) SHA1(fa9b311b1a6ad56e136b66d090bc62ed5003b2f2) ) |
| 2861 | 3700 | |
| 2862 | 3701 | ROM_REGION( 0x80000, "oki", 0 ) |
| 2863 | 3702 | ROM_LOAD( "s1102.u23", 0x00000, 0x80000, CRC(51ffe245) SHA1(849011b186096add657ab20d49d260ec23363ef3) ) |
| r14862 | r14863 | |
| 2869 | 3708 | ROM_REGION( 0x80000, "maincpu", 0 ) |
| 2870 | 3709 | ROM_LOAD16_WORD_SWAP( "p-4096", 0x00000, 0x80000, CRC(41293f32) SHA1(df4e993f4a458729ade13981e58f32d8116c0082) ) |
| 2871 | 3710 | |
| 2872 | | ROM_REGION( 0x200000, "sprites", 0 ) // adddress scrambling |
| 2873 | | ROM_LOAD16_WORD_SWAP( "m1101.u6", 0x000000, 0x200000, CRC(fed09cd6) SHA1(0658a97983f8ba408126e79889cc58323f2d99ba) ) |
| 3711 | ROM_REGION( 0x400000, "sprites", 0 ) // adddress scrambling |
| 3712 | ROM_LOAD16_WORD_SWAP( "m1101.u6", 0x000000, 0x400000, CRC(0114e9d1) SHA1(5b16170d3cd8b8e1662c949b7234fbdd2ca927f7) ) // FIXED BITS (0xxxxxxxxxxxxxxx) |
| 2874 | 3713 | |
| 2875 | 3714 | ROM_REGION( 0x80000, "tilemaps", 0 ) // adddress scrambling |
| 2876 | | ROM_LOAD( "m1103", 0x000000, 0x080000, CRC(4d3776b4) SHA1(fa9b311b1a6ad56e136b66d090bc62ed5003b2f2) ) |
| 3715 | ROM_LOAD( "m1103.u8", 0x00000, 0x80000, CRC(4d3776b4) SHA1(fa9b311b1a6ad56e136b66d090bc62ed5003b2f2) ) |
| 2877 | 3716 | |
| 2878 | 3717 | ROM_REGION( 0x80000, "oki", 0 ) |
| 2879 | 3718 | ROM_LOAD( "s1102.u23", 0x00000, 0x80000, CRC(51ffe245) SHA1(849011b186096add657ab20d49d260ec23363ef3) ) |
| r14862 | r14863 | |
| 2928 | 3767 | ROM_REGION( 0x10000, "igs022", 0 ) // INTERNATIONAL GAMES SYSTEM CO.,LTD |
| 2929 | 3768 | ROM_LOAD( "m1103.u12", 0x00000, 0x10000, CRC(9f3b8d65) SHA1(5ee1ad025474399c2826f21d970e76f25d0fa1fd) ) |
| 2930 | 3769 | |
| 2931 | | ROM_REGION( 0x200000, "sprites", 0 ) // adddress scrambling |
| 2932 | | ROM_LOAD16_WORD_SWAP( "m1101.u4", 0x000000, 0x200000, CRC(fed09cd6) SHA1(0658a97983f8ba408126e79889cc58323f2d99ba) ) // = m1101.u6 Mahjong Long Hu Zheng Ba 2 |
| 3770 | ROM_REGION( 0x400000, "sprites", 0 ) // adddress scrambling |
| 3771 | ROM_LOAD16_WORD_SWAP( "m1101.u4", 0x000000, 0x400000, CRC(0114e9d1) SHA1(5b16170d3cd8b8e1662c949b7234fbdd2ca927f7) ) // FIXED BITS (0xxxxxxxxxxxxxxx) |
| 2933 | 3772 | |
| 2934 | 3773 | ROM_REGION( 0x80000, "tilemaps", 0 ) // light adddress scrambling |
| 2935 | 3774 | ROM_LOAD( "text.u6", 0x00000, 0x80000, CRC(40d21adf) SHA1(18b202d6330ac89026bec2c9c8224b52540dd48d) ) |
| r14862 | r14863 | |
| 3132 | 3971 | |
| 3133 | 3972 | GAME( 1996, iqblocka, iqblock, iqblocka, iqblocka, iqblocka, ROT0, "IGS", "Shu Zi Le Yuan (V127M)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3134 | 3973 | GAME( 1996, iqblockf, iqblock, iqblocka, iqblocka, iqblockf, ROT0, "IGS", "Shu Zi Le Yuan (V113FR)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3135 | | GAME( 1997, tjsb, 0, tjsb, tjsb, tjsb, ROT0, "IGS", "Mahjong Tian Jiang Shen Bing (V137C)", GAME_UNEMULATED_PROTECTION ) |
| 3136 | | GAME( 1997, sdmg2, 0, sdmg2, sdmg2, sdmg2, ROT0, "IGS", "Mahjong Super Da Man Guan II (China, V754C)", 0 ) |
| 3137 | 3974 | GAME( 1997, mgdh, 0, mgdha, mgdh, mgdh, ROT0, "IGS", "Mahjong Man Guan Da Heng (Taiwan, V125T1)", 0 ) |
| 3138 | 3975 | GAME( 1997, mgdha, mgdh, mgdha, mgdh , mgdha, ROT0, "IGS", "Mahjong Man Guan Da Heng (Taiwan, V123T1)", 0 ) |
| 3976 | GAME( 1997, sdmg2, 0, sdmg2, sdmg2, sdmg2, ROT0, "IGS", "Mahjong Super Da Man Guan II (China, V754C)", 0 ) |
| 3977 | GAME( 1997, tjsb, 0, tjsb, tjsb, tjsb, ROT0, "IGS", "Mahjong Tian Jiang Shen Bing (V137C)", GAME_UNEMULATED_PROTECTION ) |
| 3139 | 3978 | GAME( 1998, mgcs, 0, mgcs, mgcs, mgcs, ROT0, "IGS", "Mahjong Man Guan Cai Shen (V103CS)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_IMPERFECT_SOUND ) |
| 3140 | | GAME( 1998, lhzb2, 0, sdmg2, sdmg2, lhzb2, ROT0, "IGS", "Mahjong Long Hu Zheng Ba 2 (set 1)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3141 | | GAME( 1998, lhzb2a, lhzb2, sdmg2, sdmg2, lhzb2a, ROT0, "IGS", "Mahjong Long Hu Zheng Ba 2 (set 2)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3142 | | GAME( 1998, slqz2, 0, sdmg2, sdmg2, slqz2, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 2", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3979 | GAME( 1998, lhzb2, 0, lhzb2, lhzb2, lhzb2, ROT0, "IGS", "Mahjong Long Hu Zheng Ba 2 (set 1)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3980 | GAME( 1998, lhzb2a, lhzb2, lhzb2a, lhzb2a, lhzb2a, ROT0, "IGS", "Mahjong Long Hu Zheng Ba 2 (VS221M)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3981 | GAME( 1998, slqz2, 0, slqz2, slqz2, slqz2, ROT0, "IGS", "Mahjong Shuang Long Qiang Zhu 2 (VS203J)", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) |
| 3143 | 3982 | GAME( 1999?, tarzan, 0, iqblocka, iqblocka, tarzan, ROT0, "IGS", "Tarzan (V109C)", GAME_NOT_WORKING ) |
| 3144 | 3983 | GAME( 1999?, tarzana, tarzan, iqblocka, iqblocka, tarzana, ROT0, "IGS", "Tarzan (V107)", GAME_NOT_WORKING ) |
| 3145 | 3984 | GAME( 2000?, starzan, 0, iqblocka, iqblocka, starzan, ROT0, "IGS / G.F. Gioca", "Super Tarzan (Italy, V100I)", GAME_NOT_WORKING ) |
src/emu/driver.c
| r14862 | r14863 | |
| 2 | 2 | |
| 3 | 3 | driver.c |
| 4 | 4 | |
| 5 | | Driver enumeration helpers. |
| 5 | Core driver device base class. |
| 6 | 6 | |
| 7 | 7 | **************************************************************************** |
| 8 | 8 | |
| r14862 | r14863 | |
| 38 | 38 | ***************************************************************************/ |
| 39 | 39 | |
| 40 | 40 | #include "emu.h" |
| 41 | | #include <ctype.h> |
| 41 | #include "drivenum.h" |
| 42 | 42 | |
| 43 | 43 | |
| 44 | | |
| 45 | 44 | //************************************************************************** |
| 46 | | // DRIVER LIST |
| 45 | // DRIVER DEVICE |
| 47 | 46 | //************************************************************************** |
| 48 | 47 | |
| 49 | 48 | //------------------------------------------------- |
| 50 | | // driver_list - constructor |
| 49 | // driver_device - constructor |
| 51 | 50 | //------------------------------------------------- |
| 52 | 51 | |
| 53 | | driver_list::driver_list() |
| 52 | driver_device::driver_device(const machine_config &mconfig, device_type type, const char *tag) |
| 53 | : device_t(mconfig, type, "Driver Device", tag, NULL, 0), |
| 54 | m_system(NULL), |
| 55 | m_palette_init(NULL), |
| 56 | m_generic_paletteram_8(*this, "paletteram"), |
| 57 | m_generic_paletteram2_8(*this, "paletteram2"), |
| 58 | m_generic_paletteram_16(*this, "paletteram"), |
| 59 | m_generic_paletteram2_16(*this, "paletteram2"), |
| 60 | m_generic_paletteram_32(*this, "paletteram"), |
| 61 | m_generic_paletteram2_32(*this, "paletteram2") |
| 54 | 62 | { |
| 63 | memset(m_callbacks, 0, sizeof(m_callbacks)); |
| 55 | 64 | } |
| 56 | 65 | |
| 57 | 66 | |
| 58 | 67 | //------------------------------------------------- |
| 59 | | // find - find a driver by name |
| 68 | // driver_device - destructor |
| 60 | 69 | //------------------------------------------------- |
| 61 | 70 | |
| 62 | | int driver_list::find(const char *name) |
| 71 | driver_device::~driver_device() |
| 63 | 72 | { |
| 64 | | // if no name, bail |
| 65 | | if (name == NULL) |
| 66 | | return -1; |
| 67 | | |
| 68 | | // create a dummy item for comparison purposes |
| 69 | | game_driver driver; |
| 70 | | driver.name = name; |
| 71 | | game_driver *driverptr = &driver; |
| 72 | | |
| 73 | | // binary search to find it |
| 74 | | const game_driver **result = reinterpret_cast<const game_driver **>(bsearch(&driverptr, s_drivers_sorted, s_driver_count, sizeof(*s_drivers_sorted), driver_sort_callback)); |
| 75 | | return (result == NULL) ? -1 : result - s_drivers_sorted; |
| 76 | 73 | } |
| 77 | 74 | |
| 78 | 75 | |
| 79 | 76 | //------------------------------------------------- |
| 80 | | // matches - true if we match, taking into |
| 81 | | // account wildcards in the wildstring |
| 77 | // static_set_game - set the game in the device |
| 78 | // configuration |
| 82 | 79 | //------------------------------------------------- |
| 83 | 80 | |
| 84 | | bool driver_list::matches(const char *wildstring, const char *string) |
| 81 | void driver_device::static_set_game(device_t &device, const game_driver &game) |
| 85 | 82 | { |
| 86 | | // can only match internal drivers if the wildstring starts with an underscore |
| 87 | | if (string[0] == '_' && (wildstring == NULL || wildstring[0] != '_')) |
| 88 | | return false; |
| 83 | driver_device &driver = downcast<driver_device &>(device); |
| 89 | 84 | |
| 90 | | // match everything else normally |
| 91 | | return (wildstring == NULL || mame_strwildcmp(wildstring, string) == 0); |
| 85 | // set the system |
| 86 | driver.m_system = &game; |
| 87 | |
| 88 | // set the short name to the game's name |
| 89 | driver.m_shortname = game.name; |
| 90 | |
| 91 | // set the full name to the game's description |
| 92 | driver.m_name = game.description; |
| 93 | |
| 94 | // and set the search path to include all parents |
| 95 | driver.m_searchpath = game.name; |
| 96 | for (int parent = driver_list::clone(game); parent != -1; parent = driver_list::clone(parent)) |
| 97 | driver.m_searchpath.cat(";").cat(driver_list::driver(parent).name); |
| 92 | 98 | } |
| 93 | 99 | |
| 94 | 100 | |
| 95 | 101 | //------------------------------------------------- |
| 96 | | // driver_sort_callback - compare two items in |
| 97 | | // an array of game_driver pointers |
| 102 | // static_set_machine_start - set the legacy |
| 103 | // machine start callback in the device |
| 104 | // configuration |
| 98 | 105 | //------------------------------------------------- |
| 99 | 106 | |
| 100 | | int driver_list::driver_sort_callback(const void *elem1, const void *elem2) |
| 107 | void driver_device::static_set_callback(device_t &device, callback_type type, legacy_callback_func callback) |
| 101 | 108 | { |
| 102 | | const game_driver * const *item1 = reinterpret_cast<const game_driver * const *>(elem1); |
| 103 | | const game_driver * const *item2 = reinterpret_cast<const game_driver * const *>(elem2); |
| 104 | | return mame_stricmp((*item1)->name, (*item2)->name); |
| 109 | downcast<driver_device &>(device).m_callbacks[type] = callback; |
| 105 | 110 | } |
| 106 | 111 | |
| 107 | 112 | |
| 108 | 113 | //------------------------------------------------- |
| 109 | | // penalty_compare - compare two strings for |
| 110 | | // closeness and assign a score. |
| 114 | // static_set_palette_init - set the legacy |
| 115 | // palette init callback in the device |
| 116 | // configuration |
| 111 | 117 | //------------------------------------------------- |
| 112 | 118 | |
| 113 | | int driver_list::penalty_compare(const char *source, const char *target) |
| 119 | void driver_device::static_set_palette_init(device_t &device, palette_init_func callback) |
| 114 | 120 | { |
| 115 | | int gaps = 1; |
| 116 | | bool last = true; |
| 117 | | |
| 118 | | // scan the strings |
| 119 | | for ( ; *source && *target; target++) |
| 120 | | { |
| 121 | | // do a case insensitive match |
| 122 | | bool match = (tolower((UINT8)*source) == tolower((UINT8)*target)); |
| 123 | | |
| 124 | | // if we matched, advance the source |
| 125 | | if (match) |
| 126 | | source++; |
| 127 | | |
| 128 | | // if the match state changed, count gaps |
| 129 | | if (match != last) |
| 130 | | { |
| 131 | | last = match; |
| 132 | | if (!match) |
| 133 | | gaps++; |
| 134 | | } |
| 135 | | } |
| 136 | | |
| 137 | | // penalty if short string does not completely fit in |
| 138 | | for ( ; *source; source++) |
| 139 | | gaps++; |
| 140 | | |
| 141 | | // if we matched perfectly, gaps == 0 |
| 142 | | if (gaps == 1 && *source == 0 && *target == 0) |
| 143 | | gaps = 0; |
| 144 | | |
| 145 | | return gaps; |
| 121 | downcast<driver_device &>(device).m_palette_init = callback; |
| 146 | 122 | } |
| 147 | 123 | |
| 148 | 124 | |
| 149 | | |
| 150 | | //************************************************************************** |
| 151 | | // DRIVER ENUMERATOR |
| 152 | | //************************************************************************** |
| 153 | | |
| 154 | 125 | //------------------------------------------------- |
| 155 | | // driver_enumerator - constructor |
| 126 | // driver_start - default implementation which |
| 127 | // does nothing |
| 156 | 128 | //------------------------------------------------- |
| 157 | 129 | |
| 158 | | driver_enumerator::driver_enumerator(emu_options &options) |
| 159 | | : m_current(-1), |
| 160 | | m_filtered_count(0), |
| 161 | | m_options(options), |
| 162 | | m_included(global_alloc_array(UINT8, s_driver_count)), |
| 163 | | m_config(global_alloc_array_clear(machine_config *, s_driver_count)) |
| 130 | void driver_device::driver_start() |
| 164 | 131 | { |
| 165 | | include_all(); |
| 166 | 132 | } |
| 167 | 133 | |
| 168 | 134 | |
| 169 | | driver_enumerator::driver_enumerator(emu_options &options, const char *string) |
| 170 | | : m_current(-1), |
| 171 | | m_filtered_count(0), |
| 172 | | m_options(options), |
| 173 | | m_included(global_alloc_array(UINT8, s_driver_count)), |
| 174 | | m_config(global_alloc_array_clear(machine_config *, s_driver_count)) |
| 135 | //------------------------------------------------- |
| 136 | // machine_start - default implementation which |
| 137 | // calls to the legacy machine_start function |
| 138 | //------------------------------------------------- |
| 139 | |
| 140 | void driver_device::machine_start() |
| 175 | 141 | { |
| 176 | | filter(string); |
| 142 | if (m_callbacks[CB_MACHINE_START] != NULL) |
| 143 | (*m_callbacks[CB_MACHINE_START])(machine()); |
| 177 | 144 | } |
| 178 | 145 | |
| 179 | 146 | |
| 180 | | driver_enumerator::driver_enumerator(emu_options &options, const game_driver &driver) |
| 181 | | : m_current(-1), |
| 182 | | m_filtered_count(0), |
| 183 | | m_options(options), |
| 184 | | m_included(global_alloc_array(UINT8, s_driver_count)), |
| 185 | | m_config(global_alloc_array_clear(machine_config *, s_driver_count)) |
| 147 | //------------------------------------------------- |
| 148 | // sound_start - default implementation which |
| 149 | // calls to the legacy sound_start function |
| 150 | //------------------------------------------------- |
| 151 | |
| 152 | void driver_device::sound_start() |
| 186 | 153 | { |
| 187 | | filter(driver); |
| 154 | if (m_callbacks[CB_SOUND_START] != NULL) |
| 155 | (*m_callbacks[CB_SOUND_START])(machine()); |
| 188 | 156 | } |
| 189 | 157 | |
| 190 | 158 | |
| 191 | 159 | //------------------------------------------------- |
| 192 | | // ~driver_enumerator - destructor |
| 160 | // video_start - default implementation which |
| 161 | // calls to the legacy video_start function |
| 193 | 162 | //------------------------------------------------- |
| 194 | 163 | |
| 195 | | driver_enumerator::~driver_enumerator() |
| 164 | void driver_device::video_start() |
| 196 | 165 | { |
| 197 | | // free any configs |
| 198 | | for (int index = 0; index < s_driver_count; index++) |
| 199 | | global_free(m_config[index]); |
| 200 | | |
| 201 | | // free the arrays |
| 202 | | global_free(m_included); |
| 203 | | global_free(m_config); |
| 166 | if (m_callbacks[CB_VIDEO_START] != NULL) |
| 167 | (*m_callbacks[CB_VIDEO_START])(machine()); |
| 204 | 168 | } |
| 205 | 169 | |
| 206 | 170 | |
| 207 | 171 | //------------------------------------------------- |
| 208 | | // config - return a machine_config for the given |
| 209 | | // driver, allocating on demand if needed |
| 172 | // driver_reset - default implementation which |
| 173 | // does nothing |
| 210 | 174 | //------------------------------------------------- |
| 211 | 175 | |
| 212 | | machine_config &driver_enumerator::config(int index, emu_options &options) const |
| 176 | void driver_device::driver_reset() |
| 213 | 177 | { |
| 214 | | assert(index >= 0 && index < s_driver_count); |
| 215 | | |
| 216 | | // if we don't have it cached, add it |
| 217 | | if (m_config[index] == NULL) |
| 218 | | { |
| 219 | | // if our cache is full, release the head entry |
| 220 | | if (m_config_cache.count() == CONFIG_CACHE_COUNT) |
| 221 | | { |
| 222 | | config_entry *first = m_config_cache.first(); |
| 223 | | m_config[first->index()] = NULL; |
| 224 | | m_config_cache.remove(*first); |
| 225 | | } |
| 226 | | |
| 227 | | // allocate the config and add it to the end of the list |
| 228 | | machine_config *config = m_config[index] = global_alloc(machine_config(*s_drivers_sorted[index], options)); |
| 229 | | m_config_cache.append(*global_alloc(config_entry(*config, index))); |
| 230 | | } |
| 231 | | return *m_config[index]; |
| 232 | 178 | } |
| 233 | 179 | |
| 234 | 180 | |
| 235 | 181 | //------------------------------------------------- |
| 236 | | // filter - filter the driver list against the |
| 237 | | // given string |
| 182 | // machine_reset - default implementation which |
| 183 | // calls to the legacy machine_reset function |
| 238 | 184 | //------------------------------------------------- |
| 239 | 185 | |
| 240 | | int driver_enumerator::filter(const char *filterstring) |
| 186 | void driver_device::machine_reset() |
| 241 | 187 | { |
| 242 | | // reset the count |
| 243 | | exclude_all(); |
| 244 | | |
| 245 | | // match name against each driver in the list |
| 246 | | for (int index = 0; index < s_driver_count; index++) |
| 247 | | if (matches(filterstring, s_drivers_sorted[index]->name)) |
| 248 | | include(index); |
| 249 | | |
| 250 | | return m_filtered_count; |
| 188 | if (m_callbacks[CB_MACHINE_RESET] != NULL) |
| 189 | (*m_callbacks[CB_MACHINE_RESET])(machine()); |
| 251 | 190 | } |
| 252 | 191 | |
| 253 | 192 | |
| 254 | 193 | //------------------------------------------------- |
| 255 | | // filter - filter the driver list against the |
| 256 | | // given driver |
| 194 | // sound_reset - default implementation which |
| 195 | // calls to the legacy sound_reset function |
| 257 | 196 | //------------------------------------------------- |
| 258 | 197 | |
| 259 | | int driver_enumerator::filter(const game_driver &driver) |
| 198 | void driver_device::sound_reset() |
| 260 | 199 | { |
| 261 | | // reset the count |
| 262 | | exclude_all(); |
| 263 | | |
| 264 | | // match name against each driver in the list |
| 265 | | for (int index = 0; index < s_driver_count; index++) |
| 266 | | if (s_drivers_sorted[index] == &driver) |
| 267 | | include(index); |
| 268 | | |
| 269 | | return m_filtered_count; |
| 200 | if (m_callbacks[CB_SOUND_RESET] != NULL) |
| 201 | (*m_callbacks[CB_SOUND_RESET])(machine()); |
| 270 | 202 | } |
| 271 | 203 | |
| 272 | 204 | |
| 273 | 205 | //------------------------------------------------- |
| 274 | | // include_all - include all non-internal drivers |
| 206 | // video_reset - default implementation which |
| 207 | // calls to the legacy video_reset function |
| 275 | 208 | //------------------------------------------------- |
| 276 | 209 | |
| 277 | | void driver_enumerator::include_all() |
| 210 | void driver_device::video_reset() |
| 278 | 211 | { |
| 279 | | memset(m_included, 1, sizeof(m_included[0]) * s_driver_count); m_filtered_count = s_driver_count; |
| 280 | | int empty = find("___empty"); |
| 281 | | assert(empty != -1); |
| 282 | | m_included[empty] = 0; |
| 212 | if (m_callbacks[CB_VIDEO_RESET] != NULL) |
| 213 | (*m_callbacks[CB_VIDEO_RESET])(machine()); |
| 283 | 214 | } |
| 284 | 215 | |
| 285 | 216 | |
| 286 | 217 | //------------------------------------------------- |
| 287 | | // next - get the next driver matching the given |
| 288 | | // filter |
| 218 | // device_rom_region - return a pointer to the |
| 219 | // game's ROMs |
| 289 | 220 | //------------------------------------------------- |
| 290 | 221 | |
| 291 | | bool driver_enumerator::next() |
| 222 | const rom_entry *driver_device::device_rom_region() const |
| 292 | 223 | { |
| 293 | | // always advance one |
| 294 | | m_current++; |
| 295 | | |
| 296 | | // if we have a filter, scan forward to the next match |
| 297 | | while (m_current < s_driver_count) |
| 298 | | { |
| 299 | | if (m_included[m_current]) |
| 300 | | break; |
| 301 | | m_current++; |
| 302 | | } |
| 303 | | |
| 304 | | // return true if we end up in range |
| 305 | | return (m_current >= 0 && m_current < s_driver_count); |
| 224 | return m_system->rom; |
| 306 | 225 | } |
| 307 | 226 | |
| 308 | 227 | |
| 309 | 228 | //------------------------------------------------- |
| 310 | | // next_excluded - get the next driver that is |
| 311 | | // not currently included in the list |
| 229 | // device_input_ports - return a pointer to the |
| 230 | // game's input ports |
| 312 | 231 | //------------------------------------------------- |
| 313 | 232 | |
| 314 | | bool driver_enumerator::next_excluded() |
| 233 | ioport_constructor driver_device::device_input_ports() const |
| 315 | 234 | { |
| 316 | | // always advance one |
| 317 | | m_current++; |
| 318 | | |
| 319 | | // if we have a filter, scan forward to the next match |
| 320 | | while (m_current < s_driver_count) |
| 321 | | { |
| 322 | | if (!m_included[m_current]) |
| 323 | | break; |
| 324 | | m_current++; |
| 325 | | } |
| 326 | | |
| 327 | | // return true if we end up in range |
| 328 | | return (m_current >= 0 && m_current < s_driver_count); |
| 235 | return m_system->ipt; |
| 329 | 236 | } |
| 330 | 237 | |
| 331 | 238 | |
| 332 | 239 | //------------------------------------------------- |
| 333 | | // driver_sort_callback - compare two items in |
| 334 | | // an array of game_driver pointers |
| 240 | // device_start - device override which calls |
| 241 | // the various helpers |
| 335 | 242 | //------------------------------------------------- |
| 336 | 243 | |
| 337 | | void driver_enumerator::find_approximate_matches(const char *string, int count, int *results) |
| 244 | void driver_device::device_start() |
| 338 | 245 | { |
| 339 | | #undef rand |
| 246 | // reschedule ourselves to be last |
| 247 | device_iterator iter(*this); |
| 248 | for (device_t *test = iter.first(); test != NULL; test = iter.next()) |
| 249 | if (test != this && !test->started()) |
| 250 | throw device_missing_dependencies(); |
| 340 | 251 | |
| 341 | | // if no name, pick random entries |
| 342 | | if (string == NULL || string[0] == 0) |
| 343 | | { |
| 344 | | // seed the RNG first |
| 345 | | srand(osd_ticks()); |
| 252 | // call the game-specific init |
| 253 | if (m_system->driver_init != NULL) |
| 254 | (*m_system->driver_init)(machine()); |
| 346 | 255 | |
| 347 | | // allocate a temporary list |
| 348 | | int *templist = global_alloc_array(int, m_filtered_count); |
| 349 | | int arrayindex = 0; |
| 350 | | for (int index = 0; index < s_driver_count; index++) |
| 351 | | if (m_included[index]) |
| 352 | | templist[arrayindex++] = index; |
| 353 | | assert(arrayindex == m_filtered_count); |
| 256 | // finish image devices init process |
| 257 | image_postdevice_init(machine()); |
| 354 | 258 | |
| 355 | | // shuffle |
| 356 | | for (int shufnum = 0; shufnum < 4 * s_driver_count; shufnum++) |
| 357 | | { |
| 358 | | int item1 = rand() % m_filtered_count; |
| 359 | | int item2 = rand() % m_filtered_count; |
| 360 | | int temp = templist[item1]; |
| 361 | | templist[item1] = templist[item2]; |
| 362 | | templist[item2] = temp; |
| 363 | | } |
| 259 | // call palette_init if present |
| 260 | if (m_palette_init != NULL) |
| 261 | (*m_palette_init)(machine(), machine().region("proms")->base()); |
| 364 | 262 | |
| 365 | | // copy out the first few entries |
| 366 | | for (int matchnum = 0; matchnum < count; matchnum++) |
| 367 | | results[matchnum] = templist[matchnum % m_filtered_count]; |
| 368 | | |
| 369 | | global_free(templist); |
| 370 | | return; |
| 371 | | } |
| 372 | | |
| 373 | | // allocate memory to track the penalty value |
| 374 | | int *penalty = global_alloc_array(int, count); |
| 375 | | |
| 376 | | // initialize everyone's states |
| 377 | | for (int matchnum = 0; matchnum < count; matchnum++) |
| 378 | | { |
| 379 | | penalty[matchnum] = 9999; |
| 380 | | results[matchnum] = -1; |
| 381 | | } |
| 382 | | |
| 383 | | // scan the entire drivers array |
| 384 | | for (int index = 0; index < s_driver_count; index++) |
| 385 | | if (m_included[index]) |
| 386 | | { |
| 387 | | // skip things that can't run |
| 388 | | if ((s_drivers_sorted[index]->flags & GAME_NO_STANDALONE) != 0) |
| 389 | | continue; |
| 390 | | |
| 391 | | // pick the best match between driver name and description |
| 392 | | int curpenalty = penalty_compare(string, s_drivers_sorted[index]->description); |
| 393 | | int tmp = penalty_compare(string, s_drivers_sorted[index]->name); |
| 394 | | curpenalty = MIN(curpenalty, tmp); |
| 395 | | |
| 396 | | // insert into the sorted table of matches |
| 397 | | for (int matchnum = count - 1; matchnum >= 0; matchnum--) |
| 398 | | { |
| 399 | | // stop if we're worse than the current entry |
| 400 | | if (curpenalty >= penalty[matchnum]) |
| 401 | | break; |
| 402 | | |
| 403 | | // as long as this isn't the last entry, bump this one down |
| 404 | | if (matchnum < count - 1) |
| 405 | | { |
| 406 | | penalty[matchnum + 1] = penalty[matchnum]; |
| 407 | | results[matchnum + 1] = results[matchnum]; |
| 408 | | } |
| 409 | | results[matchnum] = index; |
| 410 | | penalty[matchnum] = curpenalty; |
| 411 | | } |
| 412 | | } |
| 413 | | |
| 414 | | // free our temp memory |
| 415 | | global_free(penalty); |
| 263 | // start the various pieces |
| 264 | driver_start(); |
| 265 | machine_start(); |
| 266 | sound_start(); |
| 267 | video_start(); |
| 416 | 268 | } |
| 417 | 269 | |
| 418 | 270 | |
| 419 | | driver_enumerator::config_entry::config_entry(machine_config &config, int index) |
| 420 | | : m_next(NULL), |
| 421 | | m_config(&config), |
| 422 | | m_index(index) |
| 423 | | { |
| 424 | | } |
| 271 | //------------------------------------------------- |
| 272 | // device_reset_after_children - device override |
| 273 | // which calls the various helpers; must happen |
| 274 | // after all child devices are reset |
| 275 | //------------------------------------------------- |
| 425 | 276 | |
| 426 | | |
| 427 | | driver_enumerator::config_entry::~config_entry() |
| 277 | void driver_device::device_reset_after_children() |
| 428 | 278 | { |
| 429 | | global_free(m_config); |
| 279 | // reset each piece |
| 280 | driver_reset(); |
| 281 | machine_reset(); |
| 282 | sound_reset(); |
| 283 | video_reset(); |
| 430 | 284 | } |
src/emu/driver.h
| r14862 | r14863 | |
| 2 | 2 | |
| 3 | 3 | driver.h |
| 4 | 4 | |
| 5 | | Driver enumeration helpers. |
| 5 | Core driver device base class. |
| 6 | 6 | |
| 7 | 7 | **************************************************************************** |
| 8 | 8 | |
| r14862 | r14863 | |
| 47 | 47 | #define __DRIVER_H__ |
| 48 | 48 | |
| 49 | 49 | |
| 50 | | /*************************************************************************** |
| 51 | | CONSTANTS |
| 52 | | ***************************************************************************/ |
| 50 | //************************************************************************** |
| 51 | // TYPE DEFINITIONS |
| 52 | //************************************************************************** |
| 53 | 53 | |
| 54 | | /* maxima */ |
| 55 | | #define MAX_DRIVER_NAME_CHARS 8 |
| 56 | 54 | |
| 55 | // ======================> driver_device |
| 57 | 56 | |
| 58 | | |
| 59 | | /* ----- flags for game drivers ----- */ |
| 60 | | |
| 61 | | #define ORIENTATION_MASK 0x00000007 |
| 62 | | #define GAME_NOT_WORKING 0x00000008 |
| 63 | | #define GAME_UNEMULATED_PROTECTION 0x00000010 /* game's protection not fully emulated */ |
| 64 | | #define GAME_WRONG_COLORS 0x00000020 /* colors are totally wrong */ |
| 65 | | #define GAME_IMPERFECT_COLORS 0x00000040 /* colors are not 100% accurate, but close */ |
| 66 | | #define GAME_IMPERFECT_GRAPHICS 0x00000080 /* graphics are wrong/incomplete */ |
| 67 | | #define GAME_NO_COCKTAIL 0x00000100 /* screen flip support is missing */ |
| 68 | | #define GAME_NO_SOUND 0x00000200 /* sound is missing */ |
| 69 | | #define GAME_IMPERFECT_SOUND 0x00000400 /* sound is known to be wrong */ |
| 70 | | #define GAME_SUPPORTS_SAVE 0x00000800 /* game supports save states */ |
| 71 | | #define GAME_IS_BIOS_ROOT 0x00001000 /* this driver entry is a BIOS root */ |
| 72 | | #define GAME_NO_STANDALONE 0x00002000 /* this driver cannot stand alone */ |
| 73 | | #define GAME_REQUIRES_ARTWORK 0x00004000 /* the driver requires external artwork for key elements of the game */ |
| 74 | | #define GAME_UNOFFICIAL 0x00008000 /* unofficial hardware change */ |
| 75 | | #define GAME_NO_SOUND_HW 0x00010000 /* sound hardware not available */ |
| 76 | | #define GAME_MECHANICAL 0x00020000 /* contains mechanical parts (pinball, redemption games,...) */ |
| 77 | | #define GAME_IS_SKELETON 0x00000208 /* mask for skelly games */ |
| 78 | | #define GAME_IS_SKELETON_MECHANICAL 0x00024208 /* mask for skelly mechanical games */ |
| 79 | | #define GAME_TYPE_ARCADE 0x00040000 /* arcade machine (coin operated machines) */ |
| 80 | | #define GAME_TYPE_CONSOLE 0x00080000 /* console system */ |
| 81 | | #define GAME_TYPE_COMPUTER 0x00100000 /* any kind of computer including home computers, minis, calcs,... */ |
| 82 | | #define GAME_TYPE_OTHER 0x00200000 /* any other emulated system that doesn't fit above (ex. clock, satelite receiver,...) */ |
| 83 | | |
| 84 | | /* ----- flags to return from video_update ----- */ |
| 85 | | #define UPDATE_HAS_NOT_CHANGED 0x0001 /* the video has not changed */ |
| 86 | | |
| 87 | | |
| 88 | | |
| 89 | | /*************************************************************************** |
| 90 | | TYPE DEFINITIONS |
| 91 | | ***************************************************************************/ |
| 92 | | |
| 93 | | typedef void (*driver_init_func)(running_machine &machine); |
| 94 | | |
| 95 | | |
| 96 | | struct game_driver |
| 57 | // base class for machine driver-specific devices |
| 58 | class driver_device : public device_t |
| 97 | 59 | { |
| 98 | | const char * source_file; /* set this to __FILE__ */ |
| 99 | | const char * parent; /* if this is a clone, the name of the parent */ |
| 100 | | const char * name; /* short (8-character) name of the game */ |
| 101 | | const char * description; /* full name of the game */ |
| 102 | | const char * year; /* year the game was released */ |
| 103 | | const char * manufacturer; /* manufacturer of the game */ |
| 104 | | machine_config_constructor machine_config; /* machine driver tokens */ |
| 105 | | ioport_constructor ipt; /* pointer to array of input port tokens */ |
| 106 | | void (*driver_init)(running_machine &machine); /* DRIVER_INIT callback */ |
| 107 | | const rom_entry * rom; /* pointer to list of ROMs for the game */ |
| 108 | | const char * compatible_with; |
| 109 | | UINT32 flags; /* orientation and other flags; see defines below */ |
| 110 | | const char * default_layout; /* default internally defined layout */ |
| 111 | | }; |
| 112 | | |
| 113 | | |
| 114 | | // driver_list is a purely static class that wraps the global driver list |
| 115 | | class driver_list |
| 116 | | { |
| 117 | | DISABLE_COPYING(driver_list); |
| 118 | | |
| 119 | | protected: |
| 60 | public: |
| 120 | 61 | // construction/destruction |
| 121 | | driver_list(); |
| 62 | driver_device(const machine_config &mconfig, device_type type, const char *tag); |
| 63 | virtual ~driver_device(); |
| 122 | 64 | |
| 123 | | public: |
| 124 | | // getters |
| 125 | | static int total() { return s_driver_count; } |
| 65 | // indexes into our generic callbacks |
| 66 | enum callback_type |
| 67 | { |
| 68 | CB_MACHINE_START, |
| 69 | CB_MACHINE_RESET, |
| 70 | CB_SOUND_START, |
| 71 | CB_SOUND_RESET, |
| 72 | CB_VIDEO_START, |
| 73 | CB_VIDEO_RESET, |
| 74 | CB_COUNT |
| 75 | }; |
| 126 | 76 | |
| 127 | | // any item by index |
| 128 | | static const game_driver &driver(int index) { assert(index >= 0 && index < s_driver_count); return *s_drivers_sorted[index]; } |
| 129 | | static int clone(int index) { return find(driver(index).parent); } |
| 130 | | static int non_bios_clone(int index) { int result = find(driver(index).parent); return (result != -1 && (driver(result).flags & GAME_IS_BIOS_ROOT) == 0) ? result : -1; } |
| 131 | | static int compatible_with(int index) { return find(driver(index).compatible_with); } |
| 77 | // inline configuration helpers |
| 78 | static void static_set_game(device_t &device, const game_driver &game); |
| 79 | static void static_set_callback(device_t &device, callback_type type, legacy_callback_func callback); |
| 80 | static void static_set_palette_init(device_t &device, palette_init_func callback); |
| 132 | 81 | |
| 133 | | // any item by driver |
| 134 | | static int clone(const game_driver &driver) { int index = find(driver); assert(index != -1); return clone(index); } |
| 135 | | static int non_bios_clone(const game_driver &driver) { int index = find(driver); assert(index != -1); return non_bios_clone(index); } |
| 136 | | static int compatible_with(const game_driver &driver) { int index = find(driver); assert(index != -1); return compatible_with(index); } |
| 82 | // generic helpers |
| 137 | 83 | |
| 138 | | // general helpers |
| 139 | | static int find(const char *name); |
| 140 | | static int find(const game_driver &driver) { return find(driver.name); } |
| 84 | // watchdog read/write handlers |
| 85 | DECLARE_WRITE8_MEMBER( watchdog_reset_w ); |
| 86 | DECLARE_READ8_MEMBER( watchdog_reset_r ); |
| 87 | DECLARE_WRITE16_MEMBER( watchdog_reset16_w ); |
| 88 | DECLARE_READ16_MEMBER( watchdog_reset16_r ); |
| 89 | DECLARE_WRITE32_MEMBER( watchdog_reset32_w ); |
| 90 | DECLARE_READ32_MEMBER( watchdog_reset32_r ); |
| 141 | 91 | |
| 142 | | // static helpers |
| 143 | | static bool matches(const char *wildstring, const char *string); |
| 92 | // sound latch readers |
| 93 | DECLARE_READ8_MEMBER( soundlatch_r ); |
| 94 | DECLARE_READ8_MEMBER( soundlatch2_r ); |
| 95 | DECLARE_READ8_MEMBER( soundlatch3_r ); |
| 96 | DECLARE_READ8_MEMBER( soundlatch4_r ); |
| 97 | DECLARE_READ16_MEMBER( soundlatch_word_r ); |
| 98 | DECLARE_READ16_MEMBER( soundlatch2_word_r ); |
| 99 | DECLARE_READ16_MEMBER( soundlatch3_word_r ); |
| 100 | DECLARE_READ16_MEMBER( soundlatch4_word_r ); |
| 144 | 101 | |
| 145 | | protected: |
| 146 | | // internal helpers |
| 147 | | static int driver_sort_callback(const void *elem1, const void *elem2); |
| 148 | | static int penalty_compare(const char *source, const char *target); |
| 102 | // sound latch writers |
| 103 | DECLARE_WRITE8_MEMBER( soundlatch_w ); |
| 104 | DECLARE_WRITE8_MEMBER( soundlatch2_w ); |
| 105 | DECLARE_WRITE8_MEMBER( soundlatch3_w ); |
| 106 | DECLARE_WRITE8_MEMBER( soundlatch4_w ); |
| 107 | DECLARE_WRITE16_MEMBER( soundlatch_word_w ); |
| 108 | DECLARE_WRITE16_MEMBER( soundlatch2_word_w ); |
| 109 | DECLARE_WRITE16_MEMBER( soundlatch3_word_w ); |
| 110 | DECLARE_WRITE16_MEMBER( soundlatch4_word_w ); |
| 149 | 111 | |
| 150 | | // internal state |
| 151 | | static int s_driver_count; |
| 152 | | static const game_driver * const s_drivers_sorted[]; |
| 153 | | }; |
| 112 | // sound latch clearers |
| 113 | DECLARE_WRITE8_MEMBER( soundlatch_clear_w ); |
| 114 | DECLARE_WRITE8_MEMBER( soundlatch2_clear_w ); |
| 115 | DECLARE_WRITE8_MEMBER( soundlatch3_clear_w ); |
| 116 | DECLARE_WRITE8_MEMBER( soundlatch4_clear_w ); |
| 117 | |
| 118 | // general palette helpers |
| 119 | void set_color_332(pen_t color, int rshift, int gshift, int bshift, UINT32 data); |
| 120 | void set_color_444(pen_t color, int rshift, int gshift, int bshift, UINT32 data); |
| 121 | void set_color_555(pen_t color, int rshift, int gshift, int bshift, UINT32 data); |
| 122 | void set_color_565(pen_t color, int rshift, int gshift, int bshift, UINT32 data); |
| 123 | void set_color_888(pen_t color, int rshift, int gshift, int bshift, UINT32 data); |
| 124 | void set_color_4444(pen_t color, int ishift, int rshift, int gshift, int bshift, UINT16 data); |
| 154 | 125 | |
| 126 | // 3-3-2 RGB palette write handlers |
| 127 | DECLARE_WRITE8_MEMBER( paletteram_BBGGGRRR_w ); |
| 128 | DECLARE_WRITE8_MEMBER( paletteram_RRRGGGBB_w ); |
| 129 | DECLARE_WRITE8_MEMBER( paletteram_BBGGRRII_w ); |
| 130 | DECLARE_WRITE8_MEMBER( paletteram_IIBBGGRR_w ); |
| 155 | 131 | |
| 156 | | // driver_enumerator enables efficient iteration through the driver list |
| 157 | | class driver_enumerator : public driver_list |
| 158 | | { |
| 159 | | DISABLE_COPYING(driver_enumerator); |
| 132 | // 4-4-4 RGB palette write handlers |
| 133 | DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_le_w ); |
| 134 | DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_be_w ); |
| 135 | DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_split1_w ); // uses paletteram |
| 136 | DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBGGGGRRRR_split2_w ); // uses paletteram2 |
| 137 | DECLARE_WRITE16_MEMBER( paletteram16_xxxxBBBBGGGGRRRR_word_w ); |
| 160 | 138 | |
| 161 | | public: |
| 162 | | // construction/destruction |
| 163 | | driver_enumerator(emu_options &options); |
| 164 | | driver_enumerator(emu_options &options, const char *filter); |
| 165 | | driver_enumerator(emu_options &options, const game_driver &filter); |
| 166 | | ~driver_enumerator(); |
| 139 | DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_le_w ); |
| 140 | DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_be_w ); |
| 141 | DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_split1_w ); // uses paletteram |
| 142 | DECLARE_WRITE8_MEMBER( paletteram_xxxxBBBBRRRRGGGG_split2_w ); // uses paletteram2 |
| 143 | DECLARE_WRITE16_MEMBER( paletteram16_xxxxBBBBRRRRGGGG_word_w ); |
| 167 | 144 | |
| 168 | | // getters |
| 169 | | int count() const { return m_filtered_count; } |
| 170 | | int current() const { return m_current; } |
| 171 | | emu_options &options() const { return m_options; } |
| 145 | DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRBBBBGGGG_split1_w ); // uses paletteram |
| 146 | DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRBBBBGGGG_split2_w ); // uses paletteram2 |
| 172 | 147 | |
| 173 | | // current item |
| 174 | | const game_driver &driver() const { return driver_list::driver(m_current); } |
| 175 | | machine_config &config() const { return config(m_current, m_options); } |
| 176 | | int clone() { return driver_list::clone(m_current); } |
| 177 | | int non_bios_clone() { return driver_list::non_bios_clone(m_current); } |
| 178 | | int compatible_with() { return driver_list::compatible_with(m_current); } |
| 179 | | void include() { include(m_current); } |
| 180 | | void exclude() { exclude(m_current); } |
| 148 | DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_le_w ); |
| 149 | DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_be_w ); |
| 150 | DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_split1_w ); // uses paletteram |
| 151 | DECLARE_WRITE8_MEMBER( paletteram_xxxxRRRRGGGGBBBB_split2_w ); // uses paletteram2 |
| 152 | DECLARE_WRITE16_MEMBER( paletteram16_xxxxRRRRGGGGBBBB_word_w ); |
| 181 | 153 | |
| 182 | | // any item by index |
| 183 | | bool included(int index) const { assert(index >= 0 && index < s_driver_count); return m_included[index]; } |
| 184 | | bool excluded(int index) const { assert(index >= 0 && index < s_driver_count); return !m_included[index]; } |
| 185 | | machine_config &config(int index) const { return config(index,m_options); } |
| 186 | | machine_config &config(int index, emu_options &options) const; |
| 187 | | void include(int index) { assert(index >= 0 && index < s_driver_count); if (!m_included[index]) { m_included[index] = true; m_filtered_count++; } } |
| 188 | | void exclude(int index) { assert(index >= 0 && index < s_driver_count); if (m_included[index]) { m_included[index] = false; m_filtered_count--; } } |
| 189 | | using driver_list::driver; |
| 190 | | using driver_list::clone; |
| 191 | | using driver_list::non_bios_clone; |
| 192 | | using driver_list::compatible_with; |
| 154 | DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_be_w ); |
| 155 | DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_split1_w ); // uses paletteram |
| 156 | DECLARE_WRITE8_MEMBER( paletteram_RRRRGGGGBBBBxxxx_split2_w ); // uses paletteram2 |
| 157 | DECLARE_WRITE16_MEMBER( paletteram16_RRRRGGGGBBBBxxxx_word_w ); |
| 193 | 158 | |
| 194 | | // filtering/iterating |
| 195 | | int filter(const char *string = NULL); |
| 196 | | int filter(const game_driver &driver); |
| 197 | | void include_all(); |
| 198 | | void exclude_all() { memset(m_included, 0, sizeof(m_included[0]) * s_driver_count); m_filtered_count = 0; } |
| 199 | | void reset() { m_current = -1; } |
| 200 | | bool next(); |
| 201 | | bool next_excluded(); |
| 159 | // 4-4-4-4 IRGB palette write handlers |
| 160 | DECLARE_WRITE16_MEMBER( paletteram16_IIIIRRRRGGGGBBBB_word_w ); |
| 161 | DECLARE_WRITE16_MEMBER( paletteram16_RRRRGGGGBBBBIIII_word_w ); |
| 202 | 162 | |
| 203 | | // general helpers |
| 204 | | void set_current(int index) { assert(index >= -1 && index <= s_driver_count); m_current = index; } |
| 205 | | void find_approximate_matches(const char *string, int count, int *results); |
| 163 | // 5-5-5 RGB palette write handlers |
| 164 | DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_le_w ); |
| 165 | DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_be_w ); |
| 166 | DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_split1_w ); // uses paletteram |
| 167 | DECLARE_WRITE8_MEMBER( paletteram_xBBBBBGGGGGRRRRR_split2_w ); // uses paletteram2 |
| 168 | DECLARE_WRITE16_MEMBER( paletteram16_xBBBBBGGGGGRRRRR_word_w ); |
| 206 | 169 | |
| 207 | | private: |
| 208 | | // entry in the config cache |
| 209 | | struct config_entry |
| 210 | | { |
| 211 | | friend class simple_list<config_entry>; |
| 170 | DECLARE_WRITE8_MEMBER( paletteram_xBBBBBRRRRRGGGGG_split1_w ); // uses paletteram |
| 171 | DECLARE_WRITE8_MEMBER( paletteram_xBBBBBRRRRRGGGGG_split2_w ); // uses paletteram2 |
| 212 | 172 | |
| 213 | | public: |
| 214 | | // construction/destruction |
| 215 | | config_entry(machine_config &config, int index); |
| 216 | | ~config_entry(); |
| 173 | DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_le_w ); |
| 174 | DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_be_w ); |
| 175 | DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_split1_w ); |
| 176 | DECLARE_WRITE8_MEMBER( paletteram_xRRRRRGGGGGBBBBB_split2_w ); |
| 177 | DECLARE_WRITE16_MEMBER( paletteram16_xRRRRRGGGGGBBBBB_word_w ); |
| 217 | 178 | |
| 218 | | // getters |
| 219 | | config_entry *next() const { return m_next; } |
| 220 | | int index() const { return m_index; } |
| 221 | | machine_config *config() const { return m_config; } |
| 179 | DECLARE_WRITE16_MEMBER( paletteram16_xGGGGGRRRRRBBBBB_word_w ); |
| 180 | DECLARE_WRITE16_MEMBER( paletteram16_xGGGGGBBBBBRRRRR_word_w ); |
| 222 | 181 | |
| 223 | | private: |
| 224 | | // internal state |
| 225 | | config_entry * m_next; |
| 226 | | machine_config * m_config; |
| 227 | | int m_index; |
| 228 | | }; |
| 182 | DECLARE_WRITE16_MEMBER( paletteram16_RRRRRGGGGGBBBBBx_word_w ); |
| 183 | DECLARE_WRITE16_MEMBER( paletteram16_GGGGGRRRRRBBBBBx_word_w ); |
| 184 | DECLARE_WRITE16_MEMBER( paletteram16_RRRRGGGGBBBBRGBx_word_w ); |
| 229 | 185 | |
| 230 | | static const int CONFIG_CACHE_COUNT = 100; |
| 186 | // 8-8-8 RGB palette write handlers |
| 187 | DECLARE_WRITE16_MEMBER( paletteram16_xrgb_word_be_w ); |
| 188 | DECLARE_WRITE16_MEMBER( paletteram16_xbgr_word_be_w ); |
| 231 | 189 | |
| 232 | | // internal state |
| 233 | | int m_current; |
| 234 | | int m_filtered_count; |
| 235 | | emu_options & m_options; |
| 236 | | UINT8 * m_included; |
| 237 | | machine_config ** m_config; |
| 238 | | mutable simple_list<config_entry> m_config_cache; |
| 239 | | }; |
| 190 | protected: |
| 191 | // helpers called at startup |
| 192 | virtual void driver_start(); |
| 193 | virtual void machine_start(); |
| 194 | virtual void sound_start(); |
| 195 | virtual void video_start(); |
| 240 | 196 | |
| 197 | // helpers called at reset |
| 198 | virtual void driver_reset(); |
| 199 | virtual void machine_reset(); |
| 200 | virtual void sound_reset(); |
| 201 | virtual void video_reset(); |
| 241 | 202 | |
| 203 | // device-level overrides |
| 204 | virtual const rom_entry *device_rom_region() const; |
| 205 | virtual ioport_constructor device_input_ports() const; |
| 206 | virtual void device_start(); |
| 207 | virtual void device_reset_after_children(); |
| 242 | 208 | |
| 243 | | /*************************************************************************** |
| 244 | | MACROS FOR BUILDING GAME DRIVERS |
| 245 | | ***************************************************************************/ |
| 209 | // internal helpers |
| 210 | inline UINT16 paletteram16_le(offs_t offset) const { return m_generic_paletteram_8[offset & ~1] | (m_generic_paletteram_8[offset | 1] << 8); } |
| 211 | inline UINT16 paletteram16_be(offs_t offset) const { return m_generic_paletteram_8[offset | 1] | (m_generic_paletteram_8[offset & ~1] << 8); } |
| 212 | inline UINT16 paletteram16_split(offs_t offset) const { return m_generic_paletteram_8[offset] | (m_generic_paletteram2_8[offset] << 8); } |
| 213 | inline UINT32 paletteram32_be(offs_t offset) const { return m_generic_paletteram_16[offset | 1] | (m_generic_paletteram_16[offset & ~1] << 16); } |
| 246 | 214 | |
| 215 | // internal state |
| 216 | const game_driver * m_system; // pointer to the game driver |
| 247 | 217 | |
| 248 | | #define DRIVER_INIT_NAME(name) driver_init_##name |
| 249 | | #define DRIVER_INIT(name) void DRIVER_INIT_NAME(name)(running_machine &machine) |
| 250 | | #define DRIVER_INIT_CALL(name) DRIVER_INIT_NAME(name)(machine) |
| 218 | legacy_callback_func m_callbacks[CB_COUNT]; // generic legacy callbacks |
| 219 | palette_init_func m_palette_init; // one-time palette init callback |
| 251 | 220 | |
| 252 | | #define driver_init_0 NULL |
| 253 | | |
| 254 | | |
| 255 | | #define GAME_NAME(name) driver_##name |
| 256 | | #define GAME_EXTERN(name) extern const game_driver GAME_NAME(name) |
| 257 | | |
| 258 | | #define GAME(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS) \ |
| 259 | | GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,((const char *)0)) |
| 260 | | |
| 261 | | #define GAMEL(YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS,LAYOUT) \ |
| 262 | | extern const game_driver GAME_NAME(NAME) = \ |
| 263 | | { \ |
| 264 | | __FILE__, \ |
| 265 | | #PARENT, \ |
| 266 | | #NAME, \ |
| 267 | | FULLNAME, \ |
| 268 | | #YEAR, \ |
| 269 | | COMPANY, \ |
| 270 | | MACHINE_CONFIG_NAME(MACHINE), \ |
| 271 | | INPUT_PORTS_NAME(INPUT), \ |
| 272 | | DRIVER_INIT_NAME(INIT), \ |
| 273 | | ROM_NAME(NAME), \ |
| 274 | | NULL, \ |
| 275 | | (MONITOR)|(FLAGS)|GAME_TYPE_ARCADE, \ |
| 276 | | &LAYOUT[0] \ |
| 221 | public: |
| 222 | // generic pointers |
| 223 | optional_shared_ptr<UINT8> m_generic_paletteram_8; |
| 224 | optional_shared_ptr<UINT8> m_generic_paletteram2_8; |
| 225 | optional_shared_ptr<UINT16> m_generic_paletteram_16; |
| 226 | optional_shared_ptr<UINT16> m_generic_paletteram2_16; |
| 227 | optional_shared_ptr<UINT32> m_generic_paletteram_32; |
| 228 | optional_shared_ptr<UINT32> m_generic_paletteram2_32; |
| 277 | 229 | }; |
| 278 | 230 | |
| 279 | | #define CONS(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,INIT,COMPANY,FULLNAME,FLAGS) \ |
| 280 | | extern const game_driver GAME_NAME(NAME) = \ |
| 281 | | { \ |
| 282 | | __FILE__, \ |
| 283 | | #PARENT, \ |
| 284 | | #NAME, \ |
| 285 | | FULLNAME, \ |
| 286 | | #YEAR, \ |
| 287 | | COMPANY, \ |
| 288 | | MACHINE_CONFIG_NAME(MACHINE), \ |
| 289 | | INPUT_PORTS_NAME(INPUT), \ |
| 290 | | DRIVER_INIT_NAME(INIT), \ |
| 291 | | ROM_NAME(NAME), \ |
| 292 | | #COMPAT, \ |
| 293 | | ROT0|(FLAGS)|GAME_TYPE_CONSOLE, \ |
| 294 | | NULL \ |
| 295 | | }; |
| 296 | 231 | |
| 297 | | #define COMP(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,INIT,COMPANY,FULLNAME,FLAGS) \ |
| 298 | | extern const game_driver GAME_NAME(NAME) = \ |
| 299 | | { \ |
| 300 | | __FILE__, \ |
| 301 | | #PARENT, \ |
| 302 | | #NAME, \ |
| 303 | | FULLNAME, \ |
| 304 | | #YEAR, \ |
| 305 | | COMPANY, \ |
| 306 | | MACHINE_CONFIG_NAME(MACHINE), \ |
| 307 | | INPUT_PORTS_NAME(INPUT), \ |
| 308 | | DRIVER_INIT_NAME(INIT), \ |
| 309 | | ROM_NAME(NAME), \ |
| 310 | | #COMPAT, \ |
| 311 | | ROT0|(FLAGS)|GAME_TYPE_COMPUTER, \ |
| 312 | | NULL \ |
| 313 | | }; |
| 232 | // this template function creates a stub which constructs a device |
| 233 | template<class _DriverClass> |
| 234 | device_t *driver_device_creator(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 235 | { |
| 236 | assert(owner == NULL); |
| 237 | assert(clock == 0); |
| 238 | return global_alloc_clear(_DriverClass(mconfig, &driver_device_creator<_DriverClass>, tag)); |
| 239 | } |
| 314 | 240 | |
| 315 | | #define SYST(YEAR,NAME,PARENT,COMPAT,MACHINE,INPUT,INIT,COMPANY,FULLNAME,FLAGS) \ |
| 316 | | extern const game_driver GAME_NAME(NAME) = \ |
| 317 | | { \ |
| 318 | | __FILE__, \ |
| 319 | | #PARENT, \ |
| 320 | | #NAME, \ |
| 321 | | FULLNAME, \ |
| 322 | | #YEAR, \ |
| 323 | | COMPANY, \ |
| 324 | | MACHINE_CONFIG_NAME(MACHINE), \ |
| 325 | | INPUT_PORTS_NAME(INPUT), \ |
| 326 | | DRIVER_INIT_NAME(INIT), \ |
| 327 | | ROM_NAME(NAME), \ |
| 328 | | #COMPAT, \ |
| 329 | | ROT0|(FLAGS)|GAME_TYPE_OTHER, \ |
| 330 | | NULL \ |
| 331 | | }; |
| 332 | 241 | |
| 333 | | /*************************************************************************** |
| 334 | | GLOBAL VARIABLES |
| 335 | | ***************************************************************************/ |
| 336 | | |
| 337 | | GAME_EXTERN(___empty); |
| 338 | | |
| 339 | | |
| 340 | | |
| 341 | | #endif |
| 242 | #endif /* __DRIVER_H__ */ |