src/mess/machine/sms.c
| r13617 | r13618 | |
| 73 | 73 | |
| 74 | 74 | if ( m_cartridge[m_current_cartridge].ROM ) |
| 75 | 75 | { |
| 76 | | UINT8 rom_bank_count = m_cartridge[m_current_cartridge].size / 0x2000; |
| 76 | UINT16 rom_bank_count = m_cartridge[m_current_cartridge].size / 0x2000; |
| 77 | 77 | bank_start = m_cartridge[m_current_cartridge].ROM + ((rom_bank_count > 0) ? bank % rom_bank_count : 0) * 0x2000; |
| 78 | if ( bank >= rom_bank_count ) |
| 79 | printf("%s: swiching to bank %02x of %02x\n", machine().describe_context(), bank, rom_bank_count); |
| 78 | 80 | } |
| 79 | 81 | |
| 80 | 82 | switch ( address ) |
| r13617 | r13618 | |
| 160 | 162 | |
| 161 | 163 | if ( m_BIOS ) |
| 162 | 164 | { |
| 163 | | bank_start = m_BIOS + ((m_bios_page_count > 0) ? bank % m_bios_page_count : 0) * 0x2000; |
| 165 | bank_start = m_BIOS + ((m_bios_page_count > 0) ? bank % ( m_bios_page_count << 1 ) : 0) * 0x2000; |
| 164 | 166 | } |
| 165 | 167 | |
| 166 | 168 | switch ( address ) |
| r13617 | r13618 | |
| 1797 | 1799 | state->m_cartridge[index].features |= CF_TVDRAW; |
| 1798 | 1800 | } |
| 1799 | 1801 | |
| 1802 | if (state->m_cartridge[index].features & CF_JANGGUN_MAPPER) |
| 1803 | { |
| 1804 | // Reverse bytes when bit 6 in the mapper is set |
| 1805 | |
| 1806 | if ( state->m_cartridge[index].size <= 0x40 * 0x4000 ) |
| 1807 | { |
| 1808 | UINT8 *new_rom = auto_alloc_array(machine, UINT8, 0x80 * 0x4000); |
| 1809 | UINT32 dest = 0; |
| 1810 | |
| 1811 | while ( dest < 0x40 * 0x4000 ) |
| 1812 | { |
| 1813 | memcpy( new_rom + dest, state->m_cartridge[index].ROM, state->m_cartridge[index].size ); |
| 1814 | dest += state->m_cartridge[index].size; |
| 1815 | } |
| 1816 | |
| 1817 | for ( dest = 0; dest < 0x40 * 0x4000; dest++ ) |
| 1818 | { |
| 1819 | new_rom[ 0x40 * 0x4000 + dest ] = BITSWAP8( new_rom[ dest ], 0, 1, 2, 3, 4, 5, 6, 7); |
| 1820 | } |
| 1821 | |
| 1822 | state->m_cartridge[index].ROM = new_rom; |
| 1823 | state->m_cartridge[index].size = 0x80 * 0x4000; |
| 1824 | } |
| 1825 | } |
| 1826 | |
| 1800 | 1827 | LOG(("Cart Features: %x\n", state->m_cartridge[index].features)); |
| 1801 | 1828 | |
| 1802 | 1829 | /* Load battery backed RAM, if available */ |