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

1.1       root        1:  /* 
                      2:   * UAE - The Un*x Amiga Emulator
                      3:   * 
                      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;
1.1.1.2 ! root       21: extern int may_run_compiled;
1.1       root       22: 
                     23: typedef void cpuop_func(ULONG) REGPARAM;
                     24: 
                     25: struct cputbl {
                     26:     cpuop_func *handler;
                     27:     int specific;
                     28:     UWORD opcode;
                     29: };
                     30: 
                     31: extern void op_illg(ULONG) REGPARAM;
                     32: 
1.1.1.2 ! root       33: typedef char flagtype;
1.1       root       34: 
                     35: /* Arrrghh.. */
                     36: 
                     37: #if defined(USE_COMPILER) && !defined(USE_POINTER)
                     38: #define USE_POINTER
                     39: #undef NEED_TO_DEBUG_BADLY
                     40: #endif
                     41: #if defined(NEED_TO_DEBUG_BADLY) && !defined(USE_POINTER)
                     42: #define USE_POINTER
                     43: #endif
                     44: 
                     45: extern struct regstruct 
                     46: {
1.1.1.2 ! root       47:     ULONG regs[16];
        !            48:     CPTR  usp,isp,msp;
1.1       root       49:     UWORD sr;
                     50:     flagtype t1;
                     51:     flagtype t0;
                     52:     flagtype s;
                     53:     flagtype m;
                     54:     flagtype x;
                     55:     flagtype stopped;
                     56:     int intmask;
                     57:     ULONG pc;
                     58: #ifdef USE_POINTER
                     59:     UBYTE *pc_p;
                     60:     UBYTE *pc_oldp;
                     61: #endif
                     62:     
                     63:     ULONG vbr,sfc,dfc;
                     64: 
                     65:     double fp[8];
                     66:     ULONG fpcr,fpsr,fpiar;
1.1.1.2 ! root       67: #ifdef USE_EXECLIB
        !            68:     volatile
        !            69: #endif
1.1       root       70:     ULONG spcflags;
1.1.1.2 ! root       71:     ULONG kick_mask;
1.1       root       72: } regs, lastint_regs;
                     73: 
1.1.1.2 ! root       74: #define m68k_dreg(r,num) ((r).regs[(num)])
        !            75: #define m68k_areg(r,num) ((r).regs[(num)+8])
1.1       root       76: 
                     77: #ifdef USE_POINTER
1.1.1.2 ! root       78: static __inline__ ULONG nextibyte(void)
1.1       root       79: {
1.1.1.2 ! root       80:     ULONG r = do_get_mem_byte(regs.pc_p+1);
        !            81:     regs.pc_p += 2;
        !            82:     return r;
        !            83: }
        !            84: 
        !            85: static __inline__ ULONG nextiword(void)
        !            86: {
        !            87:     ULONG r = do_get_mem_word((UWORD *)regs.pc_p);
1.1       root       88:     regs.pc_p += 2;
                     89:     return r;
                     90: }
                     91: 
                     92: static __inline__ ULONG nextilong(void)
                     93: {
1.1.1.2 ! root       94:     ULONG r = do_get_mem_long((ULONG *)regs.pc_p);
1.1       root       95:     regs.pc_p += 4;
                     96:     return r;
                     97: }
                     98: #else
                     99: 
1.1.1.2 ! root      100: static __inline__ ULONG nextibyte(void)
1.1       root      101: {
1.1.1.2 ! root      102:     ULONG r = get_byte(regs.pc+1);
        !           103:     regs.pc += 2;
        !           104:     return r;
        !           105: }
        !           106: 
        !           107: static __inline__ ULONG nextiword(void)
        !           108: {
        !           109:     ULONG r = get_aword(regs.pc);
1.1       root      110:     regs.pc += 2;
                    111:     return r;
                    112: }
                    113: 
                    114: static __inline__ ULONG nextilong(void)
                    115: {
                    116:     ULONG r = get_along(regs.pc);
                    117:     regs.pc += 4;
                    118:     return r;
                    119: }
                    120: 
                    121: #endif
                    122: 
                    123: #ifdef USE_POINTER
                    124: 
                    125: #if !defined(NEED_TO_DEBUG_BADLY) && !defined(USE_COMPILER)
                    126: static __inline__ void m68k_setpc(CPTR newpc)
                    127: {
                    128:     regs.pc_p = regs.pc_oldp = get_real_address(newpc);
1.1.1.2 ! root      129:     regs.pc = newpc;
        !           130: #if USER_PROGRAMS_BEHAVE > 0
        !           131:     if ((newpc & 0xF80000) != regs.kick_mask)
        !           132:        regs.spcflags |= SPCFLAG_MODE_CHANGE;
        !           133:     regs.kick_mask = newpc & 0xF80000;
        !           134: #endif
1.1       root      135: }
                    136: #else
                    137: extern void m68k_setpc(CPTR newpc);
                    138: #endif
                    139: 
                    140: static __inline__ CPTR m68k_getpc(void)
                    141: {
                    142:     return regs.pc + ((char *)regs.pc_p - (char *)regs.pc_oldp);
                    143: }
                    144: 
                    145: #else
                    146: 
                    147: static __inline__ void m68k_setpc(CPTR newpc)
                    148: {
                    149:     regs.pc = newpc;
                    150: }
                    151: 
                    152: static __inline__ CPTR m68k_getpc(void)
                    153: {
                    154:     return regs.pc;
                    155: }
                    156: #endif
                    157: 
                    158: #ifdef USE_COMPILER
                    159: extern void m68k_setpc_fast(CPTR newpc);
                    160: extern void m68k_setpc_bcc(CPTR newpc);
                    161: extern void m68k_setpc_rte(CPTR newpc);
                    162: #else
                    163: #define m68k_setpc_fast m68k_setpc
                    164: #define m68k_setpc_bcc  m68k_setpc
                    165: #define m68k_setpc_rte  m68k_setpc
                    166: #endif
                    167: 
                    168: static __inline__ void m68k_setstopped(int stop)
                    169: {
                    170:     regs.stopped = stop;
                    171:     if (stop)
                    172:        regs.spcflags |= SPCFLAG_STOP;
                    173: }
                    174: 
                    175: #if CPU_LEVEL > 1
                    176: static __inline__ ULONG get_disp_ea (ULONG base)
                    177: {
                    178:     UWORD dp = nextiword();
1.1.1.2 ! root      179:     int reg = (dp >> 12) & 15;
        !           180:     LONG regd = regs.regs[reg];
1.1       root      181:     if ((dp & 0x800) == 0)
                    182:        regd = (LONG)(WORD)regd;
                    183:     regd <<= (dp >> 9) & 3;
                    184:     if (dp & 0x100) {
                    185:        LONG outer = 0;
                    186:        if (dp & 0x80) base = 0;
                    187:        if (dp & 0x40) regd = 0;
                    188: 
                    189:        if ((dp & 0x30) == 0x20) base += (LONG)(WORD)nextiword();
                    190:        if ((dp & 0x30) == 0x30) base += nextilong();
                    191:        
                    192:        if ((dp & 0x3) == 0x2) outer = (LONG)(WORD)nextiword();
                    193:        if ((dp & 0x3) == 0x3) outer = nextilong();
                    194:        
                    195:        if ((dp & 0x4) == 0) base += regd;
                    196:        if (dp & 0x3) base = get_long (base);
                    197:        if (dp & 0x4) base += regd;
                    198:        
                    199:        return base + outer;
                    200:     } else {
                    201:        return base + (LONG)((BYTE)dp) + regd;
                    202:     }
                    203: }
                    204: #else
                    205: static __inline__ ULONG get_disp_ea (ULONG base)
                    206: {
                    207:     UWORD dp = nextiword();
1.1.1.2 ! root      208:     int reg = (dp >> 12) & 15;
        !           209:     LONG regd = regs.regs[reg];
1.1       root      210:     if ((dp & 0x800) == 0)
                    211:        regd = (LONG)(WORD)regd;
                    212:     return base + (BYTE)(dp) + regd;
                    213: }
                    214: #endif
                    215: 
1.1.1.2 ! root      216: extern LONG ShowEA(int reg, amodes mode, wordsizes size, char *buf);
        !           217: 
1.1       root      218: extern void MakeSR(void);
                    219: extern void MakeFromSR(void);
                    220: extern void Exception(int, CPTR);
                    221: extern void dump_counts(void);
                    222: extern void m68k_move2c(int, ULONG *);
                    223: extern void m68k_movec2(int, ULONG *);
                    224: extern void m68k_divl (ULONG, ULONG, UWORD, CPTR);
                    225: extern void m68k_mull (ULONG, ULONG, UWORD);
                    226: extern void init_m68k (void);
                    227: extern void m68k_go(int);
                    228: extern void m68k_dumpstate(CPTR *);
                    229: extern void m68k_disasm(CPTR,CPTR *,int);
                    230: extern void m68k_reset(void);
1.1.1.2 ! root      231: 
1.1       root      232: extern void mmu_op (ULONG, UWORD);
1.1.1.2 ! root      233: 
1.1       root      234: extern void fpp_opp (ULONG, UWORD);
                    235: extern void fdbcc_opp (ULONG, UWORD);
                    236: extern void fscc_opp (ULONG, UWORD);
                    237: extern void ftrapcc_opp (ULONG,CPTR);
                    238: extern void fbcc_opp (ULONG, CPTR, ULONG);
                    239: extern void fsave_opp (ULONG);
                    240: extern void frestore_opp (ULONG);
                    241: 
1.1.1.2 ! root      242: #ifdef MEMFUNCS_DIRECT_REQUESTED
        !           243: #define CPU_OP_NAME(a) op_direct ## a
        !           244: #else
        !           245: #define CPU_OP_NAME(a) op ## a
        !           246: #endif
        !           247: 
        !           248: extern struct cputbl op_smalltbl[];
        !           249: extern struct cputbl op_direct_smalltbl[];
        !           250: 
        !           251: #ifndef INTEL_FLAG_OPT
        !           252: extern cpuop_func *cpufunctbl[65536];
        !           253: #if USER_PROGRAMS_BEHAVE > 0
        !           254: extern cpuop_func *cpufunctbl_behaved[65536];
        !           255: #endif
        !           256: #else
        !           257: extern cpuop_func *cpufunctbl[65536] __asm__ ("cpufunctbl");
        !           258: #if USER_PROGRAMS_BEHAVE > 0
        !           259: extern cpuop_func *cpufunctbl_behaved[65536] __asm__ ("cpufunctbl_behaved");;
        !           260: #endif
        !           261: #endif

unix.superglobalmegacorp.com

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