machine/micomx1a.cpp: Confirmed Digital MD mode emulates a 3-button Sega pad.

This commit is contained in:
Vas Crabb 2022-12-19 02:06:18 +11:00
parent d6fe526b28
commit bfa14b837b

View File

@ -58,6 +58,16 @@
Start appears as simultaneous Left/Right Start appears as simultaneous Left/Right
Select appears as simultaneous Up/Down Select appears as simultaneous Up/Down
Digital MD mode emulates a 3-button Mega Drive pad:
Req 0 1
D0 Up Up
D1 Down Down
D2 0 Left
D3 0 Right
L/H A B
Ack Start C
This mode is almost compatible with a 6-button Towns Pad (on a This mode is almost compatible with a 6-button Towns Pad (on a
real 6-button Towns Pad, buttons A and B can be read in either real 6-button Towns Pad, buttons A and B can be read in either
state, they bypass the multiplexer). state, they bypass the multiplexer).
@ -66,9 +76,8 @@
* Dump MB88513 microcontroller from original controller. * Dump MB88513 microcontroller from original controller.
* Measure timings. * Measure timings.
* Latch data at beginning of packet. * Latch data at beginning of packet.
* Confirm A', B', E1 and E2 bit mappings in analog mode. * Confirm button mapping in digital mode.
* Confirm buttons mapping in digital mode. * Estimate thresholds in digital modes.
- Is the mapping different in PC vs MD mode?
* Implement trigger A/B rapid fire switches. * Implement trigger A/B rapid fire switches.
* Implement channel shift switch (Y->X, X->Z, Z->X). * Implement channel shift switch (Y->X, X->Z, Z->X).
* Implement special modes (holding buttons on power-on): * Implement special modes (holding buttons on power-on):
@ -128,38 +137,74 @@ u8 micom_xe_1a_device::out_r()
else else
{ {
u16 const buttons = m_buttons_callback(); u16 const buttons = m_buttons_callback();
if (m_req) if (m_interface)
{ {
u8 const z = m_analog_callback(2); u8 const y = m_analog_callback(0);
u8 const result = if (m_req)
((0xc0 > z) ? 0x01 : 0x00) | // Throttle Up {
((0x40 <= z) ? 0x02 : 0x00) | // Throttle Down u8 const x = m_analog_callback(1);
(BIT(buttons, 1) << 2) | // C u8 const result =
(BIT(buttons, 0) << 3) | // D ((0x40 <= y) ? 0x01 : 0x00) | // Up
(BIT(buttons, 7) << 4) | // E1 ((0xc0 > y) ? 0x02 : 0x00) | // Down
(BIT(buttons, 6) << 5); // E2 ((0x40 <= x) ? 0x04 : 0x00) | // Left
LOG( ((0xc0 > x) ? 0x08 : 0x00) | // Right
"%s: digital mode extended read = 0x%02X\n", ((BIT(buttons, 2) & BIT(buttons, 8)) << 4) | // B/B'
machine().describe_context(), (BIT(buttons, 1) << 5); // C
result); LOG(
return result; "%s: MD digital mode basic read = 0x%02X\n",
machine().describe_context(),
result);
return result;
}
else
{
u8 const result =
((0x40 <= y) ? 0x01 : 0x00) | // Up
((0xc0 > y) ? 0x02 : 0x00) | // Down
((BIT(buttons, 3) & BIT(buttons, 9)) << 4) | // A/A'
(BIT(buttons, 5) << 5); // Start
LOG(
"%s: MD digital mode extended read = 0x%02X\n",
machine().describe_context(),
result);
return result;
}
} }
else else
{ {
u8 const y = m_analog_callback(0); if (m_req)
u8 const x = m_analog_callback(1); {
u8 const result = u8 const z = m_analog_callback(2);
((BIT(buttons, 4) && (0x40 <= y)) ? 0x01 : 0x00) | // Select/Up u8 const result =
((BIT(buttons, 4) && (0xc0 > y)) ? 0x02 : 0x00) | // Select/Down ((0xc0 > z) ? 0x01 : 0x00) | // Throttle Up
((BIT(buttons, 5) && (0x40 <= x)) ? 0x04 : 0x00) | // Start/Left ((0x40 <= z) ? 0x02 : 0x00) | // Throttle Down
((BIT(buttons, 5) && (0xc0 > x)) ? 0x08 : 0x00) | // Start/Right (BIT(buttons, 1) << 2) | // C
((BIT(buttons, 3) & BIT(buttons, 9)) << 4) | // A/A' (BIT(buttons, 0) << 3) | // D
((BIT(buttons, 2) & BIT(buttons, 8)) << 5); // B/B' (BIT(buttons, 7) << 4) | // E1
LOG( (BIT(buttons, 6) << 5); // E2
"%s: digital mode basic read = 0x%02X\n", LOG(
machine().describe_context(), "%s: digital mode extended read = 0x%02X\n",
result); machine().describe_context(),
return result; result);
return result;
}
else
{
u8 const y = m_analog_callback(0);
u8 const x = m_analog_callback(1);
u8 const result =
((BIT(buttons, 4) && (0x40 <= y)) ? 0x01 : 0x00) | // Select/Up
((BIT(buttons, 4) && (0xc0 > y)) ? 0x02 : 0x00) | // Select/Down
((BIT(buttons, 5) && (0x40 <= x)) ? 0x04 : 0x00) | // Start/Left
((BIT(buttons, 5) && (0xc0 > x)) ? 0x08 : 0x00) | // Start/Right
((BIT(buttons, 3) & BIT(buttons, 9)) << 4) | // A/A'
((BIT(buttons, 2) & BIT(buttons, 8)) << 5); // B/B'
LOG(
"%s: digital mode basic read = 0x%02X\n",
machine().describe_context(),
result);
return result;
}
} }
} }
} }