trunk/src/mame/includes/snes.h
r17403 | r17404 | |
503 | 503 | inline void snes_draw_tile( UINT8 planes, UINT8 layer, UINT32 tileaddr, INT16 x, UINT8 priority, UINT8 flip, UINT8 direct_colors, UINT16 pal, UINT8 hires ); |
504 | 504 | inline UINT32 snes_get_tmap_addr( UINT8 layer, UINT8 tile_size, UINT32 base, UINT32 x, UINT32 y ); |
505 | 505 | inline void snes_update_line( UINT16 curline, UINT8 layer, UINT8 priority_b, UINT8 priority_a, UINT8 color_depth, UINT8 hires, UINT8 offset_per_tile, UINT8 direct_colors ); |
| 506 | UINT32 snes_get_vram_address( void ); |
506 | 507 | void snes_update_line_mode7( UINT16 curline, UINT8 layer, UINT8 priority_b, UINT8 priority_a ); |
507 | 508 | void snes_update_obsel( void ); |
508 | 509 | void snes_oam_list_build( void ); |
trunk/src/mame/video/snes.c
r17403 | r17404 | |
1873 | 1873 | { |
1874 | 1874 | UINT32 rem = addr & state->m_vram_fgr_mask; |
1875 | 1875 | UINT32 faddr = (addr & ~state->m_vram_fgr_mask) + (rem >> state->m_vram_fgr_shift) + ((rem & (state->m_vram_fgr_count - 1)) << 3); |
1876 | | return faddr; |
| 1876 | return faddr << 1; |
1877 | 1877 | } |
1878 | 1878 | |
1879 | | return addr; |
| 1879 | return addr << 1; |
1880 | 1880 | } |
1881 | 1881 | |
1882 | 1882 | READ8_MEMBER( snes_state::snes_vram_read ) |
1883 | 1883 | { |
1884 | 1884 | UINT8 res = 0; |
1885 | | offset &= 0x1ffff; |
| 1885 | offset &= 0xffff; // only 64KB are present on SNES |
1886 | 1886 | |
1887 | 1887 | if (snes_ppu.screen_disabled) |
1888 | 1888 | res = m_snes_vram[offset]; |
r17403 | r17404 | |
1914 | 1914 | |
1915 | 1915 | WRITE8_MEMBER( snes_state::snes_vram_write ) |
1916 | 1916 | { |
1917 | | offset &= 0x1ffff; |
| 1917 | offset &= 0xffff; // only 64KB are present on SNES, Robocop 3 relies on this |
1918 | 1918 | |
1919 | 1919 | if (snes_ppu.screen_disabled) |
1920 | 1920 | m_snes_vram[offset] = data; |
r17403 | r17404 | |
2149 | 2149 | return snes_ppu.ppu1_open_bus; |
2150 | 2150 | case RVMDATAL: /* Read data from VRAM (low) */ |
2151 | 2151 | { |
2152 | | UINT32 addr = snes_get_vram_address(space->machine()) << 1; |
| 2152 | UINT32 addr = snes_get_vram_address(space->machine()); |
2153 | 2153 | snes_ppu.ppu1_open_bus = state->m_vram_read_buffer & 0xff; |
2154 | 2154 | |
2155 | 2155 | if (!state->m_vram_fgr_high) |
r17403 | r17404 | |
2164 | 2164 | } |
2165 | 2165 | case RVMDATAH: /* Read data from VRAM (high) */ |
2166 | 2166 | { |
2167 | | UINT32 addr = snes_get_vram_address(space->machine()) << 1; |
| 2167 | UINT32 addr = snes_get_vram_address(space->machine()); |
2168 | 2168 | snes_ppu.ppu1_open_bus = (state->m_vram_read_buffer >> 8) & 0xff; |
2169 | 2169 | |
2170 | 2170 | if (state->m_vram_fgr_high) |
r17403 | r17404 | |
2399 | 2399 | { |
2400 | 2400 | UINT32 addr; |
2401 | 2401 | state->m_vmadd = (state->m_vmadd & 0xff00) | (data << 0); |
2402 | | addr = snes_get_vram_address(space->machine()) << 1; |
| 2402 | addr = snes_get_vram_address(space->machine()); |
2403 | 2403 | state->m_vram_read_buffer = state->snes_vram_read(*space, addr); |
2404 | 2404 | state->m_vram_read_buffer |= (state->snes_vram_read(*space, addr + 1) << 8); |
2405 | 2405 | } |
r17403 | r17404 | |
2408 | 2408 | { |
2409 | 2409 | UINT32 addr; |
2410 | 2410 | state->m_vmadd = (state->m_vmadd & 0x00ff) | (data << 8); |
2411 | | addr = snes_get_vram_address(space->machine()) << 1; |
| 2411 | addr = snes_get_vram_address(space->machine()); |
2412 | 2412 | state->m_vram_read_buffer = state->snes_vram_read(*space, addr); |
2413 | 2413 | state->m_vram_read_buffer |= (state->snes_vram_read(*space, addr + 1) << 8); |
2414 | 2414 | } |
2415 | 2415 | break; |
2416 | 2416 | case VMDATAL: /* 2118: Data for VRAM write (low) */ |
2417 | 2417 | { |
2418 | | UINT32 addr = snes_get_vram_address(space->machine()) << 1; |
| 2418 | UINT32 addr = snes_get_vram_address(space->machine()); |
2419 | 2419 | state->snes_vram_write(*space, addr, data); |
2420 | 2420 | |
2421 | 2421 | if (!state->m_vram_fgr_high) |
r17403 | r17404 | |
2424 | 2424 | return; |
2425 | 2425 | case VMDATAH: /* 2119: Data for VRAM write (high) */ |
2426 | 2426 | { |
2427 | | UINT32 addr = snes_get_vram_address(space->machine()) << 1; |
| 2427 | UINT32 addr = snes_get_vram_address(space->machine()); |
2428 | 2428 | state->snes_vram_write(*space, addr + 1, data); |
2429 | 2429 | |
2430 | 2430 | if (state->m_vram_fgr_high) |