mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
vectrex.c: Reduce tagmap lookups and some minor cleanups. (nw)
This commit is contained in:
parent
fcb030d94d
commit
77b5c79c89
@ -8,6 +8,8 @@
|
||||
#define VECTREX_H_
|
||||
|
||||
#include "machine/6522via.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
|
||||
#define NVECT 10000
|
||||
|
||||
@ -22,8 +24,23 @@ class vectrex_state : public driver_device
|
||||
{
|
||||
public:
|
||||
vectrex_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag) ,
|
||||
m_gce_vectorram(*this, "gce_vectorram"){ }
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_gce_vectorram(*this, "gce_vectorram")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_via6522_0(*this, "via6522_0")
|
||||
, m_dac(*this, "dac")
|
||||
, m_ay8912(*this, "ay8912")
|
||||
, m_io_contr1x(*this, "CONTR1X")
|
||||
, m_io_contr1y(*this, "CONTR1Y")
|
||||
, m_io_contr2x(*this, "CONTR2X")
|
||||
, m_io_contr2y(*this, "CONTR2Y")
|
||||
, m_io_buttons(*this, "BUTTONS")
|
||||
, m_io_3dconf(*this, "3DCONF")
|
||||
, m_io_lpenconf(*this, "LPENCONF")
|
||||
, m_io_lpenx(*this, "LPENX")
|
||||
, m_io_lpeny(*this, "LPENY")
|
||||
, m_io_coin(*this, "COIN")
|
||||
{ }
|
||||
|
||||
required_shared_ptr<UINT8> m_gce_vectorram;
|
||||
int m_64k_cart;
|
||||
@ -61,7 +78,7 @@ public:
|
||||
UINT16 m_via_timer2;
|
||||
attotime m_vector_start_time;
|
||||
UINT8 m_cb2;
|
||||
void (*vector_add_point_function) (running_machine &, int, int, rgb_t, int);
|
||||
void (vectrex_state::*vector_add_point_function)(int, int, rgb_t, int);
|
||||
DECLARE_WRITE8_MEMBER(vectrex_psg_port_w);
|
||||
DECLARE_READ8_MEMBER(vectrex_via_r);
|
||||
DECLARE_WRITE8_MEMBER(vectrex_via_w);
|
||||
@ -85,20 +102,33 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(v_via_ca2_w);
|
||||
DECLARE_WRITE8_MEMBER(v_via_cb2_w);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( vectrex_cart );
|
||||
DECLARE_WRITE_LINE_MEMBER(vectrex_via_irq);
|
||||
|
||||
protected:
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<via6522_device> m_via6522_0;
|
||||
required_device<dac_device> m_dac;
|
||||
required_device<device_t> m_ay8912;
|
||||
optional_ioport m_io_contr1x;
|
||||
optional_ioport m_io_contr1y;
|
||||
optional_ioport m_io_contr2x;
|
||||
optional_ioport m_io_contr2y;
|
||||
required_ioport m_io_buttons;
|
||||
required_ioport m_io_3dconf;
|
||||
required_ioport m_io_lpenconf;
|
||||
required_ioport m_io_lpenx;
|
||||
required_ioport m_io_lpeny;
|
||||
optional_ioport m_io_coin;
|
||||
|
||||
void vectrex_configuration();
|
||||
void vectrex_multiplexer(int mux);
|
||||
void vectrex_add_point(int x, int y, rgb_t color, int intensity);
|
||||
void vectrex_add_point_stereo(int x, int y, rgb_t color, int intensity);
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in machine/vectrex.c -----------*/
|
||||
|
||||
void vectrex_configuration(running_machine &machine);
|
||||
void vectrex_via_irq (device_t *device, int level);
|
||||
|
||||
/*----------- defined in video/vectrex.c -----------*/
|
||||
/*---------- defined in video/vectrex.c -----------*/
|
||||
|
||||
extern const via6522_interface vectrex_via6522_interface;
|
||||
extern const via6522_interface spectrum1_via6522_interface;
|
||||
|
||||
void vectrex_add_point_stereo (running_machine &machine, int x, int y, rgb_t color, int intensity);
|
||||
void vectrex_add_point (running_machine &machine, int x, int y, rgb_t color, int intensity);
|
||||
|
||||
#endif /* VECTREX_H_ */
|
||||
|
@ -66,15 +66,14 @@ static int vectrex_verify_cart(char *data)
|
||||
|
||||
DEVICE_IMAGE_LOAD_MEMBER(vectrex_state,vectrex_cart)
|
||||
{
|
||||
vectrex_state *state = image.device().machine().driver_data<vectrex_state>();
|
||||
UINT8 *mem = state->memregion("maincpu")->base();
|
||||
UINT8 *mem = memregion("maincpu")->base();
|
||||
if (image.software_entry() == NULL)
|
||||
{
|
||||
image.fread( mem, 0x8000);
|
||||
if (image.length() > 0x8000)
|
||||
{
|
||||
image.fread( mem+0x10000, 0x8000);
|
||||
state->m_64k_cart = 1;
|
||||
m_64k_cart = 1;
|
||||
}
|
||||
} else {
|
||||
int size = image.get_software_region_length("rom");
|
||||
@ -89,14 +88,14 @@ DEVICE_IMAGE_LOAD_MEMBER(vectrex_state,vectrex_cart)
|
||||
}
|
||||
|
||||
if (memcmp(mem + 0x06,"SRAM",4)) {
|
||||
image.device().machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x0000, 0x7fff);
|
||||
m_maincpu->space(AS_PROGRAM).unmap_write(0x0000, 0x7fff);
|
||||
}
|
||||
|
||||
/* If VIA T2 starts, reset refresh timer.
|
||||
This is the best strategy for most games. */
|
||||
state->m_reset_refresh = 1;
|
||||
m_reset_refresh = 1;
|
||||
|
||||
state->m_imager_angles = narrow_escape_angles;
|
||||
m_imager_angles = narrow_escape_angles;
|
||||
|
||||
/* let's do this 3D detection with a strcmp using data inside the cart images */
|
||||
/* slightly prettier than having to hardcode CRCs */
|
||||
@ -104,21 +103,21 @@ DEVICE_IMAGE_LOAD_MEMBER(vectrex_state,vectrex_cart)
|
||||
/* handle 3D Narrow Escape but skip the 2-d hack of it from Fred Taft */
|
||||
if (!memcmp(mem + 0x11,"NARROW",6) && (((char*)mem)[0x39] == 0x0c))
|
||||
{
|
||||
state->m_imager_angles = narrow_escape_angles;
|
||||
m_imager_angles = narrow_escape_angles;
|
||||
}
|
||||
|
||||
if (!memcmp(mem + 0x11,"CRAZY COASTER", 13))
|
||||
{
|
||||
state->m_imager_angles = crazy_coaster_angles;
|
||||
m_imager_angles = crazy_coaster_angles;
|
||||
}
|
||||
|
||||
if (!memcmp(mem + 0x11,"3D MINE STORM", 13))
|
||||
{
|
||||
state->m_imager_angles = minestorm_3d_angles;
|
||||
m_imager_angles = minestorm_3d_angles;
|
||||
|
||||
/* Don't reset T2 each time it's written.
|
||||
This would cause jerking in mine3. */
|
||||
state->m_reset_refresh = 0;
|
||||
m_reset_refresh = 0;
|
||||
}
|
||||
|
||||
return IMAGE_INIT_PASS;
|
||||
@ -131,87 +130,86 @@ DEVICE_IMAGE_LOAD_MEMBER(vectrex_state,vectrex_cart)
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
void vectrex_configuration(running_machine &machine)
|
||||
void vectrex_state::vectrex_configuration()
|
||||
{
|
||||
vectrex_state *state = machine.driver_data<vectrex_state>();
|
||||
unsigned char cport = state->ioport("3DCONF")->read();
|
||||
unsigned char cport = m_io_3dconf->read();
|
||||
|
||||
/* Vectrex 'dipswitch' configuration */
|
||||
|
||||
/* Imager control */
|
||||
if (cport & 0x01) /* Imager enabled */
|
||||
{
|
||||
if (state->m_imager_status == 0)
|
||||
state->m_imager_status = cport & 0x01;
|
||||
if (m_imager_status == 0)
|
||||
m_imager_status = cport & 0x01;
|
||||
|
||||
state->vector_add_point_function = cport & 0x02 ? vectrex_add_point_stereo: vectrex_add_point;
|
||||
vector_add_point_function = cport & 0x02 ? &vectrex_state::vectrex_add_point_stereo: &vectrex_state::vectrex_add_point;
|
||||
|
||||
switch ((cport >> 2) & 0x07)
|
||||
{
|
||||
case 0x00:
|
||||
state->m_imager_colors[0] = state->m_imager_colors[1] = state->m_imager_colors[2] = RGB_BLACK;
|
||||
m_imager_colors[0] = m_imager_colors[1] = m_imager_colors[2] = RGB_BLACK;
|
||||
break;
|
||||
case 0x01:
|
||||
state->m_imager_colors[0] = state->m_imager_colors[1] = state->m_imager_colors[2] = VC_DARKRED;
|
||||
m_imager_colors[0] = m_imager_colors[1] = m_imager_colors[2] = VC_DARKRED;
|
||||
break;
|
||||
case 0x02:
|
||||
state->m_imager_colors[0] = state->m_imager_colors[1] = state->m_imager_colors[2] = VC_GREEN;
|
||||
m_imager_colors[0] = m_imager_colors[1] = m_imager_colors[2] = VC_GREEN;
|
||||
break;
|
||||
case 0x03:
|
||||
state->m_imager_colors[0] = state->m_imager_colors[1] = state->m_imager_colors[2] = VC_BLUE;
|
||||
m_imager_colors[0] = m_imager_colors[1] = m_imager_colors[2] = VC_BLUE;
|
||||
break;
|
||||
case 0x04:
|
||||
/* mine3 has a different color sequence */
|
||||
if (state->m_imager_angles == minestorm_3d_angles)
|
||||
if (m_imager_angles == minestorm_3d_angles)
|
||||
{
|
||||
state->m_imager_colors[0] = VC_GREEN;
|
||||
state->m_imager_colors[1] = VC_RED;
|
||||
m_imager_colors[0] = VC_GREEN;
|
||||
m_imager_colors[1] = VC_RED;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_imager_colors[0] = VC_RED;
|
||||
state->m_imager_colors[1] = VC_GREEN;
|
||||
m_imager_colors[0] = VC_RED;
|
||||
m_imager_colors[1] = VC_GREEN;
|
||||
}
|
||||
state->m_imager_colors[2]=VC_BLUE;
|
||||
m_imager_colors[2]=VC_BLUE;
|
||||
break;
|
||||
}
|
||||
|
||||
switch ((cport >> 5) & 0x07)
|
||||
{
|
||||
case 0x00:
|
||||
state->m_imager_colors[3] = state->m_imager_colors[4] = state->m_imager_colors[5] = RGB_BLACK;
|
||||
m_imager_colors[3] = m_imager_colors[4] = m_imager_colors[5] = RGB_BLACK;
|
||||
break;
|
||||
case 0x01:
|
||||
state->m_imager_colors[3] = state->m_imager_colors[4] = state->m_imager_colors[5] = VC_DARKRED;
|
||||
m_imager_colors[3] = m_imager_colors[4] = m_imager_colors[5] = VC_DARKRED;
|
||||
break;
|
||||
case 0x02:
|
||||
state->m_imager_colors[3] = state->m_imager_colors[4] = state->m_imager_colors[5] = VC_GREEN;
|
||||
m_imager_colors[3] = m_imager_colors[4] = m_imager_colors[5] = VC_GREEN;
|
||||
break;
|
||||
case 0x03:
|
||||
state->m_imager_colors[3] = state->m_imager_colors[4] = state->m_imager_colors[5] = VC_BLUE;
|
||||
m_imager_colors[3] = m_imager_colors[4] = m_imager_colors[5] = VC_BLUE;
|
||||
break;
|
||||
case 0x04:
|
||||
if (state->m_imager_angles == minestorm_3d_angles)
|
||||
if (m_imager_angles == minestorm_3d_angles)
|
||||
{
|
||||
state->m_imager_colors[3] = VC_GREEN;
|
||||
state->m_imager_colors[4] = VC_RED;
|
||||
m_imager_colors[3] = VC_GREEN;
|
||||
m_imager_colors[4] = VC_RED;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_imager_colors[3] = VC_RED;
|
||||
state->m_imager_colors[4] = VC_GREEN;
|
||||
m_imager_colors[3] = VC_RED;
|
||||
m_imager_colors[4] = VC_GREEN;
|
||||
}
|
||||
state->m_imager_colors[5]=VC_BLUE;
|
||||
m_imager_colors[5]=VC_BLUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
state->vector_add_point_function = vectrex_add_point;
|
||||
state->m_beam_color = RGB_WHITE;
|
||||
state->m_imager_colors[0] = state->m_imager_colors[1] = state->m_imager_colors[2] = state->m_imager_colors[3] = state->m_imager_colors[4] = state->m_imager_colors[5] = RGB_WHITE;
|
||||
vector_add_point_function = &vectrex_state::vectrex_add_point;
|
||||
m_beam_color = RGB_WHITE;
|
||||
m_imager_colors[0] = m_imager_colors[1] = m_imager_colors[2] = m_imager_colors[3] = m_imager_colors[4] = m_imager_colors[5] = RGB_WHITE;
|
||||
}
|
||||
state->m_lightpen_port = machine.root_device().ioport("LPENCONF")->read() & 0x03;
|
||||
m_lightpen_port = m_io_lpenconf->read() & 0x03;
|
||||
}
|
||||
|
||||
|
||||
@ -221,18 +219,18 @@ void vectrex_configuration(running_machine &machine)
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
void vectrex_via_irq(device_t *device, int level)
|
||||
WRITE_LINE_MEMBER(vectrex_state::vectrex_via_irq)
|
||||
{
|
||||
device->machine().device("maincpu")->execute().set_input_line(M6809_IRQ_LINE, level);
|
||||
m_maincpu->set_input_line(M6809_IRQ_LINE, state);
|
||||
}
|
||||
|
||||
|
||||
READ8_MEMBER(vectrex_state::vectrex_via_pb_r)
|
||||
{
|
||||
int pot;
|
||||
static const char *const ctrlnames[] = { "CONTR1X", "CONTR1Y", "CONTR2X", "CONTR2Y" };
|
||||
ioport_port *io_port[4] = { m_io_contr1x, m_io_contr1y, m_io_contr2x, m_io_contr2y };
|
||||
|
||||
pot = machine().root_device().ioport(ctrlnames[(m_via_out[PORTB] & 0x6) >> 1])->read() - 0x80;
|
||||
pot = io_port[(m_via_out[PORTB] & 0x6) >> 1]->read() - 0x80;
|
||||
|
||||
if (pot > (signed char)m_via_out[PORTA])
|
||||
m_via_out[PORTB] |= 0x20;
|
||||
@ -248,9 +246,7 @@ READ8_MEMBER(vectrex_state::vectrex_via_pa_r)
|
||||
if ((!(m_via_out[PORTB] & 0x10)) && (m_via_out[PORTB] & 0x08))
|
||||
/* BDIR inactive, we can read the PSG. BC1 has to be active. */
|
||||
{
|
||||
device_t *ay = machine().device("ay8912");
|
||||
|
||||
m_via_out[PORTA] = ay8910_r(ay, space, 0)
|
||||
m_via_out[PORTA] = ay8910_r(m_ay8912, space, 0)
|
||||
& ~(m_imager_pinlevel & 0x80);
|
||||
}
|
||||
return m_via_out[PORTA];
|
||||
@ -259,7 +255,7 @@ READ8_MEMBER(vectrex_state::vectrex_via_pa_r)
|
||||
|
||||
READ8_MEMBER(vectrex_state::vectrex_s1_via_pb_r)
|
||||
{
|
||||
return (m_via_out[PORTB] & ~0x40) | (ioport("COIN")->read() & 0x40);
|
||||
return (m_via_out[PORTB] & ~0x40) | (m_io_coin->read() & 0x40);
|
||||
}
|
||||
|
||||
|
||||
@ -284,7 +280,6 @@ TIMER_CALLBACK_MEMBER(vectrex_state::update_level)
|
||||
|
||||
TIMER_CALLBACK_MEMBER(vectrex_state::vectrex_imager_eye)
|
||||
{
|
||||
via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
|
||||
int coffset;
|
||||
double rtime = (1.0 / m_imager_freq);
|
||||
|
||||
@ -301,8 +296,8 @@ TIMER_CALLBACK_MEMBER(vectrex_state::vectrex_imager_eye)
|
||||
machine().scheduler().timer_set (attotime::from_double(rtime * 0.50), timer_expired_delegate(FUNC(vectrex_state::vectrex_imager_eye),this), 1);
|
||||
|
||||
/* Index hole sensor is connected to IO7 which triggers also CA1 of VIA */
|
||||
via_0->write_ca1(1);
|
||||
via_0->write_ca1(0);
|
||||
m_via6522_0->write_ca1(1);
|
||||
m_via6522_0->write_ca1(0);
|
||||
m_imager_pinlevel |= 0x80;
|
||||
machine().scheduler().timer_set (attotime::from_double(rtime / 360.0), timer_expired_delegate(FUNC(vectrex_state::update_level),this), 0, &m_imager_pinlevel);
|
||||
}
|
||||
|
@ -2,10 +2,8 @@
|
||||
#include "emu.h"
|
||||
#include "includes/vectrex.h"
|
||||
#include "video/vector.h"
|
||||
#include "machine/6522via.h"
|
||||
#include "cpu/m6809/m6809.h"
|
||||
#include "sound/ay8910.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
|
||||
#define ANALOG_DELAY 7800
|
||||
@ -47,7 +45,7 @@ const via6522_interface vectrex_via6522_interface =
|
||||
DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, /* read ca1, cb1, ca2, cb2 */
|
||||
DEVCB_DRIVER_MEMBER(vectrex_state,v_via_pa_w), DEVCB_DRIVER_MEMBER(vectrex_state,v_via_pb_w), /* write PA/B */
|
||||
DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER(vectrex_state,v_via_ca2_w), DEVCB_DRIVER_MEMBER(vectrex_state,v_via_cb2_w), /* write ca1, cb1, ca2, cb2 */
|
||||
DEVCB_LINE(vectrex_via_irq), /* IRQ */
|
||||
DEVCB_DRIVER_LINE_MEMBER(vectrex_state,vectrex_via_irq), /* IRQ */
|
||||
};
|
||||
|
||||
|
||||
@ -62,14 +60,13 @@ TIMER_CALLBACK_MEMBER(vectrex_state::lightpen_trigger)
|
||||
{
|
||||
if (m_lightpen_port & 1)
|
||||
{
|
||||
via6522_device *via_0 = machine().device<via6522_device>("via6522_0");
|
||||
via_0->write_ca1(1);
|
||||
via_0->write_ca1(0);
|
||||
m_via6522_0->write_ca1(1);
|
||||
m_via6522_0->write_ca1(0);
|
||||
}
|
||||
|
||||
if (m_lightpen_port & 2)
|
||||
{
|
||||
machine().device("maincpu")->execute().set_input_line(M6809_FIRQ_LINE, PULSE_LINE);
|
||||
m_maincpu->set_input_line(M6809_FIRQ_LINE, PULSE_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,13 +92,11 @@ TIMER_CALLBACK_MEMBER(vectrex_state::lightpen_trigger)
|
||||
|
||||
READ8_MEMBER(vectrex_state::vectrex_via_r)
|
||||
{
|
||||
via6522_device *via = machine().device<via6522_device>("via6522_0");
|
||||
return via->read(space, offset);
|
||||
return m_via6522_0->read(space, offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(vectrex_state::vectrex_via_w)
|
||||
{
|
||||
via6522_device *via = machine().device<via6522_device>("via6522_0");
|
||||
attotime period;
|
||||
|
||||
switch (offset)
|
||||
@ -113,7 +108,7 @@ WRITE8_MEMBER(vectrex_state::vectrex_via_w)
|
||||
case 9:
|
||||
m_via_timer2 = (m_via_timer2 & 0x00ff) | (data << 8);
|
||||
|
||||
period = (attotime::from_hz(machine().device("maincpu")->unscaled_clock()) * m_via_timer2);
|
||||
period = (attotime::from_hz(m_maincpu->unscaled_clock()) * m_via_timer2);
|
||||
|
||||
if (m_reset_refresh)
|
||||
m_refresh->adjust(period, 0, period);
|
||||
@ -124,7 +119,7 @@ WRITE8_MEMBER(vectrex_state::vectrex_via_w)
|
||||
period);
|
||||
break;
|
||||
}
|
||||
via->write(space, offset, data);
|
||||
m_via6522_0->write(space, offset, data);
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +142,7 @@ UINT32 vectrex_state::screen_update_vectrex(screen_device &screen, bitmap_rgb32
|
||||
{
|
||||
int i;
|
||||
|
||||
vectrex_configuration(machine());
|
||||
vectrex_configuration();
|
||||
|
||||
/* start black */
|
||||
vector_add_point(machine(),
|
||||
@ -177,13 +172,12 @@ UINT32 vectrex_state::screen_update_vectrex(screen_device &screen, bitmap_rgb32
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
void vectrex_add_point(running_machine &machine, int x, int y, rgb_t color, int intensity)
|
||||
void vectrex_state::vectrex_add_point(int x, int y, rgb_t color, int intensity)
|
||||
{
|
||||
vectrex_state *state = machine.driver_data<vectrex_state>();
|
||||
vectrex_point *newpoint;
|
||||
|
||||
state->m_point_index = (state->m_point_index+1) % NVECT;
|
||||
newpoint = &state->m_points[state->m_point_index];
|
||||
m_point_index = (m_point_index+1) % NVECT;
|
||||
newpoint = &m_points[m_point_index];
|
||||
|
||||
newpoint->x = x;
|
||||
newpoint->y = y;
|
||||
@ -192,17 +186,16 @@ void vectrex_add_point(running_machine &machine, int x, int y, rgb_t color, int
|
||||
}
|
||||
|
||||
|
||||
void vectrex_add_point_stereo(running_machine &machine, int x, int y, rgb_t color, int intensity)
|
||||
void vectrex_state::vectrex_add_point_stereo(int x, int y, rgb_t color, int intensity)
|
||||
{
|
||||
vectrex_state *state = machine.driver_data<vectrex_state>();
|
||||
if (state->m_imager_status == 2) /* left = 1, right = 2 */
|
||||
vectrex_add_point(machine, (int)(y * M_SQRT1_2)+ state->m_x_center,
|
||||
(int)(((state->m_x_max - x) * M_SQRT1_2)),
|
||||
if (m_imager_status == 2) /* left = 1, right = 2 */
|
||||
vectrex_add_point((int)(y * M_SQRT1_2)+ m_x_center,
|
||||
(int)(((m_x_max - x) * M_SQRT1_2)),
|
||||
color,
|
||||
intensity);
|
||||
else
|
||||
vectrex_add_point(machine, (int)(y * M_SQRT1_2),
|
||||
(int)((state->m_x_max - x) * M_SQRT1_2),
|
||||
vectrex_add_point((int)(y * M_SQRT1_2),
|
||||
(int)((m_x_max - x) * M_SQRT1_2),
|
||||
color,
|
||||
intensity);
|
||||
}
|
||||
@ -212,7 +205,7 @@ TIMER_CALLBACK_MEMBER(vectrex_state::vectrex_zero_integrators)
|
||||
{
|
||||
m_x_int = m_x_center + (m_analog[A_ZR] * INT_PER_CLOCK);
|
||||
m_y_int = m_y_center + (m_analog[A_ZR] * INT_PER_CLOCK);
|
||||
(*vector_add_point_function)(machine(), m_x_int, m_y_int, m_beam_color, 0);
|
||||
(this->*vector_add_point_function)(m_x_int, m_y_int, m_beam_color, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -232,18 +225,18 @@ TIMER_CALLBACK_MEMBER(vectrex_state::update_signal)
|
||||
|
||||
if (!m_ramp)
|
||||
{
|
||||
length = machine().device("maincpu")->unscaled_clock() * INT_PER_CLOCK
|
||||
length = m_maincpu->unscaled_clock() * INT_PER_CLOCK
|
||||
* (machine().time() - m_vector_start_time).as_double();
|
||||
|
||||
m_x_int += length * (m_analog[A_X] + m_analog[A_ZR]);
|
||||
m_y_int += length * (m_analog[A_Y] + m_analog[A_ZR]);
|
||||
|
||||
(*vector_add_point_function)(machine(), m_x_int, m_y_int, m_beam_color, 2 * m_analog[A_Z] * m_blank);
|
||||
(this->*vector_add_point_function)(m_x_int, m_y_int, m_beam_color, 2 * m_analog[A_Z] * m_blank);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_blank)
|
||||
(*vector_add_point_function)(machine(), m_x_int, m_y_int, m_beam_color, 2 * m_analog[A_Z]);
|
||||
(this->*vector_add_point_function)(m_x_int, m_y_int, m_beam_color, 2 * m_analog[A_Z]);
|
||||
}
|
||||
|
||||
m_vector_start_time = machine().time();
|
||||
@ -271,7 +264,7 @@ void vectrex_state::video_start()
|
||||
|
||||
m_imager_freq = 1;
|
||||
|
||||
vector_add_point_function = vectrex_add_point;
|
||||
vector_add_point_function = &vectrex_state::vectrex_add_point;
|
||||
m_imager_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vectrex_state::vectrex_imager_eye),this));
|
||||
m_imager_timer->adjust(
|
||||
attotime::from_hz(m_imager_freq),
|
||||
@ -292,15 +285,12 @@ void vectrex_state::video_start()
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
static void vectrex_multiplexer(running_machine &machine, int mux)
|
||||
void vectrex_state::vectrex_multiplexer(int mux)
|
||||
{
|
||||
vectrex_state *state = machine.driver_data<vectrex_state>();
|
||||
dac_device *dac = machine.device<dac_device>("dac");
|
||||
|
||||
machine.scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::update_signal),state), state->m_via_out[PORTA], &state->m_analog[mux]);
|
||||
machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::update_signal),this), m_via_out[PORTA], &m_analog[mux]);
|
||||
|
||||
if (mux == A_AUDIO)
|
||||
dac->write_unsigned8(state->m_via_out[PORTA]);
|
||||
m_dac->write_unsigned8(m_via_out[PORTA]);
|
||||
}
|
||||
|
||||
|
||||
@ -344,7 +334,7 @@ WRITE8_MEMBER(vectrex_state::v_via_pb_w)
|
||||
+(double)(m_pen_y - m_y_int) * (m_pen_y - m_y_int);
|
||||
d2 = b2 - ab * ab / a2;
|
||||
if (d2 < 2e10 && m_analog[A_Z] * m_blank > 0)
|
||||
m_lp_t->adjust(attotime::from_double(ab / a2 / (machine().device("maincpu")->unscaled_clock() * INT_PER_CLOCK)));
|
||||
m_lp_t->adjust(attotime::from_double(ab / a2 / (m_maincpu->unscaled_clock() * INT_PER_CLOCK)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -386,7 +376,7 @@ WRITE8_MEMBER(vectrex_state::v_via_pb_w)
|
||||
}
|
||||
|
||||
if (!(data & 0x1) && (m_via_out[PORTB] & 0x1))
|
||||
vectrex_multiplexer (machine(), (data >> 1) & 0x3);
|
||||
vectrex_multiplexer((data >> 1) & 0x3);
|
||||
|
||||
m_via_out[PORTB] = data;
|
||||
machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::update_signal),this), data & 0x80, &m_ramp);
|
||||
@ -400,7 +390,7 @@ WRITE8_MEMBER(vectrex_state::v_via_pa_w)
|
||||
machine().scheduler().timer_set(attotime::from_nsec(ANALOG_DELAY), timer_expired_delegate(FUNC(vectrex_state::update_signal),this), data, &m_analog[A_Y]);
|
||||
|
||||
if (!(m_via_out[PORTB] & 0x1))
|
||||
vectrex_multiplexer (machine(), (m_via_out[PORTB] >> 1) & 0x3);
|
||||
vectrex_multiplexer((m_via_out[PORTB] >> 1) & 0x3);
|
||||
}
|
||||
|
||||
|
||||
@ -450,7 +440,7 @@ const via6522_interface spectrum1_via6522_interface =
|
||||
{
|
||||
/*inputs : A/B,CA/B1,CA/B2 */ DEVCB_DRIVER_MEMBER(vectrex_state,vectrex_via_pa_r), DEVCB_DRIVER_MEMBER(vectrex_state,vectrex_s1_via_pb_r), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
|
||||
/*outputs: A/B,CA/B1,CA/B2 */ DEVCB_DRIVER_MEMBER(vectrex_state,v_via_pa_w), DEVCB_DRIVER_MEMBER(vectrex_state,v_via_pb_w), DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER(vectrex_state,v_via_ca2_w), DEVCB_DRIVER_MEMBER(vectrex_state,v_via_cb2_w),
|
||||
/*irq */ DEVCB_LINE(vectrex_via_irq),
|
||||
/*irq */ DEVCB_DRIVER_LINE_MEMBER(vectrex_state,vectrex_via_irq),
|
||||
};
|
||||
|
||||
|
||||
@ -472,7 +462,7 @@ VIDEO_START_MEMBER(vectrex_state,raaspec)
|
||||
m_x_max = visarea.max_x << 16;
|
||||
m_y_max = visarea.max_y << 16;
|
||||
|
||||
vector_add_point_function = vectrex_add_point;
|
||||
vector_add_point_function = &vectrex_state::vectrex_add_point;
|
||||
m_refresh = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vectrex_state::vectrex_refresh),this));
|
||||
|
||||
VIDEO_START_CALL_LEGACY(vector);
|
||||
|
Loading…
Reference in New Issue
Block a user