6003a768 |
1 | \r |
619b1824 |
2 | // This file is part of the Cyclone 68000 Emulator\r |
3 | \r |
d9d77995 |
4 | // Copyright (c) 2004,2011 FinalDave (emudave (at) gmail.com)\r |
5 | // Copyright (c) 2005-2011 GraÅžvydas "notaz" Ignotas (notasas (at) gmail.com)\r |
c41b9b97 |
6 | \r |
619b1824 |
7 | // This code is licensed under the GNU General Public License version 2.0 and the MAME License.\r |
8 | // You can choose the license that has the most advantages for you.\r |
9 | \r |
10 | // SVN repository can be found at http://code.google.com/p/cyclone68000/\r |
11 | \r |
d9d77995 |
12 | \r |
6003a768 |
13 | #include <stdio.h>\r |
14 | #include <stdarg.h>\r |
15 | #include <stdlib.h>\r |
16 | #include <string.h>\r |
17 | \r |
d9d77995 |
18 | #ifndef CONFIG_FILE\r |
19 | #define CONFIG_FILE "config.h"\r |
20 | #endif\r |
21 | #include CONFIG_FILE\r |
22 | \r |
6003a768 |
23 | // Disa.c\r |
d9d77995 |
24 | #include "Disa/Disa.h"\r |
6003a768 |
25 | \r |
26 | // Ea.cpp\r |
65044ba9 |
27 | enum EaRWType {\r |
28 | earwt_sign_extend = 1,\r |
29 | earwt_zero_extend,\r |
30 | earwt_shifted_up,\r |
31 | earwt_msb_dont_care,\r |
32 | };\r |
33 | \r |
d9d77995 |
34 | extern int earead_check_addrerr;\r |
35 | extern int eawrite_check_addrerr;\r |
36 | extern int g_jmp_cycle_table[];\r |
37 | extern int g_jsr_cycle_table[];\r |
38 | extern int g_lea_cycle_table[];\r |
39 | extern int g_pea_cycle_table[];\r |
40 | extern int g_movem_cycle_table[];\r |
41 | int Ea_add_ns(int *tab, int ea); // add nonstandard EA cycles\r |
65044ba9 |
42 | int EaCalc(int a,int mask,int ea,int size,EaRWType type=earwt_sign_extend); // 6\r |
43 | int EaRead(int a,int v,int ea,int size,int mask,EaRWType type=earwt_sign_extend,int set_nz=0); // 8\r |
44 | int EaCalcRead(int r_ea,int r,int ea,int size,int mask,EaRWType type=earwt_sign_extend,int set_nz=0); // 7\r |
6003a768 |
45 | int EaCanRead(int ea,int size);\r |
65044ba9 |
46 | int EaWrite(int a,int v,int ea,int size,int mask,EaRWType type=earwt_sign_extend);\r |
6003a768 |
47 | int EaCanWrite(int ea);\r |
d9d77995 |
48 | int EaAn(int ea);\r |
6003a768 |
49 | \r |
50 | // Main.cpp\r |
d9d77995 |
51 | extern int *CyJump; // Jump table\r |
52 | extern int ms; // If non-zero, output in Microsoft ARMASM format\r |
53 | extern const char * const Narm[4]; // Normal ARM Extensions for operand sizes 0,1,2\r |
54 | extern const char * const Sarm[4]; // Sign-extend ARM Extensions for operand sizes 0,1,2\r |
55 | extern int Cycles; // Current cycles for opcode\r |
56 | extern int pc_dirty; // something changed PC during processing\r |
57 | extern int arm_op_count; // for stats\r |
c30e2e2d |
58 | void ot(const char *format, ...);\r |
6003a768 |
59 | void ltorg();\r |
d9d77995 |
60 | int MemHandler(int type,int size,int addrreg=0,int need_addrerr_check=1);\r |
61 | void FlushPC(void);\r |
6003a768 |
62 | \r |
63 | // OpAny.cpp\r |
d9d77995 |
64 | extern int g_op;\r |
65 | extern int opend_op_changes_cycles, opend_check_interrupt, opend_check_trace;\r |
66 | int OpGetFlags(int subtract,int xbit,int sprecialz=0);\r |
3504ce94 |
67 | void OpGetFlagsNZ(int rd);\r |
6003a768 |
68 | void OpUse(int op,int use);\r |
d9d77995 |
69 | void OpStart(int op,int sea=0,int tea=0,int op_changes_cycles=0,int supervisor_check=0);\r |
70 | void OpEnd(int sea=0,int tea=0);\r |
71 | int OpBase(int op,int size,int sepa=0);\r |
6003a768 |
72 | void OpAny(int op);\r |
73 | \r |
74 | //----------------------\r |
75 | // OpArith.cpp\r |
76 | int OpArith(int op);\r |
77 | int OpLea(int op);\r |
78 | int OpAddq(int op);\r |
79 | int OpArithReg(int op);\r |
80 | int OpMul(int op);\r |
81 | int OpAbcd(int op);\r |
d9d77995 |
82 | int OpNbcd(int op);\r |
6003a768 |
83 | int OpAritha(int op);\r |
84 | int OpAddx(int op);\r |
85 | int OpCmpEor(int op);\r |
d9d77995 |
86 | int OpCmpm(int op);\r |
87 | int OpChk(int op);\r |
88 | int GetXBit(int subtract);\r |
6003a768 |
89 | \r |
90 | // OpBranch.cpp\r |
91 | void OpPush32();\r |
92 | void OpPushSr(int high);\r |
93 | int OpTrap(int op);\r |
94 | int OpLink(int op);\r |
95 | int OpUnlk(int op);\r |
96 | int Op4E70(int op);\r |
97 | int OpJsr(int op);\r |
98 | int OpBranch(int op);\r |
99 | int OpDbra(int op);\r |
100 | \r |
101 | // OpLogic.cpp\r |
102 | int OpBtstReg(int op);\r |
103 | int OpBtstImm(int op);\r |
104 | int OpNeg(int op);\r |
105 | int OpSwap(int op);\r |
106 | int OpTst(int op);\r |
107 | int OpExt(int op);\r |
108 | int OpSet(int op);\r |
109 | int OpAsr(int op);\r |
110 | int OpAsrEa(int op);\r |
d9d77995 |
111 | int OpTas(int op, int gen_special=0);\r |
cfe17eee |
112 | const char *TestCond(int m68k_cc, int invert=0);\r |
6003a768 |
113 | \r |
114 | // OpMove.cpp\r |
115 | int OpMove(int op);\r |
116 | int OpLea(int op);\r |
117 | void OpFlagsToReg(int high);\r |
d9d77995 |
118 | void OpRegToFlags(int high,int srh_reg=0);\r |
6003a768 |
119 | int OpMoveSr(int op);\r |
120 | int OpArithSr(int op);\r |
121 | int OpPea(int op);\r |
122 | int OpMovem(int op);\r |
123 | int OpMoveq(int op);\r |
124 | int OpMoveUsp(int op);\r |
125 | int OpExg(int op);\r |
d9d77995 |
126 | int OpMovep(int op);\r |
127 | int OpStopReset(int op);\r |
128 | void SuperEnd(void);\r |
129 | void SuperChange(int op,int srh_reg=-1);\r |
130 | \r |