mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
Added logic probe to stuntcyc for debugging, does not seem to work, pushing so others can take a look (nw)
This commit is contained in:
parent
538d76efe3
commit
7b41cc2c47
@ -127,19 +127,67 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class stuntcyc_state : public atarikee_state
|
||||
class stuntcyc_state : public driver_device
|
||||
{
|
||||
public:
|
||||
stuntcyc_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: atarikee_state(mconfig, type, tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_screen(*this, "screen")
|
||||
, m_hf1(*this, "maincpu:hf1")
|
||||
, m_d7(*this, "maincpu:d7")
|
||||
, m_probe_bit0(0.0)
|
||||
, m_probe_bit1(0.0)
|
||||
, m_probe_bit2(0.0)
|
||||
, m_probe_bit3(0.0)
|
||||
, m_probe_bit4(0.0)
|
||||
, m_probe_bit5(0.0)
|
||||
, m_probe_bit6(0.0)
|
||||
, m_probe_data(nullptr)
|
||||
, m_last_beam(0.0)
|
||||
, m_last_hpos(0)
|
||||
, m_last_vpos(0)
|
||||
, m_last_fraction(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit0_cb);
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit1_cb);
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit2_cb);
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit3_cb);
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit4_cb);
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit5_cb);
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(probe_bit6_cb);
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(probe_clock_cb);
|
||||
|
||||
uint32_t screen_update_stuntcyc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
|
||||
protected:
|
||||
|
||||
// driver_device overrides
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
private:
|
||||
required_device<netlist_mame_device_t> m_maincpu;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<netlist_mame_rom_t> m_hf1;
|
||||
required_device<netlist_mame_rom_t> m_d7;
|
||||
|
||||
double m_probe_bit0;
|
||||
double m_probe_bit1;
|
||||
double m_probe_bit2;
|
||||
double m_probe_bit3;
|
||||
double m_probe_bit4;
|
||||
double m_probe_bit5;
|
||||
double m_probe_bit6;
|
||||
|
||||
std::unique_ptr<float[]> m_probe_data;
|
||||
|
||||
double m_last_beam;
|
||||
int m_last_hpos;
|
||||
int m_last_vpos;
|
||||
double m_last_fraction;
|
||||
};
|
||||
|
||||
static NETLIST_START(atarikee)
|
||||
@ -167,7 +215,101 @@ void atarikee_state::video_start()
|
||||
{
|
||||
}
|
||||
|
||||
void stuntcyc_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_probe_bit0));
|
||||
save_item(NAME(m_probe_bit1));
|
||||
save_item(NAME(m_probe_bit2));
|
||||
save_item(NAME(m_probe_bit3));
|
||||
save_item(NAME(m_probe_bit4));
|
||||
save_item(NAME(m_probe_bit5));
|
||||
save_item(NAME(m_probe_bit6));
|
||||
save_item(NAME(m_last_beam));
|
||||
save_item(NAME(m_last_hpos));
|
||||
save_item(NAME(m_last_vpos));
|
||||
save_item(NAME(m_last_fraction));
|
||||
|
||||
m_probe_bit0 = 0;
|
||||
m_probe_bit1 = 0;
|
||||
m_probe_bit2 = 0;
|
||||
m_probe_bit3 = 0;
|
||||
m_probe_bit4 = 0;
|
||||
m_probe_bit5 = 0;
|
||||
m_probe_bit6 = 0;
|
||||
|
||||
m_probe_data = std::make_unique<float[]>(SC_HTOTAL * SC_VTOTAL);
|
||||
}
|
||||
|
||||
void stuntcyc_state::machine_reset()
|
||||
{
|
||||
m_probe_bit0 = 0;
|
||||
m_probe_bit1 = 0;
|
||||
m_probe_bit2 = 0;
|
||||
m_probe_bit3 = 0;
|
||||
m_probe_bit4 = 0;
|
||||
m_probe_bit5 = 0;
|
||||
m_probe_bit6 = 0;
|
||||
}
|
||||
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit0_cb) { m_probe_bit0 = data; }
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit1_cb) { m_probe_bit1 = data; }
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit2_cb) { m_probe_bit2 = data; }
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit3_cb) { m_probe_bit3 = data; }
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit4_cb) { m_probe_bit4 = data; }
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit5_cb) { m_probe_bit5 = data; }
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_bit6_cb) { m_probe_bit6 = data; }
|
||||
NETDEV_ANALOG_CALLBACK_MEMBER(stuntcyc_state::probe_clock_cb)
|
||||
{
|
||||
synchronize();
|
||||
attotime second_fraction(0, time.attoseconds());
|
||||
attotime frame_fraction(0, (second_fraction * 60).attoseconds());
|
||||
attotime pixel_time = frame_fraction * (SC_HTOTAL * SC_VTOTAL);
|
||||
int32_t pixel_index = (frame_fraction * (SC_HTOTAL * SC_VTOTAL)).seconds();
|
||||
double pixel_fraction = ATTOSECONDS_TO_DOUBLE(pixel_time.attoseconds());
|
||||
|
||||
const int hpos = pixel_index % SC_HTOTAL;//m_screen->hpos();
|
||||
const int vpos = pixel_index / SC_HTOTAL;//m_screen->vpos();
|
||||
const int curr_index = vpos * SC_HTOTAL + hpos;
|
||||
|
||||
int last_index = m_last_vpos * SC_HTOTAL + m_last_hpos;
|
||||
if (last_index != curr_index)
|
||||
{
|
||||
m_probe_data[last_index] *= m_last_fraction;
|
||||
m_probe_data[last_index] += float(m_last_beam * (1.0 - m_last_fraction));
|
||||
last_index++;
|
||||
while (last_index <= curr_index)
|
||||
m_probe_data[last_index++] = float(m_last_beam);
|
||||
}
|
||||
|
||||
//m_last_beam = float(data);
|
||||
m_last_beam = float(m_probe_bit0 + m_probe_bit1 * 2.0 + m_probe_bit2 * 4.0 + m_probe_bit3 * 8.0 + m_probe_bit4 * 16.0 + m_probe_bit5 * 32.0 + m_probe_bit6 * 64.0);
|
||||
m_last_hpos = hpos;
|
||||
m_last_vpos = vpos;
|
||||
m_last_fraction = pixel_fraction;
|
||||
}
|
||||
|
||||
uint32_t stuntcyc_state::screen_update_stuntcyc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int last_index = m_last_vpos * SC_HTOTAL + m_last_hpos;
|
||||
while (last_index < SC_HTOTAL * SC_VTOTAL)
|
||||
{
|
||||
m_probe_data[last_index++] = m_last_beam;
|
||||
}
|
||||
m_last_hpos = 0;
|
||||
m_last_vpos = 0;
|
||||
|
||||
uint32_t pixindex = 0;
|
||||
for (int y = 0; y < SC_VTOTAL; y++)
|
||||
{
|
||||
uint32_t *scanline = &bitmap.pix32(y);
|
||||
pixindex = y * SC_HTOTAL;
|
||||
for (int x = 0; x < SC_HTOTAL; x++)
|
||||
*scanline++ = 0xff000000 | (uint8_t(m_probe_data[pixindex++] * 0.5) * 0x010101);
|
||||
//*scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 63.0) * 0x010101);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( atarikee, atarikee_state )
|
||||
/* basic machine hardware */
|
||||
@ -192,15 +334,26 @@ static MACHINE_CONFIG_START( stuntcyc, stuntcyc_state )
|
||||
MCFG_NETLIST_ROM_REGION("maincpu", "hf1", "hf1", "hf1")
|
||||
MCFG_NETLIST_ROM_REGION("maincpu", "d7", "d7", "d7")
|
||||
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "vid0", "VIDEO_OUT", fixedfreq_device, update_vid, "fixfreq")
|
||||
//MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "vid0", "VIDEO_OUT", fixedfreq_device, update_vid, "fixfreq")
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "probe_bit0", "probe_bit0", stuntcyc_state, probe_bit0_cb, "")
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "probe_bit1", "probe_bit1", stuntcyc_state, probe_bit1_cb, "")
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "probe_bit2", "probe_bit2", stuntcyc_state, probe_bit2_cb, "")
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "probe_bit3", "probe_bit3", stuntcyc_state, probe_bit3_cb, "")
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "probe_bit4", "probe_bit4", stuntcyc_state, probe_bit4_cb, "")
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "probe_bit5", "probe_bit5", stuntcyc_state, probe_bit5_cb, "")
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "probe_bit6", "probe_bit6", stuntcyc_state, probe_bit6_cb, "")
|
||||
MCFG_NETLIST_ANALOG_OUTPUT("maincpu", "probe_clock", "probe_clock", stuntcyc_state, probe_clock_cb, "")
|
||||
|
||||
/* video hardware */
|
||||
MCFG_FIXFREQ_ADD("fixfreq", "screen")
|
||||
MCFG_FIXFREQ_MONITOR_CLOCK(MASTER_CLOCK)
|
||||
MCFG_FIXFREQ_HORZ_PARAMS(SC_HTOTAL-67,SC_HTOTAL-40,SC_HTOTAL-8, SC_HTOTAL)
|
||||
MCFG_FIXFREQ_VERT_PARAMS(SC_VTOTAL-22,SC_VTOTAL-19,SC_VTOTAL-12,SC_VTOTAL)
|
||||
MCFG_FIXFREQ_FIELDCOUNT(1)
|
||||
MCFG_FIXFREQ_SYNC_THRESHOLD(0.30)
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(stuntcyc_state, screen_update_stuntcyc)
|
||||
MCFG_SCREEN_RAW_PARAMS(14318181/2, SC_HTOTAL, 0, SC_HTOTAL, SC_VTOTAL, 0, SC_VTOTAL)
|
||||
//MCFG_FIXFREQ_ADD("fixfreq", "screen")
|
||||
//MCFG_FIXFREQ_MONITOR_CLOCK(MASTER_CLOCK)
|
||||
//MCFG_FIXFREQ_HORZ_PARAMS(SC_HTOTAL-67,SC_HTOTAL-40,SC_HTOTAL-8, SC_HTOTAL)
|
||||
//MCFG_FIXFREQ_VERT_PARAMS(SC_VTOTAL-22,SC_VTOTAL-19,SC_VTOTAL-12,SC_VTOTAL)
|
||||
//MCFG_FIXFREQ_FIELDCOUNT(1)
|
||||
//MCFG_FIXFREQ_SYNC_THRESHOLD(0.30)
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
|
@ -45,6 +45,15 @@ NETLIST_START(stuntcyc)
|
||||
ALIAS( 32H, L4.QB)
|
||||
ALIAS( 64H, L4.QC)
|
||||
ALIAS(128H, L4.QD)
|
||||
|
||||
ALIAS(probe_bit0, M4.QA)
|
||||
ALIAS(probe_bit1, M4.QB)
|
||||
ALIAS(probe_bit2, high)
|
||||
ALIAS(probe_bit3, high)
|
||||
ALIAS(probe_bit4, high)
|
||||
ALIAS(probe_bit5, high)
|
||||
ALIAS(probe_bit6, high)
|
||||
ALIAS(probe_clock, CLOCK)
|
||||
|
||||
TTL_74107(K4_1, 128H, P, P, P)
|
||||
ALIAS(256H, K4_1.Q)
|
||||
@ -310,13 +319,15 @@ NETLIST_START(stuntcyc)
|
||||
NET_C(R14.1, V5)
|
||||
RES(R15, RES_K(1))
|
||||
NET_C(R15.1, E4_2.Q)
|
||||
RES(R107, RES_K(1))
|
||||
//RES(R107, RES_K(1))
|
||||
|
||||
DIODE(D17, "1N914")
|
||||
NET_C(D17.K, COMP_SYNC_Q)
|
||||
NET_C(D17.A, R107.1, R13.2, R14.2, R15.2)
|
||||
//NET_C(D17.A, R107.1, R13.2, R14.2, R15.2)
|
||||
NET_C(D17.A, R13.2, R14.2, R15.2)
|
||||
|
||||
ALIAS(VIDEO_OUT, R107.2)
|
||||
//NET_C(R107.2, GND)
|
||||
//ALIAS(VIDEO_OUT, R107.2)
|
||||
|
||||
/* Horizontal movement */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user