351e6976dc50bc4ca5a29b5e2ee198b018fc28de
[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 POP,
71 XCH,
72 SETB,
73 CLR,
74 MOV,
75 ANL,
76 ORL,
77 BR,
78 JMP,
79 CALL,
80 RET,
81 Bcc,
82 BEQ,
83 JB,
84 JNB,
85 CJNE,
86 DJNZ,
87 JZ,
88 JNZ,
89 NOP,
90 BKPT,
91 TRAP,
92 RESET,
93 FCALL,
94 FJMP,
95 IREG,
96 };
97
98 extern char *op_mnemonic_str[];
99
100 /* this classifies the operands and is used in the dissassembly
101    to print the operands.  Its also used in the simulation to characterize
102    the op-code function.
103  */   
104 enum op_operands {
105    // the repeating parameter encoding for ADD, ADDC, SUB, SUBB, AND, XOR, ...
106   REG_REG         ,
107   REG_IREG        ,
108   IREG_REG        ,
109   REG_IREGOFF8    ,
110   IREGOFF8_REG    ,
111   REG_IREGOFF16   ,
112   IREGOFF16_REG   ,
113   REG_IREGINC     ,
114   IREGINC_REG     ,
115   DIRECT_REG      ,
116   REG_DIRECT      ,
117   REG_DATA8       ,
118   REG_DATA16      ,
119   IREG_DATA8      ,
120   IREG_DATA16     ,
121   IREGINC_DATA8   ,
122   IREGINC_DATA16  ,
123   IREGOFF8_DATA8  ,
124   IREGOFF8_DATA16 ,
125   IREGOFF16_DATA8 ,
126   IREGOFF16_DATA16,
127   DIRECT_DATA8    ,
128   DIRECT_DATA16   ,
129
130 // odd-ball ones
131   NO_OPERANDS,  // for NOP
132   C_BIT,
133   C_NOTBIT,
134   REG_DATA4,
135   IREG_DATA4,
136   IREGINC_DATA4,
137   IREGOFF8_DATA4,
138   IREGOFF16_DATA4,
139   DIRECT_DATA4,
140
141   REG_ALONE,
142   IREG_ALONE,
143   ADDR24,
144   REG_REL8,
145   DIRECT_REL8,
146
147   REL8,
148   REL16
149 };
150
151 // table of dissassembled instructions
152 struct xa_dis_entry
153 {
154   uint  code, mask;
155   char  branch;
156   uchar length;
157   int mnemonic;
158   int operands;
159 };
160
161 extern struct dis_entry glob_disass_xa[];
162
163 extern struct xa_dis_entry disass_xa[];
164
165 #endif
166
167 /* End of xa.src/glob.h */