src/mess/drivers/sg1000.c
| r14498 | r14499 | |
| 723 | 723 | // the main unit's system ram (0xC000-0xC3FF) and 8K which appears |
| 724 | 724 | // at 0x2000-0x3FFF in the memory map. |
| 725 | 725 | // |
| 726 | | if ( ! strcmp( needs_addon, "dahjee_type_a" ) ) |
| 726 | if ( needs_addon && ! strcmp( needs_addon, "dahjee_type_a" ) ) |
| 727 | 727 | { |
| 728 | 728 | install_2000_ram = true; |
| 729 | 729 | } |
| r14498 | r14499 | |
| 732 | 732 | // The Dahjee (Type B) RAM cartridge had 8KB of RAM which |
| 733 | 733 | // replaces the main unit RAM in the memory map. (0xC000-0xDFFF area) |
| 734 | 734 | // |
| 735 | | if ( ! strcmp( needs_addon, "dahjee_type_b" ) ) |
| 735 | if ( needs_addon && ! strcmp( needs_addon, "dahjee_type_b" ) ) |
| 736 | 736 | { |
| 737 | 737 | ram_size = 0x2000; |
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | // Try to auto-detect special features |
| 742 | if ( ! install_2000_ram && ram_size == 0x400 ) |
| 743 | { |
| 744 | if ( size >= 0x8000 ) |
| 745 | { |
| 746 | int x2000_3000 = 0, xd000_e000_f000 = 0, x2000_ff = 0; |
| 747 | |
| 748 | for ( int i = 0; i < 0x8000; i++ ) |
| 749 | { |
| 750 | if ( ptr[i] == 0x32 ) |
| 751 | { |
| 752 | UINT16 addr = ptr[i+1] | ( ptr[i+2] << 8 ); |
| 753 | |
| 754 | switch ( addr & 0xF000 ) |
| 755 | { |
| 756 | case 0x2000: |
| 757 | case 0x3000: |
| 758 | i += 2; |
| 759 | x2000_3000++; |
| 760 | break; |
| 761 | |
| 762 | case 0xD000: |
| 763 | case 0xE000: |
| 764 | case 0xF000: |
| 765 | i += 2; |
| 766 | xd000_e000_f000++; |
| 767 | break; |
| 768 | } |
| 769 | } |
| 770 | } |
| 771 | for ( int i = 0x2000; i < 0x4000; i++ ) |
| 772 | { |
| 773 | if ( ptr[i] == 0xFF ) |
| 774 | { |
| 775 | x2000_ff++; |
| 776 | } |
| 777 | } |
| 778 | if ( x2000_ff == 0x2000 && ( xd000_e000_f000 > 10 || x2000_3000 > 10 ) ) |
| 779 | { |
| 780 | if ( xd000_e000_f000 > x2000_3000 ) |
| 781 | { |
| 782 | ram_size = 0x2000; |
| 783 | } |
| 784 | else |
| 785 | { |
| 786 | install_2000_ram = true; |
| 787 | } |
| 788 | } |
| 789 | } |
| 790 | } |
| 791 | |
| 741 | 792 | /* cartridge ROM banking */ |
| 742 | 793 | state->install_cartridge(ptr, size); |
| 743 | 794 | |