mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
stuntcyc: Hook up fixedfreq monitor. [Couriersud]
This commit is contained in:
parent
219f4cc5e4
commit
ee9b56d4df
2 changed files with 22 additions and 149 deletions
|
@ -93,8 +93,8 @@
|
|||
#define HRES_MULT (1)
|
||||
// end
|
||||
|
||||
#define SC_VIDCLOCK (14318181/2)
|
||||
#define SC_HTOTAL (0x1C8+1) // 456
|
||||
#define SC_VIDCLOCK (14318000/2)
|
||||
#define SC_HTOTAL (0x1C8+0) // 456
|
||||
#define SC_VTOTAL (0x103+1) // 259
|
||||
#define SC_HBSTART (SC_HTOTAL)
|
||||
#define SC_HBEND (32)
|
||||
|
@ -138,34 +138,10 @@ public:
|
|||
stuntcyc_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
//, m_video(*this, "fixfreq")
|
||||
, m_probe_screen(*this, "screen")
|
||||
, 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)
|
||||
, m_video(*this, "fixfreq")
|
||||
{
|
||||
}
|
||||
|
||||
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_LOGIC_CALLBACK_MEMBER(probe_clock_cb);
|
||||
|
||||
uint32_t screen_update_stuntcyc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
|
||||
void stuntcyc(machine_config &config);
|
||||
protected:
|
||||
|
||||
|
@ -175,23 +151,7 @@ protected:
|
|||
|
||||
private:
|
||||
required_device<netlist_mame_device> m_maincpu;
|
||||
//required_device<fixedfreq_device> m_video;
|
||||
required_device<screen_device> m_probe_screen;
|
||||
|
||||
int m_probe_bit0;
|
||||
int m_probe_bit1;
|
||||
int m_probe_bit2;
|
||||
int m_probe_bit3;
|
||||
int m_probe_bit4;
|
||||
int m_probe_bit5;
|
||||
int m_probe_bit6;
|
||||
|
||||
std::unique_ptr<int[]> m_probe_data;
|
||||
|
||||
int m_last_beam;
|
||||
int m_last_hpos;
|
||||
int m_last_vpos;
|
||||
double m_last_fraction;
|
||||
required_device<fixedfreq_device> m_video;
|
||||
};
|
||||
|
||||
class gtrak10_state : public driver_device
|
||||
|
@ -236,93 +196,10 @@ 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<int[]>(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_LOGIC_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] = int(double(m_probe_data[last_index]) * m_last_fraction);
|
||||
m_probe_data[last_index] += int(double(m_last_beam) * (1.0 - m_last_fraction));
|
||||
last_index++;
|
||||
while (last_index <= curr_index)
|
||||
m_probe_data[last_index++] = m_last_beam;
|
||||
}
|
||||
|
||||
//m_last_beam = float(data);
|
||||
m_last_beam = m_probe_bit0 + m_probe_bit1 * 2 + m_probe_bit2 * 4 + m_probe_bit3 * 8 + m_probe_bit4 * 16 + m_probe_bit5 * 32 + m_probe_bit6 * 64;
|
||||
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)
|
||||
{
|
||||
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 | (m_probe_data[pixindex++] * 0x010101);
|
||||
//*scanline++ = 0xff000000 | (uint8_t(m_screen_buf[pixindex++] * 63.0) * 0x010101);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void atarikee_state::atarikee(machine_config &config)
|
||||
|
@ -347,26 +224,18 @@ void stuntcyc_state::stuntcyc(machine_config &config)
|
|||
{
|
||||
/* basic machine hardware */
|
||||
NETLIST_CPU(config, m_maincpu, STUNTCYC_NL_CLOCK).set_source(netlist_stuntcyc);
|
||||
NETLIST_ANALOG_OUTPUT(config, "maincpu:vid0", 0).set_params("VIDEO_OUT", "fixfreq", FUNC(fixedfreq_device::update_composite_monochrome));
|
||||
|
||||
NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit0", 0).set_params("probe_bit0", FUNC(stuntcyc_state::probe_bit0_cb));
|
||||
NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit1", 0).set_params("probe_bit1", FUNC(stuntcyc_state::probe_bit1_cb));
|
||||
NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit2", 0).set_params("probe_bit2", FUNC(stuntcyc_state::probe_bit2_cb));
|
||||
NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit3", 0).set_params("probe_bit3", FUNC(stuntcyc_state::probe_bit3_cb));
|
||||
NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit4", 0).set_params("probe_bit4", FUNC(stuntcyc_state::probe_bit4_cb));
|
||||
NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit5", 0).set_params("probe_bit5", FUNC(stuntcyc_state::probe_bit5_cb));
|
||||
NETLIST_ANALOG_OUTPUT(config, "maincpu:probe_bit6", 0).set_params("probe_bit6", FUNC(stuntcyc_state::probe_bit6_cb));
|
||||
NETLIST_LOGIC_OUTPUT(config, "maincpu:probe_clock", 0).set_params("probe_clock", FUNC(stuntcyc_state::probe_clock_cb));
|
||||
|
||||
/* video hardware */
|
||||
SCREEN(config, m_probe_screen, SCREEN_TYPE_RASTER);
|
||||
m_probe_screen->set_screen_update(FUNC(stuntcyc_state::screen_update_stuntcyc));
|
||||
m_probe_screen->set_raw(SC_HTOTAL*SC_VTOTAL*60, SC_HTOTAL, 0, SC_HTOTAL, SC_VTOTAL, 0, SC_VTOTAL);
|
||||
//FIXFREQ(config, m_video).set_screen("screen");
|
||||
//m_video->set_monitor_clock(SC_VIDCLOCK);
|
||||
//m_video->set_horz_params(SC_HTOTAL-67,SC_HTOTAL-40,SC_HTOTAL-8, SC_HTOTAL);
|
||||
//m_video->set_vert_params(SC_VTOTAL-22,SC_VTOTAL-19,SC_VTOTAL-12,SC_VTOTAL);
|
||||
//m_video->set_fieldcount(1);
|
||||
//m_video->set_threshold(0.30);
|
||||
/* video hardware */
|
||||
SCREEN(config, "screen", SCREEN_TYPE_RASTER);
|
||||
FIXFREQ(config, m_video).set_screen("screen");
|
||||
m_video->set_monitor_clock(SC_VIDCLOCK);
|
||||
m_video->set_horz_params(SC_HTOTAL-84,SC_HTOTAL-64,SC_HTOTAL-16, SC_HTOTAL);
|
||||
m_video->set_vert_params(SC_VTOTAL-21,SC_VTOTAL-17,SC_VTOTAL-12, SC_VTOTAL);
|
||||
m_video->set_fieldcount(1);
|
||||
m_video->set_threshold(0.89);
|
||||
m_video->set_gain(0.2);
|
||||
m_video->set_horz_scale(4);
|
||||
}
|
||||
|
||||
void gtrak10_state::gtrak10(machine_config &config)
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
NETLIST_START(stuntcyc)
|
||||
|
||||
SOLVER(Solver, 48000)
|
||||
|
||||
PARAM(Solver.PARALLEL, 0) // Don't do parallel solvers
|
||||
PARAM(Solver.ACCURACY, 1e-4) // works and is sufficient
|
||||
PARAM(NETLIST.USE_DEACTIVATE, 1)
|
||||
|
||||
ANALOG_INPUT(V5, 5)
|
||||
|
@ -22,8 +22,8 @@ NETLIST_START(stuntcyc)
|
|||
TTL_INPUT(high, 1)
|
||||
TTL_INPUT(low, 0)
|
||||
|
||||
MAINCLOCK(main_clk, 14258400)
|
||||
//MAINCLOCK(main_clk, 14318181)
|
||||
//MAINCLOCK(main_clk, 14258400)
|
||||
MAINCLOCK(main_clk, 14318000)
|
||||
ALIAS(Y1, main_clk)
|
||||
|
||||
#if 1
|
||||
|
@ -326,6 +326,10 @@ NETLIST_START(stuntcyc)
|
|||
NET_C(R15.1, E4_2.Q)
|
||||
//RES(R107, RES_K(1))
|
||||
|
||||
// FIXME: Having the diode in the video output has a negative impact
|
||||
// on performance. A "fast-but-not-perfect" approach could
|
||||
// use a switched resistor.
|
||||
|
||||
DIODE(D17, "1N914")
|
||||
NET_C(D17.K, COMP_SYNC_Q)
|
||||
//NET_C(D17.A, R107.1, R13.2, R14.2, R15.2)
|
||||
|
|
Loading…
Reference in a new issue