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

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: 
                      9: extern int areg_byteinc[];
                     10: extern int imm8_table[];
                     11: 
                     12: extern int movem_index1[256];
                     13: extern int movem_index2[256];
                     14: extern int movem_next[256];
                     15: 
                     16: extern int fpp_movem_index1[256];
                     17: extern int fpp_movem_index2[256];
                     18: extern int fpp_movem_next[256];
                     19: 
                     20: extern int broken_in;
                     21: 
1.1.1.4   root       22: typedef unsigned long cpuop_func (uae_u32) REGPARAM;
1.1       root       23: 
                     24: struct cputbl {
                     25:     cpuop_func *handler;
                     26:     int specific;
1.1.1.3   root       27:     uae_u16 opcode;
1.1       root       28: };
                     29: 
1.1.1.4   root       30: extern unsigned long op_illg (uae_u32) REGPARAM;
1.1       root       31: 
1.1.1.2   root       32: typedef char flagtype;
1.1       root       33: 
1.1.1.3   root       34: extern struct regstruct
1.1       root       35: {
1.1.1.3   root       36:     uae_u32 regs[16];
                     37:     uaecptr  usp,isp,msp;
                     38:     uae_u16 sr;
1.1       root       39:     flagtype t1;
                     40:     flagtype t0;
                     41:     flagtype s;
                     42:     flagtype m;
                     43:     flagtype x;
                     44:     flagtype stopped;
                     45:     int intmask;
1.1.1.3   root       46: 
                     47:     uae_u32 pc;
                     48:     uae_u8 *pc_p;
                     49:     uae_u8 *pc_oldp;
                     50: 
                     51:     uae_u32 vbr,sfc,dfc;
1.1       root       52: 
                     53:     double fp[8];
1.1.1.3   root       54:     uae_u32 fpcr,fpsr,fpiar;
                     55: 
                     56:     uae_u32 spcflags;
                     57:     uae_u32 kick_mask;
                     58: 
                     59:     /* Fellow sources say this is 4 longwords. That's impossible. It needs
                     60:      * to be at least a longword. The HRM has some cryptic comment about two
                     61:      * instructions being on the same longword boundary.
                     62:      * The way this is implemented now seems like a good compromise.
                     63:      */
                     64:     uae_u32 prefetch;
1.1       root       65: } regs, lastint_regs;
                     66: 
1.1.1.2   root       67: #define m68k_dreg(r,num) ((r).regs[(num)])
1.1.1.4   root       68: #define m68k_areg(r,num) (((r).regs + 8)[(num)])
1.1       root       69: 
1.1.1.3   root       70: #define get_ibyte(o) do_get_mem_byte((uae_u8 *)(regs.pc_p + (o) + 1))
                     71: #define get_iword(o) do_get_mem_word((uae_u16 *)(regs.pc_p + (o)))
                     72: #define get_ilong(o) do_get_mem_long((uae_u32 *)(regs.pc_p + (o)))
                     73: 
1.1.1.4   root       74: #ifdef HAVE_GET_WORD_UNSWAPPED
                     75: #define GET_OPCODE (do_get_mem_word_unswapped (regs.pc_p))
                     76: #else
                     77: #define GET_OPCODE (get_iword (0))
                     78: #endif
                     79: 
                     80: static __inline__ uae_u32 get_ibyte_prefetch (uae_s32 o)
1.1       root       81: {
1.1.1.3   root       82:     if (o > 3 || o < 0)
                     83:        return do_get_mem_byte((uae_u8 *)(regs.pc_p + o + 1));
                     84: 
                     85:     return do_get_mem_byte((uae_u8 *)(((uae_u8 *)&regs.prefetch) + o + 1));
1.1.1.2   root       86: }
1.1.1.4   root       87: static __inline__ uae_u32 get_iword_prefetch (uae_s32 o)
1.1.1.3   root       88: {
                     89:     if (o > 3 || o < 0)
                     90:        return do_get_mem_word((uae_u16 *)(regs.pc_p + o));
1.1.1.2   root       91: 
1.1.1.3   root       92:     return do_get_mem_word((uae_u16 *)(((uae_u8 *)&regs.prefetch) + o));
                     93: }
1.1.1.4   root       94: static __inline__ uae_u32 get_ilong_prefetch (uae_s32 o)
1.1.1.2   root       95: {
1.1.1.3   root       96:     if (o > 3 || o < 0)
                     97:        return do_get_mem_long((uae_u32 *)(regs.pc_p + o));
                     98:     if (o == 0)
                     99:        return do_get_mem_long(&regs.prefetch);
                    100:     return (do_get_mem_word (((uae_u16 *)&regs.prefetch) + 1) << 16) | do_get_mem_word ((uae_u16 *)(regs.pc_p + 4));
1.1       root      101: }
                    102: 
1.1.1.3   root      103: #define m68k_incpc(o) (regs.pc_p += (o))
                    104: 
1.1.1.4   root      105: static __inline__ void fill_prefetch_0 (void)
1.1       root      106: {
1.1.1.3   root      107:     uae_u32 r;
                    108: #ifdef UNALIGNED_PROFITABLE
                    109:     r = *(uae_u32 *)regs.pc_p;
                    110:     regs.prefetch = r;
                    111: #else
                    112:     r = do_get_mem_long ((uae_u32 *)regs.pc_p);
                    113:     do_put_mem_long (&regs.prefetch, r);
                    114: #endif
                    115: }
                    116: 
                    117: #if 0
1.1.1.4   root      118: static __inline__ void fill_prefetch_2 (void)
1.1.1.3   root      119: {
                    120:     uae_u32 r = do_get_mem_long (&regs.prefetch) << 16;
                    121:     uae_u32 r2 = do_get_mem_word (((uae_u16 *)regs.pc_p) + 1);
                    122:     r |= r2;
                    123:     do_put_mem_long (&regs.prefetch, r);
1.1       root      124: }
                    125: #else
1.1.1.3   root      126: #define fill_prefetch_2 fill_prefetch_0
                    127: #endif
1.1       root      128: 
1.1.1.3   root      129: /* These are only used by the 68020/68881 code, and therefore don't
                    130:  * need to handle prefetch.  */
1.1.1.4   root      131: static __inline__ uae_u32 next_ibyte (void)
1.1       root      132: {
1.1.1.4   root      133:     uae_u32 r = get_ibyte (0);
                    134:     m68k_incpc (2);
1.1.1.2   root      135:     return r;
                    136: }
                    137: 
1.1.1.4   root      138: static __inline__ uae_u32 next_iword (void)
1.1.1.2   root      139: {
1.1.1.4   root      140:     uae_u32 r = get_iword (0);
                    141:     m68k_incpc (2);
1.1       root      142:     return r;
                    143: }
                    144: 
1.1.1.4   root      145: static __inline__ uae_u32 next_ilong (void)
1.1       root      146: {
1.1.1.4   root      147:     uae_u32 r = get_ilong (0);
                    148:     m68k_incpc (4);
1.1       root      149:     return r;
                    150: }
                    151: 
1.1.1.4   root      152: #if !defined USE_COMPILER
                    153: static __inline__ void m68k_setpc (uaecptr newpc)
1.1       root      154: {
                    155:     regs.pc_p = regs.pc_oldp = get_real_address(newpc);
1.1.1.2   root      156:     regs.pc = newpc;
1.1       root      157: }
                    158: #else
1.1.1.4   root      159: extern void m68k_setpc (uaecptr newpc);
1.1       root      160: #endif
                    161: 
1.1.1.4   root      162: static __inline__ uaecptr m68k_getpc (void)
1.1       root      163: {
                    164:     return regs.pc + ((char *)regs.pc_p - (char *)regs.pc_oldp);
                    165: }
                    166: 
1.1.1.4   root      167: static __inline__ uaecptr m68k_getpc_p (uae_u8 *p)
                    168: {
                    169:     return regs.pc + ((char *)p - (char *)regs.pc_oldp);
                    170: }
                    171: 
1.1       root      172: #ifdef USE_COMPILER
1.1.1.4   root      173: extern void m68k_setpc_fast (uaecptr newpc);
                    174: extern void m68k_setpc_bcc (uaecptr newpc);
                    175: extern void m68k_setpc_rte (uaecptr newpc);
1.1       root      176: #else
                    177: #define m68k_setpc_fast m68k_setpc
                    178: #define m68k_setpc_bcc  m68k_setpc
                    179: #define m68k_setpc_rte  m68k_setpc
                    180: #endif
                    181: 
1.1.1.4   root      182: static __inline__ void m68k_setstopped (int stop)
1.1       root      183: {
                    184:     regs.stopped = stop;
                    185:     if (stop)
                    186:        regs.spcflags |= SPCFLAG_STOP;
                    187: }
                    188: 
1.1.1.5 ! root      189: extern uae_u32 get_disp_ea_020 (uae_u32 base, uae_u32 dp);
        !           190: extern uae_u32 get_disp_ea_000 (uae_u32 base, uae_u32 dp);
1.1       root      191: 
1.1.1.4   root      192: extern uae_s32 ShowEA (int reg, amodes mode, wordsizes size, char *buf);
1.1.1.2   root      193: 
1.1.1.4   root      194: extern void MakeSR (void);
                    195: extern void MakeFromSR (void);
                    196: extern void Exception (int, uaecptr);
                    197: extern void dump_counts (void);
                    198: extern void m68k_move2c (int, uae_u32 *);
                    199: extern void m68k_movec2 (int, uae_u32 *);
1.1.1.3   root      200: extern void m68k_divl (uae_u32, uae_u32, uae_u16, uaecptr);
                    201: extern void m68k_mull (uae_u32, uae_u32, uae_u16);
1.1       root      202: extern void init_m68k (void);
1.1.1.4   root      203: extern void m68k_go (int);
                    204: extern void m68k_dumpstate (uaecptr *);
                    205: extern void m68k_disasm (uaecptr, uaecptr *, int);
                    206: extern void m68k_reset (void);
1.1.1.2   root      207: 
1.1.1.3   root      208: extern void mmu_op (uae_u32, uae_u16);
1.1.1.2   root      209: 
1.1.1.3   root      210: extern void fpp_opp (uae_u32, uae_u16);
                    211: extern void fdbcc_opp (uae_u32, uae_u16);
                    212: extern void fscc_opp (uae_u32, uae_u16);
                    213: extern void ftrapcc_opp (uae_u32,uaecptr);
                    214: extern void fbcc_opp (uae_u32, uaecptr, uae_u32);
                    215: extern void fsave_opp (uae_u32);
                    216: extern void frestore_opp (uae_u32);
                    217: 
                    218: /* Opcode of faulting instruction */
                    219: extern uae_u16 last_op_for_exception_3;
                    220: /* PC at fault time */
                    221: extern uaecptr last_addr_for_exception_3;
                    222: /* Address that generated the exception */
                    223: extern uaecptr last_fault_for_exception_3;
1.1       root      224: 
1.1.1.2   root      225: #define CPU_OP_NAME(a) op ## a
                    226: 
1.1.1.3   root      227: /* 68020 + 68881 */
                    228: extern struct cputbl op_smalltbl_0[];
                    229: /* 68020 */
                    230: extern struct cputbl op_smalltbl_1[];
                    231: /* 68010 */
                    232: extern struct cputbl op_smalltbl_2[];
                    233: /* 68000 */
                    234: extern struct cputbl op_smalltbl_3[];
                    235: /* 68000 slow but compatible.  */
                    236: extern struct cputbl op_smalltbl_4[];
                    237: 
                    238: extern cpuop_func *cpufunctbl[65536] ASM_SYM_FOR_FUNC ("cpufunctbl");
1.1.1.2   root      239: 

unix.superglobalmegacorp.com

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