📄 cpuintrf.h
字号:
#ifndef CPUINTRF_H
#define CPUINTRF_H
#include "osd_cpu.h"
/* The old system is obsolete and no longer supported by the core */
#define NEW_INTERRUPT_SYSTEM 1
#define MAX_IRQ_LINES 8 /* maximum number of IRQ lines per CPU */
#define CLEAR_LINE 0 /* clear (a fired, held or pulsed) line */
#define ASSERT_LINE 1 /* assert an interrupt immediately */
#define HOLD_LINE 2 /* hold interrupt line until enable is true */
#define PULSE_LINE 3 /* pulse interrupt line for one instruction */
#define MAX_REGS 64 /* maximum number of register of any CPU */
/* Values passed to the cpu_info function of a core to retrieve information */
enum {
CPU_INFO_REG,
CPU_INFO_FLAGS=MAX_REGS,
CPU_INFO_NAME,
CPU_INFO_FAMILY,
CPU_INFO_VERSION,
CPU_INFO_FILE,
CPU_INFO_CREDITS,
CPU_INFO_REG_LAYOUT,
CPU_INFO_WIN_LAYOUT
};
#define CPU_IS_LE 0 /* emulated CPU is little endian */
#define CPU_IS_BE 1 /* emulated CPU is big endian */
/*
* This value is passed to cpu_get_reg to retrieve the previous
* program counter value, ie. before a CPU emulation started
* to fetch opcodes and arguments for the current instrution.
*/
#define REG_PREVIOUSPC -1
/*
* This value is passed to cpu_get_reg/cpu_set_reg, instead of one of
* the names from the enum a CPU core defines for it's registers,
* to get or set the contents of the memory pointed to by a stack pointer.
* You can specify the n'th element on the stack by (REG_SP_CONTENTS-n),
* ie. lower negative values. The actual element size (UINT16 or UINT32)
* depends on the CPU core.
* This is also used to replace the cpu_geturnpc() function.
*/
#define REG_SP_CONTENTS -2
/*
* These flags can be defined in the makefile (or project) to
* exclude (zero) or include (non zero) specific CPU cores
*/
#ifndef HAS_GENSYNC
#define HAS_GENSYNC 0
#endif
#ifndef HAS_Z80
#define HAS_Z80 0
#endif
#ifndef HAS_Z80_VM
#define HAS_Z80_VM 0
#endif
#ifndef HAS_8080
#define HAS_8080 0
#endif
#ifndef HAS_8085A
#define HAS_8085A 0
#endif
#ifndef HAS_M6502
#define HAS_M6502 0
#endif
#ifndef HAS_M65C02
#define HAS_M65C02 0
#endif
#ifndef HAS_M65SC02
#define HAS_M65SC02 0
#endif
#ifndef HAS_M65CE02
#define HAS_M65CE02 0
#endif
#ifndef HAS_M6509
#define HAS_M6509 0
#endif
#ifndef HAS_M6510
#define HAS_M6510 0
#endif
#ifndef HAS_N2A03
#define HAS_N2A03 0
#endif
#ifndef HAS_H6280
#define HAS_H6280 0
#endif
#ifndef HAS_I86
#define HAS_I86 0
#endif
#ifndef HAS_V20
#define HAS_V20 0
#endif
#ifndef HAS_V30
#define HAS_V30 0
#endif
#ifndef HAS_V33
#define HAS_V33 0
#endif
#ifndef HAS_I8035
#define HAS_I8035 0
#endif
#ifndef HAS_I8039
#define HAS_I8039 0
#endif
#ifndef HAS_I8048
#define HAS_I8048 0
#endif
#ifndef HAS_N7751
#define HAS_N7751 0
#endif
#ifndef HAS_M6800
#define HAS_M6800 0
#endif
#ifndef HAS_M6801
#define HAS_M6801 0
#endif
#ifndef HAS_M6802
#define HAS_M6802 0
#endif
#ifndef HAS_M6803
#define HAS_M6803 0
#endif
#ifndef HAS_M6808
#define HAS_M6808 0
#endif
#ifndef HAS_HD63701
#define HAS_HD63701 0
#endif
#ifndef HAS_M6805
#define HAS_M6805 0
#endif
#ifndef HAS_M68705
#define HAS_M68705 0
#endif
#ifndef HAS_HD63705
#define HAS_HD63705 0
#endif
#ifndef HAS_HD6309
#define HAS_HD6309 0
#endif
#ifndef HAS_M6809
#define HAS_M6809 0
#endif
#ifndef HAS_KONAMI
#define HAS_KONAMI 0
#endif
#ifndef HAS_M68000
#define HAS_M68000 0
#endif
#ifndef HAS_M68010
#define HAS_M68010 0
#endif
#ifndef HAS_M68020
#define HAS_M68020 0
#endif
#ifndef HAS_T11
#define HAS_T11 0
#endif
#ifndef HAS_S2650
#define HAS_S2650 0
#endif
#ifndef HAS_TMS34010
#define HAS_TMS34010 0
#endif
#ifndef HAS_TMS9900
#define HAS_TMS9900 0
#endif
#ifndef HAS_TMS9940
#define HAS_TMS9940 0
#endif
#ifndef HAS_TMS9980
#define HAS_TMS9980 0
#endif
#ifndef HAS_TMS9985
#define HAS_TMS9985 0
#endif
#ifndef HAS_TMS9989
#define HAS_TMS9989 0
#endif
#ifndef HAS_TMS9995
#define HAS_TMS9995 0
#endif
#ifndef HAS_TMS99105A
#define HAS_TMS99105A 0
#endif
#ifndef HAS_TMS99110A
#define HAS_TMS99110A 0
#endif
#ifndef HAS_Z8000
#define HAS_Z8000 0
#endif
#ifndef HAS_TMS320C10
#define HAS_TMS320C10 0
#endif
#ifndef HAS_CCPU
#define HAS_CCPU 0
#endif
#ifndef HAS_PDP1
#define HAS_PDP1 0
#endif
#ifndef HAS_ADSP2100
#define HAS_ADSP2100 0
#endif
/* ASG 971222 -- added this generic structure */
struct cpu_interface
{
unsigned cpu_num;
void (*reset)(void *param);
void (*exit)(void);
int (*execute)(int cycles);
void (*burn)(int cycles);
unsigned (*get_context)(void *reg);
void (*set_context)(void *reg);
unsigned (*get_pc)(void);
void (*set_pc)(unsigned val);
unsigned (*get_sp)(void);
void (*set_sp)(unsigned val);
unsigned (*get_reg)(int regnum);
void (*set_reg)(int regnum, unsigned val);
void (*set_nmi_line)(int linestate);
void (*set_irq_line)(int irqline, int linestate);
void (*set_irq_callback)(int(*callback)(int irqline));
void (*internal_interrupt)(int type);
void (*cpu_state_save)(void *file);
void (*cpu_state_load)(void *file);
const char* (*cpu_info)(void *context,int regnum);
unsigned (*cpu_dasm)(char *buffer,unsigned pc);
unsigned num_irqs;
int default_vector;
int *icount;
double overclock;
int no_int, irq_int, nmi_int;
int (*memory_read)(int offset);
void (*memory_write)(int offset, int data);
void (*set_op_base)(int pc);
int address_shift;
unsigned address_bits, endianess, align_unit, max_inst_len;
unsigned abits1, abits2, abitsmin;
};
extern struct cpu_interface cpuintf[];
void cpu_init(void);
void cpu_run(void);
/* optional watchdog */
void watchdog_reset_w(int offset,int data);
int watchdog_reset_r(int offset);
/* Use this function to reset the machine */
void machine_reset(void);
/* Use this function to reset a single CPU */
void cpu_set_reset_line(int cpu,int state);
/* Use this function to halt a single CPU */
void cpu_set_halt_line(int cpu,int state);
/* This function returns CPUNUM current status (running or halted) */
int cpu_getstatus(int cpunum);
int cpu_gettotalcpu(void);
int cpu_getactivecpu(void);
void cpu_setactivecpu(int cpunum);
/* Returns the current program counter */
unsigned cpu_get_pc(void);
/* Set the current program counter */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -