mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
-AVR8 improvements: [Felipe Sanches]
- Added ELPM instructions - Added fuse bits macros - Added reset logic to decide initial program counter based on fuse bits configuration - Added initial support for ATMEGA1280 and ATMEGA2560 - Use register names in the disassembly of IN and OUT instructions (MESS) New driver : Replicator 1 [Felipe Sanches] (MESS) Replicator 1 driver: [Felipe Sanches] - status: no sound / not working - general skeleton. - basic memory mapping - shift-register interfacing from PORTC writes to the LCD device - avr8 fuses configuration
This commit is contained in:
parent
0e95be33ee
commit
a0d7e3ca1d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -7223,6 +7223,7 @@ src/mess/drivers/radio86.c svneol=native#text/plain
|
||||
src/mess/drivers/rainbow.c svneol=native#text/plain
|
||||
src/mess/drivers/ravens.c svneol=native#text/plain
|
||||
src/mess/drivers/rd110.c svneol=native#text/plain
|
||||
src/mess/drivers/replicator.c svneol=native#text/plain
|
||||
src/mess/drivers/rex6000.c svneol=native#text/plain
|
||||
src/mess/drivers/rm380z.c svneol=native#text/plain
|
||||
src/mess/drivers/rmnimbus.c svneol=native#text/plain
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -46,6 +46,23 @@
|
||||
|
||||
#define MCFG_CPU_AVR8_CONFIG(_config) \
|
||||
avr8_device::static_set_config(*device, _config);
|
||||
|
||||
//**************************************************************************
|
||||
// FUSE BITS CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_CPU_AVR8_LFUSE(byte) \
|
||||
((avr8_device*) device)->set_low_fuses(byte);
|
||||
|
||||
#define MCFG_CPU_AVR8_HFUSE(byte) \
|
||||
((avr8_device*) device)->set_high_fuses(byte);
|
||||
|
||||
#define MCFG_CPU_AVR8_EFUSE(byte) \
|
||||
((avr8_device*) device)->set_extended_fuses(byte);
|
||||
|
||||
#define MCFG_CPU_AVR8_LOCK(byte) \
|
||||
((avr8_device*) device)->set_lock_bits(byte);
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
@ -73,6 +90,12 @@ public:
|
||||
// inline configuration helpers
|
||||
static void static_set_config(device_t &device, const avr8_config &config);
|
||||
|
||||
// fuse configs
|
||||
void set_low_fuses(UINT8 byte);
|
||||
void set_high_fuses(UINT8 byte);
|
||||
void set_extended_fuses(UINT8 byte);
|
||||
void set_lock_bits(UINT8 byte);
|
||||
|
||||
// public interfaces
|
||||
virtual void update_interrupt(int source);
|
||||
UINT64 get_elapsed_cycles()
|
||||
@ -83,9 +106,18 @@ public:
|
||||
// register handling
|
||||
DECLARE_WRITE8_MEMBER( regs_w );
|
||||
DECLARE_READ8_MEMBER( regs_r );
|
||||
UINT32 m_shifted_pc;
|
||||
|
||||
protected:
|
||||
avr8_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, const device_type type, UINT32 address_mask, address_map_constructor internal_map, const char *shortname, const char *source);
|
||||
enum
|
||||
{
|
||||
CPU_TYPE_ATMEGA88,
|
||||
CPU_TYPE_ATMEGA644,
|
||||
CPU_TYPE_ATMEGA1280,
|
||||
CPU_TYPE_ATMEGA2560
|
||||
};
|
||||
|
||||
avr8_device(const machine_config &mconfig, const char *name, const char *tag, device_t *owner, UINT32 clock, const device_type type, UINT32 address_mask, address_map_constructor internal_map, UINT8 cpu_type, const char *shortname, const char *source);
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start();
|
||||
@ -115,10 +147,19 @@ protected:
|
||||
const address_space_config m_io_config;
|
||||
UINT8 *m_eeprom;
|
||||
|
||||
// bootloader
|
||||
UINT16 m_boot_size;
|
||||
UINT8 m_cpu_type;
|
||||
|
||||
// Fuses
|
||||
UINT8 m_lfuses;
|
||||
UINT8 m_hfuses;
|
||||
UINT8 m_efuses;
|
||||
UINT8 m_lock_bits;
|
||||
|
||||
// CPU registers
|
||||
UINT32 m_pc;
|
||||
UINT32 m_shifted_pc;
|
||||
UINT8 m_r[256];
|
||||
UINT8 m_r[0x200];
|
||||
|
||||
// internal timers
|
||||
UINT8 m_timer0_top;
|
||||
@ -136,6 +177,11 @@ protected:
|
||||
UINT16 m_timer2_prescale;
|
||||
UINT16 m_timer2_prescale_count;
|
||||
|
||||
UINT16 m_timer4_top;
|
||||
INT32 m_timer4_increment;
|
||||
UINT16 m_timer4_prescale;
|
||||
UINT16 m_timer4_prescale_count;
|
||||
|
||||
// SPI
|
||||
bool m_spi_active;
|
||||
UINT8 m_spi_prescale;
|
||||
@ -209,6 +255,26 @@ protected:
|
||||
void update_ocr2(UINT8 newval, UINT8 reg);
|
||||
void timer2_force_output_compare(int reg);
|
||||
|
||||
// timer 3
|
||||
/*
|
||||
void timer3_tick();
|
||||
void changed_tccr3a(UINT8 data);
|
||||
void changed_tccr3b(UINT8 data);
|
||||
void update_timer3_waveform_gen_mode();
|
||||
void update_timer3_clock_source();
|
||||
void update_ocr3(UINT8 newval, UINT8 reg);
|
||||
void timer3_force_output_compare(int reg);
|
||||
*/
|
||||
|
||||
// timer 4
|
||||
void timer4_tick();
|
||||
void changed_tccr4a(UINT8 data);
|
||||
void changed_tccr4b(UINT8 data);
|
||||
void update_timer4_waveform_gen_mode();
|
||||
void update_timer4_clock_source();
|
||||
//void update_ocr4(UINT8 newval, UINT8 reg);
|
||||
//void timer4_force_output_compare(int reg);
|
||||
|
||||
// address spaces
|
||||
address_space *m_program;
|
||||
address_space *m_data;
|
||||
@ -218,6 +284,8 @@ protected:
|
||||
// device type definition
|
||||
extern const device_type ATMEGA88;
|
||||
extern const device_type ATMEGA644;
|
||||
extern const device_type ATMEGA1280;
|
||||
extern const device_type ATMEGA2560;
|
||||
|
||||
// ======================> atmega88_device
|
||||
|
||||
@ -239,6 +307,28 @@ public:
|
||||
virtual void update_interrupt(int source);
|
||||
};
|
||||
|
||||
// ======================> atmega1280_device
|
||||
|
||||
class atmega1280_device : public avr8_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
atmega1280_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
virtual void update_interrupt(int source);
|
||||
};
|
||||
|
||||
// ======================> atmega2560_device
|
||||
|
||||
class atmega2560_device : public avr8_device
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
atmega2560_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
virtual void update_interrupt(int source);
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
REGISTER ENUMERATION
|
||||
***************************************************************************/
|
||||
@ -282,7 +372,8 @@ enum
|
||||
AVR8_X,
|
||||
AVR8_Y,
|
||||
AVR8_Z,
|
||||
AVR8_SP,
|
||||
AVR8_SPH,
|
||||
AVR8_SPL,
|
||||
};
|
||||
|
||||
enum
|
||||
@ -348,7 +439,7 @@ enum
|
||||
// Used by I/O register handling
|
||||
enum
|
||||
{
|
||||
AVR8_REGIDX_R0 = 0,
|
||||
AVR8_REGIDX_R0 = 0x00,
|
||||
AVR8_REGIDX_R1,
|
||||
AVR8_REGIDX_R2,
|
||||
AVR8_REGIDX_R3,
|
||||
@ -380,7 +471,6 @@ enum
|
||||
AVR8_REGIDX_R29,
|
||||
AVR8_REGIDX_R30,
|
||||
AVR8_REGIDX_R31,
|
||||
|
||||
AVR8_REGIDX_PINA = 0x20,
|
||||
AVR8_REGIDX_DDRA,
|
||||
AVR8_REGIDX_PORTA,
|
||||
@ -393,12 +483,22 @@ enum
|
||||
AVR8_REGIDX_PIND,
|
||||
AVR8_REGIDX_DDRD,
|
||||
AVR8_REGIDX_PORTD,
|
||||
|
||||
AVR8_REGIDX_PINE,
|
||||
AVR8_REGIDX_DDRE,
|
||||
AVR8_REGIDX_PORTE,
|
||||
AVR8_REGIDX_PINF,
|
||||
AVR8_REGIDX_DDRF,
|
||||
AVR8_REGIDX_PORTF,
|
||||
AVR8_REGIDX_PING,
|
||||
AVR8_REGIDX_DDRG,
|
||||
AVR8_REGIDX_PORTG,
|
||||
AVR8_REGIDX_TIFR0 = 0x35,
|
||||
AVR8_REGIDX_TIFR1,
|
||||
AVR8_REGIDX_TIFR2,
|
||||
|
||||
AVR8_REGIDX_PCIFR = 0x3b,
|
||||
AVR8_REGIDX_TIFR3,
|
||||
AVR8_REGIDX_TIFR4,
|
||||
AVR8_REGIDX_TIFR5,
|
||||
AVR8_REGIDX_PCIFR = 0x3B,
|
||||
AVR8_REGIDX_EIFR,
|
||||
AVR8_REGIDX_EIMSK,
|
||||
AVR8_REGIDX_GPIOR0,
|
||||
@ -412,53 +512,66 @@ enum
|
||||
AVR8_REGIDX_TCNT0,
|
||||
AVR8_REGIDX_OCR0A,
|
||||
AVR8_REGIDX_OCR0B,
|
||||
|
||||
AVR8_REGIDX_GPIOR1 = 0x4a,
|
||||
//0x49: Reserved
|
||||
AVR8_REGIDX_GPIOR1 = 0x4A,
|
||||
AVR8_REGIDX_GPIOR2,
|
||||
AVR8_REGIDX_SPCR,
|
||||
AVR8_REGIDX_SPSR,
|
||||
AVR8_REGIDX_SPDR,
|
||||
|
||||
//0x4F: Reserved
|
||||
AVR8_REGIDX_ACSR = 0x50,
|
||||
|
||||
AVR8_REGIDX_OCDR,
|
||||
//0x52: Reserved
|
||||
AVR8_REGIDX_SMCR = 0x53,
|
||||
AVR8_REGIDX_MCUSR,
|
||||
AVR8_REGIDX_MCUCR,
|
||||
|
||||
//0x56: Reserved
|
||||
AVR8_REGIDX_SPMCSR = 0x57,
|
||||
|
||||
AVR8_REGIDX_SPL = 0x5d,
|
||||
//0x58: Reserved
|
||||
//0x59: Reserved
|
||||
//0x5A: Reserved
|
||||
AVR8_REGIDX_RAMPZ = 0x5B,
|
||||
AVR8_REGIDX_EIND,
|
||||
AVR8_REGIDX_SPL,
|
||||
AVR8_REGIDX_SPH,
|
||||
AVR8_REGIDX_SREG,
|
||||
AVR8_REGIDX_WDTCSR,
|
||||
//--------------------------
|
||||
AVR8_REGIDX_WDTCSR = 0x60,
|
||||
AVR8_REGIDX_CLKPR,
|
||||
|
||||
AVR8_REGIDX_PRR = 0x64,
|
||||
|
||||
AVR8_REGIDX_OSCCAL = 0x66,
|
||||
|
||||
//0x62: Reserved
|
||||
//0x63: Reserved
|
||||
AVR8_REGIDX_PRR0 = 0x64,
|
||||
AVR8_REGIDX_PRR1,
|
||||
AVR8_REGIDX_OSCCAL,
|
||||
//0x67: Reserved
|
||||
AVR8_REGIDX_PCICR = 0x68,
|
||||
AVR8_REGIDX_EICRA,
|
||||
|
||||
AVR8_REGIDX_PCMSK0 = 0x6B,
|
||||
AVR8_REGIDX_EICRB,
|
||||
AVR8_REGIDX_PCMSK0,
|
||||
AVR8_REGIDX_PCMSK1,
|
||||
AVR8_REGIDX_PCMSK2,
|
||||
AVR8_REGIDX_TIMSK0,
|
||||
AVR8_REGIDX_TIMSK1,
|
||||
AVR8_REGIDX_TIMSK2,
|
||||
|
||||
AVR8_REGIDX_TIMSK3,
|
||||
AVR8_REGIDX_TIMSK4,
|
||||
AVR8_REGIDX_TIMSK5,
|
||||
AVR8_REGIDX_XMCRA,
|
||||
AVR8_REGIDX_XMCRB,
|
||||
//0x76: Reserved
|
||||
//0x77: Reserved
|
||||
AVR8_REGIDX_ADCL = 0x78,
|
||||
AVR8_REGIDX_ADCH,
|
||||
AVR8_REGIDX_ADCSRA,
|
||||
AVR8_REGIDX_ADCSRB,
|
||||
AVR8_REGIDX_ADMUX,
|
||||
|
||||
AVR8_REGIDX_DIDR0 = 0x7e,
|
||||
AVR8_REGIDX_DIDR2,
|
||||
AVR8_REGIDX_DIDR0,
|
||||
AVR8_REGIDX_DIDR1,
|
||||
AVR8_REGIDX_TCCR1A,
|
||||
AVR8_REGIDX_TCCR1B,
|
||||
AVR8_REGIDX_TCCR1C,
|
||||
|
||||
//0x83: Reserved
|
||||
AVR8_REGIDX_TCNT1L = 0x84,
|
||||
AVR8_REGIDX_TCNT1H,
|
||||
AVR8_REGIDX_ICR1L,
|
||||
@ -467,56 +580,246 @@ enum
|
||||
AVR8_REGIDX_OCR1AH,
|
||||
AVR8_REGIDX_OCR1BL,
|
||||
AVR8_REGIDX_OCR1BH,
|
||||
|
||||
AVR8_REGIDX_TCCR2A = 0xb0,
|
||||
AVR8_REGIDX_OCR1CL,
|
||||
AVR8_REGIDX_OCR1CH,
|
||||
//0x8E: Reserved
|
||||
//0x8F: Reserved
|
||||
AVR8_REGIDX_TCCR3A = 0x90,
|
||||
AVR8_REGIDX_TCCR3B,
|
||||
AVR8_REGIDX_TCCR3C,
|
||||
//0x93: Reserved
|
||||
AVR8_REGIDX_TCNT3L = 0x94,
|
||||
AVR8_REGIDX_TCNT3H,
|
||||
AVR8_REGIDX_ICR3L,
|
||||
AVR8_REGIDX_ICR3H,
|
||||
AVR8_REGIDX_OCR3AL,
|
||||
AVR8_REGIDX_OCR3AH,
|
||||
AVR8_REGIDX_OCR3BL,
|
||||
AVR8_REGIDX_OCR3BH,
|
||||
AVR8_REGIDX_OCR3CL,
|
||||
AVR8_REGIDX_OCR3CH,
|
||||
//0x9E: Reserved
|
||||
//0x9F: Reserved
|
||||
AVR8_REGIDX_TCCR4A = 0xA0,
|
||||
AVR8_REGIDX_TCCR4B,
|
||||
AVR8_REGIDX_TCCR4C,
|
||||
//0xA3: Reserved
|
||||
AVR8_REGIDX_TCNT4L = 0xA4,
|
||||
AVR8_REGIDX_TCNT4H,
|
||||
AVR8_REGIDX_ICR4L,
|
||||
AVR8_REGIDX_ICR4H,
|
||||
AVR8_REGIDX_OCR4AL,
|
||||
AVR8_REGIDX_OCR4AH,
|
||||
AVR8_REGIDX_OCR4BL,
|
||||
AVR8_REGIDX_OCR4BH,
|
||||
AVR8_REGIDX_OCR4CL,
|
||||
AVR8_REGIDX_OCR4CH,
|
||||
//0xAE: Reserved
|
||||
//0xAF: Reserved
|
||||
AVR8_REGIDX_TCCR2A = 0xB0,
|
||||
AVR8_REGIDX_TCCR2B,
|
||||
AVR8_REGIDX_TCNT2,
|
||||
AVR8_REGIDX_OCR2A,
|
||||
AVR8_REGIDX_OCR2B,
|
||||
|
||||
AVR8_REGIDX_ASSR = 0xb6,
|
||||
|
||||
AVR8_REGIDX_TWBR = 0xb8,
|
||||
//0xB5: Reserved
|
||||
AVR8_REGIDX_ASSR = 0xB6,
|
||||
//0xB7: Reserved
|
||||
AVR8_REGIDX_TWBR = 0xB8,
|
||||
AVR8_REGIDX_TWSR,
|
||||
AVR8_REGIDX_TWAR,
|
||||
AVR8_REGIDX_TWDR,
|
||||
AVR8_REGIDX_TWCR,
|
||||
AVR8_REGIDX_TWAMR,
|
||||
|
||||
AVR8_REGIDX_UCSR0A = 0xc0,
|
||||
//0xBE: Reserved
|
||||
//0xBF: Reserved
|
||||
AVR8_REGIDX_UCSR0A = 0xC0,
|
||||
AVR8_REGIDX_UCSR0B,
|
||||
AVR8_REGIDX_UCSR0C,
|
||||
|
||||
AVR8_REGIDX_UBRR0L = 0xc4,
|
||||
//0xC3: Reserved
|
||||
AVR8_REGIDX_UBRR0L = 0xC4,
|
||||
AVR8_REGIDX_UBRR0H,
|
||||
AVR8_REGIDX_UDR0
|
||||
AVR8_REGIDX_UDR0,
|
||||
//0xC7: Reserved
|
||||
AVR8_REGIDX_UCSR1A = 0xC8,
|
||||
AVR8_REGIDX_UCSR1B,
|
||||
AVR8_REGIDX_UCSR1C,
|
||||
//0xCB: Reserved
|
||||
AVR8_REGIDX_UBRR1L = 0xCC,
|
||||
AVR8_REGIDX_UBRR1H,
|
||||
AVR8_REGIDX_UDR1,
|
||||
//0xCF: Reserved
|
||||
AVR8_REGIDX_UCSR2A = 0xD0,
|
||||
AVR8_REGIDX_UCSR2B,
|
||||
AVR8_REGIDX_UCSR2C,
|
||||
//0xD3: Reserved
|
||||
AVR8_REGIDX_UBRR2L = 0xD4,
|
||||
AVR8_REGIDX_UBRR2H,
|
||||
AVR8_REGIDX_UDR2,
|
||||
//0xD7: Reserved
|
||||
//0xD8: Reserved
|
||||
//0xD9: Reserved
|
||||
//0xDA: Reserved
|
||||
//0xDB: Reserved
|
||||
//0xDC: Reserved
|
||||
//0xDD: Reserved
|
||||
//0xDE: Reserved
|
||||
//0xDF: Reserved
|
||||
//0xE0: Reserved
|
||||
//0xE1: Reserved
|
||||
//0xE2: Reserved
|
||||
//0xE3: Reserved
|
||||
//0xE4: Reserved
|
||||
//0xE5: Reserved
|
||||
//0xE6: Reserved
|
||||
//0xE7: Reserved
|
||||
//0xE8: Reserved
|
||||
//0xE9: Reserved
|
||||
//0xEA: Reserved
|
||||
//0xEB: Reserved
|
||||
//0xEC: Reserved
|
||||
//0xED: Reserved
|
||||
//0xEE: Reserved
|
||||
//0xEF: Reserved
|
||||
//0xF0: Reserved
|
||||
//0xF1: Reserved
|
||||
//0xF2: Reserved
|
||||
//0xF3: Reserved
|
||||
//0xF4: Reserved
|
||||
//0xF5: Reserved
|
||||
//0xF6: Reserved
|
||||
//0xF7: Reserved
|
||||
//0xF8: Reserved
|
||||
//0xF9: Reserved
|
||||
//0xFA: Reserved
|
||||
//0xFB: Reserved
|
||||
//0xFC: Reserved
|
||||
//0xFD: Reserved
|
||||
//0xFE: Reserved
|
||||
//0xFF: Reserved
|
||||
AVR8_REGIDX_PINH = 0x100,
|
||||
AVR8_REGIDX_DDRH,
|
||||
AVR8_REGIDX_PORTH,
|
||||
AVR8_REGIDX_PINJ,
|
||||
AVR8_REGIDX_DDRJ,
|
||||
AVR8_REGIDX_PORTJ,
|
||||
AVR8_REGIDX_PINK,
|
||||
AVR8_REGIDX_DDRK,
|
||||
AVR8_REGIDX_PORTK,
|
||||
AVR8_REGIDX_PINL,
|
||||
AVR8_REGIDX_DDRL,
|
||||
AVR8_REGIDX_PORTL
|
||||
};
|
||||
|
||||
enum {
|
||||
AVR8_IO_PORTA = 0,
|
||||
AVR8_IO_PORTB,
|
||||
AVR8_IO_PORTC,
|
||||
AVR8_IO_PORTD,
|
||||
AVR8_IO_PORTE,
|
||||
AVR8_IO_PORTF,
|
||||
AVR8_IO_PORTG,
|
||||
AVR8_IO_PORTH,
|
||||
AVR8_IO_PORTJ,
|
||||
AVR8_IO_PORTK,
|
||||
AVR8_IO_PORTL
|
||||
};
|
||||
|
||||
//TODO: AVR8_REG_* and AVR8_IO_PORT* seem to serve the same purpose and thus should be unified. Verify this!
|
||||
enum
|
||||
{
|
||||
AVR8_REG_A = 0,
|
||||
AVR8_REG_B,
|
||||
AVR8_REG_C,
|
||||
AVR8_REG_D,
|
||||
AVR8_REG_E,
|
||||
AVR8_REG_F,
|
||||
AVR8_REG_G,
|
||||
AVR8_REG_H,
|
||||
AVR8_REG_J,
|
||||
AVR8_REG_K,
|
||||
AVR8_REG_L,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AVR8_INTIDX_SPI,
|
||||
|
||||
AVR8_INTIDX_OCF0B,
|
||||
AVR8_INTIDX_OCF0A,
|
||||
AVR8_INTIDX_TOV0,
|
||||
|
||||
AVR8_INTIDX_ICF1,
|
||||
|
||||
AVR8_INTIDX_OCF1B,
|
||||
AVR8_INTIDX_OCF1A,
|
||||
AVR8_INTIDX_TOV1,
|
||||
|
||||
AVR8_INTIDX_OCF2B,
|
||||
AVR8_INTIDX_OCF2A,
|
||||
AVR8_INTIDX_TOV2,
|
||||
|
||||
//------ TODO: review this --------
|
||||
AVR8_INTIDX_OCF3B,
|
||||
AVR8_INTIDX_OCF3A,
|
||||
AVR8_INTIDX_TOV3,
|
||||
|
||||
AVR8_INTIDX_OCF4B,
|
||||
AVR8_INTIDX_OCF4A,
|
||||
AVR8_INTIDX_TOV4,
|
||||
|
||||
AVR8_INTIDX_OCF5B,
|
||||
AVR8_INTIDX_OCF5A,
|
||||
AVR8_INTIDX_TOV5,
|
||||
//---------------------------------
|
||||
|
||||
AVR8_INTIDX_COUNT,
|
||||
};
|
||||
|
||||
//lock bit masks
|
||||
enum
|
||||
{
|
||||
LB1 = (1 << 0),
|
||||
LB2 = (1 << 1),
|
||||
BLB01 = (1 << 2),
|
||||
BLB02 = (1 << 3),
|
||||
BLB11 = (1 << 4),
|
||||
BLB12 = (1 << 5),
|
||||
};
|
||||
|
||||
//extended fuses bit masks
|
||||
enum
|
||||
{
|
||||
BODLEVEL0 = (1 << 0),
|
||||
BODLEVEL1 = (1 << 1),
|
||||
BODLEVEL2 = (1 << 2),
|
||||
};
|
||||
|
||||
//high fuses bit masks
|
||||
enum
|
||||
{
|
||||
BOOTRST = (1 << 0),
|
||||
BOOTSZ0 = (1 << 1),
|
||||
BOOTSZ1 = (1 << 2),
|
||||
EESAVE = (1 << 3),
|
||||
WDTON = (1 << 4),
|
||||
SPIEN = (1 << 5),
|
||||
JTAGEN = (1 << 6),
|
||||
OCDEN = (1 << 7),
|
||||
};
|
||||
|
||||
//low fuses bit masks
|
||||
enum
|
||||
{
|
||||
CKSEL0 = (1 << 0),
|
||||
CKSEL1 = (1 << 1),
|
||||
CKSEL2 = (1 << 2),
|
||||
CKSEL3 = (1 << 3),
|
||||
SUT0 = (1 << 4),
|
||||
SUT1 = (1 << 5),
|
||||
CKOUT = (1 << 6),
|
||||
CKDIV8 = (1 << 7),
|
||||
};
|
||||
|
||||
#define AVR8_EECR_EERE 0x01
|
||||
|
||||
#define AVR8_EEARH_MASK 0x01
|
||||
|
@ -30,6 +30,8 @@ CPU_DISASSEMBLE( avr8 )
|
||||
UINT32 op = oprom[pos++];
|
||||
op |= oprom[pos++] << 8;
|
||||
UINT32 addr = 0;
|
||||
const char* register_names[0x40] = {"PINA", "DDRA", "PORTA", "PINB", "DDRB", "PORTB", "PINC", "DDRC", "PORTC", "PIND", "DDRD", "PORTD", "PINE", "DDRE", "PORTE", "PINF", "DDRF", "PORTF", "PING", "DDRG", "PORTG", "TIFR0", "TIFR1", "TIFR2","TIFR3", "TIFR4", "TIFR5", "PCIFR", "EIFR", "EIMSK", "GPIOR0", "EECR", "EEDR", "EEARL", "EEARH", "GTCCR", "TCCR0A", "TCCR0B", "TCNT0", "OCR0A", "OCR0B", "0x29", "GPIOR1", "GPIOR2", "SPCR", "SPSR", "SPDR", "0x2F", "ACSR", "OCDR", "0x32", "SMCR", "MCUSR", "MCUCR", "0x36", "SPMCSR", "0x38", "0x39", "0x3A", "RAMPZ", "EIND", "SPL", "SPH", "SREG"};
|
||||
|
||||
switch(op & 0xf000)
|
||||
{
|
||||
case 0x0000:
|
||||
@ -478,11 +480,19 @@ CPU_DISASSEMBLE( avr8 )
|
||||
case 0xb000:
|
||||
if(op & 0x0800)
|
||||
{
|
||||
output += sprintf( output, "OUT 0x%02x, R%d", ACONST6(op), RD5(op) );
|
||||
if (ACONST6(op) < 0x40 ) {
|
||||
output += sprintf( output, "OUT %s, R%d", register_names[ACONST6(op)], RD5(op) );
|
||||
} else {
|
||||
output += sprintf( output, "OUT 0x%02x, R%d", ACONST6(op), RD5(op) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
output += sprintf( output, "IN R%d, 0x%02x", RD5(op), ACONST6(op) );
|
||||
if (ACONST6(op) < 0x40 ) {
|
||||
output += sprintf( output, "IN R%d, %s", RD5(op), register_names[ACONST6(op)] );
|
||||
} else {
|
||||
output += sprintf( output, "IN R%d, 0x%02x", RD5(op), ACONST6(op) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0xc000:
|
||||
|
@ -106,11 +106,11 @@ WRITE8_MEMBER(craft_state::port_w)
|
||||
{
|
||||
switch( offset )
|
||||
{
|
||||
case 0x00: // Port A
|
||||
case AVR8_IO_PORTA: // Port A
|
||||
// Unhandled
|
||||
break;
|
||||
|
||||
case 0x01: // Port B
|
||||
case AVR8_IO_PORTB: // Port B
|
||||
{
|
||||
UINT8 old_port_b = m_port_b;
|
||||
UINT8 pins = data;
|
||||
@ -129,13 +129,13 @@ WRITE8_MEMBER(craft_state::port_w)
|
||||
break;
|
||||
}
|
||||
|
||||
case 0x02: // Port C
|
||||
case AVR8_IO_PORTC: // Port C
|
||||
video_update();
|
||||
m_port_c = data;
|
||||
m_latched_color = m_port_c;
|
||||
break;
|
||||
|
||||
case 0x03: // Port D
|
||||
case AVR8_IO_PORTD: // Port D
|
||||
{
|
||||
m_port_d = data;
|
||||
UINT8 audio_sample = (data & 0x02) | ((data & 0xf4) >> 2);
|
||||
@ -189,7 +189,7 @@ static ADDRESS_MAP_START( craft_data_map, AS_DATA, 8, craft_state )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( craft_io_map, AS_IO, 8, craft_state )
|
||||
AM_RANGE(0x00, 0x03) AM_READWRITE( port_r, port_w )
|
||||
AM_RANGE(AVR8_IO_PORTA, AVR8_IO_PORTD) AM_READWRITE( port_r, port_w )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/****************************************************\
|
||||
|
682
src/mess/drivers/replicator.c
Normal file
682
src/mess/drivers/replicator.c
Normal file
@ -0,0 +1,682 @@
|
||||
/*
|
||||
Replicator 1 desktop 3d printer
|
||||
|
||||
driver by Felipe Corrêa da Silva Sanches <fsanches@metamaquina.com.br>
|
||||
|
||||
Licensed under GPLv2 or later.
|
||||
|
||||
NOTE: Even though the MAME/MESS project has been adopting a non-commercial additional licensing clause, I do allow commercial usage of my portion of the code according to the plain terms of the GPL license (version 2 or later). This is useful if you happen to use my code in another project or in case the other MAME/MESS developers happen to drop the non-comercial clause completely. I suggest that other developers consider doing the same. --Felipe Sanches
|
||||
|
||||
Changelog:
|
||||
|
||||
2013 DEC 28 [Felipe Sanches]:
|
||||
* LCD now works. We can see the firmware boot screen :-)
|
||||
|
||||
2013 DEC 24 [Felipe Sanches]:
|
||||
* declaration of internal EEPROM
|
||||
|
||||
2013 DEC 18 [Felipe Sanches]:
|
||||
* Initial driver skeleton
|
||||
|
||||
*/
|
||||
|
||||
// TODO:
|
||||
// * figure out what's wrong with the keypad inputs (interface seems to be blocked in the first screen)
|
||||
// * fix avr8 timer/counter #4 so that we get the buzzer to work
|
||||
// * figure-out correct size of internal EEPROM
|
||||
// * emulate an SD Card
|
||||
// * implement avr8 WDR (watchdog reset) opcode
|
||||
|
||||
#define LOG_PORTS 0
|
||||
|
||||
//Port A bits:
|
||||
//Bit 0 unused
|
||||
//Bit 1 unused
|
||||
#define A_AXIS_DIR (1 << 2)
|
||||
#define A_AXIS_STEP (1 << 3)
|
||||
#define A_AXIS_EN (1 << 4)
|
||||
#define A_AXIS_POT (1 << 5)
|
||||
#define B_AXIS_DIR (1 << 6)
|
||||
#define B_AXIS_STEP (1 << 7)
|
||||
|
||||
//Port B bits:
|
||||
#define SD_CS (1 << 0)
|
||||
#define SCK_1280 (1 << 1)
|
||||
#define MOSI_1280 (1 << 2)
|
||||
#define MISO_1280 (1 << 3)
|
||||
#define EX2_PWR_CHECK (1 << 4)
|
||||
#define EX2_HEAT (1 << 5)
|
||||
#define EX2_FAN (1 << 6)
|
||||
#define BLINK (1 << 7)
|
||||
|
||||
//Port C bits:
|
||||
#define EX2_1280 (1 << 0)
|
||||
#define EX1_1280 (1 << 1)
|
||||
#define LCD_CLK (1 << 2)
|
||||
#define LCD_DATA (1 << 3)
|
||||
#define LCD_STROBE (1 << 4)
|
||||
#define RLED (1 << 5)
|
||||
#define GLED (1 << 6)
|
||||
#define DETECT (1 << 7)
|
||||
|
||||
//Port D bits:
|
||||
#define PORTD_SCL (1 << 0)
|
||||
#define PORTD_SDA (1 << 1)
|
||||
#define EX_RX_1280 (1 << 2)
|
||||
#define EX_TX_1280 (1 << 3)
|
||||
//Bit 4 unused
|
||||
//Bit 5 unused
|
||||
//Bit 6 unused
|
||||
//Bit 7 unused
|
||||
|
||||
//Port E bits:
|
||||
#define RX_1280 (1 << 0)
|
||||
#define TX_1280 (1 << 1)
|
||||
#define THERMO_SCK (1 << 2)
|
||||
#define THERMO_CS1 (1 << 3)
|
||||
#define THERMO_CS2 (1 << 4)
|
||||
#define THERMO_DO (1 << 5)
|
||||
//Bit 6 unused
|
||||
//Bit 7 unused
|
||||
|
||||
//Port F bits:
|
||||
#define X_AXIS_DIR (1 << 0)
|
||||
#define X_AXIS_STEP (1 << 1)
|
||||
#define X_AXIS_EN (1 << 2)
|
||||
#define X_AXIS_POT (1 << 3)
|
||||
#define Y_AXIS_DIR (1 << 4)
|
||||
#define Y_AXIS_STEP (1 << 5)
|
||||
#define Y_AXIS_EN (1 << 6)
|
||||
#define Y_AXIS_POT (1 << 7)
|
||||
|
||||
//Port G bits:
|
||||
#define EX4_1280 (1 << 0)
|
||||
#define EX3_1280 (1 << 1)
|
||||
#define B_AXIS_EN (1 << 2)
|
||||
//Bit 3 unused
|
||||
#define CUTOFF_SR_CHECK (1 << 4)
|
||||
#define BUZZ (1 << 5)
|
||||
//Bit 6 unused
|
||||
//Bit 7 unused
|
||||
|
||||
//Port H bits:
|
||||
#define CUTOFF_TEST (1 << 0)
|
||||
#define CUTOFF_RESET (1 << 1)
|
||||
#define EX1_PWR_CHECK (1 << 2)
|
||||
#define EX1_HEAT (1 << 3)
|
||||
#define EX1_FAN (1 << 4)
|
||||
#define SD_WP (1 << 5)
|
||||
#define SD_CD (1 << 6)
|
||||
//Bit 7 unused
|
||||
|
||||
//Port J bits:
|
||||
#define BUTTON_CENTER (1 << 0)
|
||||
#define BUTTON_RIGHT (1 << 1)
|
||||
#define BUTTON_LEFT (1 << 2)
|
||||
#define BUTTON_DOWN (1 << 3)
|
||||
#define BUTTON_UP (1 << 4)
|
||||
#define POTS_SCL (1 << 5)
|
||||
#define B_AXIS_POT (1 << 6)
|
||||
//Bit 7 unused
|
||||
|
||||
//Port K bits:
|
||||
#define Z_AXIS_DIR (1 << 0)
|
||||
#define Z_AXIS_STEP (1 << 1)
|
||||
#define Z_AXIS_EN (1 << 2)
|
||||
#define Z_AXIS_POT (1 << 3)
|
||||
#define EX7_1280 (1 << 4)
|
||||
#define EX6_1280 (1 << 5)
|
||||
#define EX5_1280 (1 << 6)
|
||||
#define HBP_THERM (1 << 7)
|
||||
|
||||
//Port L bits:
|
||||
#define X_MIN (1 << 0)
|
||||
#define X_MAX (1 << 1)
|
||||
#define Y_MIN (1 << 2)
|
||||
#define Y_MAX (1 << 3)
|
||||
#define HBP (1 << 4)
|
||||
#define EXTRA_FET (1 << 5)
|
||||
#define Z_MIN (1 << 6)
|
||||
#define Z_MAX (1 << 7)
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/avr8/avr8.h"
|
||||
#include "video/hd44780.h"
|
||||
#include "rendlay.h"
|
||||
#include "debugger.h"
|
||||
|
||||
#define MASTER_CLOCK 16000000
|
||||
|
||||
/****************************************************\
|
||||
* I/O devices *
|
||||
\****************************************************/
|
||||
|
||||
class replicator_state : public driver_device
|
||||
{
|
||||
public:
|
||||
replicator_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_lcdc(*this, "hd44780")
|
||||
{
|
||||
}
|
||||
|
||||
virtual void machine_start();
|
||||
|
||||
UINT8 m_port_a;
|
||||
UINT8 m_port_b;
|
||||
UINT8 m_port_c;
|
||||
UINT8 m_port_d;
|
||||
UINT8 m_port_e;
|
||||
UINT8 m_port_f;
|
||||
UINT8 m_port_g;
|
||||
UINT8 m_port_h;
|
||||
UINT8 m_port_j;
|
||||
UINT8 m_port_k;
|
||||
UINT8 m_port_l;
|
||||
|
||||
UINT8 shift_register_value;
|
||||
|
||||
required_device<avr8_device> m_maincpu;
|
||||
required_device<hd44780_device> m_lcdc;
|
||||
|
||||
DECLARE_READ8_MEMBER(port_r);
|
||||
DECLARE_WRITE8_MEMBER(port_w);
|
||||
DECLARE_DRIVER_INIT(replicator);
|
||||
virtual void machine_reset();
|
||||
virtual void palette_init();
|
||||
};
|
||||
|
||||
void replicator_state::machine_start()
|
||||
{
|
||||
}
|
||||
|
||||
READ8_MEMBER(replicator_state::port_r)
|
||||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
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.
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
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();
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(replicator_state::port_w)
|
||||
{
|
||||
switch( offset )
|
||||
{
|
||||
case AVR8_IO_PORTA:
|
||||
{
|
||||
if (data == m_port_a) break;
|
||||
|
||||
#if LOG_PORTS
|
||||
UINT8 old_port_a = m_port_a;
|
||||
UINT8 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 old_port_b = m_port_b;
|
||||
UINT8 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 old_port_c = m_port_c;
|
||||
UINT8 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
|
||||
bool RS = (shift_register_value >> 1) & 1;
|
||||
bool RW = (shift_register_value >> 2) & 1;
|
||||
bool enable = (shift_register_value >> 3) & 1;
|
||||
UINT8 lcd_data = shift_register_value & 0xF0;
|
||||
|
||||
if (enable && RW==0){
|
||||
if (RS==0){
|
||||
m_lcdc->control_write(space, 0, lcd_data);
|
||||
} else {
|
||||
m_lcdc->data_write(space, 0, lcd_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
m_port_c = data;
|
||||
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTD:
|
||||
{
|
||||
if (data == m_port_d) break;
|
||||
|
||||
#if LOG_PORTS
|
||||
UINT8 old_port_d = m_port_d;
|
||||
UINT8 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 old_port_e = m_port_e;
|
||||
UINT8 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 old_port_f = m_port_f;
|
||||
UINT8 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;
|
||||
|
||||
#if LOG_PORTS
|
||||
UINT8 old_port_g = m_port_g;
|
||||
UINT8 changed = data ^ old_port_g;
|
||||
|
||||
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
|
||||
|
||||
m_port_g = data;
|
||||
break;
|
||||
}
|
||||
case AVR8_IO_PORTH:
|
||||
{
|
||||
if (data == m_port_h) break;
|
||||
|
||||
#if LOG_PORTS
|
||||
UINT8 old_port_h = m_port_h;
|
||||
UINT8 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 old_port_j = m_port_j;
|
||||
UINT8 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 old_port_k = m_port_k;
|
||||
UINT8 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 old_port_l = m_port_l;
|
||||
UINT8 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************\
|
||||
* Address maps *
|
||||
\****************************************************/
|
||||
|
||||
static ADDRESS_MAP_START( replicator_prg_map, AS_PROGRAM, 8, replicator_state )
|
||||
AM_RANGE(0x0000, 0x1FFFF) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( replicator_data_map, AS_DATA, 8, replicator_state )
|
||||
AM_RANGE(0x0200, 0x21FF) AM_RAM /* ATMEGA1280 Internal SRAM */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( replicator_io_map, AS_IO, 8, replicator_state )
|
||||
AM_RANGE(AVR8_IO_PORTA, AVR8_IO_PORTL) AM_READWRITE( port_r, port_w )
|
||||
ADDRESS_MAP_END
|
||||
|
||||
/****************************************************\
|
||||
* Input ports *
|
||||
\****************************************************/
|
||||
|
||||
static INPUT_PORTS_START( replicator )
|
||||
PORT_START("keypad")
|
||||
PORT_BIT(0x00000001, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("CENTER") PORT_CODE(KEYCODE_M)
|
||||
PORT_BIT(0x00000002, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("RIGHT") PORT_CODE(KEYCODE_D)
|
||||
PORT_BIT(0x00000004, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("LEFT") PORT_CODE(KEYCODE_A)
|
||||
PORT_BIT(0x00000008, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("DOWN") PORT_CODE(KEYCODE_S)
|
||||
PORT_BIT(0x00000010, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("UP") PORT_CODE(KEYCODE_W)
|
||||
INPUT_PORTS_END
|
||||
|
||||
/****************************************************\
|
||||
* Machine definition *
|
||||
\****************************************************/
|
||||
|
||||
DRIVER_INIT_MEMBER(replicator_state, replicator)
|
||||
{
|
||||
}
|
||||
|
||||
void replicator_state::machine_reset()
|
||||
{
|
||||
shift_register_value = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
const avr8_config atmega1280_config =
|
||||
{
|
||||
"eeprom"
|
||||
};
|
||||
|
||||
void replicator_state::palette_init()
|
||||
{
|
||||
//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_color(machine(), 0, MAKE_RGB(0xCA, 0xE7, 0xEB));
|
||||
palette_set_color(machine(), 1, MAKE_RGB(0x78, 0xAB, 0xA8));
|
||||
}
|
||||
|
||||
static const gfx_layout hd44780_charlayout =
|
||||
{
|
||||
5, 8, /* 5 x 8 characters */
|
||||
256, /* 256 characters */
|
||||
1, /* 1 bits per pixel */
|
||||
{ 0 }, /* no bitplanes */
|
||||
{ 3, 4, 5, 6, 7},
|
||||
{ 0, 8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8},
|
||||
8*8 /* 8 bytes */
|
||||
};
|
||||
|
||||
static GFXDECODE_START( replicator )
|
||||
GFXDECODE_ENTRY( "hd44780:cgrom", 0x0000, hd44780_charlayout, 0, 1 )
|
||||
GFXDECODE_END
|
||||
|
||||
static MACHINE_CONFIG_START( replicator, replicator_state )
|
||||
|
||||
MCFG_CPU_ADD("maincpu", ATMEGA1280, MASTER_CLOCK)
|
||||
MCFG_CPU_AVR8_CONFIG(atmega1280_config)
|
||||
MCFG_CPU_PROGRAM_MAP(replicator_prg_map)
|
||||
MCFG_CPU_DATA_MAP(replicator_data_map)
|
||||
MCFG_CPU_IO_MAP(replicator_io_map)
|
||||
|
||||
MCFG_CPU_AVR8_LFUSE(0xFF)
|
||||
MCFG_CPU_AVR8_HFUSE(0xDA)
|
||||
MCFG_CPU_AVR8_EFUSE(0xF4)
|
||||
MCFG_CPU_AVR8_LOCK(0x0F)
|
||||
|
||||
/*TODO: Add an ATMEGA8U2 for USB-Serial communications */
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", LCD)
|
||||
MCFG_SCREEN_REFRESH_RATE(50)
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
|
||||
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
|
||||
MCFG_SCREEN_SIZE(120, 18*2) //4x20 chars
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18*2-1)
|
||||
|
||||
MCFG_PALETTE_LENGTH(2)
|
||||
MCFG_GFXDECODE(replicator)
|
||||
MCFG_DEFAULT_LAYOUT(layout_lcd)
|
||||
|
||||
MCFG_HD44780_ADD("hd44780")
|
||||
MCFG_HD44780_LCD_SIZE(4, 20)
|
||||
|
||||
/*TODO:
|
||||
Add sound config:
|
||||
- A buzzer connected to the PG5 pin that is driven by Timer/Counter #4
|
||||
*/
|
||||
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
ROM_START( replica1 )
|
||||
ROM_REGION( 0x20000, "maincpu", 0 ) /* Main program store */
|
||||
ROM_LOAD( "mighty_one_v7.5.0.bin", 0x0000, 0x1EF9A, CRC(0d36d9e7) SHA1(a53899775b4c4eea87b6903758ebb75f06710a69) ) /*Sailfish firmware image - Metamaquian build v7.5 */
|
||||
ROM_LOAD( "atmegaboot_168_atmega1280.bin", 0x1F000, 0x0F16, CRC(c041f8db) SHA1(d995ebf360a264cccacec65f6dc0c2257a3a9224) ) /*Arduino MEGA bootloader*/
|
||||
|
||||
ROM_REGION( 0x1000, "eeprom", ROMREGION_ERASEFF ) /* on-die 4kbyte eeprom */
|
||||
//ROM_LOAD( "eeprom.raw", 0x0000, 0x1000, CRC(c71c0011) SHA1(1ceaf73df40e531df3bfb26b4fb7cd95fb7bff1d) ) /* blank EEPROM data */
|
||||
ROM_END
|
||||
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */
|
||||
CONS(2012, replica1, 0, 0, replicator, replicator, replicator_state, replicator, "Makerbot", "Replicator 1 desktop 3d printer", GAME_NOT_WORKING|GAME_NO_SOUND)
|
@ -309,6 +309,9 @@ wofch // CPS Changer (Tenchi Wo Kurau II)
|
||||
odyssey2 // Magnavox Odyssey 2 - 1978-1983
|
||||
odyssey3 // Magnavox Odyssey 3 / Command Center (prototype)
|
||||
|
||||
// Makerbot
|
||||
replica1 // Makerbot Replicator 1 desktop 3d printer
|
||||
|
||||
// Hartung, Watara, ...
|
||||
gmaster // Hartung Gamemaster
|
||||
|
||||
|
@ -598,6 +598,7 @@ DRVLIBS += \
|
||||
$(MESSOBJ)/kyocera.a \
|
||||
$(MESSOBJ)/luxor.a \
|
||||
$(MESSOBJ)/magnavox.a \
|
||||
$(MESSOBJ)/makerbot.a \
|
||||
$(MESSOBJ)/matsushi.a \
|
||||
$(MESSOBJ)/mattel.a \
|
||||
$(MESSOBJ)/mb.a \
|
||||
@ -1398,6 +1399,9 @@ $(MESSOBJ)/luxor.a: \
|
||||
$(MESSOBJ)/magnavox.a: \
|
||||
$(MESS_DRIVERS)/odyssey2.o \
|
||||
|
||||
$(MESSOBJ)/makerbot.a: \
|
||||
$(MESS_DRIVERS)/replicator.o \
|
||||
|
||||
$(MESSOBJ)/mattel.a: \
|
||||
$(MESS_DRIVERS)/aquarius.o \
|
||||
$(MESS_VIDEO)/aquarius.o \
|
||||
|
@ -399,6 +399,9 @@
|
||||
@magnavox
|
||||
/mess/drivers/odyssey2
|
||||
|
||||
@makerbot
|
||||
/mess/drivers/replicator
|
||||
|
||||
@mattel
|
||||
/mess/drivers/aquarius
|
||||
/mess/drivers/juicebox
|
||||
|
Loading…
Reference in New Issue
Block a user