mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
midway/omegrace.cpp: Replaced input lookup table with encoder function. (#10728)
This commit is contained in:
parent
6120f9a042
commit
61a26b1898
1 changed files with 9 additions and 28 deletions
|
@ -109,8 +109,7 @@
|
||||||
|
|
||||||
15 I encoder 1 (d7-d2)
|
15 I encoder 1 (d7-d2)
|
||||||
|
|
||||||
The encoder is a 64 position Grey Code encoder, or a
|
The encoder is a 64 position Gray code encoder.
|
||||||
pot and A to D converter.
|
|
||||||
|
|
||||||
Unlike the quadrature inputs on Atari and Sega games,
|
Unlike the quadrature inputs on Atari and Sega games,
|
||||||
Omega Race's controller is an absolute angle.
|
Omega Race's controller is an absolute angle.
|
||||||
|
@ -126,8 +125,7 @@
|
||||||
|
|
||||||
16 I encoder 2 (d5-d0)
|
16 I encoder 2 (d5-d0)
|
||||||
|
|
||||||
The inputs aren't scrambled as they are on the 1 player
|
The encoder is a 64 position Gray code encoder.
|
||||||
encoder
|
|
||||||
|
|
||||||
17 I DIP SW C6 (coin/cocktail settings)
|
17 I DIP SW C6 (coin/cocktail settings)
|
||||||
|
|
||||||
|
@ -269,6 +267,7 @@ private:
|
||||||
|
|
||||||
TIMER_CALLBACK_MEMBER(periodic_int);
|
TIMER_CALLBACK_MEMBER(periodic_int);
|
||||||
uint8_t vg_go_r();
|
uint8_t vg_go_r();
|
||||||
|
static constexpr uint8_t encode_spinner(uint8_t data);
|
||||||
uint8_t spinner1_r();
|
uint8_t spinner1_r();
|
||||||
uint8_t spinner2_r();
|
uint8_t spinner2_r();
|
||||||
void outputs_w(uint8_t data);
|
void outputs_w(uint8_t data);
|
||||||
|
@ -327,38 +326,20 @@ uint8_t omegrace_state::vg_go_r()
|
||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
/*
|
constexpr uint8_t omegrace_state::encode_spinner(uint8_t data)
|
||||||
* Encoder bit mappings
|
|
||||||
* The encoder is a 64 way switch, with the inputs scrambled
|
|
||||||
* on the input port (and shifted 2 bits to the left for the
|
|
||||||
* 1 player encoder)
|
|
||||||
*
|
|
||||||
* 3 6 5 4 7 2 for encoder 1 (shifted two bits left..)
|
|
||||||
*
|
|
||||||
* 1 4 3 2 5 0 for encoder 2 (not shifted..)
|
|
||||||
*/
|
|
||||||
|
|
||||||
static const uint8_t spinnerTable[64] =
|
|
||||||
{
|
{
|
||||||
0x00, 0x01, 0x05, 0x04, 0x06, 0x07, 0x17, 0x16,
|
data &= 0x3f;
|
||||||
0x14, 0x15, 0x11, 0x10, 0x12, 0x13, 0x1b, 0x1a,
|
return data ^ (data >> 1) ^ 0x3f; // Inverted 6-bit Gray code
|
||||||
0x18, 0x19, 0x1d, 0x1c, 0x1e, 0x1f, 0x3f, 0x3e,
|
}
|
||||||
0x3c, 0x3d, 0x39, 0x38, 0x3a, 0x3b, 0x33, 0x32,
|
|
||||||
0x30, 0x31, 0x35, 0x34, 0x36, 0x37, 0x27, 0x26,
|
|
||||||
0x24, 0x25, 0x21, 0x20, 0x22, 0x23, 0x2b, 0x2a,
|
|
||||||
0x28, 0x29, 0x2d, 0x2c, 0x2e, 0x2f, 0x0f, 0x0e,
|
|
||||||
0x0c, 0x0d, 0x09, 0x08, 0x0a, 0x0b, 0x03, 0x02
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t omegrace_state::spinner1_r()
|
uint8_t omegrace_state::spinner1_r()
|
||||||
{
|
{
|
||||||
return spinnerTable[m_spinner[0]->read() & 0x3f] << 2;
|
return encode_spinner(m_spinner[0]->read()) << 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t omegrace_state::spinner2_r()
|
uint8_t omegrace_state::spinner2_r()
|
||||||
{
|
{
|
||||||
return spinnerTable[m_spinner[1]->read() & 0x3f];
|
return encode_spinner(m_spinner[1]->read());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue