summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2025-06-23 03:11:33 +0200
committer hap <happppp@users.noreply.github.com>2025-06-23 03:11:46 +0200
commitcfa2b10352cc878efb96f61e2924dae6c534a587 (patch)
tree3a484b76e1d112bbcc5b9fe6a11dd2a8c4b76db3
parente7a2e1399394ea885b4b6a9e343efe68c802bc07 (diff)
k051733: improve reg 7 [hap, Jim Westfall]
-rw-r--r--src/mame/konami/bladestl.cpp8
-rw-r--r--src/mame/konami/chqflag.cpp35
-rw-r--r--src/mame/konami/k051733.cpp65
-rw-r--r--src/mame/konami/mainevt.cpp3
4 files changed, 56 insertions, 55 deletions
diff --git a/src/mame/konami/bladestl.cpp b/src/mame/konami/bladestl.cpp
index f9e5c79b064..f6e8cb15f4e 100644
--- a/src/mame/konami/bladestl.cpp
+++ b/src/mame/konami/bladestl.cpp
@@ -21,12 +21,6 @@
* FIRQ: not used.
* NMI: not used.
- Notes:
- * The protection is not fully understood(Konami 051733). The
- game is playable, but is not 100% accurate.
- * Missing samples.
- (both issues above are outdated?)
-
***************************************************************************/
#include "emu.h"
@@ -450,8 +444,6 @@ void bladestl_state::bladestl(machine_config &config)
k051733.set_nmi_cb().set_inputline(m_maincpu, INPUT_LINE_NMI);
// sound hardware
- /* the initialization order is important, the port callbacks being
- called at initialization time */
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
diff --git a/src/mame/konami/chqflag.cpp b/src/mame/konami/chqflag.cpp
index 41a6d025a6b..4aff8fdc7a2 100644
--- a/src/mame/konami/chqflag.cpp
+++ b/src/mame/konami/chqflag.cpp
@@ -9,10 +9,6 @@
Notes:
- 007232 volume & panning control is almost certainly wrong;
- - 051733 opponent cars have wrong RNG colors compared to references;
- - 051733 opponent car-to-car collisions direction are wrong, according
- to reference orange car should shift to the left instead (current emulation
- makes them to wall crash most of the time instead);
- needs proper shadow/highlight factor values for sprites and tilemap;
- compared to references, emulation is a bit slower (around 2/3 seconds
behind on a full lap of stage 2);
@@ -81,14 +77,16 @@ private:
uint32_t screen_update_chqflag(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void chqflag_map(address_map &map) ATTR_COLD;
void chqflag_sound_map(address_map &map) ATTR_COLD;
+
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
+
private:
/* misc */
- int m_k051316_readroms = 0;
- int m_last_vreg = 0;
- int m_analog_ctrl = 0;
+ int m_k051316_readroms = 0;
+ int m_last_vreg = 0;
+ int m_analog_ctrl = 0;
/* devices */
required_device<cpu_device> m_maincpu;
@@ -188,11 +186,11 @@ void chqflag_state::chqflag_bankswitch_w(uint8_t data)
void chqflag_state::chqflag_vreg_w(uint8_t data)
{
/* bits 0 & 1 = coin counters */
- machine().bookkeeping().coin_counter_w(1, data & 0x01);
- machine().bookkeeping().coin_counter_w(0, data & 0x02);
+ machine().bookkeeping().coin_counter_w(1, BIT(data, 0));
+ machine().bookkeeping().coin_counter_w(0, BIT(data, 1));
/* bit 4 = enable rom reading through K051316 #1 & #2 */
- m_k051316_readroms = (data & 0x10);
+ m_k051316_readroms = BIT(data, 4);
/* Bits 3-7 probably control palette dimming in a similar way to TMNT2/Sunset Riders, */
/* however I don't have enough evidence to determine the exact behaviour. */
@@ -212,12 +210,12 @@ void chqflag_state::chqflag_vreg_w(uint8_t data)
* TODO: true values aren't known, also shadow_factors table probably scales towards zero instead (game doesn't use those)
*/
const double shadow_factors[4] = {0.8, 1.0, 1.33, 1.66};
- uint8_t shadow_value = (data & 0x08) >> 3;
- uint8_t shadow_setting = (data & 0x80) >> 7;
+ uint8_t shadow_value = BIT(data, 3);
+ uint8_t shadow_setting = BIT(data, 7);
m_k051960->set_shadow_inv(shadow_setting);
- m_palette->set_shadow_factor(shadow_factors[(shadow_setting << 1) + shadow_value]);
+ m_palette->set_shadow_factor(shadow_factors[(shadow_setting << 1) | shadow_value]);
if (shadow_setting != m_last_vreg)
{
@@ -235,9 +233,8 @@ void chqflag_state::chqflag_vreg_w(uint8_t data)
}
#endif
-//if ((data & 0xf8) && (data & 0xf8) != 0x88)
-// popmessage("chqflag_vreg_w %02x",data);
-
+ //if ((data & 0xf8) && (data & 0xf8) != 0x88)
+ // popmessage("chqflag_vreg_w %02x",data);
/* other bits unknown. bit 5 is used. */
}
@@ -559,6 +556,6 @@ ROM_END
} // anonymous namespace
-// YEAR NAME PARENT MACHINE INPUT CLASS INIT MONITOR COMPANY FULLNAME FLAGS LAYOUT
-GAMEL( 1988, chqflag, 0, chqflag, chqflag, chqflag_state, empty_init, ROT90, "Konami", "Chequered Flag", MACHINE_UNEMULATED_PROTECTION | MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_chqflag )
-GAMEL( 1988, chqflagj, chqflag, chqflag, chqflagj, chqflag_state, empty_init, ROT90, "Konami", "Chequered Flag (Japan)", MACHINE_UNEMULATED_PROTECTION | MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_chqflag )
+// YEAR NAME PARENT MACHINE INPUT CLASS INIT MONITOR COMPANY FULLNAME FLAGS LAYOUT
+GAMEL( 1988, chqflag, 0, chqflag, chqflag, chqflag_state, empty_init, ROT90, "Konami", "Chequered Flag", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_chqflag )
+GAMEL( 1988, chqflagj, chqflag, chqflag, chqflagj, chqflag_state, empty_init, ROT90, "Konami", "Chequered Flag (Japan)", MACHINE_IMPERFECT_COLORS | MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE, layout_chqflag )
diff --git a/src/mame/konami/k051733.cpp b/src/mame/konami/k051733.cpp
index 600e7bec0cc..43015793f62 100644
--- a/src/mame/konami/k051733.cpp
+++ b/src/mame/konami/k051733.cpp
@@ -110,10 +110,10 @@ u8 k051733_device::read(offs_t offset)
u16 const op3 = (m_ram[0x04] << 8) | m_ram[0x05];
u16 const rad = (m_ram[0x06] << 8) | m_ram[0x07];
- u16 const yobj1c = (m_ram[0x08] << 8) | m_ram[0x09];
- u16 const xobj1c = (m_ram[0x0a] << 8) | m_ram[0x0b];
- u16 const yobj2c = (m_ram[0x0c] << 8) | m_ram[0x0d];
- u16 const xobj2c = (m_ram[0x0e] << 8) | m_ram[0x0f];
+ u16 const y1 = (m_ram[0x08] << 8) | m_ram[0x09];
+ u16 const x1 = (m_ram[0x0a] << 8) | m_ram[0x0b];
+ u16 const y2 = (m_ram[0x0c] << 8) | m_ram[0x0d];
+ u16 const x2 = (m_ram[0x0e] << 8) | m_ram[0x0f];
switch (offset)
{
@@ -148,37 +148,50 @@ u8 k051733_device::read(offs_t offset)
return lfsr;
case 0x07:
- // note: Chequered Flag definitely wants all these bits to be enabled
- if (abs(xobj1c - xobj2c) > rad || abs(yobj1c - yobj2c) > rad)
+ {
+ const int dx = x2 - x1;
+ const int dy = y2 - y1;
+
+ // note: Chequered Flag definitely wants all these bits to be set
+ if (abs(dx) > rad || abs(dy) > rad)
return 0xff;
- else if (yobj1c > yobj2c)
- {
- if (xobj1c == xobj2c)
- return 0x06;
- else if (xobj1c > xobj2c)
- return 0x00;
- else
- return 0x04;
- }
- else if (yobj1c < yobj2c)
+ // octant angle
+ if (y1 >= y2)
{
- if (xobj1c == xobj2c)
- return 0x02;
- else if (xobj1c > xobj2c)
- return 0x01;
+ if (x1 >= x2)
+ {
+ if (dy >= dx)
+ return 0x00;
+ else
+ return 0x06;
+ }
else
- return 0x05;
+ {
+ if (dy >= -dx)
+ return 0x04;
+ else
+ return 0x07;
+ }
}
else
{
- if (xobj1c == xobj2c)
- return 0x00;
- else if (xobj1c > xobj2c)
- return 0x00;
+ if (x1 >= x2)
+ {
+ if (dy > -dx)
+ return 0x02;
+ else
+ return 0x01;
+ }
else
- return 0x04;
+ {
+ if (dy > dx)
+ return 0x03;
+ else
+ return 0x05;
+ }
}
+ }
}
return 0;
diff --git a/src/mame/konami/mainevt.cpp b/src/mame/konami/mainevt.cpp
index 0ac7852c224..1793d7d657e 100644
--- a/src/mame/konami/mainevt.cpp
+++ b/src/mame/konami/mainevt.cpp
@@ -11,8 +11,7 @@ Notes:
- Schematics show a palette/work RAM bank selector, but this doesn't seem
to be used?
-- Devastators: has player-trench collision detection issues, player isn't
- supposed to go through them.
+- Devastators: can't shoot the watchtowers on the left side, protection?
- Devastators: sprite zooming for the planes in level 2 is particularly bad.