--- uae/src/include/newcpu.h 2018/04/24 16:40:18 1.1.1.3 +++ uae/src/include/newcpu.h 2018/04/24 16:42:29 1.1.1.4 @@ -19,7 +19,7 @@ extern int fpp_movem_next[256]; extern int broken_in; -typedef void cpuop_func(uae_u32) REGPARAM; +typedef unsigned long cpuop_func (uae_u32) REGPARAM; struct cputbl { cpuop_func *handler; @@ -27,7 +27,7 @@ struct cputbl { uae_u16 opcode; }; -extern void op_illg(uae_u32) REGPARAM; +extern unsigned long op_illg (uae_u32) REGPARAM; typedef char flagtype; @@ -65,27 +65,33 @@ extern struct regstruct } regs, lastint_regs; #define m68k_dreg(r,num) ((r).regs[(num)]) -#define m68k_areg(r,num) ((r).regs[(num)+8]) +#define m68k_areg(r,num) (((r).regs + 8)[(num)]) #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))) -static __inline__ uae_u32 get_ibyte_prefetch(uae_s32 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) { 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)); @@ -96,7 +102,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 @@ -109,7 +115,7 @@ static __inline__ void fill_prefetch_0(v } #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); @@ -122,53 +128,58 @@ static __inline__ void fill_prefetch_2(v /* 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); + 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); + 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); + uae_u32 r = get_ilong (0); + m68k_incpc (4); return r; } -#if !defined(USE_COMPILER) -static __inline__ void m68k_setpc(uaecptr newpc) +#if !defined USE_COMPILER +static __inline__ void m68k_setpc (uaecptr newpc) { regs.pc_p = regs.pc_oldp = get_real_address(newpc); regs.pc = newpc; } #else -extern void m68k_setpc(uaecptr newpc); +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) +{ + return regs.pc + ((char *)p - (char *)regs.pc_oldp); +} + #ifdef USE_COMPILER -extern void m68k_setpc_fast(uaecptr newpc); -extern void m68k_setpc_bcc(uaecptr newpc); -extern void m68k_setpc_rte(uaecptr newpc); +extern void m68k_setpc_fast (uaecptr newpc); +extern void m68k_setpc_bcc (uaecptr newpc); +extern void m68k_setpc_rte (uaecptr newpc); #else #define m68k_setpc_fast m68k_setpc #define m68k_setpc_bcc m68k_setpc #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) @@ -206,27 +217,39 @@ static __inline__ uae_u32 get_disp_ea_00 { 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_s32 ShowEA(int reg, amodes mode, wordsizes size, char *buf); +extern uae_s32 ShowEA (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 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 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_reset(void); +extern void m68k_go (int); +extern void m68k_dumpstate (uaecptr *); +extern void m68k_disasm (uaecptr, uaecptr *, int); +extern void m68k_reset (void); extern void mmu_op (uae_u32, uae_u16);