working
[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 JB,
95 JNB,
96 CJNE,
97 DJNZ,
98 JZ,
99 JNZ,
100 NOP,
101 BKPT,
102 TRAP,
103 RESET,
104 FCALL,
105 FJMP,
106 };
107
108 extern char *op_mnemonic_str[];
109
110 enum op_operands {
111    // the repeating common parameter encoding for ADD, ADDC, SUB, AND...
112   REG_REG         ,
113   REG_IREG        ,
114   IREG_REG        ,
115   REG_IREGOFF8    ,
116   IREGOFF8_REG    ,
117   REG_IREGOFF16   ,
118   IREGOFF16_REG   ,
119   REG_IREGINC     ,
120   IREGINC_REG     ,
121   DIRECT_REG      ,
122   REG_DIRECT      ,
123   REG_DATA8       ,
124   REG_DATA16      ,
125   IREG_DATA8      ,
126   IREG_DATA16     ,
127   IREGINC_DATA8   ,
128   IREGINC_DATA16  ,
129   IREGOFF8_DATA8  ,
130   IREGOFF8_DATA16 ,
131   IREGOFF16_DATA8 ,
132   IREGOFF16_DATA16,
133   DIRECT_DATA8    ,
134   DIRECT_DATA16   ,
135
136 // odd-ball ones
137   NO_OPERANDS,  // for NOP
138   C_BIT,
139   NOTC_BIT,
140   REG_DATA4,
141   IREG_DATA4,
142   IREGINC_DATA4,
143   IREGOFF8_DATA4,
144   IREGOFF16_DATA4,
145   DIRECT_DATA4,
146
147   REG_ALONE,
148   ADDR24,
149   REG_REL8,
150   DIRECT_REL8
151 };
152
153 // table of dissassembled instructions
154 struct xa_dis_entry
155 {
156   uint  code, mask;
157   char  branch;
158   uchar length;
159 //  enum op_mnemonic mnemonic;
160 //  enum op_operands operands;
161   int mnemonic;
162   int operands;
163 };
164
165 extern struct dis_entry glob_disass_xa[];
166
167 extern struct xa_dis_entry disass_xa[];
168
169 #endif
170
171 /* End of xa.src/glob.h */