namco/ygv608.cpp, sega/saturn_v.cpp, seibu/seibuspi_v.cpp: Use util::sext for sign extension

This commit is contained in:
AJR 2023-11-09 10:13:47 -05:00
parent f6b94463e4
commit eb1d4f8ad7
3 changed files with 7 additions and 17 deletions

View File

@ -2295,8 +2295,7 @@ inline uint32_t ygv608_device::roz_convert_raw24(uint32_t *raw_reg, uint8_t offs
// convert raw to the given register
res = *raw_reg & roz_data_mask24;
res <<= 7;
if( res & 0x08000000 ) res |= 0xf8000000; // 2s complement
res = util::sext(res << 7, 28);
return res;
}
@ -2313,8 +2312,7 @@ inline uint32_t ygv608_device::roz_convert_raw16(uint16_t *raw_reg, uint8_t offs
// convert raw to the given register
res = *raw_reg & roz_data_mask16;
res <<= 7;
if( res & 0x00080000 ) res |= 0xfff80000; // 2s complement
res = util::sext(res << 7, 20);
return res;
}

View File

@ -6373,9 +6373,7 @@ void saturn_state::stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const recta
#define STV_VDP2_READ_VERTICAL_LINESCROLL( _val, _address ) \
{ \
_val = m_vdp2_vram[ _address ]; \
_val &= 0x07ffff00; \
if ( _val & 0x04000000 ) _val |= 0xf8000000; \
_val = util::sext(m_vdp2_vram[ _address ] & 0x07ffff00, 27); \
}
@ -6478,8 +6476,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap,
// linescroll
if ( linescroll_enable )
{
prev_scroll_values[i] &= 0x07ffff00;
if ( prev_scroll_values[i] & 0x04000000 ) prev_scroll_values[i] |= 0xf8000000;
prev_scroll_values[i] = util::sext(prev_scroll_values[i] & 0x07ffff00, 27);
stv2_current_tilemap.scrollx = main_scrollx + (prev_scroll_values[i] >> 16);
i++;
}
@ -6493,8 +6490,7 @@ void saturn_state::stv_vdp2_check_tilemap_with_linescroll(bitmap_rgb32 &bitmap,
// linezooom
if ( linezoom_enable )
{
prev_scroll_values[i] &= 0x0007ff00;
if ( prev_scroll_values[i] & 0x00040000 ) prev_scroll_values[i] |= 0xfff80000;
prev_scroll_values[i] = util::sext(prev_scroll_values[i] & 0x0007ff00, 19);
stv2_current_tilemap.incx = prev_scroll_values[i];
i++;
}

View File

@ -512,12 +512,8 @@ void seibuspi_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprec
continue;
const u8 primask = 1 << priority;
s16 xpos = m_sprite_ram[a + 1] & 0x3ff;
if (xpos & 0x200)
xpos |= 0xfc00;
s16 ypos = m_sprite_ram[a + 1] >> 16 & 0x1ff;
if (ypos & 0x100)
ypos |= 0xfe00;
s16 xpos = util::sext(m_sprite_ram[a + 1], 10);
s16 ypos = util::sext(m_sprite_ram[a + 1] >> 16, 9);
const int color = m_sprite_ram[a + 0] & 0x3f;
int width = (m_sprite_ram[a + 0] >> 8 & 0x7) + 1;