--- hatari/src/uae-cpu/newcpu.h 2019/04/01 07:10:41 1.1.1.5 +++ hatari/src/uae-cpu/newcpu.h 2019/04/01 07:11:01 1.1.1.6 @@ -1,6 +1,6 @@ /* * UAE - The Un*x Amiga Emulator - CPU core - * + * * MC68000 emulation * * Copyright 1995 Bernd Schmidt @@ -20,17 +20,16 @@ /* custom chip support */ #define SPCFLAG_STOP 2 -/*#define SPCFLAG_COPPER 4*/ +#define SPCFLAG_BUSERROR 4 #define SPCFLAG_INT 8 -#define SPCFLAG_BRK 16 -#define SPCFLAG_EXTRA_CYCLES 32 -#define SPCFLAG_TRACE 64 -#define SPCFLAG_DOTRACE 128 -#define SPCFLAG_DOINT 256 -/*#define SPCFLAG_BLTNASTY 512*/ -#define SPCFLAG_EXEC 1024 -#define SPCFLAG_MODE_CHANGE 8192 - +#define SPCFLAG_BRK 0x10 +#define SPCFLAG_EXTRA_CYCLES 0x20 +#define SPCFLAG_TRACE 0x40 +#define SPCFLAG_DOTRACE 0x80 +#define SPCFLAG_DOINT 0x100 +/*#define SPCFLAG_BLTNASTY 0x200 */ +#define SPCFLAG_EXEC 0x400 +#define SPCFLAG_MODE_CHANGE 0x800 #ifndef SET_CFLG @@ -136,15 +135,12 @@ STATIC_INLINE void unset_special (uae_u3 #define m68k_dreg(r,num) ((r).regs[(num)]) #define m68k_areg(r,num) (((r).regs + 8)[(num)]) -#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); -#endif STATIC_INLINE uaecptr m68k_getpc (void) { @@ -162,7 +158,7 @@ STATIC_INLINE uaecptr m68k_getpc_p (uae_ STATIC_INLINE void refill_prefetch (uae_u32 currpc, uae_u32 offs) { - uae_u32 t = (currpc + offs) & ~3; + uae_u32 t = (currpc + offs) & ~1; uae_s32 pc_p_offs = t - currpc; uae_u8 *ptr = regs.pc_p + pc_p_offs; uae_u32 r; @@ -189,7 +185,7 @@ STATIC_INLINE uae_u32 get_ibyte_prefetch } v = do_get_mem_byte (((uae_u8 *)®s.prefetch) + offs); if (offs >= 2) - refill_prefetch (currpc, 4); + refill_prefetch (currpc, 2); /* printf ("get_ibyte PC %lx ADDR %lx OFFS %lx V %lx\n", currpc, addr, offs, v); */ return v; } @@ -205,7 +201,7 @@ STATIC_INLINE uae_u32 get_iword_prefetch } v = do_get_mem_word ((uae_u16 *)(((uae_u8 *)®s.prefetch) + offs)); if (offs >= 2) - refill_prefetch (currpc, 4); + refill_prefetch (currpc, 2); /* printf ("get_iword PC %lx ADDR %lx OFFS %lx V %lx\n", currpc, addr, offs, v); */ return v; } @@ -248,15 +244,8 @@ STATIC_INLINE uae_u32 next_ilong (void) return r; } -#ifdef USE_COMPILER -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) { @@ -267,6 +256,30 @@ STATIC_INLINE void m68k_setstopped (int regs.spcflags |= SPCFLAG_STOP; } +/* m68k_do_rts, m68k_do_bsr and m68k_do_jsr were originally defined in + * compiler.h, but since that header file has been removed from Hatari, + * they are now defined here: */ +STATIC_INLINE void m68k_do_rts(void) +{ + m68k_setpc(get_long(m68k_areg(regs, 7))); + m68k_areg(regs, 7) += 4; +} + +STATIC_INLINE void m68k_do_bsr(uaecptr oldpc, uae_s32 offset) +{ + m68k_areg(regs, 7) -= 4; + put_long(m68k_areg(regs, 7), oldpc); + m68k_incpc(offset); +} + +STATIC_INLINE void m68k_do_jsr(uaecptr oldpc, uaecptr dest) +{ + m68k_areg(regs, 7) -= 4; + put_long(m68k_areg(regs, 7), oldpc); + m68k_setpc(dest); +} + + 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);