mirror of
https://github.com/holub/mame
synced 2025-04-16 05:24:54 +03:00
-avr8: Converted from using an IO address space to devcb for GPIO I/O. [Ryan Holtz]
This commit is contained in:
parent
36961e3e5f
commit
c9d3d973dd
@ -711,7 +711,6 @@ avr8_device::avr8_device(const machine_config &mconfig, const char *tag, device_
|
||||
, m_shifted_pc(0)
|
||||
, m_program_config("program", ENDIANNESS_LITTLE, 8, 22)
|
||||
, m_data_config("data", ENDIANNESS_LITTLE, 8, 16, 0, internal_map)
|
||||
, m_io_config("io", ENDIANNESS_LITTLE, 8, 4)
|
||||
, m_eeprom(*this, finder_base::DUMMY_TAG)
|
||||
, m_lfuses(0x62)
|
||||
, m_hfuses(0x99)
|
||||
@ -719,6 +718,8 @@ avr8_device::avr8_device(const machine_config &mconfig, const char *tag, device_
|
||||
, m_lock_bits(0xff)
|
||||
, m_pc(0)
|
||||
, m_num_timers(num_timers)
|
||||
, m_gpio_out_cb(*this)
|
||||
, m_gpio_in_cb(*this)
|
||||
, m_spi_active(false)
|
||||
, m_spi_prescale(0)
|
||||
, m_spi_prescale_count(0)
|
||||
@ -813,7 +814,9 @@ void avr8_device::device_start()
|
||||
|
||||
m_program = &space(AS_PROGRAM);
|
||||
m_data = &space(AS_DATA);
|
||||
m_io = &space(AS_IO);
|
||||
|
||||
m_gpio_out_cb.resolve_all_safe();
|
||||
m_gpio_in_cb.resolve_all_safe(0);
|
||||
|
||||
// register our state for the debugger
|
||||
state_add(STATE_GENPC, "GENPC", m_shifted_pc).noshow();
|
||||
@ -992,8 +995,7 @@ device_memory_interface::space_config_vector avr8_device::memory_space_config()
|
||||
{
|
||||
return space_config_vector {
|
||||
std::make_pair(AS_PROGRAM, &m_program_config),
|
||||
std::make_pair(AS_DATA, &m_data_config),
|
||||
std::make_pair(AS_IO, &m_io_config)
|
||||
std::make_pair(AS_DATA, &m_data_config)
|
||||
};
|
||||
}
|
||||
|
||||
@ -1226,7 +1228,7 @@ void avr8_device::timer_tick()
|
||||
{
|
||||
uint8_t out_bit = (m_r[AVR8_REGIDX_SPDR] & (1 << m_spi_prescale_countdown)) >> m_spi_prescale_countdown;
|
||||
m_spi_prescale_countdown--;
|
||||
m_io->write_byte(AVR8_IO_PORTB, (m_r[AVR8_REGIDX_PORTB] &~ AVR8_PORTB_MOSI) | (out_bit ? AVR8_PORTB_MOSI : 0));
|
||||
write_gpio(AVR8_IO_PORTB, (m_r[AVR8_REGIDX_PORTB] &~ AVR8_PORTB_MOSI) | (out_bit ? AVR8_PORTB_MOSI : 0));
|
||||
m_r[AVR8_REGIDX_PORTB] = (m_r[AVR8_REGIDX_PORTB] &~ AVR8_PORTB_MOSI) | (out_bit ? AVR8_PORTB_MOSI : 0);
|
||||
m_spi_prescale_count -= m_spi_prescale;
|
||||
}
|
||||
@ -1299,7 +1301,7 @@ void avr8_device::timer0_tick()
|
||||
{
|
||||
m_timer_top[0] = 0;
|
||||
LOGMASKED(LOG_TIMER0, "%s: timer0: Toggle OC0B on match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTG, m_io->read_byte(AVR8_IO_PORTG) ^ (1 << 5));
|
||||
write_gpio(AVR8_IO_PORTG, m_r[AVR8_REGIDX_PORTG] ^ (1 << 5));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1308,7 +1310,7 @@ void avr8_device::timer0_tick()
|
||||
{
|
||||
m_timer_top[0] = 0;
|
||||
LOGMASKED(LOG_TIMER0, "[0] timer0: Clear OC0B on match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTG, m_io->read_byte(AVR8_IO_PORTG) & ~(1 << 5));
|
||||
write_gpio(AVR8_IO_PORTG, m_r[AVR8_REGIDX_PORTG] & ~(1 << 5));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1317,7 +1319,7 @@ void avr8_device::timer0_tick()
|
||||
{
|
||||
m_timer_top[0] = 0;
|
||||
LOGMASKED(LOG_TIMER0, "%s: timer0: Set OC0B on match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTG, m_io->read_byte(AVR8_IO_PORTG) | (1 << 5));
|
||||
write_gpio(AVR8_IO_PORTG, m_r[AVR8_REGIDX_PORTG] | (1 << 5));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1443,18 +1445,18 @@ inline void avr8_device::timer1_tick()
|
||||
if (reg == 0)
|
||||
{
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Toggle OC1%c on match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) ^ (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, read_gpio(AVR8_REGIDX_PORTB) ^ (2 << reg));
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Clear OC1A/B on compare match */
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Clear OC1%c on match\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) & ~(2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, read_gpio(AVR8_REGIDX_PORTB) & ~(2 << reg));
|
||||
break;
|
||||
|
||||
case 3: /* Set OC1A/B on compare match */
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Set OC1%c on match\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) | (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, read_gpio(AVR8_REGIDX_PORTB) | (2 << reg));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1491,18 +1493,18 @@ inline void avr8_device::timer1_tick()
|
||||
if (reg == 0)
|
||||
{
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Toggle OC1%c on match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) ^ (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] ^ (2 << reg));
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Clear OC1A/B on compare match */
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Clear OC1%c on match\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) & ~(2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] & ~(2 << reg));
|
||||
break;
|
||||
|
||||
case 3: /* Set OC1A/B on compare match */
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Set OC1%c on match\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) | (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] | (2 << reg));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1526,18 +1528,18 @@ inline void avr8_device::timer1_tick()
|
||||
if (reg == 0)
|
||||
{
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Toggle OC1A at BOTTOM\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) ^ (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] ^ (2 << reg));
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Set OC1A/B at BOTTOM*/
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Set OC1%c at BOTTOM\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) | (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] | (2 << reg));
|
||||
break;
|
||||
|
||||
case 3: /* Clear OC1A/B at BOTTOM */
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Clear OC1%c at BOTTOM\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) & ~(2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] & ~(2 << reg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1555,18 +1557,18 @@ inline void avr8_device::timer1_tick()
|
||||
if (reg == 0)
|
||||
{
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Toggle OC1%c on match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) ^ (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] ^ (2 << reg));
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Clear OC1A/B on compare match */
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Clear OC1%c on match\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) & ~(2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] & ~(2 << reg));
|
||||
break;
|
||||
|
||||
case 3: /* Set OC1A/B on compare match */
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Set OC1%c on match\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) | (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] | (2 << reg));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1590,18 +1592,18 @@ inline void avr8_device::timer1_tick()
|
||||
if (reg == 0)
|
||||
{
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Toggle OC1A at BOTTOM\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) ^ (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] ^ (2 << reg));
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: /* Set OC1A/B at BOTTOM*/
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Set OC1%c at BOTTOM\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) | (2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] | (2 << reg));
|
||||
break;
|
||||
|
||||
case 3: /* Clear OC1A/B at BOTTOM */
|
||||
LOGMASKED(LOG_TIMER1, "%s: timer1: Clear OC1%c at BOTTOM\n", machine().describe_context(), reg ? 'B' : 'A');
|
||||
m_io->write_byte(AVR8_IO_PORTB, m_io->read_byte(AVR8_IO_PORTB) & ~(2 << reg));
|
||||
write_gpio(AVR8_IO_PORTB, m_r[AVR8_REGIDX_PORTB] & ~(2 << reg));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1795,7 +1797,7 @@ void avr8_device::timer2_tick()
|
||||
if (count >= 0xff)
|
||||
{
|
||||
// Turn on
|
||||
m_io->write_byte(AVR8_IO_PORTD, m_io->read_byte(AVR8_IO_PORTD) | (1 << 7));
|
||||
write_gpio(AVR8_IO_PORTD, m_r[AVR8_REGIDX_PORTD] | (1 << 7));
|
||||
m_r[AVR8_REGIDX_TCNT2] = 0;
|
||||
m_ocr2_not_reached_yet = true;
|
||||
}
|
||||
@ -1804,7 +1806,7 @@ void avr8_device::timer2_tick()
|
||||
if (m_ocr2_not_reached_yet)
|
||||
{
|
||||
// Turn off
|
||||
m_io->write_byte(AVR8_IO_PORTD, m_io->read_byte(AVR8_IO_PORTD) & ~(1 << 7));
|
||||
write_gpio(AVR8_IO_PORTD, m_r[AVR8_REGIDX_PORTD] & ~(1 << 7));
|
||||
m_ocr2_not_reached_yet = false;
|
||||
}
|
||||
}
|
||||
@ -1945,13 +1947,13 @@ void avr8_device::timer4_tick()
|
||||
{
|
||||
// Clear OC0B
|
||||
LOGMASKED(LOG_TIMER4, "%s: timer4: non-inverting mode, Clear OC0B\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTG, m_io->read_byte(AVR8_IO_PORTG) & ~(1 << 5));
|
||||
write_gpio(AVR8_IO_PORTG, m_r[AVR8_REGIDX_PORTG] & ~(1 << 5));
|
||||
}
|
||||
else if (count == 0)
|
||||
{
|
||||
// Set OC0B
|
||||
LOGMASKED(LOG_TIMER4, "%s: timer4: non-inverting mode, Set OC0B\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTG, m_io->read_byte(AVR8_IO_PORTG) | (1 << 5));
|
||||
write_gpio(AVR8_IO_PORTG, m_r[AVR8_REGIDX_PORTG] | (1 << 5));
|
||||
}
|
||||
break;
|
||||
case 3: /* Inverting mode */
|
||||
@ -1959,13 +1961,13 @@ void avr8_device::timer4_tick()
|
||||
{
|
||||
// Set OC0B
|
||||
LOGMASKED(LOG_TIMER4, "%s: timer4: inverting mode, Clear OC0B\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTG, m_io->read_byte(AVR8_IO_PORTG) | (1 << 5));
|
||||
write_gpio(AVR8_IO_PORTG, m_r[AVR8_REGIDX_PORTG] | (1 << 5));
|
||||
}
|
||||
else if (count == 0)
|
||||
{
|
||||
// Clear OC0B
|
||||
LOGMASKED(LOG_TIMER4, "%s: timer4: inverting mode, Set OC0B\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTG, m_io->read_byte(AVR8_IO_PORTG) & ~(1 << 5));
|
||||
write_gpio(AVR8_IO_PORTG, m_r[AVR8_REGIDX_PORTG] & ~(1 << 5));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2144,7 +2146,7 @@ void avr8_device::timer5_tick()
|
||||
{
|
||||
m_timer_top[5] = 0;
|
||||
LOGMASKED(LOG_TIMER5, "%s: timer5: Toggle OC5B on compare match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTL, m_io->read_byte(AVR8_IO_PORTL) ^ (1 << 4));
|
||||
write_gpio(AVR8_IO_PORTL, m_r[AVR8_REGIDX_PORTL] ^ (1 << 4));
|
||||
}
|
||||
break;
|
||||
case 2: /* Clear OC5B on compare match */
|
||||
@ -2153,7 +2155,7 @@ void avr8_device::timer5_tick()
|
||||
m_timer_top[5] = 0;
|
||||
// Clear OC5B
|
||||
LOGMASKED(LOG_TIMER5, "%s: timer5: Clear OC5B on compare match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTL, m_io->read_byte(AVR8_IO_PORTL) & ~(1 << 4));
|
||||
write_gpio(AVR8_IO_PORTL, m_r[AVR8_REGIDX_PORTL] & ~(1 << 4));
|
||||
}
|
||||
break;
|
||||
case 3: /* Set OC5B on compare match */
|
||||
@ -2161,7 +2163,7 @@ void avr8_device::timer5_tick()
|
||||
{
|
||||
m_timer_top[5] = 0;
|
||||
LOGMASKED(LOG_TIMER5, "%s: timer5: Set OC5B on compare match\n", machine().describe_context());
|
||||
m_io->write_byte(AVR8_IO_PORTL, m_io->read_byte(AVR8_IO_PORTL) | (1 << 4));
|
||||
write_gpio(AVR8_IO_PORTL, m_r[AVR8_REGIDX_PORTL] | (1 << 4));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -2335,6 +2337,34 @@ void avr8_device::change_spsr(uint8_t data)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void avr8_device::write_gpio(const uint8_t port, const uint8_t data)
|
||||
{
|
||||
static const uint16_t s_port_to_reg[11] =
|
||||
{
|
||||
AVR8_REGIDX_PORTA,
|
||||
AVR8_REGIDX_PORTB,
|
||||
AVR8_REGIDX_PORTC,
|
||||
AVR8_REGIDX_PORTD,
|
||||
AVR8_REGIDX_PORTE,
|
||||
AVR8_REGIDX_PORTF,
|
||||
AVR8_REGIDX_PORTG,
|
||||
AVR8_REGIDX_PORTH,
|
||||
AVR8_REGIDX_PORTJ,
|
||||
AVR8_REGIDX_PORTK,
|
||||
AVR8_REGIDX_PORTL
|
||||
};
|
||||
|
||||
m_r[s_port_to_reg[port]] = data;
|
||||
m_gpio_out_cb[port](data);
|
||||
}
|
||||
|
||||
uint8_t avr8_device::read_gpio(const uint8_t port)
|
||||
{
|
||||
return m_gpio_in_cb[port]();
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void avr8_device::regs_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
switch (offset)
|
||||
@ -2376,68 +2406,57 @@ void avr8_device::regs_w(offs_t offset, uint8_t data)
|
||||
|
||||
case AVR8_REGIDX_PORTA:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTA Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTA, data);
|
||||
m_r[AVR8_REGIDX_PORTA] = data;
|
||||
write_gpio(AVR8_IO_PORTA, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTB:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTB Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTB, data);
|
||||
m_r[AVR8_REGIDX_PORTB] = data;
|
||||
write_gpio(AVR8_IO_PORTB, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTC:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTC Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTC, data);
|
||||
m_r[AVR8_REGIDX_PORTC] = data;
|
||||
write_gpio(AVR8_IO_PORTC, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTD:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTD Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTD, data);
|
||||
m_r[AVR8_REGIDX_PORTD] = data;
|
||||
write_gpio(AVR8_IO_PORTD, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTE:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTE Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTE, data);
|
||||
m_r[AVR8_REGIDX_PORTE] = data;
|
||||
write_gpio(AVR8_IO_PORTE, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTF:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTF Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTF, data);
|
||||
m_r[AVR8_REGIDX_PORTF] = data;
|
||||
write_gpio(AVR8_IO_PORTF, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTG:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTG Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTG, data);
|
||||
m_r[AVR8_REGIDX_PORTG] = data;
|
||||
write_gpio(AVR8_IO_PORTG, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTH:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTH Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTH, data);
|
||||
m_r[AVR8_REGIDX_PORTH] = data;
|
||||
write_gpio(AVR8_IO_PORTH, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTJ:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTJ Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTJ, data);
|
||||
m_r[AVR8_REGIDX_PORTJ] = data;
|
||||
write_gpio(AVR8_IO_PORTJ, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTK:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTK Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTK, data);
|
||||
m_r[AVR8_REGIDX_PORTK] = data;
|
||||
write_gpio(AVR8_IO_PORTK, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_PORTL:
|
||||
LOGMASKED(LOG_GPIO, "%s: PORTL Write: %02x\n", machine().describe_context(), data);
|
||||
m_io->write_byte(AVR8_IO_PORTL, data);
|
||||
m_r[AVR8_REGIDX_PORTL] = data;
|
||||
write_gpio(AVR8_IO_PORTL, data);
|
||||
break;
|
||||
|
||||
case AVR8_REGIDX_DDRA:
|
||||
@ -2994,47 +3013,47 @@ uint8_t avr8_device::regs_r(offs_t offset)
|
||||
|
||||
case AVR8_REGIDX_PINA:
|
||||
// TODO: account for DDRA
|
||||
return m_io->read_byte(AVR8_REG_A);
|
||||
return read_gpio(AVR8_IO_PORTA);
|
||||
|
||||
case AVR8_REGIDX_PINB:
|
||||
// TODO: account for DDRB
|
||||
return m_io->read_byte(AVR8_REG_B);
|
||||
return read_gpio(AVR8_IO_PORTB);
|
||||
|
||||
case AVR8_REGIDX_PINC:
|
||||
// TODO: account for DDRC
|
||||
return m_io->read_byte(AVR8_REG_C);
|
||||
return read_gpio(AVR8_IO_PORTC);
|
||||
|
||||
case AVR8_REGIDX_PIND:
|
||||
// TODO: account for DDRD
|
||||
return m_io->read_byte(AVR8_REG_D);
|
||||
return read_gpio(AVR8_IO_PORTD);
|
||||
|
||||
case AVR8_REGIDX_PINE:
|
||||
// TODO: account for DDRE
|
||||
return m_io->read_byte(AVR8_REG_E);
|
||||
return read_gpio(AVR8_IO_PORTE);
|
||||
|
||||
case AVR8_REGIDX_PINF:
|
||||
// TODO: account for DDRF
|
||||
return m_io->read_byte(AVR8_REG_F);
|
||||
return read_gpio(AVR8_IO_PORTF);
|
||||
|
||||
case AVR8_REGIDX_PING:
|
||||
// TODO: account for DDRG
|
||||
return m_io->read_byte(AVR8_REG_G);
|
||||
return read_gpio(AVR8_IO_PORTG);
|
||||
|
||||
case AVR8_REGIDX_PINH:
|
||||
// TODO: account for DDRH
|
||||
return m_io->read_byte(AVR8_REG_H);
|
||||
return read_gpio(AVR8_IO_PORTH);
|
||||
|
||||
case AVR8_REGIDX_PINJ:
|
||||
// TODO: account for DDRJ
|
||||
return m_io->read_byte(AVR8_REG_J);
|
||||
return read_gpio(AVR8_IO_PORTJ);
|
||||
|
||||
case AVR8_REGIDX_PINK:
|
||||
// TODO: account for DDRK
|
||||
return m_io->read_byte(AVR8_REG_K);
|
||||
return read_gpio(AVR8_IO_PORTK);
|
||||
|
||||
case AVR8_REGIDX_PINL:
|
||||
// TODO: account for DDRL
|
||||
return m_io->read_byte(AVR8_REG_L);
|
||||
return read_gpio(AVR8_IO_PORTL);
|
||||
|
||||
case AVR8_REGIDX_PORTA:
|
||||
case AVR8_REGIDX_PORTB:
|
||||
|
@ -40,6 +40,10 @@ public:
|
||||
uint8_t regs_r(offs_t offset);
|
||||
uint32_t m_shifted_pc;
|
||||
|
||||
// GPIO
|
||||
template<uint8_t Port> auto gpio_out() { return m_gpio_out_cb[Port].bind(); }
|
||||
template<uint8_t Port> auto gpio_in() { return m_gpio_in_cb[Port].bind(); }
|
||||
|
||||
protected:
|
||||
avr8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, const device_type type, uint32_t address_mask, address_map_constructor internal_map, int32_t num_timers);
|
||||
|
||||
@ -78,7 +82,6 @@ protected:
|
||||
// address spaces
|
||||
const address_space_config m_program_config;
|
||||
const address_space_config m_data_config;
|
||||
const address_space_config m_io_config;
|
||||
required_region_ptr<uint8_t> m_eeprom;
|
||||
|
||||
// bootloader
|
||||
@ -106,6 +109,12 @@ protected:
|
||||
uint16_t m_timer1_count;
|
||||
bool m_ocr2_not_reached_yet;
|
||||
|
||||
// GPIO
|
||||
void write_gpio(const uint8_t port, const uint8_t data);
|
||||
uint8_t read_gpio(const uint8_t port);
|
||||
devcb_write8::array<11> m_gpio_out_cb;
|
||||
devcb_read8::array<11> m_gpio_in_cb;
|
||||
|
||||
// SPI
|
||||
bool m_spi_active;
|
||||
uint8_t m_spi_prescale;
|
||||
@ -293,7 +302,6 @@ protected:
|
||||
// address spaces
|
||||
address_space *m_program;
|
||||
address_space *m_data;
|
||||
address_space *m_io;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
@ -389,7 +397,7 @@ public:
|
||||
REGISTER ENUMERATION
|
||||
***************************************************************************/
|
||||
|
||||
enum
|
||||
enum : uint8_t
|
||||
{
|
||||
AVR8_SREG = 1,
|
||||
AVR8_PC,
|
||||
@ -432,7 +440,7 @@ enum
|
||||
AVR8_SPL
|
||||
};
|
||||
|
||||
enum
|
||||
enum : uint8_t
|
||||
{
|
||||
AVR8_INT_RESET = 0,
|
||||
AVR8_INT_INT0,
|
||||
@ -493,7 +501,7 @@ enum
|
||||
};
|
||||
|
||||
// Used by I/O register handling
|
||||
enum
|
||||
enum : uint16_t
|
||||
{
|
||||
AVR8_REGIDX_R0 = 0x00,
|
||||
AVR8_REGIDX_R1,
|
||||
@ -814,7 +822,7 @@ enum
|
||||
//0x1FF: Reserved
|
||||
};
|
||||
|
||||
enum {
|
||||
enum : uint8_t {
|
||||
AVR8_IO_PORTA = 0,
|
||||
AVR8_IO_PORTB,
|
||||
AVR8_IO_PORTC,
|
||||
@ -828,8 +836,7 @@ enum {
|
||||
AVR8_IO_PORTL
|
||||
};
|
||||
|
||||
//TODO: AVR8_REG_* and AVR8_IO_PORT* seem to serve the same purpose and thus should be unified. Verify this!
|
||||
enum
|
||||
enum : uint8_t
|
||||
{
|
||||
AVR8_REG_A = 0,
|
||||
AVR8_REG_B,
|
||||
@ -844,7 +851,7 @@ enum
|
||||
AVR8_REG_L
|
||||
};
|
||||
|
||||
enum
|
||||
enum : uint8_t
|
||||
{
|
||||
AVR8_INTIDX_SPI,
|
||||
|
||||
@ -879,8 +886,8 @@ enum
|
||||
AVR8_INTIDX_COUNT
|
||||
};
|
||||
|
||||
//lock bit masks
|
||||
enum
|
||||
// lock bit masks
|
||||
enum : uint8_t
|
||||
{
|
||||
LB1 = (1 << 0),
|
||||
LB2 = (1 << 1),
|
||||
@ -890,16 +897,16 @@ enum
|
||||
BLB12 = (1 << 5)
|
||||
};
|
||||
|
||||
//extended fuses bit masks
|
||||
enum
|
||||
// extended fuses bit masks
|
||||
enum : uint8_t
|
||||
{
|
||||
BODLEVEL0 = (1 << 0),
|
||||
BODLEVEL1 = (1 << 1),
|
||||
BODLEVEL2 = (1 << 2)
|
||||
};
|
||||
|
||||
//high fuses bit masks
|
||||
enum
|
||||
// high fuses bit masks
|
||||
enum : uint8_t
|
||||
{
|
||||
BOOTRST = (1 << 0),
|
||||
BOOTSZ0 = (1 << 1),
|
||||
@ -911,8 +918,8 @@ enum
|
||||
OCDEN = (1 << 7)
|
||||
};
|
||||
|
||||
//low fuses bit masks
|
||||
enum
|
||||
// low fuses bit masks
|
||||
enum : uint8_t
|
||||
{
|
||||
CKSEL0 = (1 << 0),
|
||||
CKSEL1 = (1 << 1),
|
||||
|
@ -58,7 +58,6 @@ private:
|
||||
// address maps
|
||||
void main_map(address_map &map);
|
||||
void data_map(address_map &map);
|
||||
void io_map(address_map &map);
|
||||
|
||||
// I/O handlers
|
||||
void update_display();
|
||||
@ -130,15 +129,6 @@ void avrmax_state::data_map(address_map &map)
|
||||
map(0x0100, 0x04ff).ram();
|
||||
}
|
||||
|
||||
void avrmax_state::io_map(address_map &map)
|
||||
{
|
||||
map(AVR8_IO_PORTB, AVR8_IO_PORTB).r(FUNC(avrmax_state::input_r));
|
||||
map(AVR8_IO_PORTC, AVR8_IO_PORTC).w(FUNC(avrmax_state::mux_w));
|
||||
map(AVR8_IO_PORTD, AVR8_IO_PORTD).w(FUNC(avrmax_state::led_w));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Input Ports
|
||||
******************************************************************************/
|
||||
@ -177,8 +167,10 @@ void avrmax_state::avrmax(machine_config &config)
|
||||
ATMEGA88(config, m_maincpu, 8000000); // internal R/C clock
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &avrmax_state::main_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &avrmax_state::data_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &avrmax_state::io_map);
|
||||
m_maincpu->set_eeprom_tag("eeprom");
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTB>().set(FUNC(avrmax_state::input_r));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTC>().set(FUNC(avrmax_state::mux_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTD>().set(FUNC(avrmax_state::led_w));
|
||||
|
||||
/* video hardware */
|
||||
PWM_DISPLAY(config, m_display).set_size(4, 8);
|
||||
|
@ -28,7 +28,6 @@ public:
|
||||
protected:
|
||||
void prg_map(address_map &map);
|
||||
void data_map(address_map &map);
|
||||
void io_map(address_map &map);
|
||||
|
||||
required_device<avr8_device> m_maincpu;
|
||||
required_device<dac_byte_interface> m_dac;
|
||||
@ -48,11 +47,6 @@ void lft_chiptune_state::data_map(address_map &map)
|
||||
map(0x0100, 0x04ff).ram();
|
||||
}
|
||||
|
||||
void lft_chiptune_state::io_map(address_map &map)
|
||||
{
|
||||
map(AVR8_IO_PORTD, AVR8_IO_PORTD).w(m_dac, FUNC(dac_8bit_r2r_device::write));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// MACHINE
|
||||
//**************************************************************************
|
||||
@ -66,8 +60,8 @@ void lft_chiptune_state::chiptune(machine_config &config)
|
||||
ATMEGA88(config, m_maincpu, MASTER_CLOCK);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &lft_chiptune_state::prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &lft_chiptune_state::data_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &lft_chiptune_state::io_map);
|
||||
m_maincpu->set_eeprom_tag("eeprom");
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTD>().set(m_dac, FUNC(dac_8bit_r2r_device::write));
|
||||
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "avr8").front_center();
|
||||
|
@ -44,10 +44,10 @@ protected:
|
||||
|
||||
void prg_map(address_map &map);
|
||||
void data_map(address_map &map);
|
||||
void io_map(address_map &map);
|
||||
|
||||
uint8_t port_r(offs_t offset);
|
||||
void port_w(offs_t offset, uint8_t data);
|
||||
void port_b_w(uint8_t data);
|
||||
void port_c_w(uint8_t data);
|
||||
void port_d_w(uint8_t data);
|
||||
|
||||
void init_palette(palette_device &palette) const;
|
||||
void video_update();
|
||||
@ -58,17 +58,8 @@ protected:
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
enum port : uint8_t
|
||||
{
|
||||
PORT_A,
|
||||
PORT_B,
|
||||
PORT_C,
|
||||
PORT_D,
|
||||
|
||||
PORT_COUNT
|
||||
};
|
||||
|
||||
uint8_t m_ports[PORT_COUNT];
|
||||
uint8_t m_gpio_b;
|
||||
uint8_t m_gpio_c;
|
||||
|
||||
uint32_t m_last_cycles;
|
||||
uint64_t m_frame_start_cycle;
|
||||
@ -81,41 +72,34 @@ protected:
|
||||
// GPIO
|
||||
//**************************************************************************
|
||||
|
||||
uint8_t lft_craft_state::port_r(offs_t offset)
|
||||
void lft_craft_state::port_b_w(uint8_t data)
|
||||
{
|
||||
return m_ports[offset];
|
||||
}
|
||||
|
||||
void lft_craft_state::port_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
const uint8_t old = m_ports[offset];
|
||||
m_ports[offset] = data;
|
||||
const uint8_t old = m_gpio_b;
|
||||
m_gpio_b = data;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
switch (offset)
|
||||
if (BIT(changed, 1) && BIT(data, 1))
|
||||
{
|
||||
case AVR8_IO_PORTB:
|
||||
if (BIT(changed, 1) && BIT(data, 1))
|
||||
{
|
||||
m_frame_start_cycle = machine().time().as_ticks(MASTER_CLOCK);
|
||||
video_update();
|
||||
}
|
||||
if (BIT(changed, 3))
|
||||
{
|
||||
video_update();
|
||||
m_latched_color = (data & 0x08) ? (m_ports[PORT_C] & 0x3f) : 0x3f;
|
||||
}
|
||||
break;
|
||||
|
||||
case AVR8_IO_PORTC:
|
||||
m_frame_start_cycle = machine().time().as_ticks(MASTER_CLOCK);
|
||||
video_update();
|
||||
m_latched_color = data;
|
||||
break;
|
||||
|
||||
case AVR8_IO_PORTD:
|
||||
m_dac->write((data & 0x02) | ((data & 0xf4) >> 2));
|
||||
break;
|
||||
}
|
||||
if (BIT(changed, 3))
|
||||
{
|
||||
video_update();
|
||||
m_latched_color = (data & 0x08) ? (m_gpio_c & 0x3f) : 0x3f;
|
||||
}
|
||||
}
|
||||
|
||||
void lft_craft_state::port_c_w(uint8_t data)
|
||||
{
|
||||
m_gpio_c = data;
|
||||
video_update();
|
||||
m_latched_color = data;
|
||||
}
|
||||
|
||||
void lft_craft_state::port_d_w(uint8_t data)
|
||||
{
|
||||
m_dac->write((data & 0x02) | ((data & 0xf4) >> 2));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@ -132,11 +116,6 @@ void lft_craft_state::data_map(address_map &map)
|
||||
map(0x0100, 0x04ff).ram();
|
||||
}
|
||||
|
||||
void lft_craft_state::io_map(address_map &map)
|
||||
{
|
||||
map(AVR8_IO_PORTA, AVR8_IO_PORTD).rw(FUNC(lft_craft_state::port_r), FUNC(lft_craft_state::port_w));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// VIDEO
|
||||
//**************************************************************************
|
||||
@ -194,7 +173,8 @@ void lft_craft_state::machine_start()
|
||||
{
|
||||
m_pixels = std::make_unique<uint8_t[]>(PIXELS_PER_FRAME);
|
||||
|
||||
save_item(NAME(m_ports));
|
||||
save_item(NAME(m_gpio_b));
|
||||
save_item(NAME(m_gpio_c));
|
||||
save_item(NAME(m_last_cycles));
|
||||
save_item(NAME(m_frame_start_cycle));
|
||||
|
||||
@ -204,7 +184,8 @@ void lft_craft_state::machine_start()
|
||||
|
||||
void lft_craft_state::machine_reset()
|
||||
{
|
||||
memset(m_ports, 0, PORT_COUNT);
|
||||
m_gpio_b = 0;
|
||||
m_gpio_c = 0;
|
||||
|
||||
m_frame_start_cycle = 0;
|
||||
m_last_cycles = 0;
|
||||
@ -218,8 +199,12 @@ void lft_craft_state::craft(machine_config &config)
|
||||
ATMEGA88(config, m_maincpu, MASTER_CLOCK);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &lft_craft_state::prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &lft_craft_state::data_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &lft_craft_state::io_map);
|
||||
m_maincpu->set_eeprom_tag("eeprom");
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTB>().set([this]() { return m_gpio_b; });
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTC>().set([this]() { return m_gpio_c; });
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTB>().set(FUNC(lft_craft_state::port_b_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTC>().set(FUNC(lft_craft_state::port_c_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTD>().set(FUNC(lft_craft_state::port_d_w));
|
||||
|
||||
PALETTE(config, m_palette, FUNC(lft_craft_state::init_palette), 64);
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
|
@ -37,12 +37,11 @@ protected:
|
||||
|
||||
void prg_map(address_map &map);
|
||||
void data_map(address_map &map);
|
||||
void io_map(address_map &map);
|
||||
|
||||
uint8_t port_r(offs_t offset);
|
||||
void port_w(offs_t offset, uint8_t data);
|
||||
|
||||
void init_palette(palette_device &palette) const;
|
||||
|
||||
void port_b_w(uint8_t data);
|
||||
|
||||
void video_update();
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
|
||||
@ -51,17 +50,7 @@ protected:
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
enum port : uint8_t
|
||||
{
|
||||
PORT_A,
|
||||
PORT_B,
|
||||
PORT_C,
|
||||
PORT_D,
|
||||
|
||||
PORT_COUNT
|
||||
};
|
||||
|
||||
uint8_t m_ports[PORT_COUNT];
|
||||
uint8_t m_gpio_b;
|
||||
|
||||
uint64_t m_last_cycles;
|
||||
uint64_t m_frame_start_cycle;
|
||||
@ -74,36 +63,6 @@ protected:
|
||||
std::unique_ptr<uint8_t[]> m_samples;
|
||||
};
|
||||
|
||||
//**************************************************************************
|
||||
// GPIO
|
||||
//**************************************************************************
|
||||
|
||||
uint8_t lft_phasor_state::port_r(offs_t offset)
|
||||
{
|
||||
return m_ports[offset];
|
||||
}
|
||||
|
||||
void lft_phasor_state::port_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
m_ports[offset] = data;
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
case AVR8_IO_PORTB:
|
||||
video_update();
|
||||
break;
|
||||
|
||||
case AVR8_IO_PORTC:
|
||||
m_dac->write(data & 0x3f);
|
||||
break;
|
||||
|
||||
case AVR8_IO_PORTD:
|
||||
//video_update();
|
||||
m_latched_sample = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// MEMORY
|
||||
//**************************************************************************
|
||||
@ -118,9 +77,14 @@ void lft_phasor_state::data_map(address_map &map)
|
||||
map(0x0100, 0x04ff).ram();
|
||||
}
|
||||
|
||||
void lft_phasor_state::io_map(address_map &map)
|
||||
//**************************************************************************
|
||||
// GPIO
|
||||
//**************************************************************************
|
||||
|
||||
void lft_phasor_state::port_b_w(uint8_t data)
|
||||
{
|
||||
map(AVR8_IO_PORTA, AVR8_IO_PORTD).rw(FUNC(lft_phasor_state::port_r), FUNC(lft_phasor_state::port_w));
|
||||
m_gpio_b = data;
|
||||
video_update();
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
@ -168,7 +132,7 @@ void lft_phasor_state::video_update()
|
||||
|
||||
if (m_last_cycles < cycles && !m_in_blanking)
|
||||
{
|
||||
const uint8_t shift = (m_ports[PORT_B] & 4);
|
||||
const uint8_t shift = (m_gpio_b & 4);
|
||||
uint32_t sample_pix = m_sample_y * 1135 + m_sample_x;
|
||||
for (uint64_t idx = m_last_cycles; idx < cycles && sample_pix < SAMPLES_PER_FRAME; idx++)
|
||||
{
|
||||
@ -206,7 +170,7 @@ void lft_phasor_state::machine_start()
|
||||
{
|
||||
m_samples = std::make_unique<uint8_t[]>(SAMPLES_PER_FRAME);
|
||||
|
||||
save_item(NAME(m_ports));
|
||||
save_item(NAME(m_gpio_b));
|
||||
save_item(NAME(m_last_cycles));
|
||||
save_item(NAME(m_frame_start_cycle));
|
||||
|
||||
@ -220,7 +184,7 @@ void lft_phasor_state::machine_start()
|
||||
|
||||
void lft_phasor_state::machine_reset()
|
||||
{
|
||||
memset(m_ports, 0, PORT_COUNT);
|
||||
m_gpio_b = 0;
|
||||
|
||||
m_frame_start_cycle = 0;
|
||||
m_last_cycles = 0;
|
||||
@ -238,8 +202,11 @@ void lft_phasor_state::phasor(machine_config &config)
|
||||
ATMEGA88(config, m_maincpu, MASTER_CLOCK);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &lft_phasor_state::prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &lft_phasor_state::data_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &lft_phasor_state::io_map);
|
||||
m_maincpu->set_eeprom_tag("eeprom");
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTB>().set([this]() { return m_gpio_b; });
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTB>().set(FUNC(lft_phasor_state::port_b_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTC>().set([this](uint8_t data) { m_dac->write(data & 0x3f); });
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTD>().set([this](uint8_t data) { m_latched_sample = data; });
|
||||
|
||||
PALETTE(config, m_palette, FUNC(lft_phasor_state::init_palette), 0x10);
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
|
@ -129,10 +129,14 @@ public:
|
||||
private:
|
||||
void prg_map(address_map &map);
|
||||
void data_map(address_map &map);
|
||||
void io_map(address_map &map);
|
||||
|
||||
uint8_t port_b_r();
|
||||
void port_b_w(uint8_t data);
|
||||
void port_c_w(uint8_t data);
|
||||
void port_d_w(uint8_t data);
|
||||
void port_e_w(uint8_t data);
|
||||
|
||||
void update_display();
|
||||
uint8_t port_r(offs_t offset);
|
||||
void port_w(offs_t offset, uint8_t value);
|
||||
|
||||
uint8_t m_port_b;
|
||||
uint8_t m_port_c;
|
||||
@ -151,54 +155,57 @@ protected:
|
||||
|
||||
void pensebem2017_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_port_b));
|
||||
save_item(NAME(m_port_c));
|
||||
save_item(NAME(m_port_d));
|
||||
save_item(NAME(m_port_e));
|
||||
}
|
||||
|
||||
uint8_t pensebem2017_state::port_r(offs_t offset)
|
||||
void pensebem2017_state::machine_reset()
|
||||
{
|
||||
uint8_t value;
|
||||
m_port_b = 0;
|
||||
m_port_c = 0;
|
||||
m_port_d = 0;
|
||||
m_port_e = 0;
|
||||
}
|
||||
|
||||
uint8_t pensebem2017_state::port_b_r()
|
||||
{
|
||||
uint8_t value = m_port_b & 0xc3;
|
||||
int bit;
|
||||
|
||||
switch(offset)
|
||||
for (bit=0; bit<8; bit++)
|
||||
{
|
||||
case AVR8_IO_PORTB:
|
||||
value = m_port_b & 0xc3;
|
||||
for (bit=0; bit<8; bit++)
|
||||
{
|
||||
if (bit < 2 && !BIT(m_port_e, bit)) break;
|
||||
if (bit >= 2 && !BIT(m_port_d, bit)) break;
|
||||
}
|
||||
if (BIT(m_keyb_rows[0]->read(), bit)) value |= (1 << 5);
|
||||
if (BIT(m_keyb_rows[1]->read(), bit)) value |= (1 << 3);
|
||||
if (BIT(m_keyb_rows[2]->read(), bit)) value |= (1 << 2);
|
||||
if (BIT(m_keyb_rows[3]->read(), bit)) value |= (1 << 4);
|
||||
return value;
|
||||
default:
|
||||
return 0xff;
|
||||
if (bit < 2 && !BIT(m_port_e, bit)) break;
|
||||
if (bit >= 2 && !BIT(m_port_d, bit)) break;
|
||||
}
|
||||
if (BIT(m_keyb_rows[0]->read(), bit)) value |= (1 << 5);
|
||||
if (BIT(m_keyb_rows[1]->read(), bit)) value |= (1 << 3);
|
||||
if (BIT(m_keyb_rows[2]->read(), bit)) value |= (1 << 2);
|
||||
if (BIT(m_keyb_rows[3]->read(), bit)) value |= (1 << 4);
|
||||
return value;
|
||||
}
|
||||
|
||||
void pensebem2017_state::port_w(offs_t offset, uint8_t data)
|
||||
void pensebem2017_state::port_b_w(uint8_t data) // buzzer + keyboard select rows
|
||||
{
|
||||
switch(offset)
|
||||
{
|
||||
case AVR8_IO_PORTB: // buzzer + keyboard_select_rows
|
||||
m_port_b = data;
|
||||
m_dac->write(BIT(data, 1));
|
||||
break;
|
||||
case AVR8_IO_PORTC: // display
|
||||
m_port_c = data;
|
||||
update_display();
|
||||
break;
|
||||
case AVR8_IO_PORTD: // display
|
||||
m_port_d = data;
|
||||
break;
|
||||
case AVR8_IO_PORTE: // display
|
||||
m_port_e = data;
|
||||
update_display();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_port_b = data;
|
||||
m_dac->write(BIT(data, 1));
|
||||
}
|
||||
|
||||
void pensebem2017_state::port_c_w(uint8_t data) // display
|
||||
{
|
||||
m_port_c = data;
|
||||
update_display();
|
||||
}
|
||||
|
||||
void pensebem2017_state::port_d_w(uint8_t data) // display
|
||||
{
|
||||
m_port_d = data;
|
||||
}
|
||||
|
||||
void pensebem2017_state::port_e_w(uint8_t data) // display
|
||||
{
|
||||
m_port_e = data;
|
||||
update_display();
|
||||
}
|
||||
|
||||
void pensebem2017_state::update_display()
|
||||
@ -220,11 +227,6 @@ void pensebem2017_state::data_map(address_map &map)
|
||||
map(0x0400, 0xffff).ram(); /* Some additional SRAM ? This is likely an exagerated amount ! */
|
||||
}
|
||||
|
||||
void pensebem2017_state::io_map(address_map &map)
|
||||
{
|
||||
map(AVR8_IO_PORTA, AVR8_IO_PORTE).rw(FUNC(pensebem2017_state::port_r), FUNC(pensebem2017_state::port_w));
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START( pensebem2017 )
|
||||
PORT_START("ROW0")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("A") PORT_CODE(KEYCODE_A)
|
||||
@ -267,26 +269,22 @@ static INPUT_PORTS_START( pensebem2017 )
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYPAD) PORT_NAME("5") PORT_CODE(KEYCODE_5)
|
||||
INPUT_PORTS_END
|
||||
|
||||
void pensebem2017_state::machine_reset()
|
||||
{
|
||||
m_port_b = 0;
|
||||
m_port_c = 0;
|
||||
m_port_d = 0;
|
||||
m_port_e = 0;
|
||||
}
|
||||
|
||||
void pensebem2017_state::pensebem2017(machine_config &config)
|
||||
{
|
||||
/* CPU */
|
||||
ATMEGA168(config, m_maincpu, 16_MHz_XTAL); /* Actual chip is an Atmel ATMEGA168PB */
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &pensebem2017_state::prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &pensebem2017_state::data_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &pensebem2017_state::io_map);
|
||||
m_maincpu->set_eeprom_tag("eeprom");
|
||||
m_maincpu->set_low_fuses(0xf7);
|
||||
m_maincpu->set_high_fuses(0xdd);
|
||||
m_maincpu->set_extended_fuses(0xf9);
|
||||
m_maincpu->set_lock_bits(0x0f);
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTB>().set(FUNC(pensebem2017_state::port_b_r));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTB>().set(FUNC(pensebem2017_state::port_b_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTC>().set(FUNC(pensebem2017_state::port_c_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTD>().set(FUNC(pensebem2017_state::port_d_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTE>().set(FUNC(pensebem2017_state::port_e_w));
|
||||
|
||||
/* video hardware */
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_SVG));
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
#define MASTER_CLOCK 16000000
|
||||
|
||||
#define LOG_PORTS 0
|
||||
|
||||
/****************************************************\
|
||||
* I/O devices *
|
||||
\****************************************************/
|
||||
@ -39,73 +37,17 @@ public:
|
||||
|
||||
void rambo(machine_config &config);
|
||||
|
||||
void init_rambo();
|
||||
|
||||
private:
|
||||
uint8_t m_port_a;
|
||||
uint8_t m_port_b;
|
||||
uint8_t m_port_c;
|
||||
uint8_t m_port_d;
|
||||
uint8_t m_port_e;
|
||||
uint8_t m_port_f;
|
||||
uint8_t m_port_g;
|
||||
uint8_t m_port_h;
|
||||
uint8_t m_port_j;
|
||||
uint8_t m_port_k;
|
||||
uint8_t m_port_l;
|
||||
required_device<avr8_device> m_maincpu;
|
||||
|
||||
uint8_t port_r(offs_t offset);
|
||||
void port_w(offs_t offset, uint8_t data);
|
||||
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
void rambo_data_map(address_map &map);
|
||||
void rambo_io_map(address_map &map);
|
||||
|
||||
void rambo_prg_map(address_map &map);
|
||||
void rambo_data_map(address_map &map);
|
||||
|
||||
uint8_t m_port_a;
|
||||
required_device<avr8_device> m_maincpu;
|
||||
};
|
||||
|
||||
void rambo_state::machine_start()
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t rambo_state::port_r(offs_t offset)
|
||||
{
|
||||
switch( offset )
|
||||
{
|
||||
case AVR8_IO_PORTA:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port A READ \n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return m_port_a;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rambo_state::port_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
switch( offset )
|
||||
{
|
||||
case AVR8_IO_PORTA:
|
||||
{
|
||||
if (data == m_port_a) break;
|
||||
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_a = m_port_a;
|
||||
uint8_t changed = data ^ old_port_a;
|
||||
#endif
|
||||
m_port_a = data;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************\
|
||||
* Address maps *
|
||||
\****************************************************/
|
||||
@ -120,32 +62,18 @@ void rambo_state::rambo_data_map(address_map &map)
|
||||
map(0x0200, 0x21FF).ram(); /* ATMEGA2560 Internal SRAM */
|
||||
}
|
||||
|
||||
void rambo_state::rambo_io_map(address_map &map)
|
||||
{
|
||||
map(AVR8_IO_PORTA, AVR8_IO_PORTL).rw(FUNC(rambo_state::port_r), FUNC(rambo_state::port_w));
|
||||
}
|
||||
|
||||
/****************************************************\
|
||||
* Machine definition *
|
||||
\****************************************************/
|
||||
|
||||
void rambo_state::init_rambo()
|
||||
void rambo_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_port_a));
|
||||
}
|
||||
|
||||
void rambo_state::machine_reset()
|
||||
{
|
||||
m_port_a = 0;
|
||||
m_port_b = 0;
|
||||
m_port_c = 0;
|
||||
m_port_d = 0;
|
||||
m_port_e = 0;
|
||||
m_port_f = 0;
|
||||
m_port_g = 0;
|
||||
m_port_h = 0;
|
||||
m_port_j = 0;
|
||||
m_port_k = 0;
|
||||
m_port_l = 0;
|
||||
}
|
||||
|
||||
void rambo_state::rambo(machine_config &config)
|
||||
@ -153,13 +81,13 @@ void rambo_state::rambo(machine_config &config)
|
||||
ATMEGA2560(config, m_maincpu, MASTER_CLOCK);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &rambo_state::rambo_prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &rambo_state::rambo_data_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &rambo_state::rambo_io_map);
|
||||
|
||||
m_maincpu->set_eeprom_tag("eeprom");
|
||||
m_maincpu->set_low_fuses(0xff);
|
||||
m_maincpu->set_high_fuses(0xda);
|
||||
m_maincpu->set_extended_fuses(0xf4);
|
||||
m_maincpu->set_lock_bits(0x0f);
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTA>().set([this]() { return m_port_a; });
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTA>().set([this](uint8_t data) { m_port_a = data; });
|
||||
|
||||
/*TODO: Add an ATMEGA32U2 for USB-Serial communications */
|
||||
/*TODO: Emulate the AD5206 digipot */
|
||||
@ -234,4 +162,4 @@ ROM_START( metamaq2 )
|
||||
ROM_END
|
||||
|
||||
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
|
||||
COMP(2012, metamaq2, 0, 0, rambo, 0, rambo_state, init_rambo, "Metamaquina", "Metamaquina 2 desktop 3d printer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
|
||||
COMP(2012, metamaq2, 0, 0, rambo, 0, rambo_state, empty_init, "Metamaquina", "Metamaquina 2 desktop 3d printer", MACHINE_NOT_WORKING | MACHINE_NO_SOUND)
|
||||
|
@ -32,8 +32,24 @@
|
||||
#include "screen.h"
|
||||
#include "speaker.h"
|
||||
|
||||
#define LOG_PORT_A (1 << 1)
|
||||
#define LOG_PORT_B (1 << 2)
|
||||
#define LOG_PORT_C (1 << 3)
|
||||
#define LOG_PORT_D (1 << 4)
|
||||
#define LOG_PORT_E (1 << 5)
|
||||
#define LOG_PORT_F (1 << 6)
|
||||
#define LOG_PORT_G (1 << 7)
|
||||
#define LOG_PORT_H (1 << 8)
|
||||
#define LOG_PORT_J (1 << 9)
|
||||
#define LOG_PORT_K (1 << 10)
|
||||
#define LOG_PORT_L (1 << 11)
|
||||
#define LOG_LCD_CLK (1 << 12)
|
||||
#define LOG_LCD_SHIFT (1 << 13)
|
||||
|
||||
#define VERBOSE (0)
|
||||
#include "logmacro.h"
|
||||
|
||||
#define MASTER_CLOCK 16000000
|
||||
#define LOG_PORTS 0
|
||||
|
||||
//Port A bits:
|
||||
//Bit 0 unused
|
||||
@ -156,16 +172,45 @@ public:
|
||||
driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_lcdc(*this, "hd44780"),
|
||||
m_dac(*this, "dac")
|
||||
m_dac(*this, "dac"),
|
||||
m_io_keypad(*this, "keypad")
|
||||
{
|
||||
}
|
||||
|
||||
void replicator(machine_config &config);
|
||||
|
||||
void init_replicator();
|
||||
|
||||
private:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
void palette_init(palette_device &palette) const;
|
||||
|
||||
void prg_map(address_map &map);
|
||||
void data_map(address_map &map);
|
||||
|
||||
uint8_t port_a_r();
|
||||
uint8_t port_b_r();
|
||||
uint8_t port_c_r();
|
||||
uint8_t port_d_r();
|
||||
uint8_t port_e_r();
|
||||
uint8_t port_f_r();
|
||||
uint8_t port_g_r();
|
||||
uint8_t port_h_r();
|
||||
uint8_t port_j_r();
|
||||
uint8_t port_k_r();
|
||||
uint8_t port_l_r();
|
||||
|
||||
void port_a_w(uint8_t data);
|
||||
void port_b_w(uint8_t data);
|
||||
void port_c_w(uint8_t data);
|
||||
void port_d_w(uint8_t data);
|
||||
void port_e_w(uint8_t data);
|
||||
void port_f_w(uint8_t data);
|
||||
void port_g_w(uint8_t data);
|
||||
void port_h_w(uint8_t data);
|
||||
void port_j_w(uint8_t data);
|
||||
void port_k_w(uint8_t data);
|
||||
void port_l_w(uint8_t data);
|
||||
|
||||
uint8_t m_port_a;
|
||||
uint8_t m_port_b;
|
||||
@ -179,369 +224,392 @@ private:
|
||||
uint8_t m_port_k;
|
||||
uint8_t m_port_l;
|
||||
|
||||
uint8_t shift_register_value;
|
||||
uint8_t m_shift_register_value;
|
||||
|
||||
required_device<avr8_device> m_maincpu;
|
||||
required_device<hd44780_device> m_lcdc;
|
||||
required_device<dac_bit_interface> m_dac;
|
||||
|
||||
uint8_t port_r(offs_t offset);
|
||||
void port_w(offs_t offset, uint8_t data);
|
||||
virtual void machine_reset() override;
|
||||
void replicator_palette(palette_device &palette) const;
|
||||
void replicator_data_map(address_map &map);
|
||||
void replicator_io_map(address_map &map);
|
||||
void replicator_prg_map(address_map &map);
|
||||
required_ioport m_io_keypad;
|
||||
};
|
||||
|
||||
void replicator_state::machine_start()
|
||||
uint8_t replicator_state::port_a_r()
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_r(offs_t offset)
|
||||
{
|
||||
switch( offset )
|
||||
{
|
||||
case AVR8_IO_PORTA:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port A READ (A-axis signals + B-axis STEP&DIR)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
case AVR8_IO_PORTB:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port B READ (SD-CS; 1280-MISO/MOSI/SCK; EX2-FAN/HEAT/PWR-CHECK; BLINK)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
case AVR8_IO_PORTC:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port C READ (1280-EX1/EX2; LCD-signals; R&G-LED; DETECT)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return DETECT; //indicated that the Interface board is present.
|
||||
}
|
||||
case AVR8_IO_PORTD:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port D READ (SDA/SCL; 1280-EX-TX/RX)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
case AVR8_IO_PORTE:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port E READ (1280-TX/RX; THERMO-signals)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
case AVR8_IO_PORTF:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port F READ (X-axis & Y-axis signals)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
case AVR8_IO_PORTG:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port G READ (BUZZ; Cutoff-sr-check; B-axis EN; 1280-EX3/EX4)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
case AVR8_IO_PORTH:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port H READ (cuttoff-text/reset; EX1-FAN/HEAT/PWR-CHECK; SD-CD/SD-WP)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
case AVR8_IO_PORTJ:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port J READ (Interface buttons; POTS-SCL; B-axis-POT)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return ioport("keypad")->read();
|
||||
}
|
||||
case AVR8_IO_PORTK:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port K READ (Z-axis signals; HBP-THERM; 1280-EX5/6/7)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
case AVR8_IO_PORTL:
|
||||
{
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] Port L READ (HBP; EXTRA-FET; X-MIN/MAX; Y-MIN/MAX; Z-MIN/MAX)\n", m_maincpu->m_shifted_pc);
|
||||
#endif
|
||||
return 0x00;
|
||||
}
|
||||
}
|
||||
LOGMASKED(LOG_PORT_A, "%s: Port A READ (A-axis signals + B-axis STEP&DIR)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
void replicator_state::port_w(offs_t offset, uint8_t data)
|
||||
uint8_t replicator_state::port_b_r()
|
||||
{
|
||||
switch( offset )
|
||||
LOGMASKED(LOG_PORT_B, "%s: Port B READ (SD-CS; 1280-MISO/MOSI/SCK; EX2-FAN/HEAT/PWR-CHECK; BLINK)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_c_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_C, "%s: Port C READ (1280-EX1/EX2; LCD-signals; R&G-LED; DETECT)\n", machine().describe_context());
|
||||
return DETECT; //indicated that the Interface board is present.
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_d_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_D, "%s: Port D READ (SDA/SCL; 1280-EX-TX/RX)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_e_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_E, "%s: Port E READ (1280-TX/RX; THERMO-signals)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_f_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_F, "%s: Port F READ (X-axis & Y-axis signals)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_g_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_G, "%s: Port G READ (BUZZ; Cutoff-sr-check; B-axis EN; 1280-EX3/EX4)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_h_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_H, "%s: Port H READ (cuttoff-text/reset; EX1-FAN/HEAT/PWR-CHECK; SD-CD/SD-WP)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_j_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_J, "%s: Port J READ (Interface buttons; POTS-SCL; B-axis-POT)\n", machine().describe_context());
|
||||
return m_io_keypad->read();
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_k_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_K, "%s: Port K READ (Z-axis signals; HBP-THERM; 1280-EX5/6/7)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t replicator_state::port_l_r()
|
||||
{
|
||||
LOGMASKED(LOG_PORT_L, "%s: Port L READ (HBP; EXTRA-FET; X-MIN/MAX; Y-MIN/MAX; Z-MIN/MAX)\n", machine().describe_context());
|
||||
return 0;
|
||||
}
|
||||
|
||||
void replicator_state::port_a_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_a) return;
|
||||
|
||||
const uint8_t old = m_port_a;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & A_AXIS_DIR)
|
||||
LOGMASKED(LOG_PORT_A, "%s: [A] A_AXIS_DIR: %d\n", machine().describe_context(), data & A_AXIS_DIR ? 1 : 0);
|
||||
if (changed & A_AXIS_STEP)
|
||||
LOGMASKED(LOG_PORT_A, "%s: [A] A_AXIS_STEP: %d\n", machine().describe_context(), data & A_AXIS_STEP ? 1 : 0);
|
||||
if (changed & A_AXIS_EN)
|
||||
LOGMASKED(LOG_PORT_A, "%s: [A] A_AXIS_EN: %d\n", machine().describe_context(), data & A_AXIS_EN ? 1 : 0);
|
||||
if (changed & A_AXIS_POT)
|
||||
LOGMASKED(LOG_PORT_A, "%s: [A] A_AXIS_POT: %d\n", machine().describe_context(), data & A_AXIS_POT ? 1 : 0);
|
||||
if (changed & B_AXIS_DIR)
|
||||
LOGMASKED(LOG_PORT_A, "%s: [A] B_AXIS_DIR: %d\n", machine().describe_context(), data & B_AXIS_DIR ? 1 : 0);
|
||||
if (changed & B_AXIS_STEP)
|
||||
LOGMASKED(LOG_PORT_A, "%s: [A] B_AXIS_STEP: %d\n", machine().describe_context(), data & B_AXIS_STEP ? 1 : 0);
|
||||
|
||||
m_port_a = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_b_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_b) return;
|
||||
|
||||
const uint8_t old = m_port_b;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & SD_CS)
|
||||
LOGMASKED(LOG_PORT_B, "%s: [B] SD Card Chip Select: %d\n", machine().describe_context(), data & SD_CS ? 1 : 0);
|
||||
if (changed & SCK_1280)
|
||||
LOGMASKED(LOG_PORT_B, "%s: [B] 1280-SCK: %d\n", machine().describe_context(), data & SCK_1280 ? 1 : 0);
|
||||
if (changed & MOSI_1280)
|
||||
LOGMASKED(LOG_PORT_B, "%s: [B] 1280-MOSI: %d\n", machine().describe_context(), data & MOSI_1280 ? 1 : 0);
|
||||
if (changed & MISO_1280)
|
||||
LOGMASKED(LOG_PORT_B, "%s: [B] 1280-MISO: %d\n", machine().describe_context(), data & MISO_1280 ? 1 : 0);
|
||||
if (changed & EX2_PWR_CHECK)
|
||||
LOGMASKED(LOG_PORT_B, "%s: [B] EX2-PWR-CHECK: %d\n", machine().describe_context(), data & EX2_PWR_CHECK ? 1 : 0);
|
||||
if (changed & EX2_HEAT)
|
||||
LOGMASKED(LOG_PORT_B, "%s: [B] EX2_HEAT: %d\n", machine().describe_context(), data & EX2_HEAT ? 1 : 0);
|
||||
if (changed & EX2_FAN)
|
||||
LOGMASKED(LOG_PORT_B, "%s: [B] EX2_FAN: %d\n", machine().describe_context(), data & EX2_FAN ? 1 : 0);
|
||||
if (changed & BLINK)
|
||||
LOGMASKED(LOG_PORT_B, "%s: [B] BLINK: %d\n", machine().describe_context(), data & BLINK ? 1 : 0);
|
||||
|
||||
m_port_b = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_c_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_c) return;
|
||||
|
||||
const uint8_t old_port_c = m_port_c;
|
||||
const uint8_t changed = data ^ old_port_c;
|
||||
|
||||
if(changed & EX2_1280)
|
||||
LOGMASKED(LOG_PORT_C, "%s: [C] EX2_1280: %d\n", machine().describe_context(), data & EX2_1280 ? 1 : 0);
|
||||
if(changed & EX1_1280)
|
||||
LOGMASKED(LOG_PORT_C, "%s: [C] EX1_1280: %d\n", machine().describe_context(), data & EX1_1280 ? 1 : 0);
|
||||
if(changed & LCD_CLK)
|
||||
LOGMASKED(LOG_PORT_C, "%s: [C] LCD_CLK: %d\n", machine().describe_context(), data & LCD_CLK ? 1 : 0);
|
||||
if(changed & LCD_DATA)
|
||||
LOGMASKED(LOG_PORT_C, "%s: [C] LCD_DATA: %d\n", machine().describe_context(), data & LCD_DATA ? 1 : 0);
|
||||
if(changed & LCD_STROBE)
|
||||
LOGMASKED(LOG_PORT_C, "%s: [C] LCD_STROBE: %d\n", machine().describe_context(), data & LCD_STROBE ? 1 : 0);
|
||||
if(changed & RLED)
|
||||
LOGMASKED(LOG_PORT_C, "%s: [C] RLED: %d\n", machine().describe_context(), data & RLED ? 1 : 0);
|
||||
if(changed & GLED)
|
||||
LOGMASKED(LOG_PORT_C, "%s: [C] GLED: %d\n", machine().describe_context(), data & GLED ? 1 : 0);
|
||||
if(changed & DETECT)
|
||||
LOGMASKED(LOG_PORT_C, "%s: [C] DETECT: %d\n", machine().describe_context(), data & DETECT ? 1 : 0);
|
||||
|
||||
if (changed & LCD_CLK)
|
||||
{
|
||||
case AVR8_IO_PORTA:
|
||||
/* The LCD is interfaced by an 8-bit shift register (74HC4094). */
|
||||
if (data & LCD_CLK) // CLK positive edge
|
||||
{
|
||||
if (data == m_port_a) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_a = m_port_a;
|
||||
uint8_t changed = data ^ old_port_a;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & A_AXIS_DIR) printf("[A] A_AXIS_DIR: %s\n", data & A_AXIS_DIR ? "HIGH" : "LOW");
|
||||
if(changed & A_AXIS_STEP) printf("[A] A_AXIS_STEP: %s\n", data & A_AXIS_STEP ? "HIGH" : "LOW");
|
||||
if(changed & A_AXIS_EN) printf("[A] A_AXIS_EN: %s\n", data & A_AXIS_EN ? "HIGH" : "LOW");
|
||||
if(changed & A_AXIS_POT) printf("[A] A_AXIS_POT: %s\n", data & A_AXIS_POT ? "HIGH" : "LOW");
|
||||
if(changed & B_AXIS_DIR) printf("[A] B_AXIS_DIR: %s\n", data & B_AXIS_DIR ? "HIGH" : "LOW");
|
||||
if(changed & B_AXIS_STEP) printf("[A] B_AXIS_STEP: %s\n", data & B_AXIS_STEP ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_a = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTB:
|
||||
{
|
||||
if (data == m_port_b) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_b = m_port_b;
|
||||
uint8_t changed = data ^ old_port_b;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & SD_CS) printf("[B] SD Card Chip Select: %s\n", data & SD_CS ? "HIGH" : "LOW");
|
||||
if(changed & SCK_1280) printf("[B] 1280-SCK: %s\n", data & SCK_1280 ? "HIGH" : "LOW");
|
||||
if(changed & MOSI_1280) printf("[B] 1280-MOSI: %s\n", data & MOSI_1280 ? "HIGH" : "LOW");
|
||||
if(changed & MISO_1280) printf("[B] 1280-MISO: %s\n", data & MISO_1280 ? "HIGH" : "LOW");
|
||||
if(changed & EX2_PWR_CHECK) printf("[B] EX2-PWR-CHECK: %s\n", data & EX2_PWR_CHECK ? "HIGH" : "LOW");
|
||||
if(changed & EX2_HEAT) printf("[B] EX2_HEAT: %s\n", data & EX2_HEAT ? "HIGH" : "LOW");
|
||||
if(changed & EX2_FAN) printf("[B] EX2_FAN: %s\n", data & EX2_FAN ? "HIGH" : "LOW");
|
||||
if(changed & BLINK) printf("[B] BLINK: %s\n", data & BLINK ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_b = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTC:
|
||||
{
|
||||
if (data == m_port_c) break;
|
||||
|
||||
uint8_t old_port_c = m_port_c;
|
||||
uint8_t changed = data ^ old_port_c;
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & EX2_1280) printf("[C] EX2_1280: %s\n", data & EX2_1280 ? "HIGH" : "LOW");
|
||||
if(changed & EX1_1280) printf("[C] EX1_1280: %s\n", data & EX1_1280 ? "HIGH" : "LOW");
|
||||
if(changed & LCD_CLK) printf("[C] LCD_CLK: %s\n", data & LCD_CLK ? "HIGH" : "LOW");
|
||||
if(changed & LCD_DATA) printf("[C] LCD_DATA: %s\n", data & LCD_DATA ? "HIGH" : "LOW");
|
||||
if(changed & LCD_STROBE) printf("[C] LCD_STROBE: %s\n", data & LCD_STROBE ? "HIGH" : "LOW");
|
||||
if(changed & RLED) printf("[C] RLED: %s\n", data & RLED ? "HIGH" : "LOW");
|
||||
if(changed & GLED) printf("[C] GLED: %s\n", data & GLED ? "HIGH" : "LOW");
|
||||
if(changed & DETECT) printf("[C] DETECT: %s\n", data & DETECT ? "HIGH" : "LOW");
|
||||
#endif
|
||||
if (changed & LCD_CLK){
|
||||
/* The LCD is interfaced by an 8-bit shift register (74HC4094). */
|
||||
if (data & LCD_CLK){//CLK positive edge
|
||||
shift_register_value = (shift_register_value << 1) | ((data & LCD_DATA) >> 3);
|
||||
//printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
//printf("[C] LCD CLK positive edge. shift_register=0x%02X\n", shift_register_value);
|
||||
}
|
||||
}
|
||||
|
||||
if(changed & LCD_STROBE){
|
||||
if (data & LCD_STROBE){ //STROBE positive edge
|
||||
logerror("LCD shift register = %02X\n", shift_register_value);
|
||||
m_lcdc->rs_w(BIT(shift_register_value, 1));
|
||||
m_lcdc->rw_w(BIT(shift_register_value, 2));
|
||||
m_lcdc->e_w(BIT(shift_register_value, 3));
|
||||
m_lcdc->db_w(shift_register_value & 0xF0);
|
||||
}
|
||||
}
|
||||
m_port_c = data;
|
||||
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTD:
|
||||
{
|
||||
if (data == m_port_d) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_d = m_port_d;
|
||||
uint8_t changed = data ^ old_port_d;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & PORTD_SCL) printf("[D] PORTD_SCL: %s\n", data & PORTD_SCL ? "HIGH" : "LOW");
|
||||
if(changed & PORTD_SDA) printf("[D] PORTD_SDA: %s\n", data & PORTD_SDA ? "HIGH" : "LOW");
|
||||
if(changed & EX_RX_1280) printf("[D] EX_RX_1280: %s\n", data & EX_RX_1280 ? "HIGH" : "LOW");
|
||||
if(changed & EX_TX_1280) printf("[D] EX_TX_1280: %s\n", data & EX_TX_1280 ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_d = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTE:
|
||||
{
|
||||
if (data == m_port_e) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_e = m_port_e;
|
||||
uint8_t changed = data ^ old_port_e;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & RX_1280) printf("[E] 1280-RX: %s\n", data & RX_1280 ? "HIGH" : "LOW");
|
||||
if(changed & TX_1280) printf("[E] 1280-TX: %s\n", data & TX_1280 ? "HIGH" : "LOW");
|
||||
if(changed & THERMO_SCK) printf("[E] THERMO-SCK: %s\n", data & THERMO_SCK ? "HIGH" : "LOW");
|
||||
if(changed & THERMO_CS1) printf("[E] THERMO-CS1: %s\n", data & THERMO_CS1 ? "HIGH" : "LOW");
|
||||
if(changed & THERMO_CS2) printf("[E] THERMO-CS2: %s\n", data & THERMO_CS2 ? "HIGH" : "LOW");
|
||||
if(changed & THERMO_DO) printf("[E] THERMO-DO: %s\n", data & THERMO_DO ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_e = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTF:
|
||||
{
|
||||
if (data == m_port_f) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_f = m_port_f;
|
||||
uint8_t changed = data ^ old_port_f;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & X_AXIS_DIR) printf("[F] X_AXIS_DIR: %s\n", data & X_AXIS_DIR ? "HIGH" : "LOW");
|
||||
if(changed & X_AXIS_STEP) printf("[F] X_AXIS_STEP: %s\n", data & X_AXIS_STEP ? "HIGH" : "LOW");
|
||||
if(changed & X_AXIS_EN) printf("[F] X_AXIS_EN: %s\n", data & X_AXIS_EN ? "HIGH" : "LOW");
|
||||
if(changed & X_AXIS_POT) printf("[F] X_AXIS_POT: %s\n", data & X_AXIS_POT ? "HIGH" : "LOW");
|
||||
if(changed & Y_AXIS_DIR) printf("[F] Y_AXIS_DIR: %s\n", data & Y_AXIS_DIR ? "HIGH" : "LOW");
|
||||
if(changed & Y_AXIS_STEP) printf("[F] Y_AXIS_STEP: %s\n", data & Y_AXIS_STEP ? "HIGH" : "LOW");
|
||||
if(changed & Y_AXIS_EN) printf("[F] Y_AXIS_EN: %s\n", data & Y_AXIS_EN ? "HIGH" : "LOW");
|
||||
if(changed & Y_AXIS_POT) printf("[F] Y_AXIS_POT: %s\n", data & Y_AXIS_POT ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_f = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTG:
|
||||
{
|
||||
if (data == m_port_g) break;
|
||||
|
||||
uint8_t old_port_g = m_port_g;
|
||||
uint8_t changed = data ^ old_port_g;
|
||||
|
||||
#if LOG_PORTS
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & EX4_1280) printf("[G] EX4_1280: %s\n", data & EX4_1280 ? "HIGH" : "LOW");
|
||||
if(changed & EX3_1280) printf("[G] EX3_1280: %s\n", data & EX3_1280 ? "HIGH" : "LOW");
|
||||
if(changed & B_AXIS_EN) printf("[G] B_AXIS_EN: %s\n", data & B_AXIS_EN ? "HIGH" : "LOW");
|
||||
if(changed & CUTOFF_SR_CHECK) printf("[G] CUTOFF_SR_CHECK: %s\n", data & CUTOFF_SR_CHECK ? "HIGH" : "LOW");
|
||||
if(changed & BUZZ) printf("[G] BUZZ: %s\n", data & BUZZ ? "HIGH" : "LOW");
|
||||
#endif
|
||||
|
||||
if (changed & BUZZ)
|
||||
{
|
||||
m_dac->write(BIT(data, 5));
|
||||
}
|
||||
|
||||
m_port_g = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTH:
|
||||
{
|
||||
if (data == m_port_h) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_h = m_port_h;
|
||||
uint8_t changed = data ^ old_port_h;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & CUTOFF_TEST) printf("[H] CUTOFF_TEST: %s\n", data & CUTOFF_TEST ? "HIGH" : "LOW");
|
||||
if(changed & CUTOFF_RESET) printf("[H] CUTOFF_RESET: %s\n", data & CUTOFF_RESET ? "HIGH" : "LOW");
|
||||
if(changed & EX1_PWR_CHECK) printf("[H] EX1_PWR_CHECK: %s\n", data & EX1_PWR_CHECK ? "HIGH" : "LOW");
|
||||
if(changed & EX1_HEAT) printf("[H] EX1_HEAT: %s\n", data & EX1_HEAT ? "HIGH" : "LOW");
|
||||
if(changed & EX1_FAN) printf("[H] EX1_FAN: %s\n", data & EX1_FAN ? "HIGH" : "LOW");
|
||||
if(changed & SD_WP) printf("[H] SD_WP: %s\n", data & SD_WP ? "HIGH" : "LOW");
|
||||
if(changed & SD_CD) printf("[H] SD_CD: %s\n", data & SD_CD ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_h = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTJ:
|
||||
{
|
||||
if (data == m_port_j) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_j = m_port_j;
|
||||
uint8_t changed = data ^ old_port_j;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & BUTTON_CENTER) printf("[J] BUTTON_CENTER: %s\n", data & BUTTON_CENTER ? "HIGH" : "LOW");
|
||||
if(changed & BUTTON_RIGHT) printf("[J] BUTTON_RIGHT: %s\n", data & BUTTON_RIGHT ? "HIGH" : "LOW");
|
||||
if(changed & BUTTON_LEFT) printf("[J] BUTTON_LEFT: %s\n", data & BUTTON_LEFT ? "HIGH" : "LOW");
|
||||
if(changed & BUTTON_DOWN) printf("[J] BUTTON_DOWN: %s\n", data & BUTTON_DOWN ? "HIGH" : "LOW");
|
||||
if(changed & BUTTON_UP) printf("[J] BUTTON_UP: %s\n", data & BUTTON_UP ? "HIGH" : "LOW");
|
||||
if(changed & POTS_SCL) printf("[J] POTS_SCL: %s\n", data & POTS_SCL ? "HIGH" : "LOW");
|
||||
if(changed & B_AXIS_POT) printf("[J] B_AXIS_POT: %s\n", data & B_AXIS_POT ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_j = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTK:
|
||||
{
|
||||
if (data == m_port_k) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_k = m_port_k;
|
||||
uint8_t changed = data ^ old_port_k;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & Z_AXIS_DIR) printf("[K] Z_AXIS_DIR: %s\n", data & Z_AXIS_DIR ? "HIGH" : "LOW");
|
||||
if(changed & Z_AXIS_STEP) printf("[K] Z_AXIS_STEP: %s\n", data & Z_AXIS_STEP ? "HIGH" : "LOW");
|
||||
if(changed & Z_AXIS_EN) printf("[K] Z_AXIS_EN: %s\n", data & Z_AXIS_EN ? "HIGH" : "LOW");
|
||||
if(changed & Z_AXIS_POT) printf("[K] Z_AXIS_POT: %s\n", data & Z_AXIS_POT ? "HIGH" : "LOW");
|
||||
if(changed & EX7_1280) printf("[K] EX7_1280: %s\n", data & EX7_1280 ? "HIGH" : "LOW");
|
||||
if(changed & EX6_1280) printf("[K] EX6_1280: %s\n", data & EX6_1280 ? "HIGH" : "LOW");
|
||||
if(changed & EX5_1280) printf("[K] EX5_1280: %s\n", data & EX5_1280 ? "HIGH" : "LOW");
|
||||
if(changed & HBP_THERM) printf("[K] HBP_THERM: %s\n", data & HBP_THERM ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_k = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTL:
|
||||
{
|
||||
if (data == m_port_l) break;
|
||||
#if LOG_PORTS
|
||||
uint8_t old_port_l = m_port_l;
|
||||
uint8_t changed = data ^ old_port_l;
|
||||
|
||||
printf("[%08X] ", m_maincpu->m_shifted_pc);
|
||||
if(changed & X_MIN) printf("[L] X_MIN: %s\n", data & X_MIN ? "HIGH" : "LOW");
|
||||
if(changed & X_MAX) printf("[L] X_MAX: %s\n", data & X_MAX ? "HIGH" : "LOW");
|
||||
if(changed & Y_MIN) printf("[L] Y_MIN: %s\n", data & Y_MIN ? "HIGH" : "LOW");
|
||||
if(changed & Y_MAX) printf("[L] Y_MAX: %s\n", data & Y_MAX ? "HIGH" : "LOW");
|
||||
if(changed & HBP) printf("[L] HBP: %s\n", data & HBP ? "HIGH" : "LOW");
|
||||
if(changed & EXTRA_FET) printf("[L] EXTRA_FET: %s\n", data & EXTRA_FET ? "HIGH" : "LOW");
|
||||
if(changed & Z_MIN) printf("[L] Z_MIN: %s\n", data & Z_MIN ? "HIGH" : "LOW");
|
||||
if(changed & Z_MAX) printf("[L] Z_MAX: %s\n", data & Z_MAX ? "HIGH" : "LOW");
|
||||
#endif
|
||||
m_port_l = data;
|
||||
break;
|
||||
m_shift_register_value = (m_shift_register_value << 1) | ((data & LCD_DATA) >> 3);
|
||||
LOGMASKED(LOG_LCD_CLK, "%s: [C] LCD CLK positive edge. shift_register=0x%02X\n", machine().describe_context(), m_shift_register_value);
|
||||
}
|
||||
}
|
||||
|
||||
if (changed & LCD_STROBE)
|
||||
{
|
||||
if (data & LCD_STROBE) // STROBE positive edge
|
||||
{
|
||||
LOGMASKED(LOG_LCD_SHIFT, "%s: LCD shift register = %02X\n", machine().describe_context(), m_shift_register_value);
|
||||
m_lcdc->rs_w(BIT(m_shift_register_value, 1));
|
||||
m_lcdc->rw_w(BIT(m_shift_register_value, 2));
|
||||
m_lcdc->e_w(BIT(m_shift_register_value, 3));
|
||||
m_lcdc->db_w(m_shift_register_value & 0xF0);
|
||||
}
|
||||
}
|
||||
|
||||
m_port_c = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_d_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_d) return;
|
||||
|
||||
const uint8_t old = m_port_d;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & PORTD_SCL)
|
||||
LOGMASKED(LOG_PORT_D, "%s: [D] PORTD_SCL: %d\n", machine().describe_context(), data & PORTD_SCL ? 1 : 0);
|
||||
if (changed & PORTD_SDA)
|
||||
LOGMASKED(LOG_PORT_D, "%s: [D] PORTD_SDA: %d\n", machine().describe_context(), data & PORTD_SDA ? 1 : 0);
|
||||
if (changed & EX_RX_1280)
|
||||
LOGMASKED(LOG_PORT_D, "%s: [D] EX_RX_1280: %d\n", machine().describe_context(), data & EX_RX_1280 ? 1 : 0);
|
||||
if (changed & EX_TX_1280)
|
||||
LOGMASKED(LOG_PORT_D, "%s: [D] EX_TX_1280: %d\n", machine().describe_context(), data & EX_TX_1280 ? 1 : 0);
|
||||
|
||||
m_port_d = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_e_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_e) return;
|
||||
|
||||
const uint8_t old = m_port_e;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & RX_1280)
|
||||
LOGMASKED(LOG_PORT_E, "%s: [E] 1280-RX: %d\n", machine().describe_context(), data & RX_1280 ? 1 : 0);
|
||||
if (changed & TX_1280)
|
||||
LOGMASKED(LOG_PORT_E, "%s: [E] 1280-TX: %d\n", machine().describe_context(), data & TX_1280 ? 1 : 0);
|
||||
if (changed & THERMO_SCK)
|
||||
LOGMASKED(LOG_PORT_E, "%s: [E] THERMO-SCK: %d\n", machine().describe_context(), data & THERMO_SCK ? 1 : 0);
|
||||
if (changed & THERMO_CS1)
|
||||
LOGMASKED(LOG_PORT_E, "%s: [E] THERMO-CS1: %d\n", machine().describe_context(), data & THERMO_CS1 ? 1 : 0);
|
||||
if (changed & THERMO_CS2)
|
||||
LOGMASKED(LOG_PORT_E, "%s: [E] THERMO-CS2: %d\n", machine().describe_context(), data & THERMO_CS2 ? 1 : 0);
|
||||
if (changed & THERMO_DO)
|
||||
LOGMASKED(LOG_PORT_E, "%s: [E] THERMO-DO: %d\n", machine().describe_context(), data & THERMO_DO ? 1 : 0);
|
||||
|
||||
m_port_e = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_f_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_f) return;
|
||||
|
||||
const uint8_t old = m_port_f;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & X_AXIS_DIR)
|
||||
LOGMASKED(LOG_PORT_F, "%s: [F] X_AXIS_DIR: %d\n", machine().describe_context(), data & X_AXIS_DIR ? 1 : 0);
|
||||
if (changed & X_AXIS_STEP)
|
||||
LOGMASKED(LOG_PORT_F, "%s: [F] X_AXIS_STEP: %d\n", machine().describe_context(), data & X_AXIS_STEP ? 1 : 0);
|
||||
if (changed & X_AXIS_EN)
|
||||
LOGMASKED(LOG_PORT_F, "%s: [F] X_AXIS_EN: %d\n", machine().describe_context(), data & X_AXIS_EN ? 1 : 0);
|
||||
if (changed & X_AXIS_POT)
|
||||
LOGMASKED(LOG_PORT_F, "%s: [F] X_AXIS_POT: %d\n", machine().describe_context(), data & X_AXIS_POT ? 1 : 0);
|
||||
if (changed & Y_AXIS_DIR)
|
||||
LOGMASKED(LOG_PORT_F, "%s: [F] Y_AXIS_DIR: %d\n", machine().describe_context(), data & Y_AXIS_DIR ? 1 : 0);
|
||||
if (changed & Y_AXIS_STEP)
|
||||
LOGMASKED(LOG_PORT_F, "%s: [F] Y_AXIS_STEP: %d\n", machine().describe_context(), data & Y_AXIS_STEP ? 1 : 0);
|
||||
if (changed & Y_AXIS_EN)
|
||||
LOGMASKED(LOG_PORT_F, "%s: [F] Y_AXIS_EN: %d\n", machine().describe_context(), data & Y_AXIS_EN ? 1 : 0);
|
||||
if (changed & Y_AXIS_POT)
|
||||
LOGMASKED(LOG_PORT_F, "%s: [F] Y_AXIS_POT: %d\n", machine().describe_context(), data & Y_AXIS_POT ? 1 : 0);
|
||||
|
||||
m_port_f = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_g_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_g) return;
|
||||
|
||||
const uint8_t old = m_port_g;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & EX4_1280)
|
||||
LOGMASKED(LOG_PORT_G, "%s: [G] EX4_1280: %d\n", machine().describe_context(), data & EX4_1280 ? 1 : 0);
|
||||
if (changed & EX3_1280)
|
||||
LOGMASKED(LOG_PORT_G, "%s: [G] EX3_1280: %d\n", machine().describe_context(), data & EX3_1280 ? 1 : 0);
|
||||
if (changed & B_AXIS_EN)
|
||||
LOGMASKED(LOG_PORT_G, "%s: [G] B_AXIS_EN: %d\n", machine().describe_context(), data & B_AXIS_EN ? 1 : 0);
|
||||
if (changed & CUTOFF_SR_CHECK)
|
||||
LOGMASKED(LOG_PORT_G, "%s: [G] CUTOFF_SR_CHECK: %d\n", machine().describe_context(), data & CUTOFF_SR_CHECK ? 1 : 0);
|
||||
if (changed & BUZZ)
|
||||
LOGMASKED(LOG_PORT_G, "%s: [G] BUZZ: %d\n", machine().describe_context(), data & BUZZ ? 1 : 0);
|
||||
|
||||
if (changed & BUZZ)
|
||||
{
|
||||
m_dac->write(BIT(data, 5));
|
||||
}
|
||||
|
||||
m_port_g = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_h_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_h) return;
|
||||
|
||||
const uint8_t old = m_port_h;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & CUTOFF_TEST)
|
||||
LOGMASKED(LOG_PORT_H, "%s: [H] CUTOFF_TEST: %d\n", machine().describe_context(), data & CUTOFF_TEST ? 1 : 0);
|
||||
if (changed & CUTOFF_RESET)
|
||||
LOGMASKED(LOG_PORT_H, "%s: [H] CUTOFF_RESET: %d\n", machine().describe_context(), data & CUTOFF_RESET ? 1 : 0);
|
||||
if (changed & EX1_PWR_CHECK)
|
||||
LOGMASKED(LOG_PORT_H, "%s: [H] EX1_PWR_CHECK: %d\n", machine().describe_context(), data & EX1_PWR_CHECK ? 1 : 0);
|
||||
if (changed & EX1_HEAT)
|
||||
LOGMASKED(LOG_PORT_H, "%s: [H] EX1_HEAT: %d\n", machine().describe_context(), data & EX1_HEAT ? 1 : 0);
|
||||
if (changed & EX1_FAN)
|
||||
LOGMASKED(LOG_PORT_H, "%s: [H] EX1_FAN: %d\n", machine().describe_context(), data & EX1_FAN ? 1 : 0);
|
||||
if (changed & SD_WP)
|
||||
LOGMASKED(LOG_PORT_H, "%s: [H] SD_WP: %d\n", machine().describe_context(), data & SD_WP ? 1 : 0);
|
||||
if (changed & SD_CD)
|
||||
LOGMASKED(LOG_PORT_H, "%s: [H] SD_CD: %d\n", machine().describe_context(), data & SD_CD ? 1 : 0);
|
||||
|
||||
m_port_h = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_j_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_j) return;
|
||||
|
||||
const uint8_t old = m_port_j;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & BUTTON_CENTER)
|
||||
LOGMASKED(LOG_PORT_J, "%s: [J] BUTTON_CENTER: %d\n", machine().describe_context(), data & BUTTON_CENTER ? 1 : 0);
|
||||
if (changed & BUTTON_RIGHT)
|
||||
LOGMASKED(LOG_PORT_J, "%s: [J] BUTTON_RIGHT: %d\n", machine().describe_context(), data & BUTTON_RIGHT ? 1 : 0);
|
||||
if (changed & BUTTON_LEFT)
|
||||
LOGMASKED(LOG_PORT_J, "%s: [J] BUTTON_LEFT: %d\n", machine().describe_context(), data & BUTTON_LEFT ? 1 : 0);
|
||||
if (changed & BUTTON_DOWN)
|
||||
LOGMASKED(LOG_PORT_J, "%s: [J] BUTTON_DOWN: %d\n", machine().describe_context(), data & BUTTON_DOWN ? 1 : 0);
|
||||
if (changed & BUTTON_UP)
|
||||
LOGMASKED(LOG_PORT_J, "%s: [J] BUTTON_UP: %d\n", machine().describe_context(), data & BUTTON_UP ? 1 : 0);
|
||||
if (changed & POTS_SCL)
|
||||
LOGMASKED(LOG_PORT_J, "%s: [J] POTS_SCL: %d\n", machine().describe_context(), data & POTS_SCL ? 1 : 0);
|
||||
if (changed & B_AXIS_POT)
|
||||
LOGMASKED(LOG_PORT_J, "%s: [J] B_AXIS_POT: %d\n", machine().describe_context(), data & B_AXIS_POT ? 1 : 0);
|
||||
|
||||
m_port_j = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_k_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_k) return;
|
||||
|
||||
const uint8_t old = m_port_k;
|
||||
const uint8_t changed = data ^ old;
|
||||
|
||||
if (changed & Z_AXIS_DIR)
|
||||
LOGMASKED(LOG_PORT_K, "%s: [K] Z_AXIS_DIR: %d\n", machine().describe_context(), data & Z_AXIS_DIR ? 1 : 0);
|
||||
if (changed & Z_AXIS_STEP)
|
||||
LOGMASKED(LOG_PORT_K, "%s: [K] Z_AXIS_STEP: %d\n", machine().describe_context(), data & Z_AXIS_STEP ? 1 : 0);
|
||||
if (changed & Z_AXIS_EN)
|
||||
LOGMASKED(LOG_PORT_K, "%s: [K] Z_AXIS_EN: %d\n", machine().describe_context(), data & Z_AXIS_EN ? 1 : 0);
|
||||
if (changed & Z_AXIS_POT)
|
||||
LOGMASKED(LOG_PORT_K, "%s: [K] Z_AXIS_POT: %d\n", machine().describe_context(), data & Z_AXIS_POT ? 1 : 0);
|
||||
if (changed & EX7_1280)
|
||||
LOGMASKED(LOG_PORT_K, "%s: [K] EX7_1280: %d\n", machine().describe_context(), data & EX7_1280 ? 1 : 0);
|
||||
if (changed & EX6_1280)
|
||||
LOGMASKED(LOG_PORT_K, "%s: [K] EX6_1280: %d\n", machine().describe_context(), data & EX6_1280 ? 1 : 0);
|
||||
if (changed & EX5_1280)
|
||||
LOGMASKED(LOG_PORT_K, "%s: [K] EX5_1280: %d\n", machine().describe_context(), data & EX5_1280 ? 1 : 0);
|
||||
if (changed & HBP_THERM)
|
||||
LOGMASKED(LOG_PORT_K, "%s: [K] HBP_THERM: %d\n", machine().describe_context(), data & HBP_THERM ? 1 : 0);
|
||||
|
||||
m_port_k = data;
|
||||
}
|
||||
|
||||
void replicator_state::port_l_w(uint8_t data)
|
||||
{
|
||||
if (data == m_port_l) return;
|
||||
|
||||
const uint8_t old_port_l = m_port_l;
|
||||
const uint8_t changed = data ^ old_port_l;
|
||||
|
||||
if (changed & X_MIN)
|
||||
LOGMASKED(LOG_PORT_L, "%s: [L] X_MIN: %d\n", machine().describe_context(), data & X_MIN ? 1 : 0);
|
||||
if (changed & X_MAX)
|
||||
LOGMASKED(LOG_PORT_L, "%s: [L] X_MAX: %d\n", machine().describe_context(), data & X_MAX ? 1 : 0);
|
||||
if (changed & Y_MIN)
|
||||
LOGMASKED(LOG_PORT_L, "%s: [L] Y_MIN: %d\n", machine().describe_context(), data & Y_MIN ? 1 : 0);
|
||||
if (changed & Y_MAX)
|
||||
LOGMASKED(LOG_PORT_L, "%s: [L] Y_MAX: %d\n", machine().describe_context(), data & Y_MAX ? 1 : 0);
|
||||
if (changed & HBP)
|
||||
LOGMASKED(LOG_PORT_L, "%s: [L] HBP: %d\n", machine().describe_context(), data & HBP ? 1 : 0);
|
||||
if (changed & EXTRA_FET)
|
||||
LOGMASKED(LOG_PORT_L, "%s: [L] EXTRA_FET: %d\n", data & EXTRA_FET ? 1 : 0);
|
||||
if (changed & Z_MIN)
|
||||
LOGMASKED(LOG_PORT_L, "%s: [L] Z_MIN: %d\n", machine().describe_context(), data & Z_MIN ? 1 : 0);
|
||||
if (changed & Z_MAX)
|
||||
LOGMASKED(LOG_PORT_L, "%s: [L] Z_MAX: %d\n", machine().describe_context(), data & Z_MAX ? 1 : 0);
|
||||
|
||||
m_port_l = data;
|
||||
}
|
||||
|
||||
/****************************************************\
|
||||
* Address maps *
|
||||
\****************************************************/
|
||||
|
||||
void replicator_state::replicator_prg_map(address_map &map)
|
||||
void replicator_state::prg_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x1FFFF).rom();
|
||||
}
|
||||
|
||||
void replicator_state::replicator_data_map(address_map &map)
|
||||
void replicator_state::data_map(address_map &map)
|
||||
{
|
||||
map(0x0200, 0x21FF).ram(); /* ATMEGA1280 Internal SRAM */
|
||||
}
|
||||
|
||||
void replicator_state::replicator_io_map(address_map &map)
|
||||
{
|
||||
map(AVR8_IO_PORTA, AVR8_IO_PORTL).rw(FUNC(replicator_state::port_r), FUNC(replicator_state::port_w));
|
||||
}
|
||||
|
||||
/****************************************************\
|
||||
* Input ports *
|
||||
\****************************************************/
|
||||
@ -559,13 +627,25 @@ INPUT_PORTS_END
|
||||
* Machine definition *
|
||||
\****************************************************/
|
||||
|
||||
void replicator_state::init_replicator()
|
||||
void replicator_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_shift_register_value));
|
||||
save_item(NAME(m_port_a));
|
||||
save_item(NAME(m_port_b));
|
||||
save_item(NAME(m_port_c));
|
||||
save_item(NAME(m_port_d));
|
||||
save_item(NAME(m_port_e));
|
||||
save_item(NAME(m_port_f));
|
||||
save_item(NAME(m_port_g));
|
||||
save_item(NAME(m_port_h));
|
||||
save_item(NAME(m_port_j));
|
||||
save_item(NAME(m_port_k));
|
||||
save_item(NAME(m_port_l));
|
||||
}
|
||||
|
||||
void replicator_state::machine_reset()
|
||||
{
|
||||
shift_register_value = 0;
|
||||
m_shift_register_value = 0;
|
||||
m_port_a = 0;
|
||||
m_port_b = 0;
|
||||
m_port_c = 0;
|
||||
@ -579,7 +659,7 @@ void replicator_state::machine_reset()
|
||||
m_port_l = 0;
|
||||
}
|
||||
|
||||
void replicator_state::replicator_palette(palette_device &palette) const
|
||||
void replicator_state::palette_init(palette_device &palette) const
|
||||
{
|
||||
// These colors were picked with the color picker in Inkscape, based on a photo of the LCD used in the Replicator 1 3d printer:
|
||||
palette.set_pen_color(0, rgb_t(0xca, 0xe7, 0xeb));
|
||||
@ -604,9 +684,8 @@ GFXDECODE_END
|
||||
void replicator_state::replicator(machine_config &config)
|
||||
{
|
||||
ATMEGA1280(config, m_maincpu, MASTER_CLOCK);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &replicator_state::replicator_prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &replicator_state::replicator_data_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &replicator_state::replicator_io_map);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &replicator_state::prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &replicator_state::data_map);
|
||||
|
||||
m_maincpu->set_eeprom_tag("eeprom");
|
||||
m_maincpu->set_low_fuses(0xff);
|
||||
@ -614,6 +693,30 @@ void replicator_state::replicator(machine_config &config)
|
||||
m_maincpu->set_extended_fuses(0xf4);
|
||||
m_maincpu->set_lock_bits(0x0f);
|
||||
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTA>().set(FUNC(replicator_state::port_a_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTB>().set(FUNC(replicator_state::port_b_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTC>().set(FUNC(replicator_state::port_c_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTD>().set(FUNC(replicator_state::port_d_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTE>().set(FUNC(replicator_state::port_e_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTF>().set(FUNC(replicator_state::port_f_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTG>().set(FUNC(replicator_state::port_g_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTH>().set(FUNC(replicator_state::port_h_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTJ>().set(FUNC(replicator_state::port_j_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTK>().set(FUNC(replicator_state::port_k_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTL>().set(FUNC(replicator_state::port_l_r));
|
||||
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTA>().set(FUNC(replicator_state::port_a_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTB>().set(FUNC(replicator_state::port_b_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTC>().set(FUNC(replicator_state::port_c_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTD>().set(FUNC(replicator_state::port_d_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTE>().set(FUNC(replicator_state::port_e_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTF>().set(FUNC(replicator_state::port_f_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTG>().set(FUNC(replicator_state::port_g_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTH>().set(FUNC(replicator_state::port_h_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTJ>().set(FUNC(replicator_state::port_j_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTK>().set(FUNC(replicator_state::port_k_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTL>().set(FUNC(replicator_state::port_l_w));
|
||||
|
||||
/*TODO: Add an ATMEGA8U2 for USB-Serial communications */
|
||||
|
||||
/* video hardware */
|
||||
@ -625,7 +728,7 @@ void replicator_state::replicator(machine_config &config)
|
||||
screen.set_visarea(0, 120-1, 0, 18*2-1);
|
||||
screen.set_palette("palette");
|
||||
|
||||
PALETTE(config, "palette", FUNC(replicator_state::replicator_palette), 2);
|
||||
PALETTE(config, "palette", FUNC(replicator_state::palette_init), 2);
|
||||
GFXDECODE(config, "gfxdecode", "palette", gfx_replicator);
|
||||
|
||||
HD44780(config, "hd44780", 0).set_lcd_size(4, 20);
|
||||
@ -717,5 +820,5 @@ ROM_START( replica1 )
|
||||
ROM_REGION( 0x1000, "eeprom", ROMREGION_ERASEFF )
|
||||
ROM_END
|
||||
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */
|
||||
COMP(2012, replica1, 0, 0, replicator, replicator, replicator_state, init_replicator, "Makerbot", "Replicator 1 desktop 3d printer", MACHINE_NOT_WORKING)
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME */
|
||||
COMP(2012, replica1, 0, 0, replicator, replicator, replicator_state, empty_init, "Makerbot", "Replicator 1 desktop 3d printer", MACHINE_NOT_WORKING)
|
||||
|
@ -85,7 +85,6 @@ private:
|
||||
|
||||
void main_mem_map(address_map &map);
|
||||
void video_data_map(address_map &map);
|
||||
void video_io_map(address_map &map);
|
||||
void video_mem_map(address_map &map);
|
||||
|
||||
u8 m_key_row;
|
||||
@ -121,10 +120,6 @@ void sbc6510_state::video_data_map(address_map &map)
|
||||
map(0x0100, 0x04ff).ram();
|
||||
}
|
||||
|
||||
void sbc6510_state::video_io_map(address_map &map)
|
||||
{
|
||||
}
|
||||
|
||||
/* Input ports */
|
||||
static INPUT_PORTS_START( sbc6510 ) // cbm keyboard
|
||||
PORT_START( "X0" )
|
||||
@ -289,7 +284,6 @@ void sbc6510_state::sbc6510(machine_config &config)
|
||||
ATMEGA88(config, m_videocpu, XTAL(16'000'000)); // Video CPU trips SLEEP opcode, needs to be emulated
|
||||
m_videocpu->set_addrmap(AS_PROGRAM, &sbc6510_state::video_mem_map);
|
||||
m_videocpu->set_addrmap(AS_DATA, &sbc6510_state::video_data_map);
|
||||
m_videocpu->set_addrmap(AS_IO, &sbc6510_state::video_io_map);
|
||||
m_videocpu->set_eeprom_tag("eeprom");
|
||||
|
||||
PALETTE(config, "palette", palette_device::MONOCHROME); // for F4 displayer only
|
||||
|
@ -65,21 +65,20 @@ private:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
void line_update();
|
||||
uint32_t screen_update_uzebox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cart_load);
|
||||
|
||||
void uzebox_data_map(address_map &map);
|
||||
void uzebox_io_map(address_map &map);
|
||||
void uzebox_prg_map(address_map &map);
|
||||
void data_map(address_map &map);
|
||||
void prg_map(address_map &map);
|
||||
|
||||
int m_vpos;
|
||||
int m_vpos;
|
||||
uint64_t m_line_start_cycles;
|
||||
uint32_t m_line_pos_cycles;
|
||||
uint8_t m_port_a;
|
||||
uint8_t m_port_b;
|
||||
uint8_t m_port_c;
|
||||
uint8_t m_port_d;
|
||||
bitmap_rgb32 m_bitmap;
|
||||
bitmap_rgb32 m_bitmap;
|
||||
};
|
||||
|
||||
void uzebox_state::machine_start()
|
||||
@ -201,24 +200,16 @@ uint8_t uzebox_state::port_d_r()
|
||||
* Address maps *
|
||||
\****************************************************/
|
||||
|
||||
void uzebox_state::uzebox_prg_map(address_map &map)
|
||||
void uzebox_state::prg_map(address_map &map)
|
||||
{
|
||||
map(0x0000, 0xffff).rom(); // 64 KB internal eprom ATmega644
|
||||
}
|
||||
|
||||
void uzebox_state::uzebox_data_map(address_map &map)
|
||||
void uzebox_state::data_map(address_map &map)
|
||||
{
|
||||
map(0x0100, 0x10ff).ram(); // 4KB RAM
|
||||
}
|
||||
|
||||
void uzebox_state::uzebox_io_map(address_map &map)
|
||||
{
|
||||
map(AVR8_REG_A, AVR8_REG_A).rw(FUNC(uzebox_state::port_a_r), FUNC(uzebox_state::port_a_w));
|
||||
map(AVR8_REG_B, AVR8_REG_B).rw(FUNC(uzebox_state::port_b_r), FUNC(uzebox_state::port_b_w));
|
||||
map(AVR8_REG_C, AVR8_REG_C).rw(FUNC(uzebox_state::port_c_r), FUNC(uzebox_state::port_c_w));
|
||||
map(AVR8_REG_D, AVR8_REG_D).rw(FUNC(uzebox_state::port_d_r), FUNC(uzebox_state::port_d_w));
|
||||
}
|
||||
|
||||
/****************************************************\
|
||||
* Input ports *
|
||||
\****************************************************/
|
||||
@ -251,7 +242,7 @@ void uzebox_state::line_update()
|
||||
m_line_pos_cycles = cycles;
|
||||
}
|
||||
|
||||
uint32_t uzebox_state::screen_update_uzebox(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
uint32_t uzebox_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
copybitmap(bitmap, m_bitmap, 0, 0, 0, 0, cliprect);
|
||||
return 0;
|
||||
@ -288,18 +279,24 @@ void uzebox_state::uzebox(machine_config &config)
|
||||
{
|
||||
/* basic machine hardware */
|
||||
ATMEGA644(config, m_maincpu, MASTER_CLOCK);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &uzebox_state::uzebox_prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &uzebox_state::uzebox_data_map);
|
||||
m_maincpu->set_addrmap(AS_IO, &uzebox_state::uzebox_io_map);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &uzebox_state::prg_map);
|
||||
m_maincpu->set_addrmap(AS_DATA, &uzebox_state::data_map);
|
||||
m_maincpu->set_eeprom_tag("eeprom");
|
||||
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTA>().set(FUNC(uzebox_state::port_a_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTB>().set(FUNC(uzebox_state::port_b_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTC>().set(FUNC(uzebox_state::port_c_r));
|
||||
m_maincpu->gpio_in<AVR8_IO_PORTD>().set(FUNC(uzebox_state::port_d_r));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTA>().set(FUNC(uzebox_state::port_a_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTB>().set(FUNC(uzebox_state::port_b_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTC>().set(FUNC(uzebox_state::port_c_w));
|
||||
m_maincpu->gpio_out<AVR8_IO_PORTD>().set(FUNC(uzebox_state::port_d_w));
|
||||
/* video hardware */
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_refresh_hz(59.99);
|
||||
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(1395));
|
||||
m_screen->set_size(870, 525);
|
||||
m_screen->set_visarea(150, 870-1, 40, 488-1);
|
||||
m_screen->set_screen_update(FUNC(uzebox_state::screen_update_uzebox));
|
||||
m_screen->set_screen_update(FUNC(uzebox_state::screen_update));
|
||||
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "mono").front_center();
|
||||
|
Loading…
Reference in New Issue
Block a user