ucom4: remove global enum (nw)

This commit is contained in:
hap 2019-06-16 21:06:19 +02:00
parent d95b0b95c7
commit 7bad763949
4 changed files with 130 additions and 117 deletions

View File

@ -159,7 +159,7 @@ enum
void ucom4_cpu_device::device_start()
{
assert(NEC_UCOM4_PORTA == 0);
assert(PORTA == 0);
m_program = &space(AS_PROGRAM);
m_data = &space(AS_DATA);
@ -251,7 +251,7 @@ void ucom4_cpu_device::device_reset()
m_inte_f = (m_family == NEC_UCOM43) ? 0 : 1;
// clear i/o
for (int i = NEC_UCOM4_PORTC; i <= NEC_UCOM4_PORTI; i++)
for (int i = PORTC; i <= PORTI; i++)
output_w(i, 0);
}
@ -271,10 +271,10 @@ u8 ucom4_cpu_device::input_r(int index)
switch (index)
{
case NEC_UCOM4_PORTA: inp = m_read_a(index, 0xff); break;
case NEC_UCOM4_PORTB: inp = m_read_b(index, 0xff); break;
case NEC_UCOM4_PORTC: inp = m_read_c(index, 0xff) | m_port_out[index]; break;
case NEC_UCOM4_PORTD: inp = m_read_d(index, 0xff) | m_port_out[index]; break;
case PORTA: inp = m_read_a(index, 0xff); break;
case PORTB: inp = m_read_b(index, 0xff); break;
case PORTC: inp = m_read_c(index, 0xff) | m_port_out[index]; break;
case PORTD: inp = m_read_d(index, 0xff) | m_port_out[index]; break;
default:
logerror("%s read from unknown port %c at $%03X\n", tag(), 'A' + index, m_prev_pc);
@ -291,13 +291,13 @@ void ucom4_cpu_device::output_w(int index, u8 data)
switch (index)
{
case NEC_UCOM4_PORTC: m_write_c(index, data, 0xff); break;
case NEC_UCOM4_PORTD: m_write_d(index, data, 0xff); break;
case NEC_UCOM4_PORTE: m_write_e(index, data, 0xff); break;
case NEC_UCOM4_PORTF: m_write_f(index, data, 0xff); break;
case NEC_UCOM4_PORTG: m_write_g(index, data, 0xff); break;
case NEC_UCOM4_PORTH: m_write_h(index, data, 0xff); break;
case NEC_UCOM4_PORTI: m_write_i(index, data & 7, 0xff); break;
case PORTC: m_write_c(index, data, 0xff); break;
case PORTD: m_write_d(index, data, 0xff); break;
case PORTE: m_write_e(index, data, 0xff); break;
case PORTF: m_write_f(index, data, 0xff); break;
case PORTG: m_write_g(index, data, 0xff); break;
case PORTH: m_write_h(index, data, 0xff); break;
case PORTI: m_write_i(index, data & 7, 0xff); break;
default:
logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data, m_prev_pc);
@ -314,7 +314,7 @@ u8 upd557l_cpu_device::input_r(int index)
{
index &= 0xf;
if (index == NEC_UCOM4_PORTB)
if (index == PORTB)
logerror("%s read from unknown port %c at $%03X\n", tag(), 'A' + index, m_prev_pc);
else
return ucom4_cpu_device::input_r(index);
@ -327,12 +327,12 @@ void upd557l_cpu_device::output_w(int index, u8 data)
index &= 0xf;
data &= 0xf;
if (index == NEC_UCOM4_PORTH || index == NEC_UCOM4_PORTI)
if (index == PORTH || index == PORTI)
logerror("%s write to unknown port %c = $%X at $%03X\n", tag(), 'A' + index, data, m_prev_pc);
else
{
// only G0 for port G
if (index == NEC_UCOM4_PORTG)
if (index == PORTG)
data &= 1;
ucom4_cpu_device::output_w(index, data);

View File

@ -11,27 +11,6 @@
#pragma once
enum
{
NEC_UCOM4_PORTA = 0,
NEC_UCOM4_PORTB,
NEC_UCOM4_PORTC,
NEC_UCOM4_PORTD,
NEC_UCOM4_PORTE,
NEC_UCOM4_PORTF,
NEC_UCOM4_PORTG,
NEC_UCOM4_PORTH,
NEC_UCOM4_PORTI
};
enum
{
NEC_UCOM43 = 0,
NEC_UCOM44,
NEC_UCOM45
};
// pinout reference
/*
@ -81,6 +60,26 @@ public:
auto write_i() { return m_write_i.bind(); }
protected:
enum
{
NEC_UCOM43 = 0,
NEC_UCOM44,
NEC_UCOM45
};
enum
{
PORTA = 0,
PORTB,
PORTC,
PORTD,
PORTE,
PORTF,
PORTG,
PORTH,
PORTI
};
// construction/destruction
ucom4_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int family, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data);

View File

@ -261,14 +261,14 @@ void ucom4_cpu_device::op_reb()
{
// REB B: Reset a single bit of output port E
m_icount--;
output_w(NEC_UCOM4_PORTE, m_port_out[NEC_UCOM4_PORTE] & ~m_bitmask);
output_w(PORTE, m_port_out[PORTE] & ~m_bitmask);
}
void ucom4_cpu_device::op_seb()
{
// SEB B: Set a single bit of output port E
m_icount--;
output_w(NEC_UCOM4_PORTE, m_port_out[NEC_UCOM4_PORTE] | m_bitmask);
output_w(PORTE, m_port_out[PORTE] | m_bitmask);
}
void ucom4_cpu_device::op_rpb()
@ -376,7 +376,7 @@ void ucom4_cpu_device::op_tmb()
void ucom4_cpu_device::op_tpa()
{
// TPA B: skip next on bit(input port A)
m_skip = ((input_r(NEC_UCOM4_PORTA) & m_bitmask) != 0);
m_skip = ((input_r(PORTA) & m_bitmask) != 0);
}
void ucom4_cpu_device::op_tpb()
@ -402,7 +402,7 @@ void ucom4_cpu_device::op_ia()
{
// IA: Input port A to ACC
m_icount--;
m_acc = input_r(NEC_UCOM4_PORTA);
m_acc = input_r(PORTA);
}
void ucom4_cpu_device::op_ip()
@ -415,7 +415,7 @@ void ucom4_cpu_device::op_oe()
{
// OE: Output ACC to port E
m_icount--;
output_w(NEC_UCOM4_PORTE, m_acc);
output_w(PORTE, m_acc);
}
void ucom4_cpu_device::op_op()
@ -427,8 +427,8 @@ void ucom4_cpu_device::op_op()
void ucom4_cpu_device::op_ocd()
{
// OCD X: Output X to ports C and D
output_w(NEC_UCOM4_PORTD, m_arg >> 4);
output_w(NEC_UCOM4_PORTC, m_arg & 0xf);
output_w(PORTD, m_arg >> 4);
output_w(PORTC, m_arg & 0xf);
}

View File

@ -97,6 +97,12 @@ public:
m_inputs(*this, "IN.%u", 0)
{ }
DECLARE_INPUT_CHANGED_MEMBER(single_interrupt_line);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
// devices
required_device<ucom4_cpu_device> m_maincpu;
optional_device<pwm_display_device> m_display;
@ -114,11 +120,19 @@ public:
u8 read_inputs(int columns);
void refresh_interrupts(void);
void set_interrupt(int state);
DECLARE_INPUT_CHANGED_MEMBER(single_interrupt_line);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
enum
{
PORTA = 0,
PORTB,
PORTC,
PORTD,
PORTE,
PORTF,
PORTG,
PORTH,
PORTI
};
};
@ -248,7 +262,7 @@ void ufombs_state::prepare_display()
WRITE8_MEMBER(ufombs_state::grid_w)
{
// F,G,H0: vfd grid
int shift = (offset - NEC_UCOM4_PORTF) * 4;
int shift = (offset - PORTF) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -256,7 +270,7 @@ WRITE8_MEMBER(ufombs_state::grid_w)
WRITE8_MEMBER(ufombs_state::plate_w)
{
// C,D012,I: vfd plate
int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset == PORTI) ? 8 : (offset - PORTC) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -370,7 +384,7 @@ void ssfball_state::prepare_display()
WRITE8_MEMBER(ssfball_state::grid_w)
{
// C,D(,E3): vfd grid 0-7(,8)
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -380,15 +394,15 @@ WRITE8_MEMBER(ssfball_state::plate_w)
m_port[offset] = data;
// E,F,G,H,I(not all!): vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// F3,G3: input mux + speaker
m_inp_mux = (m_port[NEC_UCOM4_PORTF] >> 3 & 1) | (m_port[NEC_UCOM4_PORTG] >> 2 & 2);
m_inp_mux = (m_port[PORTF] >> 3 & 1) | (m_port[PORTG] >> 2 & 2);
m_speaker->level_w(m_inp_mux);
// E3: vfd grid 8
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
grid_w(space, offset, data >> 3 & 1);
else
prepare_display();
@ -532,11 +546,11 @@ void bmsoccer_state::prepare_display()
WRITE8_MEMBER(bmsoccer_state::grid_w)
{
// C01: input mux
if (offset == NEC_UCOM4_PORTC)
if (offset == PORTC)
m_inp_mux = data & 3;
// C,D(,E3): vfd grid
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -544,15 +558,15 @@ WRITE8_MEMBER(bmsoccer_state::grid_w)
WRITE8_MEMBER(bmsoccer_state::plate_w)
{
// G3: speaker out
if (offset == NEC_UCOM4_PORTG)
if (offset == PORTG)
m_speaker->level_w(data >> 3 & 1);
// E012,F012,G012,H,I: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// E3: grid 8
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
grid_w(space, offset, data >> 3 & 1);
else
prepare_display();
@ -666,7 +680,7 @@ void bmsafari_state::prepare_display()
WRITE8_MEMBER(bmsafari_state::grid_w)
{
// C,D(,E3): vfd grid
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -674,11 +688,11 @@ WRITE8_MEMBER(bmsafari_state::grid_w)
WRITE8_MEMBER(bmsafari_state::plate_w)
{
// E012,H,I: vfd plate
int shift = (offset == NEC_UCOM4_PORTE) ? 8 : (offset - NEC_UCOM4_PORTH) * 4;
int shift = (offset == PORTE) ? 8 : (offset - PORTH) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// E3: grid 0
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
grid_w(space, offset, data >> 3 & 1);
else
prepare_display();
@ -785,15 +799,15 @@ void splasfgt_state::prepare_display()
WRITE8_MEMBER(splasfgt_state::grid_w)
{
// G,H,I0: vfd grid
int shift = (offset - NEC_UCOM4_PORTG) * 4;
int shift = (offset - PORTG) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
// G(grid 0-3): input mux
m_inp_mux = m_grid & 0xf;
// I2: vfd plate 6
if (offset == NEC_UCOM4_PORTI)
plate_w(space, 4 + NEC_UCOM4_PORTC, data >> 2 & 1);
if (offset == PORTI)
plate_w(space, 4 + PORTC, data >> 2 & 1);
else
prepare_display();
}
@ -801,11 +815,11 @@ WRITE8_MEMBER(splasfgt_state::grid_w)
WRITE8_MEMBER(splasfgt_state::plate_w)
{
// F01: speaker out
if (offset == NEC_UCOM4_PORTF)
if (offset == PORTF)
m_speaker->level_w(data & 3);
// C,D,E,F23(,I2): vfd plate
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -948,11 +962,11 @@ void bcclimbr_state::prepare_display()
WRITE8_MEMBER(bcclimbr_state::grid_w)
{
// I2: speaker out
if (offset == NEC_UCOM4_PORTI)
if (offset == PORTI)
m_speaker->level_w(data >> 2 & 1);
// H,I01: vfd grid
int shift = (offset - NEC_UCOM4_PORTH) * 4;
int shift = (offset - PORTH) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -960,7 +974,7 @@ WRITE8_MEMBER(bcclimbr_state::grid_w)
WRITE8_MEMBER(bcclimbr_state::plate_w)
{
// C,D,E,F: vfd plate
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -1058,7 +1072,7 @@ WRITE8_MEMBER(tactix_state::leds_w)
{
// D,F: 4*4 led matrix
m_port[offset] = data;
m_display->matrix(m_port[NEC_UCOM4_PORTF], m_port[NEC_UCOM4_PORTD]);
m_display->matrix(m_port[PORTF], m_port[PORTD]);
}
WRITE8_MEMBER(tactix_state::speaker_w)
@ -1071,7 +1085,7 @@ WRITE8_MEMBER(tactix_state::input_w)
{
// C,E0: input mux
m_port[offset] = data;
m_inp_mux = (m_port[NEC_UCOM4_PORTE] << 4 & 0x10) | m_port[NEC_UCOM4_PORTC];
m_inp_mux = (m_port[PORTE] << 4 & 0x10) | m_port[PORTC];
}
READ8_MEMBER(tactix_state::input_r)
@ -1179,9 +1193,9 @@ public:
void ctntune_state::prepare_display()
{
u8 sel = m_port[NEC_UCOM4_PORTD] >> 3 & 1; // turn off display when power is off
u8 lamps = m_port[NEC_UCOM4_PORTD] & 3;
u8 digit = (m_port[NEC_UCOM4_PORTF] << 4 | m_port[NEC_UCOM4_PORTE]) & 0x7f;
u8 sel = m_port[PORTD] >> 3 & 1; // turn off display when power is off
u8 lamps = m_port[PORTD] & 3;
u8 digit = (m_port[PORTF] << 4 | m_port[PORTE]) & 0x7f;
m_display->matrix(sel, lamps << 7 | digit);
}
@ -1202,13 +1216,13 @@ WRITE8_MEMBER(ctntune_state::speaker_w)
WRITE8_MEMBER(ctntune_state::input_w)
{
// D3: trigger power-off on falling edge
if (offset == NEC_UCOM4_PORTD && ~data & m_port[NEC_UCOM4_PORTD] & 8)
if (offset == PORTD && ~data & m_port[PORTD] & 8)
m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
// C,D23: input mux
// D0,D1: yellow, red lamp
m_port[offset] = data;
m_inp_mux = (m_port[NEC_UCOM4_PORTD] << 2 & 0x30) | m_port[NEC_UCOM4_PORTC];
m_inp_mux = (m_port[PORTD] << 2 & 0x30) | m_port[PORTC];
prepare_display();
}
@ -1325,11 +1339,11 @@ void invspace_state::prepare_display()
WRITE8_MEMBER(invspace_state::grid_w)
{
// I0: speaker out
if (offset == NEC_UCOM4_PORTI)
if (offset == PORTI)
m_speaker->level_w(data & 1);
// C,D,I1: vfd grid
int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset == PORTI) ? 8 : (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -1337,7 +1351,7 @@ WRITE8_MEMBER(invspace_state::grid_w)
WRITE8_MEMBER(invspace_state::plate_w)
{
// E,F,G,H123: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -1436,11 +1450,11 @@ void efball_state::prepare_display()
WRITE8_MEMBER(efball_state::grid_w)
{
// H2: speaker out
if (offset == NEC_UCOM4_PORTH)
if (offset == PORTH)
m_speaker->level_w(data >> 2 & 1);
// F,G,H01: vfd grid
int shift = (offset - NEC_UCOM4_PORTF) * 4;
int shift = (offset - PORTF) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -1448,7 +1462,7 @@ WRITE8_MEMBER(efball_state::grid_w)
WRITE8_MEMBER(efball_state::plate_w)
{
// D,E,I: vfd plate
int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTD) * 4;
int shift = (offset == PORTI) ? 8 : (offset - PORTD) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -1559,11 +1573,11 @@ void galaxy2_state::prepare_display()
WRITE8_MEMBER(galaxy2_state::grid_w)
{
// E3: speaker out
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
m_speaker->level_w(data >> 3 & 1);
// C,D,E01: vfd grid
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -1571,7 +1585,7 @@ WRITE8_MEMBER(galaxy2_state::grid_w)
WRITE8_MEMBER(galaxy2_state::plate_w)
{
// F,G,H,I: vfd plate
int shift = (offset - NEC_UCOM4_PORTF) * 4;
int shift = (offset - PORTF) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -1690,7 +1704,7 @@ void astrocmd_state::prepare_display()
WRITE8_MEMBER(astrocmd_state::grid_w)
{
// C,D(,E3): vfd grid
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -1698,10 +1712,10 @@ WRITE8_MEMBER(astrocmd_state::grid_w)
WRITE8_MEMBER(astrocmd_state::plate_w)
{
// E01,F,G,H,I: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
{
// E2: speaker out
m_speaker->level_w(data >> 2 & 1);
@ -1802,7 +1816,7 @@ public:
WRITE8_MEMBER(edracula_state::grid_w)
{
// C,D: vfd grid
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
m_display->matrix(m_grid, m_plate);
}
@ -1810,11 +1824,11 @@ WRITE8_MEMBER(edracula_state::grid_w)
WRITE8_MEMBER(edracula_state::plate_w)
{
// I2: speaker out
if (offset == NEC_UCOM4_PORTI)
if (offset == PORTI)
m_speaker->level_w(data >> 2 & 1);
// E,F,G,H,I01: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
m_display->matrix(m_grid, m_plate);
}
@ -1998,12 +2012,12 @@ void mvbfree_state::prepare_display()
WRITE8_MEMBER(mvbfree_state::grid_w)
{
// E23,F,G,H: vfd grid
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
// E01: plate 0,1
if (offset == NEC_UCOM4_PORTE)
plate_w(space, 2 + NEC_UCOM4_PORTC, data & 3);
if (offset == PORTE)
plate_w(space, 2 + PORTC, data & 3);
else
prepare_display();
}
@ -2011,7 +2025,7 @@ WRITE8_MEMBER(mvbfree_state::grid_w)
WRITE8_MEMBER(mvbfree_state::plate_w)
{
// C,D(,E01): vfd plate
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2109,7 +2123,7 @@ public:
WRITE8_MEMBER(grobot9_state::lamps_w)
{
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
{
// E1: speaker out
m_speaker->level_w(data >> 1 & 1);
@ -2120,7 +2134,7 @@ WRITE8_MEMBER(grobot9_state::lamps_w)
// D,F,E0: lamps
m_port[offset] = data;
m_display->matrix(1, m_port[NEC_UCOM4_PORTD] | m_port[NEC_UCOM4_PORTF] << 4 | m_port[NEC_UCOM4_PORTE] << 8);
m_display->matrix(1, m_port[PORTD] | m_port[PORTF] << 4 | m_port[PORTE] << 8);
}
WRITE8_MEMBER(grobot9_state::input_w)
@ -2235,11 +2249,11 @@ void tccombat_state::prepare_display()
WRITE8_MEMBER(tccombat_state::grid_w)
{
// I1: speaker out
if (offset == NEC_UCOM4_PORTI)
if (offset == PORTI)
m_speaker->level_w(data >> 1 & 1);
// C,D,I0: vfd grid
int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset == PORTI) ? 8 : (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2247,7 +2261,7 @@ WRITE8_MEMBER(tccombat_state::grid_w)
WRITE8_MEMBER(tccombat_state::plate_w)
{
// E,F123,G,H: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2359,7 +2373,7 @@ void tmtennis_state::set_clock()
WRITE8_MEMBER(tmtennis_state::grid_w)
{
// G,H,I: vfd grid
int shift = (offset - NEC_UCOM4_PORTG) * 4;
int shift = (offset - PORTG) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
m_display->matrix(m_grid, m_plate);
}
@ -2367,7 +2381,7 @@ WRITE8_MEMBER(tmtennis_state::grid_w)
WRITE8_MEMBER(tmtennis_state::plate_w)
{
// C,D,F: vfd plate
int shift = (offset == NEC_UCOM4_PORTF) ? 8 : (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset == PORTF) ? 8 : (offset - PORTC) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
m_display->matrix(m_grid, m_plate);
}
@ -2513,7 +2527,7 @@ void tmpacman_state::prepare_display()
WRITE8_MEMBER(tmpacman_state::grid_w)
{
// C,D: vfd grid
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2521,11 +2535,11 @@ WRITE8_MEMBER(tmpacman_state::grid_w)
WRITE8_MEMBER(tmpacman_state::plate_w)
{
// E1: speaker out
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
m_speaker->level_w(data >> 1 & 1);
// E023,F,G,H,I: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2627,11 +2641,11 @@ void tmscramb_state::prepare_display()
WRITE8_MEMBER(tmscramb_state::grid_w)
{
// I2: speaker out
if (offset == NEC_UCOM4_PORTI)
if (offset == PORTI)
m_speaker->level_w(data >> 2 & 1);
// C,D,I01: vfd grid
int shift = (offset == NEC_UCOM4_PORTI) ? 8 : (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset == PORTI) ? 8 : (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2639,7 +2653,7 @@ WRITE8_MEMBER(tmscramb_state::grid_w)
WRITE8_MEMBER(tmscramb_state::plate_w)
{
// E,F,G,H: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2740,7 +2754,7 @@ void tcaveman_state::prepare_display()
WRITE8_MEMBER(tcaveman_state::grid_w)
{
// C,D: vfd grid
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2748,11 +2762,11 @@ WRITE8_MEMBER(tcaveman_state::grid_w)
WRITE8_MEMBER(tcaveman_state::plate_w)
{
// E3: speaker out
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
m_speaker->level_w(data >> 3 & 1);
// E012,F,G,H,I: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
prepare_display();
}
@ -2841,10 +2855,10 @@ public:
WRITE8_MEMBER(alnchase_state::output_w)
{
if (offset <= NEC_UCOM4_PORTE)
if (offset <= PORTE)
{
// C,D,E0: vfd grid
int shift = (offset - NEC_UCOM4_PORTC) * 4;
int shift = (offset - PORTC) * 4;
m_grid = (m_grid & ~(0xf << shift)) | (data << shift);
// C0(grid 0): input enable PL1
@ -2852,14 +2866,14 @@ WRITE8_MEMBER(alnchase_state::output_w)
m_inp_mux = (m_grid & 1) | (m_grid >> 3 & 2);
// E1: speaker out
if (offset == NEC_UCOM4_PORTE)
if (offset == PORTE)
m_speaker->level_w(data >> 1 & 1);
}
if (offset >= NEC_UCOM4_PORTE)
if (offset >= PORTE)
{
// E23,F,G,H,I: vfd plate
int shift = (offset - NEC_UCOM4_PORTE) * 4;
int shift = (offset - PORTE) * 4;
m_plate = ((m_plate << 2 & ~(0xf << shift)) | (data << shift)) >> 2;
}