--- hatari/src/uae-cpu/newcpu.h 2019/04/01 07:11:01 1.1.1.6 +++ hatari/src/uae-cpu/newcpu.h 2019/04/09 08:47:24 1.1.1.12 @@ -16,9 +16,18 @@ #include "readcpu.h" #include "m68k.h" +#include "memory.h" -/* custom chip support */ +/* Possible exceptions sources for M68000_Exception() and Exception() */ +#define M68000_EXCEPTION_SRC_CPU 1 /* exception is a direct CPU exception */ +#define M68000_EXCEPTION_SRC_INT_MFP 2 /* exception caused by an MFP interrupt */ +#define M68000_EXCEPTION_SRC_INT_VIDEO 3 /* exception caused by a video interrupt */ + + + +/* Special flags */ +#define SPCFLAG_DEBUGGER 1 #define SPCFLAG_STOP 2 #define SPCFLAG_BUSERROR 4 #define SPCFLAG_INT 8 @@ -27,10 +36,11 @@ #define SPCFLAG_TRACE 0x40 #define SPCFLAG_DOTRACE 0x80 #define SPCFLAG_DOINT 0x100 -/*#define SPCFLAG_BLTNASTY 0x200 */ +#define SPCFLAG_MFP 0x200 #define SPCFLAG_EXEC 0x400 #define SPCFLAG_MODE_CHANGE 0x800 + #ifndef SET_CFLG #define SET_CFLG(x) (CFLG = (x)) @@ -55,8 +65,8 @@ #define COPY_CARRY (SET_XFLG (GET_CFLG)) #endif -extern int areg_byteinc[]; -extern int imm8_table[]; +extern const int areg_byteinc[]; +extern const int imm8_table[]; extern int movem_index1[256]; extern int movem_index2[256]; @@ -66,7 +76,6 @@ extern int fpp_movem_index1[256]; extern int fpp_movem_index2[256]; extern int fpp_movem_next[256]; -extern int broken_in; typedef unsigned long cpuop_func (uae_u32) REGPARAM; @@ -152,9 +161,9 @@ STATIC_INLINE uaecptr m68k_getpc_p (uae_ return regs.pc + ((char *)p - (char *)regs.pc_oldp); } -#define get_ibyte(o) do_get_mem_byte((uae_u8 *)(regs.pc_p + (o) + 1)) -#define get_iword(o) do_get_mem_word((uae_u16 *)(regs.pc_p + (o))) -#define get_ilong(o) do_get_mem_long((uae_u32 *)(regs.pc_p + (o))) +#define get_ibyte(o) do_get_mem_byte(regs.pc_p + (o) + 1) +#define get_iword(o) do_get_mem_word(regs.pc_p + (o)) +#define get_ilong(o) do_get_mem_long(regs.pc_p + (o)) STATIC_INLINE void refill_prefetch (uae_u32 currpc, uae_u32 offs) { @@ -166,7 +175,7 @@ STATIC_INLINE void refill_prefetch (uae_ r = *(uae_u32 *)ptr; regs.prefetch = r; #else - r = do_get_mem_long ((uae_u32 *)ptr); + r = do_get_mem_long (ptr); do_put_mem_long (®s.prefetch, r); #endif /* printf ("PC %lx T %lx PCPOFFS %d R %lx\n", currpc, t, pc_p_offs, r); */ @@ -199,7 +208,7 @@ STATIC_INLINE uae_u32 get_iword_prefetch refill_prefetch (currpc, o); offs = addr - regs.prefetch_pc; } - v = do_get_mem_word ((uae_u16 *)(((uae_u8 *)®s.prefetch) + offs)); + v = do_get_mem_word (((uae_u8 *)®s.prefetch) + offs); if (offs >= 2) refill_prefetch (currpc, 2); /* printf ("get_iword PC %lx ADDR %lx OFFS %lx V %lx\n", currpc, addr, offs, v); */ @@ -287,7 +296,7 @@ extern uae_s32 ShowEA (FILE *, int reg, extern void MakeSR (void); extern void MakeFromSR (void); -extern void Exception (int, uaecptr); +extern void Exception (int, uaecptr, int); extern void dump_counts (void); extern int m68k_move2c (int, uae_u32 *); extern int m68k_movec2 (int, uae_u32 *); @@ -310,7 +319,8 @@ extern void fbcc_opp (uae_u32, uaecptr, extern void fsave_opp (uae_u32); extern void frestore_opp (uae_u32); -extern int lastInstructionCycles; +extern int getDivu68kCycles (uae_u32 dividend, uae_u16 divisor); +extern int getDivs68kCycles (uae_s32 dividend, uae_s16 divisor); /* Opcode of faulting instruction */ extern uae_u16 last_op_for_exception_3; @@ -322,18 +332,23 @@ extern uaecptr last_fault_for_exception_ #define CPU_OP_NAME(a) op ## a /* 68040 */ -extern struct cputbl op_smalltbl_0_ff[]; +extern const struct cputbl op_smalltbl_0_ff[]; /* 68020 + 68881 */ -extern struct cputbl op_smalltbl_1_ff[]; +extern const struct cputbl op_smalltbl_1_ff[]; /* 68020 */ -extern struct cputbl op_smalltbl_2_ff[]; +extern const struct cputbl op_smalltbl_2_ff[]; /* 68010 */ -extern struct cputbl op_smalltbl_3_ff[]; +extern const struct cputbl op_smalltbl_3_ff[]; /* 68000 */ -extern struct cputbl op_smalltbl_4_ff[]; +extern const struct cputbl op_smalltbl_4_ff[]; /* 68000 slow but compatible. */ -extern struct cputbl op_smalltbl_5_ff[]; +extern const struct cputbl op_smalltbl_5_ff[]; extern cpuop_func *cpufunctbl[65536]; +extern uae_u32 caar, cacr; + +/* Family of the latest instruction executed (to check for pairing) */ +extern int OpcodeFamily; /* see instrmnem in readcpu.h */ + #endif /* UAE_NEWCPU_H */