*** empty log message ***
[fw/sdcc] / sim / ucsim / xa.src / glob.h
1 /*
2  * Simulator of microcontrollers (glob.h)
3  *
4  * Copyright (C) 1999,99 Drotos Daniel, Talker Bt.
5  *
6  * To contact author send email to drdani@mazsola.iit.uni-miskolc.hu
7  * Other contributors include:
8  *   Karl Bongers karl@turbobit.com,
9  *   Johan Knol 
10  *
11  */
12
13 /* This file is part of microcontroller simulator: ucsim.
14
15 UCSIM is free software; you can redistribute it and/or modify
16 it under the terms of the GNU General Public License as published by
17 the Free Software Foundation; either version 2 of the License, or
18 (at your option) any later version.
19
20 UCSIM is distributed in the hope that it will be useful,
21 but WITHOUT ANY WARRANTY; without even the implied warranty of
22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 GNU General Public License for more details.
24
25 You should have received a copy of the GNU General Public License
26 along with UCSIM; see the file COPYING.  If not, write to the Free
27 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
28 02111-1307, USA. */
29 /*@1@*/
30
31 #ifndef GLOB_HEADER
32 #define GLOB_HEADER
33
34 #include "stypes.h"
35
36 /* this needs to match char *op_mnemonic_str[] definition in glob.cc */
37 enum {
38 BAD_OPCODE=0,
39 ADD,
40 ADDC,
41 SUB,
42 SUBB,
43 CMP,
44 AND,
45 OR,
46 XOR,
47 ADDS,
48 NEG,
49 SEXT,
50 MUL,
51 DIV_w,
52 DIV_d,
53 DIVU_b,
54 DIVU_w,
55 DIVU_d,
56 DA,
57 ASL,
58 ASR,
59 LEA,
60 CPL,
61 LSR,
62 NORM,
63 RL,
64 RLC,
65 RR,
66 RRC,
67 MOVS,
68 MOVC,
69 MOVX,
70 PUSH,
71 PUSHU,
72 POP,
73 POPU,
74 XCH,
75 SETB,
76 CLR,
77 MOV,
78 ANL,
79 ORL,
80 JMP,
81 CALL,
82 RET,
83 RETI,
84 BCC,
85 BCS,
86 BEQ,
87 BG,
88 BGE,
89 BGT,
90 BL,
91 BLE,
92 BLT,
93 BMI,
94 BNE,
95 BNV,
96 BOV,
97 BPL,
98 BR,
99 JB,
100 JBC,
101 JNB,
102 CJNE,
103 DJNZ,
104 JZ,
105 JNZ,
106 NOP,
107 BKPT,
108 TRAP,
109 RESET,
110 FCALL,
111 FJMP,
112 IREG,
113 };
114
115 extern char *op_mnemonic_str[];
116
117 /* this classifies the operands and is used in the dissassembly
118    to print the operands.  Its also used in the simulation to characterize
119    the op-code function.
120  */   
121 enum op_operands {
122    // the repeating parameter encoding for ADD, ADDC, SUB, SUBB, AND, XOR, ...
123   REG_REG         ,
124   REG_IREG        ,
125   IREG_REG        ,
126   REG_IREGOFF8    ,
127   IREGOFF8_REG    ,
128   REG_IREGOFF16   ,
129   IREGOFF16_REG   ,
130   REG_IREGINC     ,
131   IREGINC_REG     ,
132   DIRECT_REG      ,
133   REG_DIRECT      ,
134   REG_DATA8       ,
135   REG_DATA16      ,
136   IREG_DATA8      ,
137   IREG_DATA16     ,
138   IREGINC_DATA8   ,
139   IREGINC_DATA16  ,
140   IREGOFF8_DATA8  ,
141   IREGOFF8_DATA16 ,
142   IREGOFF16_DATA8 ,
143   IREGOFF16_DATA16,
144   DIRECT_DATA8    ,
145   DIRECT_DATA16   ,
146
147 // odd-ball ones
148   NO_OPERANDS,  // for NOP
149   C_BIT,
150   C_NOTBIT,
151   REG_DATA4,
152   IREG_DATA4,
153   IREGINC_DATA4,
154   IREGOFF8_DATA4,
155   IREGOFF16_DATA4,
156   DIRECT_DATA4,
157
158   REG_ALONE,
159   IREG_ALONE,
160   BIT_ALONE,
161   BIT_REL8,
162   DIRECT_ALONE,
163   RLIST,
164   ADDR24,
165   REG_REL8,
166   DIRECT_REL8,
167
168   REL8,
169   REL16,
170
171   REG_DIRECT_REL8,
172   REG_DATA8_REL8,
173   REG_DATA16_REL8,
174   IREG_DATA8_REL8,
175   IREG_DATA16_REL8
176
177 };
178
179 // table of dissassembled instructions
180 struct xa_dis_entry
181 {
182   uint  code, mask;
183   char  branch;
184   uchar length;
185   int mnemonic;
186   int operands;
187 };
188
189 extern struct dis_entry glob_disass_xa[];
190
191 extern struct xa_dis_entry disass_xa[];
192
193 #endif
194
195 /* End of xa.src/glob.h */