turbo: no need for port_0_r

This commit is contained in:
hap 2022-12-19 18:47:03 +01:00
parent 5f41e67d63
commit dbb71a0180
3 changed files with 101 additions and 112 deletions

View File

@ -423,36 +423,27 @@ void turbo_base_state::digit_w(uint8_t data)
m_digits[m_i8279_scanlines * 2 + 1] = ls48_map[data >> 4];
}
/*************************************
*
* Shared pedal reading
*
*************************************/
uint8_t turbo_base_state::pedal_r()
CUSTOM_INPUT_MEMBER(turbo_base_state::pedal_r)
{
if (m_pedal)
{
// inverted 2-bit Gray code from a pair of optos in mechanical pedal
uint8_t pedal = m_pedal->read();
return (pedal >> 6) ^ (pedal >> 7) ^ 0x03;
}
else
return 0xff;
}
/*************************************
*
* Misc Turbo inputs/outputs
*
*************************************/
uint8_t turbo_state::port_0_r()
{
return m_in0->read() | pedal_r();
}
uint8_t turbo_state::collision_r()
{
m_screen->update_partial(m_screen->vpos());
@ -512,15 +503,6 @@ uint8_t buckrog_state::subcpu_command_r()
}
uint8_t buckrog_state::port_0_r()
{
if (m_dsw[1]->read() & 0x02) // upright w/ buttons
return m_in0->read();
else // cocktail w/ pedal
return (m_in0->read() & ~0x30) | pedal_r() << 4;
}
uint8_t buckrog_state::port_2_r()
{
uint8_t inp1 = bitswap<4>(m_dsw[0]->read(), 6, 4, 3, 0);
@ -583,7 +565,7 @@ void turbo_state::prg_map(address_map &map)
map(0xfa00, 0xfa03).mirror(0x00fc).rw(m_i8255[2], FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0xfb00, 0xfb03).mirror(0x00fc).rw(m_i8255[3], FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0xfc00, 0xfc01).mirror(0x00fe).rw("i8279", FUNC(i8279_device::read), FUNC(i8279_device::write));
map(0xfd00, 0xfdff).r(FUNC(turbo_state::port_0_r));
map(0xfd00, 0xfdff).portr("IN0");
map(0xfe00, 0xfeff).r(FUNC(turbo_state::collision_r));
}
@ -624,12 +606,12 @@ void buckrog_state::main_prg_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0xc000, 0xc7ff).ram().w(FUNC(buckrog_state::videoram_w)).share(m_videoram); // FIX PAGE
map(0xc800, 0xc803).mirror(0x07fc).r(m_i8255[0], FUNC(i8255_device::read)).w(FUNC(buckrog_state::i8255_0_w)); // 8255
map(0xd000, 0xd003).mirror(0x07fc).rw(m_i8255[1], FUNC(i8255_device::read), FUNC(i8255_device::write)); // 8255
map(0xc800, 0xc803).mirror(0x07fc).r(m_i8255[0], FUNC(i8255_device::read)).w(FUNC(buckrog_state::i8255_0_w));
map(0xd000, 0xd003).mirror(0x07fc).rw(m_i8255[1], FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0xd800, 0xd801).mirror(0x07fe).rw("i8279", FUNC(i8279_device::read), FUNC(i8279_device::write));
map(0xe000, 0xe3ff).ram().share(m_sprite_position); // CONT RAM
map(0xe400, 0xe7ff).ram().share(m_spriteram); // CONT RAM
map(0xe800, 0xe800).mirror(0x07fc).r(FUNC(buckrog_state::port_0_r)); // INPUT
map(0xe800, 0xe800).mirror(0x07fc).portr("IN0"); // INPUT
map(0xe801, 0xe801).mirror(0x07fc).portr("IN1");
map(0xe802, 0xe802).mirror(0x07fc).r(FUNC(buckrog_state::port_2_r));
map(0xe803, 0xe803).mirror(0x07fc).r(FUNC(buckrog_state::port_3_r));
@ -666,8 +648,7 @@ void buckrog_state::sub_portmap(address_map &map)
static INPUT_PORTS_START( turbo )
PORT_START("IN0") // IN0
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) // ACCEL A
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_CUSTOM ) // ACCEL B
PORT_BIT( 0x03, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(turbo_base_state, pedal_r)
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear Shift") PORT_TOGGLE
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_SERVICE_NO_TOGGLE( 0x10, IP_ACTIVE_LOW )
@ -829,9 +810,9 @@ static INPUT_PORTS_START( buckrog )
PORT_START("IN0")
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) PORT_CONDITION("DSW2", 0x80, EQUALS, 0x00) // cockpit
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) PORT_CONDITION("DSW2", 0x80, EQUALS, 0x80) // upright
PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CONDITION("DSW2", 0x02, EQUALS, 0x00) // pedal
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CONDITION("DSW2", 0x02, EQUALS, 0x02)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("DSW2", 0x02, EQUALS, 0x02)
PORT_BIT( 0x30, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CONDITION("DSW2", 0x02, EQUALS, 0x00) PORT_CUSTOM_MEMBER(turbo_base_state, pedal_r)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CONDITION("DSW2", 0x02, EQUALS, 0x02) // speed up
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CONDITION("DSW2", 0x02, EQUALS, 0x02) // speed down
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
@ -1829,10 +1810,12 @@ void turbo_state::rom_decode()
// 0x0800-0xbff
// 0x4000-0x43ff
// 0x4800-0x4bff
{ 0x00,0x44,0x0c,0x48,0x00,0x44,0x0c,0x48,
{
0x00,0x44,0x0c,0x48,0x00,0x44,0x0c,0x48,
0xa0,0xe4,0xac,0xe8,0xa0,0xe4,0xac,0xe8,
0x60,0x24,0x6c,0x28,0x60,0x24,0x6c,0x28,
0xc0,0x84,0xcc,0x88,0xc0,0x84,0xcc,0x88 },
0xc0,0x84,0xcc,0x88,0xc0,0x84,0xcc,0x88
},
// Table 1 */
// 0x0400-0x07ff
@ -1847,30 +1830,36 @@ void turbo_state::rom_decode()
// 0x4c00-0x4fff
// 0x5400-0x57ff
// 0x5c00-0x5fff
{ 0x00,0x44,0x18,0x5c,0x14,0x50,0x0c,0x48,
{
0x00,0x44,0x18,0x5c,0x14,0x50,0x0c,0x48,
0x28,0x6c,0x30,0x74,0x3c,0x78,0x24,0x60,
0x60,0x24,0x78,0x3c,0x74,0x30,0x6c,0x28,
0x48,0x0c,0x50,0x14,0x5c,0x18,0x44,0x00 }, //0x00 --> 0x10 ?
0x48,0x0c,0x50,0x14,0x5c,0x18,0x44,0x00 //0x00 --> 0x10 ?
},
// Table 2 */
// 0x1000-0x13ff
// 0x1800-0x1bff
// 0x5000-0x53ff
// 0x5800-0x5bff
{ 0x00,0x00,0x28,0x28,0x90,0x90,0xb8,0xb8,
{
0x00,0x00,0x28,0x28,0x90,0x90,0xb8,0xb8,
0x28,0x28,0x00,0x00,0xb8,0xb8,0x90,0x90,
0x00,0x00,0x28,0x28,0x90,0x90,0xb8,0xb8,
0x28,0x28,0x00,0x00,0xb8,0xb8,0x90,0x90 },
0x28,0x28,0x00,0x00,0xb8,0xb8,0x90,0x90
},
// Table 3 */
// 0x2000-0x23ff
// 0x2800-0x2bff
// 0x3000-0x33ff
// 0x3800-0x3bff
{ 0x00,0x14,0x88,0x9c,0x30,0x24,0xb8,0xac,
{
0x00,0x14,0x88,0x9c,0x30,0x24,0xb8,0xac,
0x24,0x30,0xac,0xb8,0x14,0x00,0x9c,0x88,
0x48,0x5c,0xc0,0xd4,0x78,0x6c,0xf0,0xe4,
0x6c,0x78,0xe4,0xf0,0x5c,0x48,0xd4,0xc0 }
0x6c,0x78,0xe4,0xf0,0x5c,0x48,0xd4,0xc0
}
};
static const int findtable[]=

View File

@ -23,7 +23,6 @@
#define TURBO_X_SCALE 2
class turbo_base_state : public driver_device
{
public:
@ -39,12 +38,13 @@ public:
, m_discrete(*this, "discrete")
, m_gfxdecode(*this, "gfxdecode")
, m_screen(*this, "screen")
, m_in0(*this, "IN0")
, m_pedal(*this, "PEDAL")
, m_digits(*this, "digit%u", 0U)
, m_lamp(*this, "lamp")
{ }
DECLARE_CUSTOM_INPUT_MEMBER(pedal_r);
protected:
virtual void machine_start() override;
virtual void video_start() override;
@ -65,9 +65,7 @@ protected:
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_ioport m_in0;
optional_ioport m_pedal;
output_finder<32> m_digits;
output_finder<> m_lamp;
@ -78,7 +76,7 @@ protected:
uint8_t m_sound_state[3]{};
// video state
tilemap_t * m_fg_tilemap = nullptr;
tilemap_t *m_fg_tilemap = nullptr;
struct sprite_info
{
@ -93,7 +91,6 @@ protected:
sprite_info m_sprite_info;
uint8_t pedal_r();
void scanlines_w(uint8_t data);
void digit_w(uint8_t data);
void videoram_w(offs_t offset, uint8_t data);
@ -139,7 +136,6 @@ private:
uint8_t m_last_sound_a;
uint8_t subcpu_command_r();
uint8_t port_0_r();
uint8_t port_2_r();
uint8_t port_3_r();
void bitmap_w(offs_t offset, uint8_t data);
@ -266,7 +262,6 @@ private:
void ppi1c_w(uint8_t data);
void ppi3c_w(uint8_t data);
uint8_t analog_r();
uint8_t port_0_r();
uint8_t spriteram_r(offs_t offset);
void spriteram_w(offs_t offset, uint8_t data);
void palette(palette_device &palette) const;

View File

@ -509,6 +509,8 @@ uint32_t turbo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
(((~grn >> mx) & 1) << 5) | // A5: CDG
(((~blu >> mx) & 1) << 6) | // A6: CDB
((m_fbcol & 6) << 6); // A7-A8: COL1-2
if (cliprect.contains(x + ix, y))
dest[x + ix] = pr1121[offs];
}
}
@ -772,6 +774,8 @@ uint32_t subroc3d_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
offs = (finalbits & 0x0f) | // A0-A3: CD0-CD3
((mux & 0x08) << 1) | // A4: MUX3
(m_col << 5); // A5-A8: COL0-COL3
if (cliprect.contains(x + ix, y))
dest[x + ix] = pr1419[offs];
}
}
@ -1000,6 +1004,7 @@ uint32_t buckrog_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
// store the final bits for this pixel
if (cliprect.contains(x + ix, y))
dest[x + ix] = palbits;
}
}