|
|
1.1 root 1: /*
2: Hatari
3: */
4:
5: extern short int PendingInterruptCount;
6: extern int SoundCycles;
7:
8:
9: /*extern unsigned long Regs[16+1];*/
10: /*extern unsigned short int SR,SR_Before;*/
11: /*extern unsigned long PC;*/
12: /*extern unsigned long *Reg_SuperSP,*Reg_UserSP;*/
13:
14: #ifndef UAESYSDEPS
15: #include "sysdeps.h"
16: #endif
17: #ifndef UAEMEMORY
18: #include "memory.h"
19: #endif
20: #ifndef UAENEWCPU
21: #include "newcpu.h"
22: #endif
23: #define Regs regs.regs /* Ouah - uggly hack - FIXME! */
24: #define SR regs.sr
25: #define PC regs.pc
26:
27:
28: /* Offset ST address to PC pointer: */
29: #define STRAM_ADDR(Var) ( (unsigned long)STRam+((unsigned long)Var&0x00ffffff) )
30:
31: /*-----------------------------------------------------------------------*/
32: /* Offsets from memory space program counter to immediate data(in wrong endian) */
33: #define IMM_BYTE SIZE_BYTE /* Byte offset */
34: #define IMM_WORD
35: #define IMM_LONG
36:
37: /*-----------------------------------------------------------------------*/
38: /* Set clock times for each instruction, see '68000 timing' pages for details */
39: /* NOTE All times are rounded up to nearest 4 cycles */
40: #define ROUND_CYCLES_TO4(var) (((int)(var)+3)&0xfffffffc)
41:
42: static inline void ADD_CYCLES(op,r,w)
43: {
44: PendingInterruptCount-= (op+3)&0xfffffffc;
45: SoundCycles += (op+3)&0xfffffffc;
46: }
47:
48:
49: //-----------------------------------------------------------------------
50: // Decode table structure offsets, see 'DecodeTable[]' MUST match 'decode.inc'
51: #define DECODE_CYCLES 0 // Cycles for this instruction, includes <ea> etc...
52: #define DECODE_FUNCTION 4 // Decode function to call
53: #define DECODE_EA 8 // <ea> Decode function
54: #define DECODE_1 12 // src/dest parameters
55: #define DECODE_2 16
56: #define DECODE_DISASS 20 // Disassembly function
57: #define SIZEOF_DECODE 8
58:
59: //-----------------------------------------------------------------------
60: #define PENDING_INTERRUPT_FLAG_MFP 0x0001 // 'PendingInterruptFlag' masks, MUST match 'decode.inc'
61: #define PENDING_INTERRUPT_FLAG_TRACE 0x0002
62: #define CLEAR_PENDING_INTERRUPT_FLAG_MFP 0xfffe
63: #define CLEAR_PENDING_INTERRUPT_FLAG_TRACE 0xfffd
64:
65: //-----------------------------------------------------------------------
66: #define INSTRUCTION_HISTORY_SIZE 8192 // MUST be ^2, and MUST match 'decode.inc'
67: #define INSTRUCTION_HISTORY_MASK (INSTRUCTION_HISTORY_SIZE-1)
68:
69: //-----------------------------------------------------------------------
70: #define NUM_BREAKPOINTS 8 // MUST match 'decode.inc'
71:
72: //-----------------------------------------------------------------------
73: // 68000 instruction emulation functions
74:
75: /*
76: extern unsigned char PCCodeTable_NZVC[4096];
77: extern unsigned char PCCodeTable_NZV_CX_SAME[4096];
78: extern unsigned long ShiftCycleTable_ByteWord[64];
79: extern unsigned long ShiftCycleTable_Long[64];
80: extern int InsPC;
81: extern BOOL bInSuperMode;
82: extern unsigned long StackSave;
83: extern unsigned long DecodeTable[65536*SIZEOF_DECODE];
84: extern unsigned long InstructionHistory[INSTRUCTION_HISTORY_SIZE];
85: extern int InstructionHistoryIndex;
86: extern unsigned long BreakPointInstruction;
87: extern unsigned long AddressBreakpoints[NUM_BREAKPOINTS];
88: extern unsigned long BreakOnAddress;
89: extern unsigned long CPUStopped;
90: */
91: extern unsigned long EmuCCode;
92: extern unsigned char STRam[16*1024*1024];
93: extern short int PendingInterruptFlag;
94: extern void *PendingInterruptFunction;
95: extern unsigned long STRamEnd;
96: extern unsigned long STRamEnd_BusErr;
97: extern unsigned long ExceptionVector;
98: extern unsigned long BusAddressLocation;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.