Annotation of uae/src/include/newcpu.h, revision 1.1.1.16

1.1.1.3   root        1:  /*
1.1       root        2:   * UAE - The Un*x Amiga Emulator
1.1.1.3   root        3:   *
1.1       root        4:   * MC68000 emulation
                      5:   *
                      6:   * Copyright 1995 Bernd Schmidt
                      7:   */
                      8: 
1.1.1.10  root        9: #include "readcpu.h"
                     10: #include "machdep/m68k.h"
1.1.1.6   root       11: 
                     12: #ifndef SET_CFLG
                     13: 
                     14: #define SET_CFLG(x) (CFLG = (x))
                     15: #define SET_NFLG(x) (NFLG = (x))
                     16: #define SET_VFLG(x) (VFLG = (x))
                     17: #define SET_ZFLG(x) (ZFLG = (x))
                     18: #define SET_XFLG(x) (XFLG = (x))
                     19: 
                     20: #define GET_CFLG CFLG
                     21: #define GET_NFLG NFLG
                     22: #define GET_VFLG VFLG
                     23: #define GET_ZFLG ZFLG
                     24: #define GET_XFLG XFLG
                     25: 
                     26: #define CLEAR_CZNV do { \
                     27:  SET_CFLG (0); \
                     28:  SET_ZFLG (0); \
                     29:  SET_NFLG (0); \
                     30:  SET_VFLG (0); \
1.1.1.7   root       31: } while (0)
1.1.1.6   root       32: 
                     33: #define COPY_CARRY (SET_XFLG (GET_CFLG))
                     34: #endif
                     35: 
1.1.1.15  root       36: extern const int areg_byteinc[];
                     37: extern const int imm8_table[];
1.1       root       38: 
                     39: extern int movem_index1[256];
                     40: extern int movem_index2[256];
                     41: extern int movem_next[256];
                     42: 
                     43: extern int fpp_movem_index1[256];
                     44: extern int fpp_movem_index2[256];
                     45: extern int fpp_movem_next[256];
                     46: 
                     47: extern int broken_in;
                     48: 
1.1.1.4   root       49: typedef unsigned long cpuop_func (uae_u32) REGPARAM;
1.1       root       50: 
                     51: struct cputbl {
                     52:     cpuop_func *handler;
                     53:     int specific;
1.1.1.3   root       54:     uae_u16 opcode;
1.1       root       55: };
                     56: 
1.1.1.4   root       57: extern unsigned long op_illg (uae_u32) REGPARAM;
1.1       root       58: 
1.1.1.2   root       59: typedef char flagtype;
1.1       root       60: 
1.1.1.11  root       61: /* You can set this to long double to be more accurate. However, the
                     62:    resulting alignment issues will cost a lot of performance in some
                     63:    apps */
                     64: #define USE_LONG_DOUBLE 0
                     65: 
                     66: #if USE_LONG_DOUBLE
                     67: typedef long double fptype;
                     68: #else
                     69: typedef double fptype;
                     70: #endif
                     71: 
1.1.1.3   root       72: extern struct regstruct
1.1       root       73: {
1.1.1.3   root       74:     uae_u32 regs[16];
1.1.1.16! root       75: 
        !            76:     uae_u32 pc;
        !            77:     uae_u8 *pc_p;
        !            78:     uae_u8 *pc_oldp;
        !            79: 
        !            80:     uae_u16 irc, ir;
        !            81:     uae_u32 spcflags;
        !            82: 
1.1.1.14  root       83:     uaecptr usp,isp,msp;
1.1.1.3   root       84:     uae_u16 sr;
1.1       root       85:     flagtype t1;
                     86:     flagtype t0;
                     87:     flagtype s;
                     88:     flagtype m;
                     89:     flagtype x;
                     90:     flagtype stopped;
                     91:     int intmask;
1.1.1.3   root       92: 
                     93:     uae_u32 vbr,sfc,dfc;
1.1       root       94: 
1.1.1.11  root       95:     fptype fp[8];
                     96:     fptype fp_result;
                     97: 
1.1.1.3   root       98:     uae_u32 fpcr,fpsr,fpiar;
1.1.1.11  root       99:     uae_u32 fpsr_highbyte;
1.1.1.3   root      100: 
1.1.1.16! root      101:     uae_u32 caar, cacr;
        !           102:     uae_u32 itt0, itt1, dtt0, dtt1;
        !           103:     uae_u32 tcr, mmusr, urp, srp, buscr;
        !           104: 
        !           105:     uae_u32 mmu_fslw, mmu_fault_addr;
        !           106:     uae_u16 mmu_ssw;
        !           107:     uae_u32 wb3_data;
        !           108:     uae_u16 wb3_status;
        !           109: 
        !           110:     uae_u64 srp_030, crp_030;
        !           111:     uae_u32 tt0_030, tt1_030, tc_030;
        !           112:     uae_u16 mmusr_030;
        !           113: 
        !           114:     uae_u32 pcr;
        !           115:     
1.1.1.3   root      116:     uae_u32 kick_mask;
1.1.1.14  root      117:     uae_u32 address_space_mask;
1.1.1.3   root      118: 
1.1.1.14  root      119:     uae_u8 panic;
                    120:     uae_u32 panic_pc, panic_addr;
1.1       root      121: } regs, lastint_regs;
                    122: 
1.1.1.14  root      123: STATIC_INLINE uae_u32 munge24(uae_u32 x)
                    124: {
                    125:     return x & regs.address_space_mask;
                    126: }
                    127: 
1.1.1.10  root      128: STATIC_INLINE void set_special (uae_u32 x)
                    129: {
                    130:     regs.spcflags |= x;
                    131: }
                    132: 
                    133: STATIC_INLINE void unset_special (uae_u32 x)
                    134: {
                    135:     regs.spcflags &= ~x;
                    136: }
                    137: 
1.1.1.2   root      138: #define m68k_dreg(r,num) ((r).regs[(num)])
1.1.1.4   root      139: #define m68k_areg(r,num) (((r).regs + 8)[(num)])
1.1       root      140: 
1.1.1.12  root      141: STATIC_INLINE void m68k_setpc (uaecptr newpc)
                    142: {
                    143:     regs.pc_p = regs.pc_oldp = get_real_address (newpc);
                    144:     regs.pc = newpc;
                    145: }
                    146: 
                    147: STATIC_INLINE uaecptr m68k_getpc (void)
                    148: {
                    149:     return regs.pc + ((char *)regs.pc_p - (char *)regs.pc_oldp);
                    150: }
                    151: 
                    152: STATIC_INLINE uaecptr m68k_getpc_p (uae_u8 *p)
                    153: {
                    154:     return regs.pc + ((char *)p - (char *)regs.pc_oldp);
                    155: }
                    156: 
1.1.1.3   root      157: #define get_ibyte(o) do_get_mem_byte((uae_u8 *)(regs.pc_p + (o) + 1))
                    158: #define get_iword(o) do_get_mem_word((uae_u16 *)(regs.pc_p + (o)))
                    159: #define get_ilong(o) do_get_mem_long((uae_u32 *)(regs.pc_p + (o)))
                    160: 
                    161: #define m68k_incpc(o) (regs.pc_p += (o))
                    162: 
                    163: /* These are only used by the 68020/68881 code, and therefore don't
                    164:  * need to handle prefetch.  */
1.1.1.7   root      165: STATIC_INLINE uae_u32 next_ibyte (void)
1.1       root      166: {
1.1.1.4   root      167:     uae_u32 r = get_ibyte (0);
                    168:     m68k_incpc (2);
1.1.1.2   root      169:     return r;
                    170: }
                    171: 
1.1.1.7   root      172: STATIC_INLINE uae_u32 next_iword (void)
1.1.1.2   root      173: {
1.1.1.4   root      174:     uae_u32 r = get_iword (0);
                    175:     m68k_incpc (2);
1.1       root      176:     return r;
                    177: }
                    178: 
1.1.1.7   root      179: STATIC_INLINE uae_u32 next_ilong (void)
1.1       root      180: {
1.1.1.4   root      181:     uae_u32 r = get_ilong (0);
                    182:     m68k_incpc (4);
1.1       root      183:     return r;
                    184: }
                    185: 
1.1.1.14  root      186: STATIC_INLINE void m68k_do_rts(void)
                    187: {
1.1.1.16! root      188:     m68k_setpc(get_long(m68k_areg (regs, 7)));
        !           189:     m68k_areg (regs, 7) += 4;
1.1.1.14  root      190: }
                    191: 
                    192: STATIC_INLINE void m68k_do_bsr(uaecptr oldpc, uae_s32 offset)
                    193: {
1.1.1.16! root      194:     m68k_areg (regs, 7) -= 4;
        !           195:     put_long(m68k_areg (regs, 7), oldpc);
1.1.1.14  root      196:     m68k_incpc(offset);
                    197: }
                    198: 
                    199: STATIC_INLINE void m68k_do_jsr(uaecptr oldpc, uaecptr dest)
                    200: {
1.1.1.16! root      201:     m68k_areg (regs, 7) -= 4;
        !           202:     put_long(m68k_areg (regs, 7), oldpc);
1.1.1.14  root      203:     m68k_setpc(dest);
                    204: }
1.1       root      205: 
1.1.1.7   root      206: STATIC_INLINE void m68k_setstopped (int stop)
1.1       root      207: {
                    208:     regs.stopped = stop;
1.1.1.12  root      209:     /* A traced STOP instruction drops through immediately without
                    210:        actually stopping.  */
                    211:     if (stop && (regs.spcflags & SPCFLAG_DOTRACE) == 0)
1.1       root      212:        regs.spcflags |= SPCFLAG_STOP;
                    213: }
                    214: 
1.1.1.5   root      215: extern uae_u32 get_disp_ea_020 (uae_u32 base, uae_u32 dp);
                    216: extern uae_u32 get_disp_ea_000 (uae_u32 base, uae_u32 dp);
1.1       root      217: 
1.1.1.9   root      218: extern uae_s32 ShowEA (FILE *, int reg, amodes mode, wordsizes size, char *buf);
1.1.1.2   root      219: 
1.1.1.4   root      220: extern void MakeSR (void);
                    221: extern void MakeFromSR (void);
                    222: extern void Exception (int, uaecptr);
                    223: extern void dump_counts (void);
1.1.1.8   root      224: extern int m68k_move2c (int, uae_u32 *);
                    225: extern int m68k_movec2 (int, uae_u32 *);
1.1.1.3   root      226: extern void m68k_divl (uae_u32, uae_u32, uae_u16, uaecptr);
                    227: extern void m68k_mull (uae_u32, uae_u32, uae_u16);
1.1       root      228: extern void init_m68k (void);
1.1.1.4   root      229: extern void m68k_go (int);
1.1.1.9   root      230: extern void m68k_dumpstate (FILE *, uaecptr *);
                    231: extern void m68k_disasm (FILE *, uaecptr, uaecptr *, int);
1.1.1.4   root      232: extern void m68k_reset (void);
1.1.1.2   root      233: 
1.1.1.3   root      234: extern void mmu_op (uae_u32, uae_u16);
1.1.1.16! root      235: extern void mmu_op30 (uaecptr, uae_u32, int, uaecptr);
1.1.1.2   root      236: 
1.1.1.3   root      237: extern void fpp_opp (uae_u32, uae_u16);
                    238: extern void fdbcc_opp (uae_u32, uae_u16);
                    239: extern void fscc_opp (uae_u32, uae_u16);
                    240: extern void ftrapcc_opp (uae_u32,uaecptr);
                    241: extern void fbcc_opp (uae_u32, uaecptr, uae_u32);
                    242: extern void fsave_opp (uae_u32);
                    243: extern void frestore_opp (uae_u32);
                    244: 
1.1.1.14  root      245: extern void exception3 (uae_u32 opcode, uaecptr addr, uaecptr fault);
                    246: extern void exception3i (uae_u32 opcode, uaecptr addr, uaecptr fault);
                    247: extern void exception2 (uaecptr addr, uaecptr fault);
                    248: extern void cpureset (void);
                    249: 
                    250: extern void fill_prefetch_slow (void);
1.1       root      251: 
1.1.1.2   root      252: #define CPU_OP_NAME(a) op ## a
                    253: 
1.1.1.16! root      254: /* 68060 */
        !           255: extern const struct cputbl op_smalltbl_0_ff[];
1.1.1.10  root      256: /* 68040 */
1.1.1.16! root      257: extern const struct cputbl op_smalltbl_1_ff[];
        !           258: /* 68030 */
        !           259: extern const struct cputbl op_smalltbl_2_ff[];
1.1.1.3   root      260: /* 68020 */
1.1.1.16! root      261: extern const struct cputbl op_smalltbl_3_ff[];
1.1.1.3   root      262: /* 68010 */
1.1.1.16! root      263: extern const struct cputbl op_smalltbl_4_ff[];
        !           264: /* 68000 - unused */
        !           265: #if 0
        !           266: extern const struct cputbl op_smalltbl_5_ff[];
        !           267: #endif
1.1.1.3   root      268: /* 68000 slow but compatible.  */
1.1.1.16! root      269: extern const struct cputbl op_smalltbl_6_ff[];
1.1.1.3   root      270: 
                    271: extern cpuop_func *cpufunctbl[65536] ASM_SYM_FOR_FUNC ("cpufunctbl");
1.1.1.2   root      272: 
1.1.1.11  root      273: #ifdef JIT
                    274: #else
                    275: #define flush_icache(X) do {} while (0)
                    276: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.