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