mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
sound/vrender0.cpp, video/ims_cvc.cpp: Use util::sext function
This commit is contained in:
parent
7b2a7ebdd1
commit
af16147de7
@ -14,11 +14,6 @@
|
||||
- Sample Rate is unverified
|
||||
|
||||
*************************************************************************************/
|
||||
static inline s32 sign_ext(s32 val, s32 bit)
|
||||
{
|
||||
bit = 32 - bit;
|
||||
return ((s32)(val << bit)) >> bit;
|
||||
}
|
||||
|
||||
//Correct table thanks to Evoga
|
||||
//they left a ulaw<->linear conversion tool inside the roms
|
||||
@ -460,7 +455,7 @@ void vr0sound_device::channel_t::write(offs_t offset, u16 data, u16 mem_mask)
|
||||
case 0x06/2:
|
||||
LD = data & 0x1000;
|
||||
EnvStage = (data & 0x0f00) >> 8;
|
||||
EnvVol = sign_ext((EnvVol & 0x00ffff) | ((data << 16) & 0xff0000), 24);
|
||||
EnvVol = util::sext((EnvVol & 0x00ffff) | ((data << 16) & 0xff0000), 24);
|
||||
break;
|
||||
case 0x08/2:
|
||||
dSAddr = data & 0xffff;
|
||||
@ -492,8 +487,8 @@ void vr0sound_device::channel_t::write(offs_t offset, u16 data, u16 mem_mask)
|
||||
case 0x1e/2:
|
||||
EnvTarget[((offset - (0x1c/2)) * 2) + 0] = (data & 0x007f);
|
||||
EnvTarget[((offset - (0x1c/2)) * 2) + 1] = ((data & 0x7f00) >> 8);
|
||||
EnvRate[((offset - (0x1c/2)) * 2) + 0] = sign_ext((EnvRate[((offset - (0x1c/2)) * 2) + 0] & 0xffff) | ((data & 0x0080) << 9), 17);
|
||||
EnvRate[((offset - (0x1c/2)) * 2) + 1] = sign_ext((EnvRate[((offset - (0x1c/2)) * 2) + 1] & 0xffff) | ((data & 0x8000) << 1), 17);
|
||||
EnvRate[((offset - (0x1c/2)) * 2) + 0] = util::sext((EnvRate[((offset - (0x1c/2)) * 2) + 0] & 0xffff) | ((data & 0x0080) << 9), 17);
|
||||
EnvRate[((offset - (0x1c/2)) * 2) + 1] = util::sext((EnvRate[((offset - (0x1c/2)) * 2) + 1] & 0xffff) | ((data & 0x8000) << 1), 17);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -257,8 +257,8 @@ u32 g332_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, rect
|
||||
if (!(m_control_a & CURSOR_DISABLE))
|
||||
{
|
||||
// get cursor origin
|
||||
int const cursor_x = screen.visible_area().min_x + (s32(m_cursor_start << 8) >> 20);
|
||||
int const cursor_y = screen.visible_area().min_y + (s32(m_cursor_start << 20) >> 20);
|
||||
int const cursor_x = screen.visible_area().min_x + util::sext(m_cursor_start >> 12, 12);
|
||||
int const cursor_y = screen.visible_area().min_y + util::sext(m_cursor_start, 12);
|
||||
|
||||
// intersect cursor with screen
|
||||
rectangle cursor(cursor_x, cursor_x + 63, cursor_y, cursor_y + 63);
|
||||
|
Loading…
Reference in New Issue
Block a user