trunk/src/emu/cpu/hmcs40/hmcs40.c
| r244805 | r244806 | |
| 31 | 31 | // MCU types |
| 32 | 32 | |
| 33 | 33 | // HMCS42/C/CL |
| 34 | | //const device_type HD38702 = &device_creator<hd38702_device>; // PMOS, 28 pins, 22 I/O lines, (512+32)x10 ROM, 32x4 RAM |
| 34 | //const device_type HD38702 = &device_creator<hd38702_device>; // PMOS, 28 pins, 22 I/O lines, (512+32)x10 ROM, 32x4 RAM, no B or SPY register |
| 35 | 35 | //const device_type HD44700 = &device_creator<hd44700_device>; // CMOS version |
| 36 | 36 | //const device_type HD44708 = &device_creator<hd44708_device>; // CMOS version, low-power |
| 37 | 37 | |
| r244805 | r244806 | |
| 65 | 65 | |
| 66 | 66 | // internal memory maps |
| 67 | 67 | static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 16, hmcs40_cpu_device) |
| 68 | | AM_RANGE(0x0000, 0x07ff) AM_ROM |
| 69 | | AM_RANGE(0x0800, 0x007f) AM_ROM |
| 68 | AM_RANGE(0x0000, 0x03ff) AM_ROM |
| 69 | AM_RANGE(0x0400, 0x043f) AM_ROM |
| 70 | 70 | ADDRESS_MAP_END |
| 71 | 71 | |
| 72 | 72 | static ADDRESS_MAP_START(program_2k, AS_PROGRAM, 16, hmcs40_cpu_device) |
| 73 | | AM_RANGE(0x0000, 0x0fff) AM_ROM |
| 74 | | AM_RANGE(0x1000, 0x10ff) AM_ROM |
| 73 | AM_RANGE(0x0000, 0x07ff) AM_ROM |
| 74 | AM_RANGE(0x0800, 0x087f) AM_ROM |
| 75 | 75 | ADDRESS_MAP_END |
| 76 | 76 | |
| 77 | 77 | |
| r244805 | r244806 | |
| 89 | 89 | |
| 90 | 90 | // device definitions |
| 91 | 91 | hmcs43_cpu_device::hmcs43_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname) |
| 92 | | : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS43, is_cmos, 3, 12, ADDRESS_MAP_NAME(program_1k), 7, ADDRESS_MAP_NAME(data_80x4), shortname, __FILE__) |
| 92 | : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS43, is_cmos, 3, 10, 11, ADDRESS_MAP_NAME(program_1k), 7, ADDRESS_MAP_NAME(data_80x4), shortname, __FILE__) |
| 93 | 93 | { } |
| 94 | 94 | |
| 95 | 95 | hd38750_device::hd38750_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r244805 | r244806 | |
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | hmcs44_cpu_device::hmcs44_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname) |
| 101 | | : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS44, is_cmos, 4, 13, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), shortname, __FILE__) |
| 101 | : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS44, is_cmos, 4, 11, 12, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), shortname, __FILE__) |
| 102 | 102 | { } |
| 103 | 103 | |
| 104 | 104 | hd38800_device::hd38800_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r244805 | r244806 | |
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | hmcs45_cpu_device::hmcs45_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, bool is_cmos, const char *shortname) |
| 110 | | : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS45, is_cmos, 4, 13, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), shortname, __FILE__) |
| 110 | : hmcs40_cpu_device(mconfig, type, name, tag, owner, clock, FAMILY_HMCS45, is_cmos, 4, 11, 12, ADDRESS_MAP_NAME(program_2k), 8, ADDRESS_MAP_NAME(data_160x4), shortname, __FILE__) |
| 111 | 111 | { } |
| 112 | 112 | |
| 113 | 113 | hd38820_device::hd38820_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r244805 | r244806 | |
| 127 | 127 | ); |
| 128 | 128 | break; |
| 129 | 129 | |
| 130 | | case STATE_GENPC: |
| 131 | | string.printf("%04X", m_pc << 1); |
| 132 | | break; |
| 133 | | |
| 134 | 130 | default: break; |
| 135 | 131 | } |
| 136 | 132 | } |
| r244805 | r244806 | |
| 159 | 155 | m_data = &space(AS_DATA); |
| 160 | 156 | m_prgmask = (1 << m_prgwidth) - 1; |
| 161 | 157 | m_datamask = (1 << m_datawidth) - 1; |
| 158 | m_pcmask = (1 << m_pcwidth) - 1; |
| 162 | 159 | |
| 163 | 160 | UINT8 defval = (m_is_cmos) ? 0xf : 0; |
| 164 | 161 | m_read_r0.resolve_safe(defval); |
| r244805 | r244806 | |
| 241 | 238 | |
| 242 | 239 | void hmcs40_cpu_device::device_reset() |
| 243 | 240 | { |
| 244 | | m_pc = m_prgmask; |
| 241 | m_pc = m_pcmask; |
| 245 | 242 | m_prev_op = m_op = 0; |
| 246 | 243 | |
| 247 | 244 | // clear i/o |
| r244805 | r244806 | |
| 282 | 279 | |
| 283 | 280 | // LPU is handled 1 cycle later |
| 284 | 281 | if ((m_prev_op & 0x3e0) == 0x340) |
| 285 | | m_pc = ((m_page << 6) | (m_pc & 0x3f)) & m_prgmask; |
| 282 | m_pc = ((m_page << 6) | (m_pc & 0x3f)) & m_pcmask; |
| 286 | 283 | |
| 287 | 284 | // remember previous state |
| 288 | 285 | m_prev_op = m_op; |
| 289 | 286 | m_prev_pc = m_pc; |
| 290 | 287 | |
| 291 | 288 | // fetch next opcode |
| 292 | | debugger_instruction_hook(this, m_pc << 1); |
| 293 | | m_op = m_program->read_word(m_pc << 1); |
| 289 | debugger_instruction_hook(this, m_pc); |
| 290 | m_op = m_program->read_word(m_pc << 1) & 0x3ff; |
| 294 | 291 | increment_pc(); |
| 295 | 292 | } |
| 296 | 293 | } |
trunk/src/emu/cpu/hmcs40/hmcs40.h
| r244805 | r244806 | |
| 32 | 32 | { |
| 33 | 33 | public: |
| 34 | 34 | // construction/destruction |
| 35 | | hmcs40_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int family, bool is_cmos, int stack_levels, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) |
| 35 | hmcs40_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, int family, bool is_cmos, int stack_levels, int pcwidth, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) |
| 36 | 36 | : cpu_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 37 | | , m_program_config("program", ENDIANNESS_LITTLE, 16, prgwidth, 0, program) |
| 37 | , m_program_config("program", ENDIANNESS_LITTLE, 16, prgwidth, -1, program) |
| 38 | 38 | , m_data_config("data", ENDIANNESS_LITTLE, 8, datawidth, 0, data) |
| 39 | | , m_prgwidth(prgwidth-1) |
| 39 | , m_pcwidth(pcwidth) |
| 40 | , m_prgwidth(prgwidth) |
| 40 | 41 | , m_datawidth(datawidth) |
| 41 | 42 | , m_family(family) |
| 42 | 43 | , m_is_cmos(is_cmos) |
| r244805 | r244806 | |
| 94 | 95 | address_space *m_program; |
| 95 | 96 | address_space *m_data; |
| 96 | 97 | |
| 98 | int m_pcwidth; // Program Counter bit-width |
| 97 | 99 | int m_prgwidth; |
| 98 | 100 | int m_datawidth; |
| 101 | int m_pcmask; |
| 99 | 102 | int m_prgmask; |
| 100 | 103 | int m_datamask; |
| 101 | 104 | int m_family; // MCU family (42-47) |