trunk/src/emu/cpu/arcompact/arcompact.c
| r0 | r242159 | |
| 1 | /*********************************\ |
| 2 | |
| 3 | ARCompact Core |
| 4 | |
| 5 | The following procesors use the ARCompact instruction set |
| 6 | |
| 7 | - ARCtangent-A5 |
| 8 | - ARC 600 |
| 9 | - ARC 700 |
| 10 | |
| 11 | (this is a skeleton core) |
| 12 | |
| 13 | ARCompact is a 32-bit CPU that freely mixes 32-bit and 16-bit instructions |
| 14 | various user customizations could be made as with the ARC A4 based processors |
| 15 | these include custom instructions and registers. |
| 16 | |
| 17 | \*********************************/ |
| 18 | |
| 19 | #include "emu.h" |
| 20 | #include "debugger.h" |
| 21 | #include "arcompact.h" |
| 22 | |
| 23 | |
| 24 | const device_type ARCA5 = &device_creator<arcompact_device>; |
| 25 | |
| 26 | |
| 27 | arcompact_device::arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 28 | : cpu_device(mconfig, ARCA5, "ARCtangent-A5", tag, owner, clock, "arca5", __FILE__) |
| 29 | , m_program_config("program", ENDIANNESS_BIG, 32, 24, 0) // some docs describe these as 'middle endian'?! |
| 30 | { |
| 31 | } |
| 32 | |
| 33 | |
| 34 | offs_t arcompact_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options) |
| 35 | { |
| 36 | extern CPU_DISASSEMBLE( arcompact ); |
| 37 | return CPU_DISASSEMBLE_NAME(arcompact)(this, buffer, pc, oprom, opram, options); |
| 38 | } |
| 39 | |
| 40 | |
| 41 | /*****************************************************************************/ |
| 42 | |
| 43 | /*****************************************************************************/ |
| 44 | |
| 45 | void arcompact_device::unimplemented_opcode(UINT16 op) |
| 46 | { |
| 47 | fatalerror("ARCOMPACT: unknown opcode %04x at %04x\n", op, m_pc << 2); |
| 48 | } |
| 49 | |
| 50 | /*****************************************************************************/ |
| 51 | |
| 52 | UINT16 arcompact_device::READ32(UINT32 address) |
| 53 | { |
| 54 | return m_program->read_dword(address << 2); |
| 55 | } |
| 56 | |
| 57 | void arcompact_device::WRITE32(UINT32 address, UINT32 data) |
| 58 | { |
| 59 | m_program->write_dword(address << 2, data); |
| 60 | } |
| 61 | |
| 62 | /*****************************************************************************/ |
| 63 | |
| 64 | void arcompact_device::device_start() |
| 65 | { |
| 66 | m_pc = 0; |
| 67 | |
| 68 | m_debugger_temp = 0; |
| 69 | |
| 70 | m_program = &space(AS_PROGRAM); |
| 71 | |
| 72 | state_add( 0, "PC", m_debugger_temp).callimport().callexport().formatstr("%08X"); |
| 73 | state_add(STATE_GENPC, "GENPC", m_debugger_temp).callexport().noshow(); |
| 74 | |
| 75 | m_icountptr = &m_icount; |
| 76 | } |
| 77 | |
| 78 | void arcompact_device::state_export(const device_state_entry &entry) |
| 79 | { |
| 80 | switch (entry.index()) |
| 81 | { |
| 82 | case 0: |
| 83 | m_debugger_temp = m_pc << 2; |
| 84 | break; |
| 85 | |
| 86 | case STATE_GENPC: |
| 87 | m_debugger_temp = m_pc << 2; |
| 88 | break; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | void arcompact_device::state_import(const device_state_entry &entry) |
| 93 | { |
| 94 | switch (entry.index()) |
| 95 | { |
| 96 | case 0: |
| 97 | m_pc = (m_debugger_temp & 0xfffffffc) >> 2; |
| 98 | break; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | void arcompact_device::device_reset() |
| 103 | { |
| 104 | m_pc = 0x00000000; |
| 105 | } |
| 106 | |
| 107 | /*****************************************************************************/ |
| 108 | |
| 109 | void arcompact_device::execute_set_input(int irqline, int state) |
| 110 | { |
| 111 | |
| 112 | } |
| 113 | |
| 114 | |
| 115 | void arcompact_device::execute_run() |
| 116 | { |
| 117 | //UINT32 lres; |
| 118 | //lres = 0; |
| 119 | |
| 120 | while (m_icount > 0) |
| 121 | { |
| 122 | debugger_instruction_hook(this, m_pc<<2); |
| 123 | |
| 124 | //UINT32 op = READ32(m_pc); |
| 125 | |
| 126 | m_pc++; |
| 127 | |
| 128 | m_icount--; |
| 129 | } |
| 130 | |
| 131 | } |
trunk/src/emu/cpu/arcompact/arcompact.h
| r0 | r242159 | |
| 1 | /*********************************\ |
| 2 | |
| 3 | ARCompact Core |
| 4 | |
| 5 | \*********************************/ |
| 6 | |
| 7 | #pragma once |
| 8 | |
| 9 | #ifndef __ARCOMPACT_H__ |
| 10 | #define __ARCOMPACT_H__ |
| 11 | |
| 12 | class arcompact_device : public cpu_device |
| 13 | { |
| 14 | public: |
| 15 | // construction/destruction |
| 16 | arcompact_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 17 | |
| 18 | protected: |
| 19 | // device-level overrides |
| 20 | virtual void device_start(); |
| 21 | virtual void device_reset(); |
| 22 | |
| 23 | // device_execute_interface overrides |
| 24 | virtual UINT32 execute_min_cycles() const { return 5; } |
| 25 | virtual UINT32 execute_max_cycles() const { return 5; } |
| 26 | virtual UINT32 execute_input_lines() const { return 0; } |
| 27 | virtual void execute_run(); |
| 28 | virtual void execute_set_input(int inputnum, int state); |
| 29 | |
| 30 | // device_memory_interface overrides |
| 31 | virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const { return (spacenum == AS_PROGRAM) ? &m_program_config : NULL; } |
| 32 | |
| 33 | // device_state_interface overrides |
| 34 | virtual void state_import(const device_state_entry &entry); |
| 35 | virtual void state_export(const device_state_entry &entry); |
| 36 | |
| 37 | // device_disasm_interface overrides |
| 38 | virtual UINT32 disasm_min_opcode_bytes() const { return 2; } |
| 39 | virtual UINT32 disasm_max_opcode_bytes() const { return 4; } |
| 40 | virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options); |
| 41 | |
| 42 | private: |
| 43 | address_space_config m_program_config; |
| 44 | |
| 45 | UINT32 m_pc; |
| 46 | |
| 47 | address_space *m_program; |
| 48 | int m_icount; |
| 49 | |
| 50 | UINT32 m_debugger_temp; |
| 51 | |
| 52 | void unimplemented_opcode(UINT16 op); |
| 53 | inline UINT16 READ32(UINT32 address); |
| 54 | inline void WRITE32(UINT32 address, UINT32 data); |
| 55 | }; |
| 56 | |
| 57 | |
| 58 | extern const device_type ARCA5; |
| 59 | |
| 60 | |
| 61 | #endif /* __ARCOMPACT_H__ */ |
trunk/src/emu/cpu/arcompact/arcompactdasm.c
| r0 | r242159 | |
| 1 | /*********************************\ |
| 2 | |
| 3 | ARCompact disassembler |
| 4 | |
| 5 | \*********************************/ |
| 6 | |
| 7 | #include "emu.h" |
| 8 | #include <stdarg.h> |
| 9 | |
| 10 | static char *output; |
| 11 | |
| 12 | static void ATTR_PRINTF(1,2) print(const char *fmt, ...) |
| 13 | { |
| 14 | va_list vl; |
| 15 | |
| 16 | va_start(vl, fmt); |
| 17 | vsprintf(output, fmt, vl); |
| 18 | va_end(vl); |
| 19 | } |
| 20 | |
| 21 | /*****************************************************************************/ |
| 22 | |
| 23 | |
| 24 | |
| 25 | /*****************************************************************************/ |
| 26 | |
| 27 | |
| 28 | |
| 29 | CPU_DISASSEMBLE(arcompact) |
| 30 | { |
| 31 | UINT32 op = oprom[0] | (oprom[1] << 8) | (oprom[2] << 16) | (oprom[3] << 24); |
| 32 | op = BIG_ENDIANIZE_INT32(op); |
| 33 | |
| 34 | output = buffer; |
| 35 | |
| 36 | print("<undefined>"); |
| 37 | |
| 38 | return 4 | DASMFLAG_SUPPORTED; |
| 39 | } |
trunk/src/emu/cpu/cpu.mak
| r242158 | r242159 | |
| 94 | 94 | $(CPUSRC)/arc/arc.h |
| 95 | 95 | |
| 96 | 96 | #------------------------------------------------- |
| 97 | # ARcompact (ARCtangent-A5, ARC 600, ARC 700) |
| 98 | #@src/emu/cpu/arc/arc.h,CPUS += ARCOMPACT |
| 99 | #------------------------------------------------- |
| 100 | |
| 101 | ifneq ($(filter ARCOMPACT,$(CPUS)),) |
| 102 | OBJDIRS += $(CPUOBJ)/arcompact |
| 103 | CPUOBJS += $(CPUOBJ)/arcompact/arcompact.o |
| 104 | DASMOBJS += $(CPUOBJ)/arcompact/arcompactdasm.o |
| 105 | endif |
| 106 | |
| 107 | $(CPUOBJ)/arcompact/arcompact.o: $(CPUSRC)/arcompact/arcompact.c \ |
| 108 | $(CPUSRC)/arcompact/arcompact.h |
| 109 | |
| 110 | #------------------------------------------------- |
| 97 | 111 | # Acorn ARM series |
| 98 | 112 | # |
| 99 | 113 | #@src/emu/cpu/arm/arm.h,CPUS += ARM |
trunk/src/mess/drivers/leapster.c
| r242158 | r242159 | |
| 207 | 207 | #include "emu.h" |
| 208 | 208 | #include "bus/generic/slot.h" |
| 209 | 209 | #include "bus/generic/carts.h" |
| 210 | | #include "cpu/arc/arc.h" |
| 210 | #include "cpu/arcompact/arcompact.h" |
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | class leapster_state : public driver_device |
| r242158 | r242159 | |
| 270 | 270 | |
| 271 | 271 | static MACHINE_CONFIG_START( leapster, leapster_state ) |
| 272 | 272 | /* basic machine hardware */ |
| 273 | | // CPU is ArcTangent A5 |
| 274 | | MCFG_CPU_ADD("maincpu", ARC, 96000000/10) |
| 273 | // CPU is ArcTangent-A5 '5.1' (ARCompact core) |
| 274 | MCFG_CPU_ADD("maincpu", ARCA5, 96000000/10) |
| 275 | 275 | MCFG_CPU_PROGRAM_MAP(leapster_map) |
| 276 | 276 | |
| 277 | 277 | |