2 Skelton for retropc emulator
\r
5 Author : Takeda.Toshiya
\r
11 #include "huc6280.h"
\r
12 #include "../fileio.h"
\r
14 /* ----------------------------------------------------------------------------
\r
16 ---------------------------------------------------------------------------- */
\r
18 #define INLINE inline
\r
20 #define offs_t UINT16
\r
24 CLEAR_LINE = 0, // clear (a fired or held) line
\r
25 ASSERT_LINE, // assert an interrupt immediately
\r
26 HOLD_LINE, // hold interrupt line until acknowledged
\r
27 PULSE_LINE // pulse interrupt line instantaneously (only for NMI, RESET)
\r
32 INPUT_LINE_IRQ1 = 0,
\r
33 INPUT_LINE_IRQ2 = 1,
\r
34 INPUT_LINE_TIRQ = 2,
\r
38 #define CPU_INIT_NAME(name) cpu_init_##name
\r
39 #define CPU_INIT(name) void* CPU_INIT_NAME(name)()
\r
40 #define CPU_INIT_CALL(name) CPU_INIT_NAME(name)()
\r
42 #define CPU_RESET_NAME(name) cpu_reset_##name
\r
43 #define CPU_RESET(name) void CPU_RESET_NAME(name)(h6280_Regs *cpustate)
\r
44 #define CPU_RESET_CALL(name) CPU_RESET_NAME(name)(cpustate)
\r
46 #define CPU_EXECUTE_NAME(name) cpu_execute_##name
\r
47 #define CPU_EXECUTE(name) int CPU_EXECUTE_NAME(name)(h6280_Regs *cpustate, int ICount)
\r
48 #define CPU_EXECUTE_CALL(name) CPU_EXECUTE_NAME(name)(cpustate, icount)
\r
50 #define READ8_HANDLER(name) UINT8 name(h6280_Regs *cpustate, offs_t offset)
\r
51 #define WRITE8_HANDLER(name) void name(h6280_Regs *cpustate, offs_t offset, UINT8 data)
\r
53 #define logerror(...)
\r
55 #include "mame/emu/cpu/h6280/h6280.c"
\r
59 void HUC6280::initialize()
\r
61 opaque = CPU_INIT_CALL(h6280);
\r
63 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
64 cpustate->program = d_mem;
\r
65 cpustate->io = d_io;
\r
68 void HUC6280::release()
\r
73 void HUC6280::reset()
\r
75 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
77 CPU_RESET_CALL(h6280);
\r
79 cpustate->program = d_mem;
\r
80 cpustate->io = d_io;
\r
83 int HUC6280::run(int icount)
\r
85 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
86 return CPU_EXECUTE_CALL(h6280);
\r
89 void HUC6280::write_signal(int id, uint32 data, uint32 mask)
\r
91 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
92 set_irq_line(cpustate, id, data);
\r
95 uint32 HUC6280::get_pc()
\r
97 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
98 return cpustate->ppc.w.l;
\r
101 uint8 HUC6280::irq_status_r(uint16 offset)
\r
103 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
104 return h6280_irq_status_r(cpustate, offset);
\r
107 void HUC6280::irq_status_w(uint16 offset, uint8 data)
\r
109 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
110 h6280_irq_status_w(cpustate, offset, data);
\r
113 uint8 HUC6280::timer_r(uint16 offset)
\r
115 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
116 return h6280_timer_r(cpustate, offset);
\r
119 void HUC6280::timer_w(uint16 offset, uint8 data)
\r
121 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
122 h6280_timer_w(cpustate, offset, data);
\r
125 #define STATE_VERSION 1
\r
127 void HUC6280::save_state(FILEIO* state_fio)
\r
129 state_fio->FputUint32(STATE_VERSION);
\r
130 state_fio->FputInt32(this_device_id);
\r
132 state_fio->Fwrite(opaque, sizeof(h6280_Regs), 1);
\r
136 bool HUC6280::load_state(FILEIO* state_fio)
\r
138 if(state_fio->FgetUint32() != STATE_VERSION) {
\r
141 if(state_fio->FgetInt32() != this_device_id) {
\r
144 state_fio->Fread(opaque, sizeof(h6280_Regs), 1);
\r
146 h6280_Regs *cpustate = (h6280_Regs *)opaque;
\r
147 cpustate->program = d_mem;
\r
148 cpustate->io = d_io;
\r