File: instr.h

package info (click to toggle)
clif 0.93-9.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 4,228 kB
  • sloc: ansic: 31,464; yacc: 5,067; lex: 819; makefile: 383; sh: 48
file content (247 lines) | stat: -rw-r--r-- 3,926 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/*
    Clif - A C-like Interpreter Framework
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997 T. Hruz, L. Koren
    1998 L. Koren

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/
/*
 * instr.h
 *
 * Header of structures.
 * Defines size of virtual machine
 * instructions.
 */

#ifndef _INSTR_H
#define _INSTR_H

/*
 * No operand, only major
 */
struct OPERAND_0_ma
{
  int major;
};

/*
 * No operand, only major and minor.
 */
struct OPERAND_0_mi
{
  int major;
  int minor;
};

/*
 * One operand and major only.
 */
struct OPERAND_1_ma
{
  int major;
  char *adr;
};	

/*
 * One operand and major and minor.
 */
struct OPERAND_1_mi
{
  int major;
  int minor;
  char *adr;
};

/*
 * One operand (immediately integer) and major and minor.
 */
struct OPERAND_1_i
{
  int major;
  int minor;
  int num;
};

/*
 * One operand (immediately unsigned integer) and major and minor.
 */
struct OPERAND_1_ui
{
  int major;
  int minor;
  unsigned int num;
};

/*
 * One operand (immediately long integer) and major and minor.
 */
struct OPERAND_1_li
{
  int major;
  int minor;
  long int num;
};

/*
 * One operand (immediately long unsigned integer) and major and minor.
 */
struct OPERAND_1_lui
{
  int major;
  int minor;
  long unsigned int num;
};

/*
 * One operand (immediately short integer) and major and minor.
 */
struct OPERAND_1_si
{
  int major;
  int minor;
  short int num;
};

/*
 * One operand (immediately short unsigned integer) and major and minor.
 */
struct OPERAND_1_sui
{
  int major;
  int minor;
  short unsigned int num;
};

/*
 * One operand (immediately double) and major and minor.
 */
struct OPERAND_1_id
{
  int major;
  int minor;
  double num;
};

/*
 * One operand (immediately long double) and major and minor.
 */
struct OPERAND_1_ild
{
  int major;
  int minor;
  long double num;
};

/*
 * One operand (immediately float) and major and minor.
 */
struct OPERAND_1_if
{
  int major;
  int minor;
  float num;
};

/*
 * One operand (immediately char) and major and minor.
 */
struct OPERAND_1_ic
{
  int major;
  int minor;
  char num;
};

/*
 * One operand (immediately signed char) and major and minor.
 */
struct OPERAND_1_isc
{
  int major;
  int minor;
  signed char num;
};

/*
 * One operand (immediately unsigned char) and major and minor.
 */
struct OPERAND_1_iuc
{
  int major;
  int minor;
  unsigned char num;
};

/*
 * Arithmetic and logical instructions.
 */
#define	 ADD  10
#define	 SUB  11
#define	 MULT 12
#define	 DIV  13
#define	 MOD  14
#define	 OR   15
#define	 AND  16
#define	 ORB   17
#define	 ANDB  18
#define	 EQ   19
#define	 LO   20 
#define	 GR   21
#define	 LE   22
#define	 GE   23
#define	 NE  24
#define  NEG 45
#define  NOT 46
#define  SAL 47
#define  SAR 48
#define  XOR 49
#define  CVT 44

/*
 * Control instructions.
 */
#define	 JMP  25
#define	 JNZ  26
#define  JZ   27 
#define	 RET  28 
#define	 CALLi 29
#define  HALT 34
#define  STOP 35 
#define  INTER 50
#define  IRET 51

/*
 * I/O instructions.
 */
#define	 OUT  30
#define	 IN   31 
#define  MESS 36

/*
 * Instructions on stacks.
 */
#define  PUSHAI 32
#define  PUSHA 33
#define  MOV 37
#define  PUSH 38
#define  POP 39
#define  POPA 40
#define  POPAD 41
#define  PUSHAD 42
#define  CLRT 43
#define  XCHG 52

#endif /* _INSTR_H */