datum,emma2: small fix to matrix() calls (nw)

This commit is contained in:
hap 2020-05-15 11:26:14 +02:00
parent a0323beb41
commit d01c23cdc8
3 changed files with 12 additions and 13 deletions

View File

@ -82,6 +82,7 @@ private:
DECLARE_WRITE8_MEMBER(pb_w);
void datum_mem(address_map &map);
uint8_t m_keydata;
uint8_t m_seg;
virtual void machine_reset() override;
required_device<pia6821_device> m_pia1;
required_device<pia6821_device> m_pia2;
@ -156,6 +157,7 @@ INPUT_CHANGED_MEMBER( datum_state::trigger_nmi )
void datum_state::machine_reset()
{
m_keydata = 0;
m_seg = 0;
}
// read keyboard
@ -170,21 +172,15 @@ READ8_MEMBER( datum_state::pa_r )
// write display segments
WRITE8_MEMBER( datum_state::pa_w )
{
data ^= 0xff;
if (m_keydata > 3)
{
m_display->matrix(1<<m_keydata, bitswap<8>(data, 7, 0, 5, 6, 4, 2, 1, 3));
m_keydata = 0;
}
return;
m_seg = bitswap<8>(~data, 7, 0, 5, 6, 4, 2, 1, 3);
m_display->matrix(1<<m_keydata, m_seg);
}
// select keyboard row, select a digit
WRITE8_MEMBER( datum_state::pb_w )
{
m_keydata = bitswap<8>(data, 7, 6, 5, 4, 0, 1, 2, 3) & 15;
return;
m_display->matrix(1<<m_keydata, m_seg);
}

View File

@ -79,6 +79,7 @@ private:
void mem_map(address_map &map);
uint8_t m_digit;
uint8_t m_seg;
required_device<cpu_device> m_maincpu;
required_device<cassette_image_device> m_cassette;
required_device<via6522_device> m_via;
@ -153,13 +154,14 @@ WRITE8_MEMBER( emma2_state::digit_w )
{
m_cassette->output( BIT(data, 6) ? +1.0 : -1.0);
data &= 7;
m_digit = data;
m_digit = data & 7;
m_display->matrix(1 << m_digit, m_seg);
}
WRITE8_MEMBER( emma2_state::segment_w )
{
m_display->matrix(1<<m_digit, data);
m_seg = data;
m_display->matrix(1 << m_digit, m_seg);
}
READ8_MEMBER( emma2_state::keyboard_r )
@ -171,6 +173,7 @@ READ8_MEMBER( emma2_state::keyboard_r )
void emma2_state::machine_reset()
{
m_seg = 0;
m_digit = 0;
}

View File

@ -87,7 +87,7 @@ license:CC0
<!-- build screen -->
<view name="Internal Layout">
<bounds left="8" right="52" top="2" bottom="38" />
<bounds left="8" right="52" top="1" bottom="39" />
<screen index="0" blend="alpha"><bounds x="10" y="4" width="15.8" height="6" /></screen>
<element ref="nothing" blend="add" inputtag="IN.4" inputmask="0x00" inputraw="1"><bounds x="9" y="3" width="18" height="8" /></element>