trunk/src/mess/drivers/gamecom.c
| r242082 | r242083 | |
| 11 | 11 | Game Status: |
| 12 | 12 | - The DAC sound partially works, sound from ports 1,2,3 not done |
| 13 | 13 | - Inbuilt ROM and PDA functions all work |
| 14 | | - When starting a cart, the graphic of the cart going into the slot is corrupt |
| 14 | - On the screen where the cart goes into the slot there is video flicker |
| 15 | 15 | - Due to an irritating message, the NVRAM is commented out in the machine config |
| 16 | | - Cart games all have severe video issues such as flickering and nonsense gfx |
| 16 | - Most of the cart games have severe video issues such as flickering and nonsense gfx |
| 17 | 17 | - Lights Out works |
| 18 | | - Centipede works with bad flickering |
| 19 | | - Frogger works, but there are bugs on the 2nd row of cars (if you turn your |
| 20 | | frog to the right it dies, and also one car goes in reverse), and not possible |
| 21 | | to get the female frog. |
| 22 | | - Wheel of Fortune 1&2, playable although the spinner is corrupt |
| 18 | - Centipede works |
| 19 | - Wheel of Fortune 1 & 2 are working. |
| 20 | - Frogger works, but it is difficult to capture the female frog or the insect. |
| 21 | - Quiz Wiz works, but the end-of-round score doesn't show |
| 23 | 22 | - Jeopardy, playable with bad gfx |
| 24 | | - Quiz Wiz works, but the final score doesn't show |
| 25 | 23 | - Tiger Web Link & Internet, they look ok, obviously aren't going to connect to anything |
| 26 | 24 | - Williams Arcade Classics, Robotron works, the rest are no use. |
| 25 | - Monopoly is starting to show promise. It's playable but the video is terrible. |
| 27 | 26 | - The remaining carts are not functional to any useful degree. |
| 28 | 27 | |
| 29 | 28 | ***************************************************************************/ |
trunk/src/mess/machine/gamecom.c
| r242082 | r242083 | |
| 7 | 7 | |
| 8 | 8 | TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_clock_timer_callback) |
| 9 | 9 | { |
| 10 | | UINT8 * RAM = m_region_maincpu->base(); |
| 11 | | UINT8 val = RAM[SM8521_CLKT] + 1; |
| 12 | | RAM[SM8521_CLKT] = ( RAM[SM8521_CLKT] & 0xC0 ) | (val & 0x3f); |
| 10 | UINT8 val = m_p_ram[SM8521_CLKT] + 1; |
| 11 | m_p_ram[SM8521_CLKT] = ( m_p_ram[SM8521_CLKT] & 0xC0 ) | (val & 0x3f); |
| 13 | 12 | m_maincpu->set_input_line(sm8500_cpu_device::CK_INT, ASSERT_LINE ); |
| 14 | 13 | } |
| 15 | 14 | |
| r242082 | r242083 | |
| 417 | 416 | |
| 418 | 417 | /* The manual is not conclusive as to which bit of the DMVP register (offset 0x3D) determines |
| 419 | 418 | which page for source or destination is used */ |
| 420 | | /* For now the increment/decrement-x and increment/decrement-y parts are NOT supported. |
| 421 | | Their usage is also not explained properly in the manuals. Guess we'll have to wait |
| 422 | | for them to show up in some rom images... |
| 423 | | */ |
| 424 | 419 | WRITE8_MEMBER( gamecom_state::gamecom_handle_dma ) |
| 425 | 420 | { |
| 426 | | UINT8 * RAM = m_region_maincpu->base(); |
| 427 | | UINT8 dmc = RAM[SM8521_DMC]; |
| 421 | UINT8 dmc = m_p_ram[SM8521_DMC]; |
| 428 | 422 | m_dma.overwrite_mode = dmc & 0x01; |
| 429 | 423 | m_dma.transfer_mode = dmc & 0x06; |
| 430 | 424 | m_dma.decrement_x = dmc & 0x08; |
| r242082 | r242083 | |
| 435 | 429 | return; |
| 436 | 430 | } |
| 437 | 431 | |
| 438 | | //if ( m_dma.decrement_x || m_dma.decrement_y ) |
| 439 | | //{ |
| 440 | | //popmessage( "TODO: Decrement-x and decrement-y are not supported yet\n" ); |
| 441 | | //} |
| 442 | | |
| 443 | | m_dma.width_x = RAM[SM8521_DMDX]; |
| 432 | m_dma.width_x = m_p_ram[SM8521_DMDX]; |
| 444 | 433 | m_dma.width_x_count = 0; |
| 445 | | m_dma.width_y = RAM[SM8521_DMDY]; |
| 434 | m_dma.width_y = m_p_ram[SM8521_DMDY]; |
| 446 | 435 | m_dma.width_y_count = 0; |
| 447 | | m_dma.source_x = RAM[SM8521_DMX1]; |
| 436 | m_dma.source_x = m_p_ram[SM8521_DMX1]; |
| 448 | 437 | m_dma.source_x_current = m_dma.source_x; |
| 449 | | m_dma.source_y = RAM[SM8521_DMY1]; |
| 450 | | m_dma.source_width = ( RAM[SM8521_LCH] & 0x20 ) ? 50 : 40; |
| 451 | | m_dma.dest_x = RAM[SM8521_DMX2]; |
| 438 | m_dma.source_y = m_p_ram[SM8521_DMY1]; |
| 439 | m_dma.source_width = ( m_p_ram[SM8521_LCH] & 0x20 ) ? 50 : 40; |
| 440 | m_dma.dest_x = m_p_ram[SM8521_DMX2]; |
| 452 | 441 | m_dma.dest_x_current = m_dma.dest_x; |
| 453 | | m_dma.dest_y = RAM[SM8521_DMY2]; |
| 454 | | m_dma.dest_width = ( RAM[SM8521_LCH] & 0x20 ) ? 50 : 40; |
| 455 | | m_dma.palette[0] = RAM[SM8521_DMPL] & 0x03; |
| 456 | | m_dma.palette[1] = ( RAM[SM8521_DMPL] >> 2 ) & 3; |
| 457 | | m_dma.palette[2] = ( RAM[SM8521_DMPL] >> 4 ) & 3; |
| 458 | | m_dma.palette[3] = RAM[SM8521_DMPL] >> 6; |
| 442 | m_dma.dest_y = m_p_ram[SM8521_DMY2]; |
| 443 | m_dma.dest_width = ( m_p_ram[SM8521_LCH] & 0x20 ) ? 50 : 40; |
| 444 | m_dma.palette[0] = m_p_ram[SM8521_DMPL] & 0x03; |
| 445 | m_dma.palette[1] = ( m_p_ram[SM8521_DMPL] >> 2 ) & 3; |
| 446 | m_dma.palette[2] = ( m_p_ram[SM8521_DMPL] >> 4 ) & 3; |
| 447 | m_dma.palette[3] = m_p_ram[SM8521_DMPL] >> 6; |
| 459 | 448 | m_dma.source_mask = 0x1FFF; |
| 460 | 449 | m_dma.dest_mask = 0x1FFF; |
| 461 | | // logerror("DMA: width %Xx%X, source (%X,%X), dest (%X,%X), transfer_mode %X, banks %X \n", m_dma.width_x, m_dma.width_y, m_dma.source_x, m_dma.source_y, m_dma.dest_x, m_dma.dest_y, m_dma.transfer_mode, RAM[SM8521_DMVP] ); |
| 450 | // logerror("DMA: width %Xx%X, source (%X,%X), dest (%X,%X), transfer_mode %X, banks %X \n", m_dma.width_x, m_dma.width_y, m_dma.source_x, m_dma.source_y, m_dma.dest_x, m_dma.dest_y, m_dma.transfer_mode, m_p_ram[SM8521_DMVP] ); |
| 462 | 451 | // logerror( " Palette: %d, %d, %d, %d\n", m_dma.palette[0], m_dma.palette[1], m_dma.palette[2], m_dma.palette[3] ); |
| 463 | 452 | switch( m_dma.transfer_mode ) |
| 464 | 453 | { |
| 465 | 454 | case 0x00: |
| 466 | 455 | /* VRAM->VRAM */ |
| 467 | | m_dma.source_bank = &m_p_videoram[(RAM[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; |
| 468 | | m_dma.dest_bank = &m_p_videoram[(RAM[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; |
| 456 | m_dma.source_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; |
| 457 | m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; |
| 469 | 458 | break; |
| 470 | 459 | case 0x02: |
| 471 | 460 | /* ROM->VRAM */ |
| 472 | | // logerror( "DMA DMBR = %X\n", RAM[SM8521_DMBR] ); |
| 461 | // logerror( "DMA DMBR = %X\n", m_p_ram[SM8521_DMBR] ); |
| 473 | 462 | m_dma.source_width = 64; |
| 474 | 463 | m_dma.source_mask = 0x3FFF; |
| 475 | | if (RAM[SM8521_DMBR] < 16) |
| 476 | | m_dma.source_bank = m_region_kernel->base() + (RAM[SM8521_DMBR] << 14); |
| 464 | if (m_p_ram[SM8521_DMBR] < 16) |
| 465 | m_dma.source_bank = m_region_kernel->base() + (m_p_ram[SM8521_DMBR] << 14); |
| 477 | 466 | else |
| 478 | 467 | if (m_cart_ptr) |
| 479 | | m_dma.source_bank = m_cart_ptr + (RAM[SM8521_DMBR] << 14); |
| 468 | m_dma.source_bank = m_cart_ptr + (m_p_ram[SM8521_DMBR] << 14); |
| 480 | 469 | |
| 481 | | m_dma.dest_bank = &m_p_videoram[(RAM[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; |
| 470 | m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; |
| 482 | 471 | break; |
| 483 | 472 | case 0x04: |
| 484 | 473 | /* Extend RAM->VRAM */ |
| 485 | 474 | m_dma.source_width = 64; |
| 486 | 475 | m_dma.source_bank = &m_p_nvram[0x0000]; |
| 487 | | m_dma.dest_bank = &m_p_videoram[(RAM[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; |
| 476 | m_dma.dest_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x02) ? 0x2000 : 0x0000]; |
| 488 | 477 | break; |
| 489 | 478 | case 0x06: |
| 490 | 479 | /* VRAM->Extend RAM */ |
| 491 | | m_dma.source_bank = &m_p_videoram[(RAM[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; |
| 480 | m_dma.source_bank = &m_p_videoram[(m_p_ram[SM8521_DMVP] & 0x01) ? 0x2000 : 0x0000]; |
| 492 | 481 | m_dma.dest_width = 64; |
| 493 | 482 | m_dma.dest_bank = &m_p_nvram[0x0000]; |
| 494 | 483 | break; |
| r242082 | r242083 | |
| 507 | 496 | { |
| 508 | 497 | for( x_count = 0; x_count <= m_dma.width_x; x_count++ ) |
| 509 | 498 | { |
| 510 | | int source_pixel = 0; |
| 511 | | int dest_pixel = 0; |
| 512 | | int src_addr = m_dma.source_current & m_dma.source_mask; |
| 513 | | int dest_addr = m_dma.dest_current & m_dma.dest_mask; |
| 499 | UINT16 src_addr = m_dma.source_current & m_dma.source_mask; |
| 500 | UINT16 dest_addr = m_dma.dest_current & m_dma.dest_mask; |
| 501 | UINT8 dest_adj = (3 - (m_dma.dest_x_current & 3)) << 1; |
| 502 | UINT8 src_adj = (3 - (m_dma.source_x_current & 3)) << 1; |
| 503 | |
| 514 | 504 | /* handle DMA for 1 pixel */ |
| 515 | | /* Read pixel data */ |
| 516 | | switch ( m_dma.source_x_current & 0x03 ) |
| 517 | | { |
| 518 | | case 0x00: source_pixel = m_dma.source_bank[src_addr] >> 6; break; |
| 519 | | case 0x01: source_pixel = ( m_dma.source_bank[src_addr] >> 4 ) & 3; break; |
| 520 | | case 0x02: source_pixel = ( m_dma.source_bank[src_addr] >> 2 ) & 3; break; |
| 521 | | case 0x03: source_pixel = m_dma.source_bank[src_addr] & 3; break; |
| 522 | | } |
| 505 | // Get new pixel |
| 506 | UINT8 source_pixel = (m_dma.source_bank[src_addr] >> src_adj) & 3; |
| 523 | 507 | |
| 524 | | if ( !m_dma.overwrite_mode && source_pixel == 0 ) |
| 508 | // If overwrite mode, write new pixel |
| 509 | if ( m_dma.overwrite_mode || source_pixel) |
| 525 | 510 | { |
| 526 | | switch ( m_dma.dest_x_current & 0x03 ) |
| 527 | | { |
| 528 | | case 0x00: dest_pixel = m_dma.dest_bank[dest_addr] >> 6; break; |
| 529 | | case 0x01: dest_pixel = ( m_dma.dest_bank[dest_addr] >> 4 ) & 3; break; |
| 530 | | case 0x02: dest_pixel = ( m_dma.dest_bank[dest_addr] >> 2 ) & 3; break; |
| 531 | | case 0x03: dest_pixel = m_dma.dest_bank[dest_addr] & 3; break; |
| 532 | | } |
| 533 | | source_pixel = dest_pixel; |
| 511 | // Get 4 pixels and remove the one about to be replaced |
| 512 | UINT8 other_pixels = m_dma.dest_bank[dest_addr] & ~(3 << dest_adj); |
| 513 | // Get palette of new pixel and place into the hole |
| 514 | m_dma.dest_bank[dest_addr] = other_pixels | (m_dma.palette[ source_pixel ] << dest_adj); |
| 534 | 515 | } |
| 535 | 516 | |
| 536 | | /* Translate pixel data using DMA palette. */ |
| 537 | | /* Not sure if this should be done before the compound stuff - WP */ |
| 538 | | source_pixel = m_dma.palette[ source_pixel ]; |
| 539 | | /* Write pixel data */ |
| 540 | | switch( m_dma.dest_x_current & 0x03 ) |
| 541 | | { |
| 542 | | case 0x00: |
| 543 | | m_dma.dest_bank[dest_addr] = ( m_dma.dest_bank[dest_addr] & 0x3F ) | ( source_pixel << 6 ); |
| 544 | | break; |
| 545 | | case 0x01: |
| 546 | | m_dma.dest_bank[dest_addr] = ( m_dma.dest_bank[dest_addr] & 0xCF ) | ( source_pixel << 4 ); |
| 547 | | break; |
| 548 | | case 0x02: |
| 549 | | m_dma.dest_bank[dest_addr] = ( m_dma.dest_bank[dest_addr] & 0xF3 ) | ( source_pixel << 2 ); |
| 550 | | break; |
| 551 | | case 0x03: |
| 552 | | m_dma.dest_bank[dest_addr] = ( m_dma.dest_bank[dest_addr] & 0xFC ) | source_pixel; |
| 553 | | break; |
| 554 | | } |
| 555 | | |
| 556 | 517 | /* Advance a pixel */ |
| 557 | 518 | if ( m_dma.decrement_x ) |
| 558 | 519 | { |
| r242082 | r242083 | |
| 588 | 549 | |
| 589 | 550 | WRITE8_MEMBER( gamecom_state::gamecom_update_timers ) |
| 590 | 551 | { |
| 591 | | UINT8 * RAM = m_region_maincpu->base(); |
| 592 | 552 | if ( m_timer[0].enabled ) |
| 593 | 553 | { |
| 594 | 554 | m_timer[0].state_count += data; |
| 595 | 555 | while ( m_timer[0].state_count >= m_timer[0].state_limit ) |
| 596 | 556 | { |
| 597 | 557 | m_timer[0].state_count -= m_timer[0].state_limit; |
| 598 | | RAM[SM8521_TM0D]++; |
| 599 | | if ( RAM[SM8521_TM0D] >= m_timer[0].check_value ) |
| 558 | m_p_ram[SM8521_TM0D]++; |
| 559 | if ( m_p_ram[SM8521_TM0D] >= m_timer[0].check_value ) |
| 600 | 560 | { |
| 601 | | RAM[SM8521_TM0D] = 0; |
| 561 | m_p_ram[SM8521_TM0D] = 0; |
| 602 | 562 | m_maincpu->set_input_line(sm8500_cpu_device::TIM0_INT, ASSERT_LINE ); |
| 603 | 563 | } |
| 604 | 564 | } |
| r242082 | r242083 | |
| 609 | 569 | while ( m_timer[1].state_count >= m_timer[1].state_limit ) |
| 610 | 570 | { |
| 611 | 571 | m_timer[1].state_count -= m_timer[1].state_limit; |
| 612 | | RAM[SM8521_TM1D]++; |
| 613 | | if ( RAM[SM8521_TM1D] >= m_timer[1].check_value ) |
| 572 | m_p_ram[SM8521_TM1D]++; |
| 573 | if ( m_p_ram[SM8521_TM1D] >= m_timer[1].check_value ) |
| 614 | 574 | { |
| 615 | | RAM[SM8521_TM1D] = 0; |
| 575 | m_p_ram[SM8521_TM1D] = 0; |
| 616 | 576 | m_maincpu->set_input_line(sm8500_cpu_device::TIM1_INT, ASSERT_LINE ); |
| 617 | 577 | } |
| 618 | 578 | } |