Added upstream from http://ftp.icm.edu.pl/pub/loglan/
[loglan.git] / loglan96 / lcode / lcode
1 \r
2             OPCODES USED FOR FOURS GENERETED BY THE PART\r
3                OF SEMANTICAL ANALYZER OF CODE GENERATOR\r
4 \r
5     Opcodes were divided in relation to number of arguments, to which\r
6 they assign values (2,1,0) and then in each group in relation  to\r
7 number of arguments being addresses in symbol table.\r
8     The rest of not mentioned arguments are: \r
9 -- values of canstants represented by INTEGER,\r
10 -- numbers of REAL constants,\r
11 -- addresses of atributes after dot in IPMEM,\r
12 -- addresses of prototypes in IPMEM.\r
13 \r
14     Short forms:\r
15 -- AF - phisical address,\r
16 -- AV - virtual address.\r
17 \r
18  \r
19 \r
20 --------------returning two arguments\r
21 ----2 ARG.\r
22 1 OPENRC   A:=AV of new record    B:=AF   C=PROTOTYP(address in IPMEM)\r
23 2 BACK     A:=AV  B:=AF of record from which follow return\r
24 3 RAISE   open record of handler  A:=AH  B:=AF  C=number of signal\r
25 \r
26 ----3 ARG.\r
27 \r
28 4 OPEN     A:=AH  B:=AF of new record  C=prototype of genereted record\r
29 5 SLOPEN   A:=AH  B:=AF of new record  C=AV of father synthetizing prototype\r
30 \r
31 \r
32 ---------- returning one argument\r
33 ---- 1 ARG.\r
34 \r
35 11 CLEAR 1,2 words A:=0\r
36 12\r
37 13 take the value A from register B  B>0 means number of register  A:=reg\r
38                               B<0 means offset (negative) in relation to (R6)\r
39 15 THIS               A:=contents of DISPLAY (AV) for B  B=address in IPMEM\r
40 16 insert prototype   A:=number of prototype B   B=address in IPMEM\r
41 20 VIRT.DISPLAY       A:=prototype of virtual of number C from DISPLAY for B\r
42 21 insert static type A:=(B,C)  B:=constant<64  C=number of prototype\r
43 22 read formal type through DISPLAY A:=formal type   B=number in DISPLAY\r
44      (address of prototype in IPMEM) C=address of description of type in IPMEM\r
45 23 PARAMETR OUTPUT    A:=value of parameter( C=number of paremeter)\r
46                       for standard procedure B (it reads parameter.output or\r
47                       value of function for standard procedure)\r
48 \r
49 ---- 2 ARG.\r
50 \r
51 29 address of variable using "." operator  A:=address(B.C) (B-A0,C-offset)\r
52 30 address of visible variable   A:=address(B)\r
53 31 SIGN                          A:=SIGN(B)      (B - INTEGER or REAL)\r
54 32 add 1 to atribute             A:=B+1\r
55 33 lower from MEMBER             A:=LOWER(B)     B=AV\r
56 34 lower without MEMBER          A:=LOWER(B)     B=AV\r
57 35 upper from MEMBER             A:=UPPER(B)     B=AV\r
58 36 upper without MEMBER          A:=UPPER(B)     B=AV\r
59 37 add constant                  A:=B+C          C - constant INTEGER\r
60 38 MOVE & SAVE        substitute A:=B and store in working variable \r
61 39 add short const.              A:=B+C          C-short const.\r
62 40 read type of formal parameter A:=type of parameter of number C \r
63                                  B=AF of data record\r
64 41 COPY                          A:=COPY B\r
65 42 NOT                           A:=NOT B\r
66 43 take AV                       A:=AV reconstracted from B=AH\r
67 44 VIRT.DOT from MEMBER          A:=prototype of virtual  B=AV\r
68 45 VIRT.DOT bez MEMBER           A:=prototype of virtual without MEMBER\r
69 46 take AF from MEMBER           A:=AF from virtual B from MEMBER\r
70 47 take AF without MEMBER        A:=AF without MEMBER\r
71 48 ABS INTEGER                   A:=ABS(B)\r
72 49 MINUS UNARNY INTEGER          A:=-B\r
73 50 ABS REAL\r
74 51 MINUS UNARNY REAL\r
75 52 take AF of parameter          A:=AF   C=number of paramteter   B=AF of record\r
76 53 cyclic SHIFT towards left of constant      A:=ISHIFT(B,CONST.C)\r
77 54 find using SL-link formal type A:=formal type   B=AV or AH\r
78                                   C=address of type description in IPMEM\r
79 55 IS      A:=B IS C   B=AV   C=address of prototype in IPMEM\r
80 56 IN\r
81 57 QUA     A:=AF from AV B with control QUA C   C=addresd in IPMEM\r
82 58 IFIX    A:=IFIX(B)\r
83 59 FLOAT   A:=FLOAT(B)\r
84 60 MOVE    A:=B\r
85 61 read 1,2,3 words from AF       A:=(B)\r
86 62 read 1,2,3 words from AF       A:=(B) \r
87 63 read 1,2,3 words from AF       A:=(B)\r
88 64 multiplication by   2   A:=2*B\r
89 65 multiplication by   3   A:=3*B\r
90 66 multiplication by   4\r
91 67 multiplication by   5\r
92 68 multiplication by   6\r
93 69 multiplication by   7\r
94 70 multiplication by   8\r
95 71 multiplication by   9\r
96 72 multiplication by  10\r
97 73 division by 8   A:=B/8\r
98 74 division by 4\r
99 75 division by 2\r
100 76 EQ 0   comparision with zero   A:=B .EQ. 0    B-INTEGER or REAL\r
101 77 NE 0\r
102 78 LT 0\r
103 79 LE 0\r
104 80 GT 0\r
105 81 GE 0\r
106 82 NOT MEMBER   A:=B .EQ. NONE    B=AV\r
107 83 MEMBER       A:=B .NE. NONE\r
108 84 read 1,2,3 words from record  AF=B  offset=C    A:=B.C\r
109 85 ""\r
110 86 ""\r
111 87 modify type     A:=B+C   A,B - formal type (2 words)   C=short constant\r
112 88 EQ CONST         comparision with constant INTEGER   A:=B .EQ. C  C=constant\r
113 89 NE CONST         ""\r
114 90 LT CONST         ""\r
115 91 LE CONST         ""\r
116 92 GT CONST         ""\r
117 93 GE CONST         ""\r
118 94 EQ SHORT         comparision with short constant  A:=B .EQ. C  C=short constant\r
119 95 NE SHORT\r
120 96 LT SHORT\r
121 97 LE SHORT\r
122 98 GT SHORT\r
123 99 GE SHORT\r
124 \r
125 ----- 3 ARG.\r
126 \r
127 100 OR         A:=B OR C\r
128 101 AND\r
129 102 ARRAY with control of indexes, with MEMBER   A:=AF of element of array\r
130                                                  B=AV of array   C=ATS of index\r
131 103 ARRAY with control of indexes, without MEMBER  "" ""\r
132 104 ARRAY without control of indexes, with MEMBER\r
133 105 ARRAY without control of indexes, without MEMBER\r
134 106 EQ    comparision INTEGER    A:=B .EQ. C    B,C= ATS values of INTEGER\r
135 107 NE    "" ""\r
136 108 LT    "" ""\r
137 109 LE    "" ""\r
138 110 GT    "" ""\r
139 111 GE    "" ""\r
140 112 begin in 1 ARG    A:=B C   B=AV   C=number of prototype (insert to R1,R2,R3)\r
141 113 + INTEGER         A:=B+C\r
142 114 - INTEGER         A:=B-C\r
143 115 * INTEGER         A:=B*C\r
144 116 cyclic SHIFT towards left A:=ISHIFT(B,C)\r
145 117 DIVE INTEGER      A:=B DIVE C\r
146 118 MODE INTEGER      A:=B MODE C\r
147 119 + REAL\r
148 120 - REAL\r
149 121 * REAL\r
150 122 / REAL       A:=B/C\r
151 123 EQ REF       A:=B .EQ. C    B,C- virtual addresses\r
152 124 NE REF       A:=B .NE. C\r
153 125 EQ REAL      A:=B .EQ. C    B,C- arguments REAL (can be constant)\r
154 126 NE REAL      " " "\r
155 127 LT REAL      " " "\r
156 128 LE REAL      " " "\r
157 129 GT REAL      " " "\r
158 130 GE REAL      " " "\r
159 131 XOR          A:=B XOR C\r
160 \r
161 \r
162 ----------returning zero arguments\r
163 ---- 0 ARG.\r
164 132 CALL standard procedure  A=number of standard procedure/function\r
165 NOT IMPL - 133 return control to code written in asembler \r
166 \r
167 ---- 1 ARG.\r
168 \r
169 137 CLEAR 1 word from record which AF=A     A.B:=0\r
170 138 CLEAR 2 word from record which AF=A     A.B:=0\r
171 139 insert value of A to register B   B>0 means number of register\r
172                                     B<0 means offset(negative) regard to (R6)\r
173 140 NOP       null instruction with argument A\r
174 141 RELEASE   relase variable used for atrybute A (for  FOR)\r
175               (delete "alive" working variable)\r
176 143 KILL A   for blocks,procedures,functions,records,arrays                  \r
177 144 dynamic control of headers A=AV of calling module\r
178                                 B=number of parameter (function,procedure)\r
179 145 parameter INPUT   write value of A as a parameter of number C of\r
180                             standard procedure B\r
181 146 GKILL A          universal, with full control\r
182 147 CLEAR 1 word from  AF=A    (A):=0\r
183 148 CLEAR 2 words from AF=A    (A):=0\r
184 149 QUA TEST   check correctness A QUA B   A=AV   B=address in IPMEM\r
185 150 STYPE      check correctness of substitution L:=A B=type of L (address in IPMEM)\r
186 151 IF-FALSE   conditional jump   A=ATS   B=number of label\r
187 152 IF-TRUE    "  "  "\r
188 153 KILL AFTER RAISE    A=AV\r
189 158 CANCEL     cancel informations : value of atribute A in register\r
190 \r
191 ---- 2 ARG\r
192 159 GO      transmit control to record: A=AF   B=AH\r
193 160 GOLOCAL " " "                     for local without prefix\r
194 161 write 1 word  into AF   (A):=B\r
195 162 write 2 words into AF   (A):=B\r
196 163 write 3 words into AF   (A):=B\r
197 164 write 1 word  into record for which AF=A  offset=C  A.C:=B\r
198 165 write 2 words into record for which AF=A  offset=C  A.C:=B\r
199 166 write 3 words into record for which AF=A  offset=C  A.C:=B\r
200 \r
201 ----- 3 ARG.\r
202 \r
203 170 DTYPE check correctness of substitution L:=B A=type of L C=type ofB\r
204 \r
205 --------requesting special service  (172-176,178-194  end segment)\r
206 ---opcodes which end base block (exeptcion 177)\r
207 \r
208 172 TERMINATE\r
209 173 WIND        \r
210 174 LAST WILL LABEL\r
211 175 JUMP AT LAST WILL   A=number of prototype\r
212 176 forced end of base block (of segment for existing["alive"] variables)\r
213 177 beginig of instruction of number A\r
214 178 INNER A=level in prefix sequence\r
215 179 FIRST LABEL = enter point to module\r
216 180 BACKHD - return through RETURN from HANDLER\r
217 181 LABEL    A=number of label (for each module labels are numbered starting from 1)\r
218 182 JUMP      "  "  "\r
219 183 JUMP behind INNER   A=address of prefix in IPMEM\r
220 184 BEGIN    begining of module (A=address in IPMEM)\r
221 185 END    end of module\r
222 186 BLOCK A  open record for A (address in IPMEM),transfer control,kill\r
223 187 DETACH\r
224 188 ATTACH   A=current ATS\r
225 189 CASE     A=ATS of expression B=number label   C=SUM of opction C,F\r
226 190 ESAC     A=number of labels  B=base label     C=minimal label \r
227              and below A+1 numbers : range of labels and their descriptions\r
228 \r
229 ----- procedures R.S. (return from module)\r
230 \r
231 191 BACKBL\r
232 192 BACKPR\r
233 193 BACK\r
234 194 FIN\r
235 \r
236 -------- services of symbol table and ending mark\r
237 \r
238 195 MOVE & SAVE   A:=B enter working atrybute of number A and apetyte like for\r
239                   atrybute B and store in working variable\r
240                   (create A with apetyte like B and generate A:=B)\r
241 197 REAL CONST    rezervation of working atrubute contaning REAL constant\r
242                   A=number   B=index of constant\r
243 198 SHORT INT     rezervation of working atrubute contaning short constant\r
244                   A=number   B=value of constant\r
245 199 LONG INT      normal constant\r
246 200 ending mark of code\r
247 201 TSTEMP1 rezervation of working atrybute and apetyte 1\r
248             A=address in symbol table\r
249 202 TSTEMP2\r
250 203 TSTEMP3\r
251 204 TSTEMP4\r
252 205 TSINSE GLOBALY    enter description of declared atrybute in main block\r
253                       A=address in symbol table  B=address of atrybute\r
254 206 TSINSE POREDNI    atrybute from indirect module\r
255 207 TSINSE LOKALNY    local atrybute \r
256 208 TSTEMP LIVE       rezervation of working atrybute which address is A \r
257                       and apetyte 1.This atrybute is "alive" after quiting\r
258                       base block (for loop FOR) together with copying \r
259                       value of B (A:=B)\r
260 --------------------------------------------------------------------------\r
261 \ 1\ 1\ 1\ 1\r