2 Skelton for retropc emulator
5 Author : Takeda.Toshiya
16 /* ----------------------------------------------------------------------------
18 ---------------------------------------------------------------------------- */
24 /*****************************************************************************/
25 /* src/emu/devcpu.h */
27 // CPU interface functions
28 #define READ8_HANDLER(name) UINT8 name(h6280_Regs *cpustate, offs_t offset)
29 #define WRITE8_HANDLER(name) void name(h6280_Regs *cpustate, offs_t offset, UINT8 data)
31 #include "mame/emu/cpu/h6280/h6280.h"
32 //#include "mame/emu/cpu/h6280/h6280.c"
34 //#include "mame/emu/cpu/h6280/6280dasm.c"
38 void HUC6280::initialize()
40 HUC6280_BASE::initialize();
43 h6280_Regs *cpustate = (h6280_Regs *)opaque;
45 cpustate->debugger = d_debugger;
46 cpustate->program_stored = d_mem;
47 cpustate->io_stored = d_io;
49 d_debugger->set_context_mem(d_mem);
50 d_debugger->set_context_io(d_io);
54 void HUC6280::release()
61 HUC6280_BASE::reset();
63 h6280_Regs *cpustate = (h6280_Regs *)opaque;
65 cpustate->debugger = d_debugger;
66 cpustate->program_stored = d_mem;
67 cpustate->io_stored = d_io;
71 int HUC6280::run(int clock)
73 h6280_Regs *cpustate = (h6280_Regs *)opaque;
80 // run only one opcode
82 return exec_call_debug();
89 int first_icount = icount;
91 // run cpu while given clocks
92 while(icount > 0 && !busreq) {
94 icount -= exec_call_debug();
96 icount -= exec_call();
99 // if busreq is raised, spin cpu while remained clock
100 if(icount > 0 && busreq) {
103 return first_icount - icount;
107 #define STATE_VERSION 4
109 void HUC6280::save_state(FILEIO* state_fio)
111 state_fio->FputUint32(STATE_VERSION);
112 state_fio->FputInt32(this_device_id);
114 //state_fio->Fwrite(opaque, sizeof(h6280_Regs), 1);
115 save_state_registers(state_fio);
116 state_fio->FputInt32(icount);
117 state_fio->FputBool(busreq);
120 bool HUC6280::load_state(FILEIO* state_fio)
122 if(state_fio->FgetUint32() != STATE_VERSION) {
125 if(state_fio->FgetInt32() != this_device_id) {
128 //state_fio->Fread(opaque, sizeof(h6280_Regs), 1);
129 load_state_registers(state_fio);
130 icount = state_fio->FgetInt32();
131 busreq = state_fio->FgetBool();
134 h6280_Regs *cpustate = (h6280_Regs *)opaque;
135 cpustate->program = d_mem;
139 cpustate->debugger = d_debugger;
140 cpustate->program_stored = d_mem;
141 cpustate->io_stored = d_io;