b8a4284e6c26b36d206286bb80219b81a2d98212
[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
36 #if 0
37 enum {
38   REG,
39   IND_REG,
40   IND_REG_PLUS,
41   IND_REG_OFFSET,
42   DIRECT,
43   DATA8,
44   DATA16
45 };
46 #endif
47
48 enum {
49 BAD_OPCODE=0,
50 ADD,
51 ADDC,
52 SUB,
53 SUBB,
54 CMP,
55 AND,
56 OR,
57 XOR,
58 ADDS,
59 NEG,
60 SEXT,
61 MUL,
62 DIV_w,
63 DIV_d,
64 DIVU_b,
65 DIVU_w,
66 DIVU_d,
67 DA,
68 ASL,
69 ASR,
70 LEA,
71 CPL,
72 LSR,
73 NORM,
74 RL,
75 RLC,
76 RR,
77 RRC,
78 MOVS,
79 MOVC,
80 MOVX,
81 PUSH,
82 POP,
83 XCH,
84 SETB,
85 CLR,
86 MOV,
87 ANL,
88 ORL,
89 BR,
90 JMP,
91 CALL,
92 RET,
93 Bcc,
94 BEQ,
95 JB,
96 JNB,
97 CJNE,
98 DJNZ,
99 JZ,
100 JNZ,
101 NOP,
102 BKPT,
103 TRAP,
104 RESET,
105 FCALL,
106 FJMP,
107 };
108
109 extern char *op_mnemonic_str[];
110
111 enum op_operands {
112    // the repeating common parameter encoding for ADD, ADDC, SUB, AND...
113   REG_REG         ,
114   REG_IREG        ,
115   IREG_REG        ,
116   REG_IREGOFF8    ,
117   IREGOFF8_REG    ,
118   REG_IREGOFF16   ,
119   IREGOFF16_REG   ,
120   REG_IREGINC     ,
121   IREGINC_REG     ,
122   DIRECT_REG      ,
123   REG_DIRECT      ,
124   REG_DATA8       ,
125   REG_DATA16      ,
126   IREG_DATA8      ,
127   IREG_DATA16     ,
128   IREGINC_DATA8   ,
129   IREGINC_DATA16  ,
130   IREGOFF8_DATA8  ,
131   IREGOFF8_DATA16 ,
132   IREGOFF16_DATA8 ,
133   IREGOFF16_DATA16,
134   DIRECT_DATA8    ,
135   DIRECT_DATA16   ,
136
137 // odd-ball ones
138   NO_OPERANDS,  // for NOP
139   C_BIT,
140   C_NOTBIT,
141   REG_DATA4,
142   IREG_DATA4,
143   IREGINC_DATA4,
144   IREGOFF8_DATA4,
145   IREGOFF16_DATA4,
146   DIRECT_DATA4,
147
148   REG_ALONE,
149   IREG_ALONE,
150   ADDR24,
151   REG_REL8,
152   DIRECT_REL8,
153
154   REL8,
155   REL16,
156 };
157
158 // table of dissassembled instructions
159 struct xa_dis_entry
160 {
161   uint  code, mask;
162   char  branch;
163   uchar length;
164 //  enum op_mnemonic mnemonic;
165 //  enum op_operands operands;
166   int mnemonic;
167   int operands;
168 };
169
170 extern struct dis_entry glob_disass_xa[];
171
172 extern struct xa_dis_entry disass_xa[];
173
174 #endif
175
176 /* End of xa.src/glob.h */