static WRITE8_HANDLER(testcs_w) { if(offset<0x800) { cpuintrf_push_context(1); program_write_byte(offset | (v30_gnd_addr << 16), data); cpuintrf_pop_context(); cpuintrf_push_context(2); program_write_byte(offset | (v30_obj_addr << 16), data); cpuintrf_pop_context(); } }
void cpunum_set_reg(int cpunum, int regnum, unsigned val) { VERIFY_CPUNUM_VOID(cpunum_set_reg); cpuintrf_push_context(cpunum); (*cpu[cpunum].intf.set_reg)(regnum, val); cpuintrf_pop_context(); }
void cpunum_set_op_base(int cpunum, unsigned val) { VERIFY_CPUNUM_VOID(cpunum_set_op_base); cpuintrf_push_context(cpunum); (*cpu[cpunum].intf.set_op_base)(val); cpuintrf_pop_context(); }
void cpunum_write_byte(int cpunum, offs_t address, UINT8 data) { VERIFY_CPUNUM(cpunum_write_byte); cpuintrf_push_context(cpunum); program_write_byte(address, data); cpuintrf_pop_context(); }
void cpunum_set_opbase(int cpunum, unsigned val) { VERIFY_CPUNUM(cpunum_set_opbase); cpuintrf_push_context(cpunum); memory_set_opbase(val); cpuintrf_pop_context(); }
void cpunum_write_byte(int cpunum, offs_t address, data8_t data) { VERIFY_CPUNUM_VOID(cpunum_write_byte); cpuintrf_push_context(cpunum); (*cpu[cpunum].intf.memory_write)(address, data); cpuintrf_pop_context(); }
void cpunum_set_cycle_tbl(int cpunum, int which, void *new_table) { VERIFY_CPUNUM_VOID(cpunum_set_cycle_tbl); cpuintrf_push_context(cpunum); (*cpu[cpunum].intf.set_cycle_table)(which, new_table); cpuintrf_pop_context(); }
static void cpu_vblankcallback(int param) { int cpunum; if (vblank_countdown == 1) vblank = 1; /* loop over CPUs */ for (cpunum = 0; cpunum < cpu_gettotalcpu(); cpunum++) { /* if the interrupt multiplier is valid */ if (cpu[cpunum].vblankint_multiplier != -1) { /* decrement; if we hit zero, generate the interrupt and reset the countdown */ if (!--cpu[cpunum].vblankint_countdown) { /* a param of -1 means don't call any callbacks */ if (param != -1) { /* if the CPU has a VBLANK handler, call it */ if (Machine->drv->cpu[cpunum].vblank_interrupt && cpu_getstatus(cpunum)) { cpuintrf_push_context(cpunum); (*Machine->drv->cpu[cpunum].vblank_interrupt)(); cpuintrf_pop_context(); } /* update the counters */ cpu[cpunum].iloops--; } /* reset the countdown and timer */ cpu[cpunum].vblankint_countdown = cpu[cpunum].vblankint_multiplier; timer_adjust(cpu[cpunum].vblankint_timer, TIME_NEVER, 0, 0); } } /* else reset the VBLANK timer if this is going to be a real VBLANK */ else if (vblank_countdown == 1) timer_adjust(cpu[cpunum].vblankint_timer, TIME_NEVER, 0, 0); } /* is it a real VBLANK? */ if (!--vblank_countdown) { /* do we update the screen now? */ if (!(Machine->drv->video_attributes & VIDEO_UPDATE_AFTER_VBLANK)) time_to_quit = updatescreen(); /* Set the timer to update the screen */ timer_set(TIME_IN_USEC(Machine->drv->vblank_duration), 0, cpu_updatecallback); /* reset the globals */ cpu_vblankreset(); /* reset the counter */ vblank_countdown = vblank_multiplier; } }
static READ8_HANDLER(main_obj_r) { UINT8 result; cpuintrf_push_context(2); result = program_read_byte(offset | (v30_obj_addr << 16)); cpuintrf_pop_context(); return result; }
void cpunum_reset(int cpunum) { VERIFY_CPUNUM(cpunum_reset); cpuintrf_push_context(cpunum); memory_set_opbase(0); (*cpu[cpunum].intf.reset)(); cpuintrf_pop_context(); }
data8_t cpunum_read_byte(int cpunum, offs_t address) { int result; VERIFY_CPUNUM(0, cpunum_read_byte); cpuintrf_push_context(cpunum); result = (*cpu[cpunum].intf.memory_read)(address); cpuintrf_pop_context(); return result; }
unsigned cpunum_dasm(int cpunum, char *buffer, unsigned pc) { unsigned result; VERIFY_CPUNUM(1, cpunum_dasm); cpuintrf_push_context(cpunum); result = internal_dasm(cpunum, buffer, pc); cpuintrf_pop_context(); return result; }
offs_t cpunum_dasm(int cpunum, char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram) { unsigned result; VERIFY_CPUNUM(cpunum_dasm); cpuintrf_push_context(cpunum); result = activecpu_dasm(buffer, pc, oprom, opram); cpuintrf_pop_context(); return result; }
const char *cpunum_dump_reg(int cpunum, int regnum) { const char *result; VERIFY_CPUNUM("", cpunum_dump_reg); cpuintrf_push_context(cpunum); result = (*cpu[cpunum].intf.cpu_info)(NULL, CPU_INFO_REG + regnum); cpuintrf_pop_context(); return result; }
unsigned cpunum_dasm(int cpunum, char *buffer, unsigned pc) { unsigned result; VERIFY_CPUNUM(1, cpunum_dasm); cpuintrf_push_context(cpunum); result = (*cpu[cpunum].intf.cpu_dasm)(buffer, pc); cpuintrf_pop_context(); return result; }
void cpunum_set_info_ptr(int cpunum, UINT32 state, void *data) { union cpuinfo info; VERIFY_CPUNUM(cpunum_set_info_ptr); info.p = data; cpuintrf_push_context(cpunum); (*cpu[cpunum].intf.set_info)(state, &info); cpuintrf_pop_context(); }
UINT8 cpunum_read_byte(int cpunum, offs_t address) { int result; VERIFY_CPUNUM(cpunum_read_byte); cpuintrf_push_context(cpunum); result = program_read_byte(address); cpuintrf_pop_context(); return result; }
offs_t cpunum_dasm(int cpunum, char *buffer, unsigned pc) { unsigned result; VERIFY_CPUNUM(cpunum_dasm); cpuintrf_push_context(cpunum); result = activecpu_dasm(buffer, pc); cpuintrf_pop_context(); return result; }
void cpunum_set_info_fct(int cpunum, UINT32 state, genf *data) { cpuinfo info; VERIFY_CPUNUM(cpunum_set_info_ptr); info.f = data; cpuintrf_push_context(cpunum); (*cpu[cpunum].intf.set_info)(state, &info); cpuintrf_pop_context(); }
const char *cpunum_dump_state(int cpunum) { static char buffer[1024+1]; VERIFY_CPUNUM("", cpunum_dump_state); cpuintrf_push_context(cpunum); strcpy(buffer, activecpu_dump_state()); cpuintrf_pop_context(); return buffer; }
void cpunum_set_info_int(int cpunum, UINT32 state, INT64 data) { cpuinfo info; VERIFY_CPUNUM(cpunum_set_info_int); info.i = data; cpuintrf_push_context(cpunum); (*cpu[cpunum].intf.set_info)(state, &info); cpuintrf_pop_context(); }
const char *cpunum_flags(int cpunum) { const char *result; VERIFY_CPUNUM("", cpunum_flags); cpuintrf_push_context(cpunum); result = (*cpu[cpunum].intf.cpu_info)(NULL, CPU_INFO_FLAGS); cpuintrf_pop_context(); return result; }
const void *cpunum_get_cycle_table(int cpunum, int which) { const void *result; VERIFY_CPUNUM(NULL, cpunum_get_cycle_table); cpuintrf_push_context(cpunum); result = (*cpu[cpunum].intf.get_cycle_table)(which); cpuintrf_pop_context(); return result; }
offs_t cpunum_dasm_new(int cpunum, char *buffer, offs_t pc, UINT8 *oprom, UINT8 *opram, int bytes) { unsigned result; VERIFY_CPUNUM(cpunum_dasm_new); cpuintrf_push_context(cpunum); result = activecpu_dasm_new(buffer, pc, oprom, opram, bytes); cpuintrf_pop_context(); return result; }
unsigned cpunum_get_reg(int cpunum, int regnum) { unsigned result; VERIFY_CPUNUM(0, cpunum_get_reg); cpuintrf_push_context(cpunum); result = (*cpu[cpunum].intf.get_reg)(regnum); cpuintrf_pop_context(); return result; }
static void cpu_empty_event_queue(int cpunum) { int i; /* swap to the CPU's context */ cpuintrf_push_context(cpunum); /* loop over all events */ for (i = 0; i < irq_event_index[cpunum]; i++) { INT32 irq_event = irq_event_queue[cpunum][i]; int state = irq_event & 0xff; int irqline = (irq_event >> 8) & 0xff; int vector = irq_event >> 16; LOG(("cpu_empty_event_queue %d,%d,%d\n",cpunum,irqline,state)); /* set the IRQ line state and vector */ if (irqline >= 0 && irqline < MAX_IRQ_LINES) { irq_line_state[cpunum][irqline] = state; irq_line_vector[cpunum][irqline] = vector; } /* switch off the requested state */ switch (state) { case PULSE_LINE: activecpu_set_irq_line(irqline, INTERNAL_ASSERT_LINE); activecpu_set_irq_line(irqline, INTERNAL_CLEAR_LINE); break; case HOLD_LINE: case ASSERT_LINE: activecpu_set_irq_line(irqline, INTERNAL_ASSERT_LINE); break; case CLEAR_LINE: activecpu_set_irq_line(irqline, INTERNAL_CLEAR_LINE); break; default: logerror("cpu_manualirqcallback cpu #%d, line %d, unknown state %d\n", cpunum, irqline, state); } /* generate a trigger to unsuspend any CPUs waiting on the interrupt */ if (state != CLEAR_LINE) cpu_triggerint(cpunum); } /* swap back */ cpuintrf_pop_context(); /* reset counter */ irq_event_index[cpunum] = 0; }
static Z80DMA_READ(mario_dma_read_byte) { UINT8 result; cpuintrf_push_context(0); result = program_read_byte(offset); cpuintrf_pop_context(); return result; }
void cpunum_reset(int cpunum, void *param, int (*irqack)(int)) { VERIFY_CPUNUM_VOID(cpunum_reset); cpuintrf_push_context(cpunum); (*cpu[cpunum].intf.set_op_base)(0); (*cpu[cpunum].intf.reset)(param); if (irqack) (*cpu[cpunum].intf.set_irq_callback)(irqack); cpuintrf_pop_context(); }
static void cpu_timedintcallback(int param) { /* bail if there is no routine */ if (Machine->drv->cpu[param].timed_interrupt && cpu_getstatus(param)) { cpuintrf_push_context(param); (*Machine->drv->cpu[param].timed_interrupt)(); cpuintrf_pop_context(); } }
void cpu_set_m68k_reset(int cpunum, void (*resetfn)(void)) { void m68k_set_reset_instr_callback(void (*callback)(void)); void m68000_set_reset_callback(void (*callback)(void)); void m68020_set_reset_callback(void (*callback)(void)); if ( 1 #if (HAS_M68000) && cpu[cpunum].cputype != CPU_M68000 #endif #if (HAS_M68010) && cpu[cpunum].cputype != CPU_M68010 #endif #if (HAS_M68020) && cpu[cpunum].cputype != CPU_M68020 #endif #if (HAS_M68EC020) && cpu[cpunum].cputype != CPU_M68EC020 #endif #if defined(PINMAME) && (HAS_M68306) && cpu[cpunum].cputype != CPU_M68306 #endif ) { logerror("Trying to set m68k reset vector on non-68k cpu\n"); exit(1); } cpuintrf_push_context(cpunum); if ( 0 #if (HAS_M68000) || cpu[cpunum].cputype == CPU_M68000 #endif #if (HAS_M68010) || cpu[cpunum].cputype == CPU_M68010 #endif ) { #ifdef A68K0 m68000_set_reset_callback(resetfn); #else m68k_set_reset_instr_callback(resetfn); #endif } else { #ifdef A68K2 m68020_set_reset_callback(resetfn); #else m68k_set_reset_instr_callback(resetfn); #endif } cpuintrf_pop_context(); }