diff options
Diffstat (limited to 'src/mame/drivers/artmagic.cpp')
-rw-r--r-- | src/mame/drivers/artmagic.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/mame/drivers/artmagic.cpp b/src/mame/drivers/artmagic.cpp index 21445451441..5a601d0ff8d 100644 --- a/src/mame/drivers/artmagic.cpp +++ b/src/mame/drivers/artmagic.cpp @@ -130,7 +130,7 @@ void artmagic_state::device_timer(emu_timer &timer, device_timer_id id, int para READ16_MEMBER(artmagic_state::ultennis_hack_r) { /* IRQ5 points to: jsr (a5); rte */ - UINT32 pc = space.device().safe_pc(); + uint32_t pc = space.device().safe_pc(); if (pc == 0x18c2 || pc == 0x18e4) { m_hack_irq = 1; @@ -161,15 +161,15 @@ void artmagic_state::ultennis_protection() case 0x01: /* 01 aaaa bbbb cccc dddd (xxxx) */ if (m_prot_input_index == 9) { - UINT16 a = m_prot_input[1] | (m_prot_input[2] << 8); - UINT16 b = m_prot_input[3] | (m_prot_input[4] << 8); - UINT16 c = m_prot_input[5] | (m_prot_input[6] << 8); - UINT16 d = m_prot_input[7] | (m_prot_input[8] << 8); - UINT16 x = a - b; - if ((INT16)x >= 0) + uint16_t a = m_prot_input[1] | (m_prot_input[2] << 8); + uint16_t b = m_prot_input[3] | (m_prot_input[4] << 8); + uint16_t c = m_prot_input[5] | (m_prot_input[6] << 8); + uint16_t d = m_prot_input[7] | (m_prot_input[8] << 8); + uint16_t x = a - b; + if ((int16_t)x >= 0) x = (x * c) >> 16; else - x = -(((UINT16)-x * c) >> 16); + x = -(((uint16_t)-x * c) >> 16); x += d; m_prot_output[0] = x; m_prot_output[1] = x >> 8; @@ -195,10 +195,10 @@ void artmagic_state::ultennis_protection() */ if (m_prot_input_index == 7) { - UINT16 a = (INT16)(m_prot_input[1] | (m_prot_input[2] << 8)); - UINT16 b = (INT16)(m_prot_input[3] | (m_prot_input[4] << 8)); - /*UINT16 c = (INT16)(m_prot_input[5] | (m_prot_input[6] << 8));*/ - UINT32 x = a * a * (b/2); + uint16_t a = (int16_t)(m_prot_input[1] | (m_prot_input[2] << 8)); + uint16_t b = (int16_t)(m_prot_input[3] | (m_prot_input[4] << 8)); + /*uint16_t c = (int16_t)(m_prot_input[5] | (m_prot_input[6] << 8));*/ + uint32_t x = a * a * (b/2); m_prot_output[0] = x; m_prot_output[1] = x >> 8; m_prot_output[2] = x >> 16; @@ -212,7 +212,7 @@ void artmagic_state::ultennis_protection() case 0x03: /* 03 (xxxx) */ if (m_prot_input_index == 1) { - UINT16 x = m_prot_save; + uint16_t x = m_prot_save; m_prot_output[0] = x; m_prot_output[1] = x >> 8; m_prot_output_index = 0; @@ -224,7 +224,7 @@ void artmagic_state::ultennis_protection() case 0x04: /* 04 aaaa */ if (m_prot_input_index == 3) { - UINT16 a = m_prot_input[1] | (m_prot_input[2] << 8); + uint16_t a = m_prot_input[1] | (m_prot_input[2] << 8); m_prot_save = a; m_prot_input_index = m_prot_output_index = 0; } @@ -251,15 +251,15 @@ void artmagic_state::cheesech_protection() case 0x01: /* 01 aaaa bbbb (xxxx) */ if (m_prot_input_index == 5) { - UINT16 a = m_prot_input[1] | (m_prot_input[2] << 8); - UINT16 b = m_prot_input[3] | (m_prot_input[4] << 8); - UINT16 c = 0x4000; /* seems to be hard-coded */ - UINT16 d = 0x00a0; /* seems to be hard-coded */ - UINT16 x = a - b; - if ((INT16)x >= 0) + uint16_t a = m_prot_input[1] | (m_prot_input[2] << 8); + uint16_t b = m_prot_input[3] | (m_prot_input[4] << 8); + uint16_t c = 0x4000; /* seems to be hard-coded */ + uint16_t d = 0x00a0; /* seems to be hard-coded */ + uint16_t x = a - b; + if ((int16_t)x >= 0) x = (x * c) >> 16; else - x = -(((UINT16)-x * c) >> 16); + x = -(((uint16_t)-x * c) >> 16); x += d; m_prot_output[0] = x; m_prot_output[1] = x >> 8; @@ -272,7 +272,7 @@ void artmagic_state::cheesech_protection() case 0x03: /* 03 (xxxx) */ if (m_prot_input_index == 1) { - UINT16 x = m_prot_save; + uint16_t x = m_prot_save; m_prot_output[0] = x; m_prot_output[1] = x >> 8; m_prot_output_index = 0; @@ -284,7 +284,7 @@ void artmagic_state::cheesech_protection() case 0x04: /* 04 aaaa */ if (m_prot_input_index == 3) { - UINT16 a = m_prot_input[1] | (m_prot_input[2] << 8); + uint16_t a = m_prot_input[1] | (m_prot_input[2] << 8); m_prot_save = a; m_prot_input_index = m_prot_output_index = 0; } @@ -306,15 +306,15 @@ void artmagic_state::stonebal_protection() case 0x01: /* 01 aaaa bbbb cccc dddd (xxxx) */ if (m_prot_input_index == 9) { - UINT16 a = m_prot_input[1] | (m_prot_input[2] << 8); - UINT16 b = m_prot_input[3] | (m_prot_input[4] << 8); - UINT16 c = m_prot_input[5] | (m_prot_input[6] << 8); - UINT16 d = m_prot_input[7] | (m_prot_input[8] << 8); - UINT16 x = a - b; - if ((INT16)x >= 0) + uint16_t a = m_prot_input[1] | (m_prot_input[2] << 8); + uint16_t b = m_prot_input[3] | (m_prot_input[4] << 8); + uint16_t c = m_prot_input[5] | (m_prot_input[6] << 8); + uint16_t d = m_prot_input[7] | (m_prot_input[8] << 8); + uint16_t x = a - b; + if ((int16_t)x >= 0) x = (x * d) >> 16; else - x = -(((UINT16)-x * d) >> 16); + x = -(((uint16_t)-x * d) >> 16); x += c; m_prot_output[0] = x; m_prot_output[1] = x >> 8; @@ -327,8 +327,8 @@ void artmagic_state::stonebal_protection() case 0x02: /* 02 aaaa (xx) */ if (m_prot_input_index == 3) { - /*UINT16 a = m_prot_input[1] | (m_prot_input[2] << 8);*/ - UINT8 x = 0xa5; + /*uint16_t a = m_prot_input[1] | (m_prot_input[2] << 8);*/ + uint8_t x = 0xa5; m_prot_output[0] = x; m_prot_output_index = 0; } @@ -339,7 +339,7 @@ void artmagic_state::stonebal_protection() case 0x03: /* 03 (xxxx) */ if (m_prot_input_index == 1) { - UINT16 x = m_prot_save; + uint16_t x = m_prot_save; m_prot_output[0] = x; m_prot_output[1] = x >> 8; m_prot_output_index = 0; @@ -351,7 +351,7 @@ void artmagic_state::stonebal_protection() case 0x04: /* 04 aaaa */ if (m_prot_input_index == 3) { - UINT16 a = m_prot_input[1] | (m_prot_input[2] << 8); + uint16_t a = m_prot_input[1] | (m_prot_input[2] << 8); m_prot_save = a; m_prot_input_index = m_prot_output_index = 0; } |