Skip to content

Commit

Permalink
mm74c922: data output pins are clocked the same time as DA pin
Browse files Browse the repository at this point in the history
  • Loading branch information
happppp committed Jul 17, 2020
1 parent 33fbb85 commit 65a2745
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
24 changes: 15 additions & 9 deletions src/devices/machine/mm74c922.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ DEFINE_DEVICE_TYPE(MM74C923, mm74c923_device, "mm74c923", "MM74C923 20-Key Encod

mm74c922_device::mm74c922_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int max_y) :
device_t(mconfig, type, tag, owner, clock),
m_write_da(*this),
m_read_x(*this),
m_write_da(*this), m_read_x(*this),
m_cap_osc(0), m_cap_debounce(0),
m_max_y(max_y),
m_inhibit(false),
m_x(0),
m_y(0), m_data(0),
m_da(false),
m_next_da(false), m_scan_timer(nullptr)
m_y(0),
m_data(0), m_next_data(0),
m_da(false), m_next_da(false),
m_scan_timer(nullptr)
{
}

Expand Down Expand Up @@ -79,6 +79,7 @@ void mm74c922_device::device_start()
save_item(NAME(m_x));
save_item(NAME(m_y));
save_item(NAME(m_data));
save_item(NAME(m_next_data));
save_item(NAME(m_da));
save_item(NAME(m_next_da));
}
Expand Down Expand Up @@ -123,6 +124,12 @@ void mm74c922_device::change_output_lines()
// active high output
m_write_da(m_da ? 1 : 0);
}

// clock data latches
if (m_next_data != m_data)
{
m_data = m_next_data;
}
}


Expand Down Expand Up @@ -156,7 +163,7 @@ void mm74c922_device::detect_keypress()
// key released
m_inhibit = false;
m_next_da = false;
m_data = 0xff; // high-Z
m_next_data = (1 << m_max_y) - 1; // high-Z

LOG("MM74C922 Key Released\n");
}
Expand All @@ -172,10 +179,9 @@ void mm74c922_device::detect_keypress()
m_next_da = true;
m_y = y;

m_data = (y << 2) | m_x;
m_next_data = (y << 2) | m_x;

LOG("MM74C922 Key Depressed: X %u Y %u = %02x\n", m_x, y, m_data);
return;
LOG("MM74C922 Key Depressed: X %u Y %u = %02x\n", m_x, y, m_next_data);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/devices/machine/mm74c922.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class mm74c922_device : public device_t
int m_y; // latched row

uint8_t m_data; // data latch
uint8_t m_next_data; // next value of data latch

bool m_da; // data available flag
bool m_next_da; // next value of data available flag
Expand Down
10 changes: 6 additions & 4 deletions src/mame/drivers/saitek_intchess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ Hardware notes:
- 4-digit 7seg display
TODO:
- remove nmistate workaround when 6502 NMI is fixed
- 6502 CPU core NMI isn't working properly at the moment, it acts like a hold_line,
m_nmistate can be removed once that is fixed
- colors are estimated from photos (black and white are obvious, but the green
and cyan are not standard 0x00ff00 / 0x00ffff)
- video timing is unknown, sprite offsets are estimated from photos
Expand Down Expand Up @@ -100,13 +101,15 @@ class intchess_state : public driver_device

u8 m_select = 0;
u8 m_7seg_data = 0;
bool m_nmistate = false;
};

void intchess_state::machine_start()
{
// register for savestates
save_item(NAME(m_select));
save_item(NAME(m_7seg_data));
save_item(NAME(m_nmistate));
}

INPUT_CHANGED_MEMBER(intchess_state::reset_button)
Expand Down Expand Up @@ -205,13 +208,12 @@ u8 intchess_state::control_r()
TIMER_DEVICE_CALLBACK_MEMBER(intchess_state::cass_input)
{
// cassette input is tied to NMI
static bool nmistate = false;
bool state = ((m_cass->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) && (m_cass->input() < -0.04);

if (state != nmistate)
if (state != m_nmistate)
{
m_maincpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE);
nmistate = state;
m_nmistate = state;
}
}

Expand Down

3 comments on commit 65a2745

@MASHinfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In drivers\vpoker.cpp the PCB info for 'Videotronics Draw Poker' listed a mm74c920J.
Is this the "MM74C922 16-Key Encoder" ? And can this fixed the inputs for 'Videotronics Draw Poker and '5-Aces Poker'

@happppp
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MM74C920 and MM74C921 is a 256x4 RAM chip

@MASHinfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the answer! ... always this Silicon Valley

Please sign in to comment.