Skip to content

Commit 49babbe

Browse files
committed
bandai/wswan_v.cpp: Fix emulation incorrection in WonderSwan Color
1 parent e487965 commit 49babbe

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/mame/bandai/wswan_v.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ wswan_video_device::wswan_video_device(const machine_config &mconfig, const char
3737
}
3838

3939
wswan_color_video_device::wswan_color_video_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
40-
: wswan_video_device(mconfig, WSWAN_COLOR_VIDEO, tag, owner, clock, wswan_video_device::VDP_TYPE_WSC)
40+
: wswan_video_device(mconfig, WSWAN_COLOR_VIDEO, tag, owner, clock, VDP_TYPE_WSC)
4141
{
4242
}
4343

@@ -307,7 +307,7 @@ inline void wswan_video_device::draw_pixel(int x_offset, u8 tile_palette, u8 pix
307307

308308
void wswan_video_device::draw_background()
309309
{
310-
const u16 map_addr = m_layer_bg_address + (((m_current_line + m_layer_bg_scroll_y) & 0xf8) << 2);
310+
const u16 map_addr = (m_layer_bg_address & (m_color_mode ? 0x3fff : 0x1fff)) + (((m_current_line + m_layer_bg_scroll_y) & 0xf8) << 2);
311311
const u8 start_column = (m_layer_bg_scroll_x >> 3);
312312

313313
for (int column = 0; column < 29; column++)
@@ -332,7 +332,7 @@ void wswan_video_device::draw_background()
332332

333333
void wswan_video_device::draw_foreground_0()
334334
{
335-
const u16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 2);
335+
const u16 map_addr = (m_layer_fg_address & (m_color_mode ? 0x3fff : 0x1fff)) + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 2);
336336
const u8 start_column = (m_layer_fg_scroll_x >> 3);
337337

338338
for (int column = 0; column < 29; column++)
@@ -357,7 +357,7 @@ void wswan_video_device::draw_foreground_0()
357357

358358
void wswan_video_device::draw_foreground_2()
359359
{
360-
const u16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 2);
360+
const u16 map_addr = (m_layer_fg_address & (m_color_mode ? 0x3fff : 0x1fff)) + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 2);
361361
const u8 start_column = (m_layer_fg_scroll_x >> 3);
362362

363363
for (int column = 0; column < 29; column++)
@@ -382,7 +382,7 @@ void wswan_video_device::draw_foreground_2()
382382

383383
void wswan_video_device::draw_foreground_3()
384384
{
385-
const u16 map_addr = m_layer_fg_address + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 2);
385+
const u16 map_addr = (m_layer_fg_address & (m_color_mode ? 0x3fff : 0x1fff)) + (((m_current_line + m_layer_fg_scroll_y) & 0xf8) << 2);
386386
const u8 start_column = (m_layer_fg_scroll_x >> 3);
387387

388388
for (int column = 0; column < 29; column++)
@@ -622,8 +622,8 @@ void wswan_video_device::reg_w(offs_t offset, u16 data, u16 mem_mask)
622622
// Bit 12-15 - Determine foreground table base address 0xxxx000 00000000 (in bytes)
623623
if (ACCESSING_BITS_8_15)
624624
{
625-
m_layer_bg_address = (data & (m_vdp_type == wswan_video_device::VDP_TYPE_WSC ? 0x0f00 : 0x0700)) << 2;
626-
m_layer_fg_address = (data & (m_vdp_type == wswan_video_device::VDP_TYPE_WSC ? 0xf000 : 0x7000)) >> 2;
625+
m_layer_bg_address = (data & (m_vdp_type == VDP_TYPE_WSC ? 0x0f00 : 0x0700)) << 2;
626+
m_layer_fg_address = (data & (m_vdp_type == VDP_TYPE_WSC ? 0xf000 : 0x7000)) >> 2;
627627
}
628628
break;
629629
case 0x08 / 2:

0 commit comments

Comments
 (0)