mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
micro3d.c: reduce tagmap lookups (nw)
This commit is contained in:
parent
35ea367141
commit
160ddc6edc
@ -343,7 +343,7 @@ WRITE8_MEMBER(micro3d_state::micro3d_sound_io_w)
|
||||
{
|
||||
case 0x01:
|
||||
{
|
||||
micro3d_sound_device *noise = machine().device<micro3d_sound_device>(data & 4 ? "noise_2" : "noise_1");
|
||||
micro3d_sound_device *noise = (data & 4) ? m_noise_2 : m_noise_1;
|
||||
noise->noise_sh_w(data);
|
||||
break;
|
||||
}
|
||||
@ -360,7 +360,7 @@ READ8_MEMBER(micro3d_state::micro3d_sound_io_r)
|
||||
{
|
||||
switch (offset)
|
||||
{
|
||||
case 0x01: return (m_sound_port_latch[offset] & 0x7f) | ioport("SOUND_SW")->read();
|
||||
case 0x01: return (m_sound_port_latch[offset] & 0x7f) | m_sound_sw->read();
|
||||
case 0x03: return (m_sound_port_latch[offset] & 0xf7) | (m_upd7759->busy_r() ? 0x08 : 0);
|
||||
default: return 0;
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ enum dac_registers {
|
||||
PAN
|
||||
};
|
||||
|
||||
class micro3d_sound_device;
|
||||
|
||||
class micro3d_state : public driver_device
|
||||
{
|
||||
@ -58,6 +59,14 @@ public:
|
||||
m_vgb(*this, "vgb"),
|
||||
m_palette(*this, "palette"),
|
||||
m_duart68681(*this, "duart68681"),
|
||||
m_noise_1(*this, "noise_1"),
|
||||
m_noise_2(*this, "noise_2"),
|
||||
m_vertex(*this, "vertex"),
|
||||
m_sound_sw(*this, "SOUND_SW"),
|
||||
m_volume(*this, "VOLUME"),
|
||||
m_joystick_x(*this, "JOYSTICK_X"),
|
||||
m_joystick_y(*this, "JOYSTICK_Y"),
|
||||
m_throttle(*this, "THROTTLE"),
|
||||
m_shared_ram(*this, "shared_ram"),
|
||||
m_mac_sram(*this, "mac_sram"),
|
||||
m_sprite_vram(*this, "sprite_vram") { }
|
||||
@ -69,6 +78,15 @@ public:
|
||||
required_device<tms34010_device> m_vgb;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<mc68681_device> m_duart68681;
|
||||
required_device<micro3d_sound_device> m_noise_1;
|
||||
required_device<micro3d_sound_device> m_noise_2;
|
||||
required_memory_region m_vertex;
|
||||
|
||||
required_ioport m_sound_sw;
|
||||
required_ioport m_volume;
|
||||
optional_ioport m_joystick_x;
|
||||
optional_ioport m_joystick_y;
|
||||
optional_ioport m_throttle;
|
||||
|
||||
required_shared_ptr<UINT16> m_shared_ram;
|
||||
UINT8 m_m68681_tx0;
|
||||
|
@ -299,7 +299,7 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w)
|
||||
case 0x08:
|
||||
{
|
||||
int i;
|
||||
const UINT16 *rom = (UINT16*)memregion("vertex")->base();
|
||||
const UINT16 *rom = (UINT16*)m_vertex->base();
|
||||
|
||||
for (i = 0; i <= cnt; ++i)
|
||||
{
|
||||
@ -338,7 +338,7 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w)
|
||||
case 0x0c:
|
||||
{
|
||||
int i;
|
||||
const UINT16 *rom = (UINT16*)memregion("vertex")->base();
|
||||
const UINT16 *rom = (UINT16*)m_vertex->base();
|
||||
|
||||
for (i = 0; i <= cnt; ++i)
|
||||
{
|
||||
@ -371,7 +371,7 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w)
|
||||
case 0x0f:
|
||||
{
|
||||
int i;
|
||||
const UINT16 *rom = (UINT16*)memregion("vertex")->base();
|
||||
const UINT16 *rom = (UINT16*)m_vertex->base();
|
||||
|
||||
for (i = 0; i <= cnt; ++i, vtx_addr += 4)
|
||||
{
|
||||
@ -467,16 +467,16 @@ WRITE32_MEMBER(micro3d_state::micro3d_mac2_w)
|
||||
|
||||
READ16_MEMBER(micro3d_state::micro3d_encoder_h_r)
|
||||
{
|
||||
UINT16 x_encoder = ioport("JOYSTICK_X")->read_safe(0);
|
||||
UINT16 y_encoder = ioport("JOYSTICK_Y")->read_safe(0);
|
||||
UINT16 x_encoder = m_joystick_x ? m_joystick_x->read() : 0;
|
||||
UINT16 y_encoder = m_joystick_y ? m_joystick_y->read() : 0;
|
||||
|
||||
return (y_encoder & 0xf00) | ((x_encoder & 0xf00) >> 8);
|
||||
}
|
||||
|
||||
READ16_MEMBER(micro3d_state::micro3d_encoder_l_r)
|
||||
{
|
||||
UINT16 x_encoder = ioport("JOYSTICK_X")->read_safe(0);
|
||||
UINT16 y_encoder = ioport("JOYSTICK_Y")->read_safe(0);
|
||||
UINT16 x_encoder = m_joystick_x ? m_joystick_x->read() : 0;
|
||||
UINT16 y_encoder = m_joystick_y ? m_joystick_y->read() : 0;
|
||||
|
||||
return ((y_encoder & 0xff) << 8) | (x_encoder & 0xff);
|
||||
}
|
||||
@ -485,9 +485,9 @@ TIMER_CALLBACK_MEMBER(micro3d_state::adc_done_callback)
|
||||
{
|
||||
switch (param)
|
||||
{
|
||||
case 0: m_adc_val = ioport("THROTTLE")->read_safe(0);
|
||||
case 0: m_adc_val = m_throttle ? m_throttle->read() : 0;
|
||||
break;
|
||||
case 1: m_adc_val = (UINT8)((255.0/100.0) * ioport("VOLUME")->read() + 0.5);
|
||||
case 1: m_adc_val = (UINT8)((255.0/100.0) * m_volume->read() + 0.5);
|
||||
break;
|
||||
case 2: break;
|
||||
case 3: break;
|
||||
|
Loading…
Reference in New Issue
Block a user