Annotation of previous_trunk/src/includes/m68000.h, revision 1.1.1.1

1.1       root        1: /*
                      2:   Hatari - m68000.h
                      3: 
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   your option any later version. Read the file gpl.txt for details.
                      6: */
                      7: 
                      8: /* 2007/11/10  [NP]    Add pairing for lsr / dbcc (and all variants    */
                      9: /*                     working on register, not on memory).            */
                     10: /* 2008/01/07  [NP]    Use PairingArray to store all valid pairing     */
                     11: /*                     combinations (in m68000.c)                      */
                     12: /* 2010/04/05  [NP]    Rework the pairing code to take BusCyclePenalty */
                     13: /*                     into account when using d8(an,ix).              */
                     14: /* 2010/05/07  [NP]    Add BusCyclePenalty to LastInstrCycles to detect*/
                     15: /*                     a possible pairing between add.l (a5,d1.w),d0   */
                     16: /*                     and move.b 7(a5,d1.w),d5.                       */
                     17: 
                     18: 
                     19: #ifndef HATARI_M68000_H
                     20: #define HATARI_M68000_H
                     21: 
                     22: #ifdef __cplusplus
                     23: extern "C" {
                     24: #endif /* __cplusplus */
                     25:     
                     26: #include "sysdeps.h"
                     27: #include "memory.h"
                     28: #include "newcpu.h"     /* for regs */
                     29: #include "cycInt.h"
                     30: #include "log.h"
                     31: #include "host.h"
                     32: #include "configuration.h"
                     33: 
                     34: /* 68000 Register defines */
                     35: enum {
                     36:   REG_D0,    /* D0.. */
                     37:   REG_D1,
                     38:   REG_D2,
                     39:   REG_D3,
                     40:   REG_D4,
                     41:   REG_D5,
                     42:   REG_D6,
                     43:   REG_D7,    /* ..D7 */
                     44:   REG_A0,    /* A0.. */
                     45:   REG_A1,
                     46:   REG_A2,
                     47:   REG_A3,
                     48:   REG_A4,
                     49:   REG_A5,
                     50:   REG_A6,
                     51:   REG_A7,    /* ..A7 (also SP) */
                     52: };
                     53: 
                     54: /* 68000 Condition code's */
                     55: #define SR_AUX              0x0010
                     56: #define SR_NEG              0x0008
                     57: #define SR_ZERO             0x0004
                     58: #define SR_OVERFLOW         0x0002
                     59: #define SR_CARRY            0x0001
                     60: 
                     61: #define SR_CLEAR_AUX        0xffef
                     62: #define SR_CLEAR_NEG        0xfff7
                     63: #define SR_CLEAR_ZERO       0xfffb
                     64: #define SR_CLEAR_OVERFLOW   0xfffd
                     65: #define SR_CLEAR_CARRY      0xfffe
                     66: 
                     67: #define SR_CCODE_MASK       (SR_AUX|SR_NEG|SR_ZERO|SR_OVERFLOW|SR_CARRY)
                     68: #define SR_MASK             0xFFE0
                     69: 
                     70: #define SR_TRACEMODE        0x8000
                     71: #define SR_SUPERMODE        0x2000
                     72: #define SR_IPL              0x0700
                     73: 
                     74: #define SR_CLEAR_IPL        0xf8ff
                     75: #define SR_CLEAR_TRACEMODE  0x7fff
                     76: #define SR_CLEAR_SUPERMODE  0xdfff
                     77: 
                     78: /* Exception vectors */
                     79: #define  EXCEPTION_BUSERROR   0x00000008
                     80: #define  EXCEPTION_ADDRERROR  0x0000000c
                     81: #define  EXCEPTION_ILLEGALINS 0x00000010
                     82: #define  EXCEPTION_DIVZERO    0x00000014
                     83: #define  EXCEPTION_CHK        0x00000018
                     84: #define  EXCEPTION_TRAPV      0x0000001c
                     85: #define  EXCEPTION_TRACE      0x00000024
                     86: #define  EXCEPTION_LINE_A     0x00000028
                     87: #define  EXCEPTION_LINE_F     0x0000002c
                     88: #define  EXCEPTION_TRAP0      0x00000080
                     89: #define  EXCEPTION_TRAP1      0x00000084
                     90: #define  EXCEPTION_TRAP2      0x00000088
                     91: #define  EXCEPTION_TRAP13     0x000000B4
                     92: #define  EXCEPTION_TRAP14     0x000000B8
                     93: 
                     94: 
                     95: /* Size of 68000 instructions */
                     96: #define MAX_68000_INSTRUCTION_SIZE  10  /* Longest 68000 instruction is 10 bytes(6+4) */
                     97: #define MIN_68000_INSTRUCTION_SIZE  2   /* Smallest 68000 instruction is 2 bytes(ie NOP) */
                     98: 
                     99: /* Illegal Opcode used to help emulation. eg. free entries are 8 to 15 inc' */
                    100: #define  GEMDOS_OPCODE        8  /* Free op-code to intercept GemDOS trap */
                    101: #define  SYSINIT_OPCODE      10  /* Free op-code to initialize system (connected drives etc.) */
                    102: #define  VDI_OPCODE          12  /* Free op-code to call VDI handlers AFTER Trap#2 */
                    103: 
                    104: 
                    105: 
                    106: /* Ugly hacks to adapt the main code to the different CPU cores: */
                    107: 
                    108: #define Regs regs.regs
                    109: 
                    110: # define M68000_GetPC()     m68k_getpc()
                    111: # define M68000_SetPC(val)  m68k_setpc(val)
                    112: 
                    113: static inline Uint16 M68000_GetSR(void)
                    114: {
                    115:        MakeSR();
                    116:        return regs.sr;
                    117: }
                    118: static inline void M68000_SetSR(Uint16 v)
                    119: {
                    120:        regs.sr = v;
                    121:        MakeFromSR();
                    122: }
                    123: 
                    124: # define M68000_SetSpecial(flags)   set_special(flags)
                    125: # define M68000_UnsetSpecial(flags) unset_special(flags)
                    126: 
                    127: 
                    128: /* bus error mode */
                    129: #define BUS_ERROR_WRITE 0
                    130: #define BUS_ERROR_READ 1
                    131: 
                    132: 
                    133: /* bus access mode */
                    134: #define        BUS_MODE_CPU            0                       /* bus is owned by the cpu */
                    135: #define        BUS_MODE_BLITTER        1                       /* bus is owned by the blitter */
                    136: 
                    137: 
                    138: extern Uint32 BusErrorAddress;
                    139: extern Uint32 BusErrorPC;
                    140: extern bool bBusErrorReadWrite;
                    141: extern int BusMode;
                    142: 
                    143: extern int     LastOpcodeFamily;
                    144: extern int     LastInstrCycles;
                    145: extern int     Pairing;
                    146: extern char    PairingArray[ MAX_OPCODE_FAMILY ][ MAX_OPCODE_FAMILY ];
                    147: extern const char *OpcodeName[];
                    148: 
                    149: 
                    150: /*-----------------------------------------------------------------------*/
                    151: /**
                    152:  * Add CPU cycles.
                    153:  */
                    154: static inline void M68000_AddCycles(int cycles) {
                    155:     nCyclesOver += cycles;
                    156:     
                    157:     if(PendingInterrupt.type == CYC_INT_CPU)
                    158:         PendingInterrupt.time -= cycles;
                    159: 
                    160:     if(usCheckCycles < 0) {
                    161:         if(!(CycInt_SetNewInterruptUs())) {
                    162:             usCheckCycles = 100 * ConfigureParams.System.nCpuFreq;
                    163:         }
                    164:     } else
                    165:         usCheckCycles -= cycles;
                    166:     nCyclesMainCounter += cycles;
                    167: }
                    168: 
                    169: void M68000_Init(void);
                    170: void M68000_Reset(bool bCold);
                    171: void M68000_Stop(void);
                    172: void M68000_Start(void);
                    173: void M68000_CheckCpuSettings(void);
                    174: void M68000_BusError(Uint32 addr, bool bReadWrite);
                    175: void M68000_Exception(Uint32 ExceptionVector , int ExceptionSource);
                    176: 
                    177: #ifdef __cplusplus
                    178: }
                    179: #endif /* __cplusplus */
                    180:         
                    181: #endif

unix.superglobalmegacorp.com

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