--- uae/src/include/newcpu.h 2018/04/24 16:42:29 1.1.1.4 +++ uae/src/include/newcpu.h 2018/04/24 16:55:13 1.1.1.9 @@ -6,6 +6,32 @@ * Copyright 1995 Bernd Schmidt */ +#include + +#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[]; @@ -71,27 +97,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 +122,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 +135,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 +148,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 +170,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 +179,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,76 +199,30 @@ 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) regs.spcflags |= SPCFLAG_STOP; } -static __inline__ uae_u32 get_disp_ea_020 (uae_u32 base, uae_u32 dp) -{ - int reg = (dp >> 12) & 15; - uae_s32 regd = regs.regs[reg]; - if ((dp & 0x800) == 0) - regd = (uae_s32)(uae_s16)regd; - regd <<= (dp >> 9) & 3; - if (dp & 0x100) { - uae_s32 outer = 0; - if (dp & 0x80) base = 0; - if (dp & 0x40) regd = 0; - - if ((dp & 0x30) == 0x20) base += (uae_s32)(uae_s16)next_iword(); - if ((dp & 0x30) == 0x30) base += next_ilong(); - - if ((dp & 0x3) == 0x2) outer = (uae_s32)(uae_s16)next_iword(); - if ((dp & 0x3) == 0x3) outer = next_ilong(); - - if ((dp & 0x4) == 0) base += regd; - if (dp & 0x3) base = get_long (base); - if (dp & 0x4) base += regd; - - return base + outer; - } else { - return base + (uae_s32)((uae_s8)dp) + regd; - } -} -static __inline__ uae_u32 get_disp_ea_000 (uae_u32 base, uae_u32 dp) -{ - int reg = (dp >> 12) & 15; - uae_s32 regd = regs.regs[reg]; -#if 1 - if ((dp & 0x800) == 0) - regd = (uae_s32)(uae_s16)regd; - return base + (uae_s8)dp + regd; -#else - uae_s32 regd16; - uae_u32 mask; - mask = ((dp & 0x800) >> 11) - 1; - regd16 = (uae_s32)(uae_s16)regd; - regd16 &= mask; - mask = ~mask; - base += (uae_s8)dp; - regd &= mask; - regd |= regd16; - return base + regd; -#endif -} +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);