--- uae/src/include/newcpu.h 2018/04/24 16:45:11 1.1.1.5 +++ uae/src/include/newcpu.h 2018/04/24 16:57:07 1.1.1.10 @@ -6,6 +6,33 @@ * Copyright 1995 Bernd Schmidt */ +#include "readcpu.h" +#include "machdep/m68k.h" + +#ifndef SET_CFLG + +#define SET_CFLG(x) (CFLG = (x)) +#define SET_NFLG(x) (NFLG = (x)) +#define SET_VFLG(x) (VFLG = (x)) +#define SET_ZFLG(x) (ZFLG = (x)) +#define SET_XFLG(x) (XFLG = (x)) + +#define GET_CFLG CFLG +#define GET_NFLG NFLG +#define GET_VFLG VFLG +#define GET_ZFLG ZFLG +#define GET_XFLG XFLG + +#define CLEAR_CZNV do { \ + SET_CFLG (0); \ + SET_ZFLG (0); \ + SET_NFLG (0); \ + SET_VFLG (0); \ +} while (0) + +#define COPY_CARRY (SET_XFLG (GET_CFLG)) +#endif + extern int areg_byteinc[]; extern int imm8_table[]; @@ -64,6 +91,16 @@ extern struct regstruct uae_u32 prefetch; } regs, lastint_regs; +STATIC_INLINE void set_special (uae_u32 x) +{ + regs.spcflags |= x; +} + +STATIC_INLINE void unset_special (uae_u32 x) +{ + regs.spcflags &= ~x; +} + #define m68k_dreg(r,num) ((r).regs[(num)]) #define m68k_areg(r,num) (((r).regs + 8)[(num)]) @@ -71,27 +108,21 @@ extern struct regstruct #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))) -#ifdef HAVE_GET_WORD_UNSWAPPED -#define GET_OPCODE (do_get_mem_word_unswapped (regs.pc_p)) -#else -#define GET_OPCODE (get_iword (0)) -#endif - -static __inline__ uae_u32 get_ibyte_prefetch (uae_s32 o) +STATIC_INLINE uae_u32 get_ibyte_prefetch (uae_s32 o) { if (o > 3 || o < 0) return do_get_mem_byte((uae_u8 *)(regs.pc_p + o + 1)); return do_get_mem_byte((uae_u8 *)(((uae_u8 *)®s.prefetch) + o + 1)); } -static __inline__ uae_u32 get_iword_prefetch (uae_s32 o) +STATIC_INLINE uae_u32 get_iword_prefetch (uae_s32 o) { if (o > 3 || o < 0) return do_get_mem_word((uae_u16 *)(regs.pc_p + o)); return do_get_mem_word((uae_u16 *)(((uae_u8 *)®s.prefetch) + o)); } -static __inline__ uae_u32 get_ilong_prefetch (uae_s32 o) +STATIC_INLINE uae_u32 get_ilong_prefetch (uae_s32 o) { if (o > 3 || o < 0) return do_get_mem_long((uae_u32 *)(regs.pc_p + o)); @@ -102,7 +133,7 @@ static __inline__ uae_u32 get_ilong_pref #define m68k_incpc(o) (regs.pc_p += (o)) -static __inline__ void fill_prefetch_0 (void) +STATIC_INLINE void fill_prefetch_0 (void) { uae_u32 r; #ifdef UNALIGNED_PROFITABLE @@ -115,7 +146,7 @@ static __inline__ void fill_prefetch_0 ( } #if 0 -static __inline__ void fill_prefetch_2 (void) +STATIC_INLINE void fill_prefetch_2 (void) { uae_u32 r = do_get_mem_long (®s.prefetch) << 16; uae_u32 r2 = do_get_mem_word (((uae_u16 *)regs.pc_p) + 1); @@ -128,21 +159,21 @@ static __inline__ void fill_prefetch_2 ( /* These are only used by the 68020/68881 code, and therefore don't * need to handle prefetch. */ -static __inline__ uae_u32 next_ibyte (void) +STATIC_INLINE uae_u32 next_ibyte (void) { uae_u32 r = get_ibyte (0); m68k_incpc (2); return r; } -static __inline__ uae_u32 next_iword (void) +STATIC_INLINE uae_u32 next_iword (void) { uae_u32 r = get_iword (0); m68k_incpc (2); return r; } -static __inline__ uae_u32 next_ilong (void) +STATIC_INLINE uae_u32 next_ilong (void) { uae_u32 r = get_ilong (0); m68k_incpc (4); @@ -150,7 +181,7 @@ static __inline__ uae_u32 next_ilong (vo } #if !defined USE_COMPILER -static __inline__ void m68k_setpc (uaecptr newpc) +STATIC_INLINE void m68k_setpc (uaecptr newpc) { regs.pc_p = regs.pc_oldp = get_real_address(newpc); regs.pc = newpc; @@ -159,12 +190,12 @@ static __inline__ void m68k_setpc (uaecp extern void m68k_setpc (uaecptr newpc); #endif -static __inline__ uaecptr m68k_getpc (void) +STATIC_INLINE uaecptr m68k_getpc (void) { return regs.pc + ((char *)regs.pc_p - (char *)regs.pc_oldp); } -static __inline__ uaecptr m68k_getpc_p (uae_u8 *p) +STATIC_INLINE uaecptr m68k_getpc_p (uae_u8 *p) { return regs.pc + ((char *)p - (char *)regs.pc_oldp); } @@ -179,7 +210,7 @@ extern void m68k_setpc_rte (uaecptr newp #define m68k_setpc_rte m68k_setpc #endif -static __inline__ void m68k_setstopped (int stop) +STATIC_INLINE void m68k_setstopped (int stop) { regs.stopped = stop; if (stop) @@ -189,20 +220,20 @@ static __inline__ void m68k_setstopped ( extern uae_u32 get_disp_ea_020 (uae_u32 base, uae_u32 dp); extern uae_u32 get_disp_ea_000 (uae_u32 base, uae_u32 dp); -extern uae_s32 ShowEA (int reg, amodes mode, wordsizes size, char *buf); +extern uae_s32 ShowEA (FILE *, int reg, amodes mode, wordsizes size, char *buf); extern void MakeSR (void); extern void MakeFromSR (void); extern void Exception (int, uaecptr); extern void dump_counts (void); -extern void m68k_move2c (int, uae_u32 *); -extern void m68k_movec2 (int, uae_u32 *); +extern int m68k_move2c (int, uae_u32 *); +extern int m68k_movec2 (int, uae_u32 *); extern void m68k_divl (uae_u32, uae_u32, uae_u16, uaecptr); extern void m68k_mull (uae_u32, uae_u32, uae_u16); extern void init_m68k (void); extern void m68k_go (int); -extern void m68k_dumpstate (uaecptr *); -extern void m68k_disasm (uaecptr, uaecptr *, int); +extern void m68k_dumpstate (FILE *, uaecptr *); +extern void m68k_disasm (FILE *, uaecptr, uaecptr *, int); extern void m68k_reset (void); extern void mmu_op (uae_u32, uae_u16); @@ -224,16 +255,18 @@ extern uaecptr last_fault_for_exception_ #define CPU_OP_NAME(a) op ## a +/* 68040 */ +extern struct cputbl op_smalltbl_0_ff[]; /* 68020 + 68881 */ -extern struct cputbl op_smalltbl_0[]; +extern struct cputbl op_smalltbl_1_ff[]; /* 68020 */ -extern struct cputbl op_smalltbl_1[]; +extern struct cputbl op_smalltbl_2_ff[]; /* 68010 */ -extern struct cputbl op_smalltbl_2[]; +extern struct cputbl op_smalltbl_3_ff[]; /* 68000 */ -extern struct cputbl op_smalltbl_3[]; +extern struct cputbl op_smalltbl_4_ff[]; /* 68000 slow but compatible. */ -extern struct cputbl op_smalltbl_4[]; +extern struct cputbl op_smalltbl_5_ff[]; extern cpuop_func *cpufunctbl[65536] ASM_SYM_FOR_FUNC ("cpufunctbl");