aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-23 17:53:34 +0200
committerBad Diode <bd@badd10de.dev>2021-05-23 17:53:34 +0200
commitc0f6187b99a1d82db71616ec67286b295cc27636 (patch)
treecf50b75fa11ffb02d184d2e8641f3fde5588798e /src
parent0a3831824a4e93825c5b939f406545eead622fbe (diff)
downloaduxngba-c0f6187b99a1d82db71616ec67286b295cc27636.tar.gz
uxngba-c0f6187b99a1d82db71616ec67286b295cc27636.zip
Update uxn opcodes to latest version
Diffstat (limited to 'src')
-rw-r--r--src/uxn/roms/automata.rombin255 -> 0 bytes
-rw-r--r--src/uxn/uxn.c5662
2 files changed, 2925 insertions, 2737 deletions
diff --git a/src/uxn/roms/automata.rom b/src/uxn/roms/automata.rom
deleted file mode 100644
index 57c505c..0000000
--- a/src/uxn/roms/automata.rom
+++ /dev/null
Binary files differ
diff --git a/src/uxn/uxn.c b/src/uxn/uxn.c
index 2b541d1..d6da3b9 100644
--- a/src/uxn/uxn.c
+++ b/src/uxn/uxn.c
@@ -26,6 +26,7 @@ evaluxn(Uxn *u, u16 vec)
26 switch(instr) { 26 switch(instr) {
27#pragma GCC diagnostic push 27#pragma GCC diagnostic push
28#pragma GCC diagnostic ignored "-Wunused-value" 28#pragma GCC diagnostic ignored "-Wunused-value"
29#pragma GCC diagnostic ignored "-Wunused-variable"
29 case 0x00: /* BRK */ 30 case 0x00: /* BRK */
30 case 0x20: /* BRK2 */ 31 case 0x20: /* BRK2 */
31 case 0x40: /* BRKr */ 32 case 0x40: /* BRKr */
@@ -34,23 +35,25 @@ evaluxn(Uxn *u, u16 vec)
34 case 0xa0: /* BRK2k */ 35 case 0xa0: /* BRK2k */
35 case 0xc0: /* BRKkr */ 36 case 0xc0: /* BRKkr */
36 case 0xe0: /* BRK2kr */ 37 case 0xe0: /* BRK2kr */
37 { 38 __asm__( "evaluxn_00_BRK:" );
38 u->ram.ptr = 0; 39 {
40 u->ram.ptr = 0;
41 }
39 break; 42 break;
40 }
41 case 0x01: /* LIT */ 43 case 0x01: /* LIT */
42 case 0x81: /* LITk */ 44 case 0x81: /* LITk */
43 { 45 __asm__( "evaluxn_01_LIT:" );
44 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); 46 {
47 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++);
45#ifndef NO_STACK_CHECKS 48#ifndef NO_STACK_CHECKS
46 if(u->wst.ptr > 254) { 49 if(__builtin_expect(u->wst.ptr > 254, 0)) {
47 u->wst.error = 2; 50 u->wst.error = 2;
48 goto error; 51 goto error;
49 } 52 }
50#endif 53#endif
51 u->wst.ptr += 1; 54 u->wst.ptr += 1;
55 }
52 break; 56 break;
53 }
54 case 0x02: /* NOP */ 57 case 0x02: /* NOP */
55 case 0x22: /* NOP2 */ 58 case 0x22: /* NOP2 */
56 case 0x42: /* NOPr */ 59 case 0x42: /* NOPr */
@@ -59,3671 +62,3877 @@ evaluxn(Uxn *u, u16 vec)
59 case 0xa2: /* NOP2k */ 62 case 0xa2: /* NOP2k */
60 case 0xc2: /* NOPkr */ 63 case 0xc2: /* NOPkr */
61 case 0xe2: /* NOP2kr */ 64 case 0xe2: /* NOP2kr */
62 { 65 __asm__( "evaluxn_02_NOP:" );
63 (void)u; 66 {
67 (void)u;
68 }
64 break; 69 break;
65 }
66 case 0x03: /* POP */ 70 case 0x03: /* POP */
67 { 71 __asm__( "evaluxn_03_POP:" );
68 u->wst.dat[u->wst.ptr - 1]; 72 {
73 u->wst.dat[u->wst.ptr - 1];
69#ifndef NO_STACK_CHECKS 74#ifndef NO_STACK_CHECKS
70 if(u->wst.ptr < 1) { 75 if(__builtin_expect(u->wst.ptr < 1, 0)) {
71 u->wst.error = 1; 76 u->wst.error = 1;
72 goto error; 77 goto error;
73 } 78 }
74#endif 79#endif
75 u->wst.ptr -= 1; 80 u->wst.ptr -= 1;
81 }
76 break; 82 break;
77 }
78 case 0x04: /* DUP */ 83 case 0x04: /* DUP */
79 { 84 __asm__( "evaluxn_04_DUP:" );
80 u8 a = u->wst.dat[u->wst.ptr - 1]; 85 {
81 u->wst.dat[u->wst.ptr - 1] = a; 86 u8 a = u->wst.dat[u->wst.ptr - 1];
82 u->wst.dat[u->wst.ptr] = a; 87 u->wst.dat[u->wst.ptr] = a;
83#ifndef NO_STACK_CHECKS 88#ifndef NO_STACK_CHECKS
84 if(u->wst.ptr < 1) { 89 if(__builtin_expect(u->wst.ptr < 1, 0)) {
85 u->wst.error = 1; 90 u->wst.error = 1;
86 goto error; 91 goto error;
87 } 92 }
88 if(u->wst.ptr > 254) { 93 if(__builtin_expect(u->wst.ptr > 254, 0)) {
89 u->wst.error = 2; 94 u->wst.error = 2;
90 goto error; 95 goto error;
91 } 96 }
92#endif 97#endif
93 u->wst.ptr += 1; 98 u->wst.ptr += 1;
99 }
94 break; 100 break;
95 }
96 case 0x05: /* SWP */ 101 case 0x05: /* SWP */
97 { 102 __asm__( "evaluxn_05_SWP:" );
98 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 103 {
99 u->wst.dat[u->wst.ptr - 2] = a; 104 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
100 u->wst.dat[u->wst.ptr - 1] = b; 105 u->wst.dat[u->wst.ptr - 2] = a;
106 u->wst.dat[u->wst.ptr - 1] = b;
101#ifndef NO_STACK_CHECKS 107#ifndef NO_STACK_CHECKS
102 if(u->wst.ptr < 2) { 108 if(__builtin_expect(u->wst.ptr < 2, 0)) {
103 u->wst.error = 1; 109 u->wst.error = 1;
104 goto error; 110 goto error;
105 } 111 }
106#endif 112#endif
113 }
107 break; 114 break;
108 }
109 case 0x06: /* OVR */ 115 case 0x06: /* OVR */
110 { 116 __asm__( "evaluxn_06_OVR:" );
111 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 117 {
112 u->wst.dat[u->wst.ptr - 2] = b; 118 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
113 u->wst.dat[u->wst.ptr - 1] = a; 119 u->wst.dat[u->wst.ptr] = b;
114 u->wst.dat[u->wst.ptr] = b;
115#ifndef NO_STACK_CHECKS 120#ifndef NO_STACK_CHECKS
116 if(u->wst.ptr < 2) { 121 if(__builtin_expect(u->wst.ptr < 2, 0)) {
117 u->wst.error = 1; 122 u->wst.error = 1;
118 goto error; 123 goto error;
119 } 124 }
120 if(u->wst.ptr > 254) { 125 if(__builtin_expect(u->wst.ptr > 254, 0)) {
121 u->wst.error = 2; 126 u->wst.error = 2;
122 goto error; 127 goto error;
123 } 128 }
124#endif 129#endif
125 u->wst.ptr += 1; 130 u->wst.ptr += 1;
131 }
126 break; 132 break;
127 }
128 case 0x07: /* ROT */ 133 case 0x07: /* ROT */
129 { 134 __asm__( "evaluxn_07_ROT:" );
130 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3]; 135 {
131 u->wst.dat[u->wst.ptr - 3] = b; 136 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3];
132 u->wst.dat[u->wst.ptr - 2] = a; 137 u->wst.dat[u->wst.ptr - 3] = b;
133 u->wst.dat[u->wst.ptr - 1] = c; 138 u->wst.dat[u->wst.ptr - 2] = a;
139 u->wst.dat[u->wst.ptr - 1] = c;
134#ifndef NO_STACK_CHECKS 140#ifndef NO_STACK_CHECKS
135 if(u->wst.ptr < 3) { 141 if(__builtin_expect(u->wst.ptr < 3, 0)) {
136 u->wst.error = 1; 142 u->wst.error = 1;
137 goto error; 143 goto error;
138 } 144 }
139#endif 145#endif
146 }
140 break; 147 break;
141 }
142 case 0x08: /* EQU */ 148 case 0x08: /* EQU */
143 { 149 __asm__( "evaluxn_08_EQU:" );
144 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 150 {
145 u->wst.dat[u->wst.ptr - 2] = b == a; 151 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
152 u->wst.dat[u->wst.ptr - 2] = b == a;
146#ifndef NO_STACK_CHECKS 153#ifndef NO_STACK_CHECKS
147 if(u->wst.ptr < 2) { 154 if(__builtin_expect(u->wst.ptr < 2, 0)) {
148 u->wst.error = 1; 155 u->wst.error = 1;
149 goto error; 156 goto error;
150 } 157 }
151#endif 158#endif
152 u->wst.ptr -= 1; 159 u->wst.ptr -= 1;
160 }
153 break; 161 break;
154 }
155 case 0x09: /* NEQ */ 162 case 0x09: /* NEQ */
156 { 163 __asm__( "evaluxn_09_NEQ:" );
157 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 164 {
158 u->wst.dat[u->wst.ptr - 2] = b != a; 165 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
166 u->wst.dat[u->wst.ptr - 2] = b != a;
159#ifndef NO_STACK_CHECKS 167#ifndef NO_STACK_CHECKS
160 if(u->wst.ptr < 2) { 168 if(__builtin_expect(u->wst.ptr < 2, 0)) {
161 u->wst.error = 1; 169 u->wst.error = 1;
162 goto error; 170 goto error;
163 } 171 }
164#endif 172#endif
165 u->wst.ptr -= 1; 173 u->wst.ptr -= 1;
174 }
166 break; 175 break;
167 }
168 case 0x0a: /* GTH */ 176 case 0x0a: /* GTH */
169 { 177 __asm__( "evaluxn_0a_GTH:" );
170 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 178 {
171 u->wst.dat[u->wst.ptr - 2] = b > a; 179 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
180 u->wst.dat[u->wst.ptr - 2] = b > a;
172#ifndef NO_STACK_CHECKS 181#ifndef NO_STACK_CHECKS
173 if(u->wst.ptr < 2) { 182 if(__builtin_expect(u->wst.ptr < 2, 0)) {
174 u->wst.error = 1; 183 u->wst.error = 1;
175 goto error; 184 goto error;
176 } 185 }
177#endif 186#endif
178 u->wst.ptr -= 1; 187 u->wst.ptr -= 1;
188 }
179 break; 189 break;
180 }
181 case 0x0b: /* LTH */ 190 case 0x0b: /* LTH */
182 { 191 __asm__( "evaluxn_0b_LTH:" );
183 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 192 {
184 u->wst.dat[u->wst.ptr - 2] = b < a; 193 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
194 u->wst.dat[u->wst.ptr - 2] = b < a;
185#ifndef NO_STACK_CHECKS 195#ifndef NO_STACK_CHECKS
186 if(u->wst.ptr < 2) { 196 if(__builtin_expect(u->wst.ptr < 2, 0)) {
187 u->wst.error = 1; 197 u->wst.error = 1;
188 goto error; 198 goto error;
189 } 199 }
190#endif 200#endif
191 u->wst.ptr -= 1; 201 u->wst.ptr -= 1;
202 }
192 break; 203 break;
193 }
194 case 0x0c: /* JMP */ 204 case 0x0c: /* JMP */
195 { 205 __asm__( "evaluxn_0c_JMP:" );
196 u8 a = u->wst.dat[u->wst.ptr - 1]; 206 {
197 u->ram.ptr += (s8)a; 207 u8 a = u->wst.dat[u->wst.ptr - 1];
208 u->ram.ptr += (s8)a;
198#ifndef NO_STACK_CHECKS 209#ifndef NO_STACK_CHECKS
199 if(u->wst.ptr < 1) { 210 if(__builtin_expect(u->wst.ptr < 1, 0)) {
200 u->wst.error = 1; 211 u->wst.error = 1;
201 goto error; 212 goto error;
202 } 213 }
203#endif 214#endif
204 u->wst.ptr -= 1; 215 u->wst.ptr -= 1;
216 }
205 break; 217 break;
206 }
207 case 0x0d: /* JCN */ 218 case 0x0d: /* JCN */
208 { 219 __asm__( "evaluxn_0d_JCN:" );
209 u8 a = u->wst.dat[u->wst.ptr - 1]; 220 {
210 if(u->wst.dat[u->wst.ptr - 2]) u->ram.ptr += (s8)a; 221 u8 a = u->wst.dat[u->wst.ptr - 1];
222 if(u->wst.dat[u->wst.ptr - 2]) u->ram.ptr += (s8)a;
211#ifndef NO_STACK_CHECKS 223#ifndef NO_STACK_CHECKS
212 if(u->wst.ptr < 2) { 224 if(__builtin_expect(u->wst.ptr < 2, 0)) {
213 u->wst.error = 1; 225 u->wst.error = 1;
214 goto error; 226 goto error;
215 } 227 }
216#endif 228#endif
217 u->wst.ptr -= 2; 229 u->wst.ptr -= 2;
230 }
218 break; 231 break;
219 }
220 case 0x0e: /* JSR */ 232 case 0x0e: /* JSR */
221 { 233 __asm__( "evaluxn_0e_JSR:" );
222 u8 a = u->wst.dat[u->wst.ptr - 1]; 234 {
223 u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; 235 u8 a = u->wst.dat[u->wst.ptr - 1];
224 u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; 236 u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8;
225 u->ram.ptr += (s8)a; 237 u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff;
238 u->ram.ptr += (s8)a;
226#ifndef NO_STACK_CHECKS 239#ifndef NO_STACK_CHECKS
227 if(u->wst.ptr < 1) { 240 if(__builtin_expect(u->wst.ptr < 1, 0)) {
228 u->wst.error = 1; 241 u->wst.error = 1;
229 goto error; 242 goto error;
230 } 243 }
231#endif 244#endif
232 u->wst.ptr -= 1; 245 u->wst.ptr -= 1;
233#ifndef NO_STACK_CHECKS 246#ifndef NO_STACK_CHECKS
234 if(u->rst.ptr > 253) { 247 if(__builtin_expect(u->rst.ptr > 253, 0)) {
235 u->rst.error = 2; 248 u->rst.error = 2;
236 goto error; 249 goto error;
237 } 250 }
238#endif 251#endif
239 u->rst.ptr += 2; 252 u->rst.ptr += 2;
253 }
240 break; 254 break;
241 }
242 case 0x0f: /* STH */ 255 case 0x0f: /* STH */
243 { 256 __asm__( "evaluxn_0f_STH:" );
244 u8 a = u->wst.dat[u->wst.ptr - 1]; 257 {
245 u->rst.dat[u->rst.ptr] = a; 258 u8 a = u->wst.dat[u->wst.ptr - 1];
259 u->rst.dat[u->rst.ptr] = a;
246#ifndef NO_STACK_CHECKS 260#ifndef NO_STACK_CHECKS
247 if(u->wst.ptr < 1) { 261 if(__builtin_expect(u->wst.ptr < 1, 0)) {
248 u->wst.error = 1; 262 u->wst.error = 1;
249 goto error; 263 goto error;
250 } 264 }
251#endif 265#endif
252 u->wst.ptr -= 1; 266 u->wst.ptr -= 1;
253#ifndef NO_STACK_CHECKS 267#ifndef NO_STACK_CHECKS
254 if(u->rst.ptr > 254) { 268 if(__builtin_expect(u->rst.ptr > 254, 0)) {
255 u->rst.error = 2; 269 u->rst.error = 2;
256 goto error; 270 goto error;
257 } 271 }
258#endif 272#endif
259 u->rst.ptr += 1; 273 u->rst.ptr += 1;
274 }
260 break; 275 break;
261 }
262 case 0x10: /* LDZ */ 276 case 0x10: /* LDZ */
263 { 277 __asm__( "evaluxn_10_LDZ:" );
264 u8 a = u->wst.dat[u->wst.ptr - 1]; 278 {
265 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); 279 u8 a = u->wst.dat[u->wst.ptr - 1];
280 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a);
266#ifndef NO_STACK_CHECKS 281#ifndef NO_STACK_CHECKS
267 if(u->wst.ptr < 1) { 282 if(__builtin_expect(u->wst.ptr < 1, 0)) {
268 u->wst.error = 1; 283 u->wst.error = 1;
269 goto error; 284 goto error;
270 } 285 }
271#endif 286#endif
287 }
272 break; 288 break;
273 }
274 case 0x11: /* STZ */ 289 case 0x11: /* STZ */
275 { 290 __asm__( "evaluxn_11_STZ:" );
276 u8 a = u->wst.dat[u->wst.ptr - 1]; 291 {
277 u8 b = u->wst.dat[u->wst.ptr - 2]; 292 u8 a = u->wst.dat[u->wst.ptr - 1];
278 mempoke8(u->ram.dat, a, b); 293 u8 b = u->wst.dat[u->wst.ptr - 2];
294 mempoke8(u->ram.dat, a, b);
279#ifndef NO_STACK_CHECKS 295#ifndef NO_STACK_CHECKS
280 if(u->wst.ptr < 2) { 296 if(__builtin_expect(u->wst.ptr < 2, 0)) {
281 u->wst.error = 1; 297 u->wst.error = 1;
282 goto error; 298 goto error;
283 } 299 }
284#endif 300#endif
285 u->wst.ptr -= 2; 301 u->wst.ptr -= 2;
302 }
286 break; 303 break;
287 }
288 case 0x12: /* LDR */ 304 case 0x12: /* LDR */
289 { 305 __asm__( "evaluxn_12_LDR:" );
290 u8 a = u->wst.dat[u->wst.ptr - 1]; 306 {
291 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); 307 u8 a = u->wst.dat[u->wst.ptr - 1];
308 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a);
292#ifndef NO_STACK_CHECKS 309#ifndef NO_STACK_CHECKS
293 if(u->wst.ptr < 1) { 310 if(__builtin_expect(u->wst.ptr < 1, 0)) {
294 u->wst.error = 1; 311 u->wst.error = 1;
295 goto error; 312 goto error;
296 } 313 }
297#endif 314#endif
315 }
298 break; 316 break;
299 }
300 case 0x13: /* STR */ 317 case 0x13: /* STR */
301 { 318 __asm__( "evaluxn_13_STR:" );
302 u8 a = u->wst.dat[u->wst.ptr - 1]; 319 {
303 u8 b = u->wst.dat[u->wst.ptr - 2]; 320 u8 a = u->wst.dat[u->wst.ptr - 1];
304 mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b); 321 u8 b = u->wst.dat[u->wst.ptr - 2];
322 mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b);
305#ifndef NO_STACK_CHECKS 323#ifndef NO_STACK_CHECKS
306 if(u->wst.ptr < 2) { 324 if(__builtin_expect(u->wst.ptr < 2, 0)) {
307 u->wst.error = 1; 325 u->wst.error = 1;
308 goto error; 326 goto error;
309 } 327 }
310#endif 328#endif
311 u->wst.ptr -= 2; 329 u->wst.ptr -= 2;
330 }
312 break; 331 break;
313 }
314 case 0x14: /* LDA */ 332 case 0x14: /* LDA */
315 { 333 __asm__( "evaluxn_14_LDA:" );
316 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 334 {
317 u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); 335 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
336 u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a);
318#ifndef NO_STACK_CHECKS 337#ifndef NO_STACK_CHECKS
319 if(u->wst.ptr < 2) { 338 if(__builtin_expect(u->wst.ptr < 2, 0)) {
320 u->wst.error = 1; 339 u->wst.error = 1;
321 goto error; 340 goto error;
322 } 341 }
323#endif 342#endif
324 u->wst.ptr -= 1; 343 u->wst.ptr -= 1;
344 }
325 break; 345 break;
326 }
327 case 0x15: /* STA */ 346 case 0x15: /* STA */
328 { 347 __asm__( "evaluxn_15_STA:" );
329 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 348 {
330 u8 b = u->wst.dat[u->wst.ptr - 3]; 349 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
331 mempoke8(u->ram.dat, a, b); 350 u8 b = u->wst.dat[u->wst.ptr - 3];
351 mempoke8(u->ram.dat, a, b);
332#ifndef NO_STACK_CHECKS 352#ifndef NO_STACK_CHECKS
333 if(u->wst.ptr < 3) { 353 if(__builtin_expect(u->wst.ptr < 3, 0)) {
334 u->wst.error = 1; 354 u->wst.error = 1;
335 goto error; 355 goto error;
336 } 356 }
337#endif 357#endif
338 u->wst.ptr -= 3; 358 u->wst.ptr -= 3;
359 }
339 break; 360 break;
340 }
341 case 0x16: /* DEI */ 361 case 0x16: /* DEI */
342 { 362 __asm__( "evaluxn_16_DEI:" );
343 u8 a = u->wst.dat[u->wst.ptr - 1]; 363 {
344 u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); 364 u8 a = u->wst.dat[u->wst.ptr - 1];
365 u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a);
345#ifndef NO_STACK_CHECKS 366#ifndef NO_STACK_CHECKS
346 if(u->wst.ptr < 1) { 367 if(__builtin_expect(u->wst.ptr < 1, 0)) {
347 u->wst.error = 1; 368 u->wst.error = 1;
348 goto error; 369 goto error;
349 } 370 }
350#endif 371#endif
372 }
351 break; 373 break;
352 }
353 case 0x17: /* DEO */ 374 case 0x17: /* DEO */
354 { 375 __asm__( "evaluxn_17_DEO:" );
355 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 376 {
356 devpoke8(&u->dev[a >> 4], a, b); 377 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
378 devpoke8(&u->dev[a >> 4], a, b);
357#ifndef NO_STACK_CHECKS 379#ifndef NO_STACK_CHECKS
358 if(u->wst.ptr < 2) { 380 if(__builtin_expect(u->wst.ptr < 2, 0)) {
359 u->wst.error = 1; 381 u->wst.error = 1;
360 goto error; 382 goto error;
361 } 383 }
362#endif 384#endif
363 u->wst.ptr -= 2; 385 u->wst.ptr -= 2;
386 }
364 break; 387 break;
365 }
366 case 0x18: /* ADD */ 388 case 0x18: /* ADD */
367 { 389 __asm__( "evaluxn_18_ADD:" );
368 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 390 {
369 u->wst.dat[u->wst.ptr - 2] = b + a; 391 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
392 u->wst.dat[u->wst.ptr - 2] = b + a;
370#ifndef NO_STACK_CHECKS 393#ifndef NO_STACK_CHECKS
371 if(u->wst.ptr < 2) { 394 if(__builtin_expect(u->wst.ptr < 2, 0)) {
372 u->wst.error = 1; 395 u->wst.error = 1;
373 goto error; 396 goto error;
374 } 397 }
375#endif 398#endif
376 u->wst.ptr -= 1; 399 u->wst.ptr -= 1;
400 }
377 break; 401 break;
378 }
379 case 0x19: /* SUB */ 402 case 0x19: /* SUB */
380 { 403 __asm__( "evaluxn_19_SUB:" );
381 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 404 {
382 u->wst.dat[u->wst.ptr - 2] = b - a; 405 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
406 u->wst.dat[u->wst.ptr - 2] = b - a;
383#ifndef NO_STACK_CHECKS 407#ifndef NO_STACK_CHECKS
384 if(u->wst.ptr < 2) { 408 if(__builtin_expect(u->wst.ptr < 2, 0)) {
385 u->wst.error = 1; 409 u->wst.error = 1;
386 goto error; 410 goto error;
387 } 411 }
388#endif 412#endif
389 u->wst.ptr -= 1; 413 u->wst.ptr -= 1;
414 }
390 break; 415 break;
391 }
392 case 0x1a: /* MUL */ 416 case 0x1a: /* MUL */
393 { 417 __asm__( "evaluxn_1a_MUL:" );
394 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 418 {
395 u->wst.dat[u->wst.ptr - 2] = b * a; 419 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
420 u->wst.dat[u->wst.ptr - 2] = b * a;
396#ifndef NO_STACK_CHECKS 421#ifndef NO_STACK_CHECKS
397 if(u->wst.ptr < 2) { 422 if(__builtin_expect(u->wst.ptr < 2, 0)) {
398 u->wst.error = 1; 423 u->wst.error = 1;
399 goto error; 424 goto error;
400 } 425 }
401#endif 426#endif
402 u->wst.ptr -= 1; 427 u->wst.ptr -= 1;
428 }
403 break; 429 break;
404 }
405 case 0x1b: /* DIV */ 430 case 0x1b: /* DIV */
406 { 431 __asm__( "evaluxn_1b_DIV:" );
407 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 432 {
408 u->wst.dat[u->wst.ptr - 2] = b / a; 433 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
434 u->wst.dat[u->wst.ptr - 2] = b / a;
409#ifndef NO_STACK_CHECKS 435#ifndef NO_STACK_CHECKS
410 if(u->wst.ptr < 2) { 436 if(__builtin_expect(u->wst.ptr < 2, 0)) {
411 u->wst.error = 1; 437 u->wst.error = 1;
412 goto error; 438 goto error;
413 } 439 }
414#endif 440#endif
415 u->wst.ptr -= 1; 441 u->wst.ptr -= 1;
442 }
416 break; 443 break;
417 }
418 case 0x1c: /* AND */ 444 case 0x1c: /* AND */
419 { 445 __asm__( "evaluxn_1c_AND:" );
420 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 446 {
421 u->wst.dat[u->wst.ptr - 2] = b & a; 447 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
448 u->wst.dat[u->wst.ptr - 2] = b & a;
422#ifndef NO_STACK_CHECKS 449#ifndef NO_STACK_CHECKS
423 if(u->wst.ptr < 2) { 450 if(__builtin_expect(u->wst.ptr < 2, 0)) {
424 u->wst.error = 1; 451 u->wst.error = 1;
425 goto error; 452 goto error;
426 } 453 }
427#endif 454#endif
428 u->wst.ptr -= 1; 455 u->wst.ptr -= 1;
456 }
429 break; 457 break;
430 }
431 case 0x1d: /* ORA */ 458 case 0x1d: /* ORA */
432 { 459 __asm__( "evaluxn_1d_ORA:" );
433 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 460 {
434 u->wst.dat[u->wst.ptr - 2] = b | a; 461 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
462 u->wst.dat[u->wst.ptr - 2] = b | a;
435#ifndef NO_STACK_CHECKS 463#ifndef NO_STACK_CHECKS
436 if(u->wst.ptr < 2) { 464 if(__builtin_expect(u->wst.ptr < 2, 0)) {
437 u->wst.error = 1; 465 u->wst.error = 1;
438 goto error; 466 goto error;
439 } 467 }
440#endif 468#endif
441 u->wst.ptr -= 1; 469 u->wst.ptr -= 1;
470 }
442 break; 471 break;
443 }
444 case 0x1e: /* EOR */ 472 case 0x1e: /* EOR */
445 { 473 __asm__( "evaluxn_1e_EOR:" );
446 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 474 {
447 u->wst.dat[u->wst.ptr - 2] = b ^ a; 475 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
476 u->wst.dat[u->wst.ptr - 2] = b ^ a;
448#ifndef NO_STACK_CHECKS 477#ifndef NO_STACK_CHECKS
449 if(u->wst.ptr < 2) { 478 if(__builtin_expect(u->wst.ptr < 2, 0)) {
450 u->wst.error = 1; 479 u->wst.error = 1;
451 goto error; 480 goto error;
452 } 481 }
453#endif 482#endif
454 u->wst.ptr -= 1; 483 u->wst.ptr -= 1;
484 }
455 break; 485 break;
456 }
457 case 0x1f: /* SFT */ 486 case 0x1f: /* SFT */
458 { 487 __asm__( "evaluxn_1f_SFT:" );
459 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 488 {
460 u->wst.dat[u->wst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4); 489 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
490 u->wst.dat[u->wst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4);
461#ifndef NO_STACK_CHECKS 491#ifndef NO_STACK_CHECKS
462 if(u->wst.ptr < 2) { 492 if(__builtin_expect(u->wst.ptr < 2, 0)) {
463 u->wst.error = 1; 493 u->wst.error = 1;
464 goto error; 494 goto error;
465 } 495 }
466#endif 496#endif
467 u->wst.ptr -= 1; 497 u->wst.ptr -= 1;
498 }
468 break; 499 break;
469 }
470 case 0x21: /* LIT2 */ 500 case 0x21: /* LIT2 */
471 case 0xa1: /* LIT2k */ 501 case 0xa1: /* LIT2k */
472 { 502 __asm__( "evaluxn_21_LIT2:" );
473 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); 503 {
474 u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr++); 504 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++);
505 u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr++);
475#ifndef NO_STACK_CHECKS 506#ifndef NO_STACK_CHECKS
476 if(u->wst.ptr > 253) { 507 if(__builtin_expect(u->wst.ptr > 253, 0)) {
477 u->wst.error = 2; 508 u->wst.error = 2;
478 goto error; 509 goto error;
479 } 510 }
480#endif 511#endif
481 u->wst.ptr += 2; 512 u->wst.ptr += 2;
513 }
482 break; 514 break;
483 }
484 case 0x23: /* POP2 */ 515 case 0x23: /* POP2 */
485 { 516 __asm__( "evaluxn_23_POP2:" );
486 (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 517 {
518 (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
487#ifndef NO_STACK_CHECKS 519#ifndef NO_STACK_CHECKS
488 if(u->wst.ptr < 2) { 520 if(__builtin_expect(u->wst.ptr < 2, 0)) {
489 u->wst.error = 1; 521 u->wst.error = 1;
490 goto error; 522 goto error;
491 } 523 }
492#endif 524#endif
493 u->wst.ptr -= 2; 525 u->wst.ptr -= 2;
526 }
494 break; 527 break;
495 }
496 case 0x24: /* DUP2 */ 528 case 0x24: /* DUP2 */
497 { 529 __asm__( "evaluxn_24_DUP2:" );
498 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 530 {
499 u->wst.dat[u->wst.ptr - 2] = a >> 8; 531 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
500 u->wst.dat[u->wst.ptr - 1] = a & 0xff; 532 u->wst.dat[u->wst.ptr] = b;
501 u->wst.dat[u->wst.ptr] = a >> 8; 533 u->wst.dat[u->wst.ptr + 1] = a;
502 u->wst.dat[u->wst.ptr + 1] = a & 0xff;
503#ifndef NO_STACK_CHECKS 534#ifndef NO_STACK_CHECKS
504 if(u->wst.ptr < 2) { 535 if(__builtin_expect(u->wst.ptr < 2, 0)) {
505 u->wst.error = 1; 536 u->wst.error = 1;
506 goto error; 537 goto error;
507 } 538 }
508 if(u->wst.ptr > 253) { 539 if(__builtin_expect(u->wst.ptr > 253, 0)) {
509 u->wst.error = 2; 540 u->wst.error = 2;
510 goto error; 541 goto error;
511 } 542 }
512#endif 543#endif
513 u->wst.ptr += 2; 544 u->wst.ptr += 2;
545 }
514 break; 546 break;
515 }
516 case 0x25: /* SWP2 */ 547 case 0x25: /* SWP2 */
517 { 548 __asm__( "evaluxn_25_SWP2:" );
518 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 549 {
519 u->wst.dat[u->wst.ptr - 4] = a >> 8; 550 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
520 u->wst.dat[u->wst.ptr - 3] = a & 0xff; 551 u->wst.dat[u->wst.ptr - 4] = b;
521 u->wst.dat[u->wst.ptr - 2] = b >> 8; 552 u->wst.dat[u->wst.ptr - 3] = a;
522 u->wst.dat[u->wst.ptr - 1] = b & 0xff; 553 u->wst.dat[u->wst.ptr - 2] = d;
554 u->wst.dat[u->wst.ptr - 1] = c;
523#ifndef NO_STACK_CHECKS 555#ifndef NO_STACK_CHECKS
524 if(u->wst.ptr < 4) { 556 if(__builtin_expect(u->wst.ptr < 4, 0)) {
525 u->wst.error = 1; 557 u->wst.error = 1;
526 goto error; 558 goto error;
527 } 559 }
528#endif 560#endif
561 }
529 break; 562 break;
530 }
531 case 0x26: /* OVR2 */ 563 case 0x26: /* OVR2 */
532 { 564 __asm__( "evaluxn_26_OVR2:" );
533 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 565 {
534 u->wst.dat[u->wst.ptr - 4] = b >> 8; 566 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
535 u->wst.dat[u->wst.ptr - 3] = b & 0xff; 567 u->wst.dat[u->wst.ptr] = d;
536 u->wst.dat[u->wst.ptr - 2] = a >> 8; 568 u->wst.dat[u->wst.ptr + 1] = c;
537 u->wst.dat[u->wst.ptr - 1] = a & 0xff;
538 u->wst.dat[u->wst.ptr] = b >> 8;
539 u->wst.dat[u->wst.ptr + 1] = b & 0xff;
540#ifndef NO_STACK_CHECKS 569#ifndef NO_STACK_CHECKS
541 if(u->wst.ptr < 4) { 570 if(__builtin_expect(u->wst.ptr < 4, 0)) {
542 u->wst.error = 1; 571 u->wst.error = 1;
543 goto error; 572 goto error;
544 } 573 }
545 if(u->wst.ptr > 253) { 574 if(__builtin_expect(u->wst.ptr > 253, 0)) {
546 u->wst.error = 2; 575 u->wst.error = 2;
547 goto error; 576 goto error;
548 } 577 }
549#endif 578#endif
550 u->wst.ptr += 2; 579 u->wst.ptr += 2;
580 }
551 break; 581 break;
552 }
553 case 0x27: /* ROT2 */ 582 case 0x27: /* ROT2 */
554 { 583 __asm__( "evaluxn_27_ROT2:" );
555 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)), c = (u->wst.dat[u->wst.ptr - 5] | (u->wst.dat[u->wst.ptr - 6] << 8)); 584 {
556 u->wst.dat[u->wst.ptr - 6] = b >> 8; 585 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4], e = u->wst.dat[u->wst.ptr - 5], f = u->wst.dat[u->wst.ptr - 6];
557 u->wst.dat[u->wst.ptr - 5] = b & 0xff; 586 u->wst.dat[u->wst.ptr - 6] = d;
558 u->wst.dat[u->wst.ptr - 4] = a >> 8; 587 u->wst.dat[u->wst.ptr - 5] = c;
559 u->wst.dat[u->wst.ptr - 3] = a & 0xff; 588 u->wst.dat[u->wst.ptr - 4] = b;
560 u->wst.dat[u->wst.ptr - 2] = c >> 8; 589 u->wst.dat[u->wst.ptr - 3] = a;
561 u->wst.dat[u->wst.ptr - 1] = c & 0xff; 590 u->wst.dat[u->wst.ptr - 2] = f;
591 u->wst.dat[u->wst.ptr - 1] = e;
562#ifndef NO_STACK_CHECKS 592#ifndef NO_STACK_CHECKS
563 if(u->wst.ptr < 6) { 593 if(__builtin_expect(u->wst.ptr < 6, 0)) {
564 u->wst.error = 1; 594 u->wst.error = 1;
565 goto error; 595 goto error;
566 } 596 }
567#endif 597#endif
598 }
568 break; 599 break;
569 }
570 case 0x28: /* EQU2 */ 600 case 0x28: /* EQU2 */
571 { 601 __asm__( "evaluxn_28_EQU2:" );
572 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 602 {
573 u->wst.dat[u->wst.ptr - 4] = b == a; 603 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
604 u->wst.dat[u->wst.ptr - 4] = b == a;
574#ifndef NO_STACK_CHECKS 605#ifndef NO_STACK_CHECKS
575 if(u->wst.ptr < 4) { 606 if(__builtin_expect(u->wst.ptr < 4, 0)) {
576 u->wst.error = 1; 607 u->wst.error = 1;
577 goto error; 608 goto error;
578 } 609 }
579#endif 610#endif
580 u->wst.ptr -= 3; 611 u->wst.ptr -= 3;
612 }
581 break; 613 break;
582 }
583 case 0x29: /* NEQ2 */ 614 case 0x29: /* NEQ2 */
584 { 615 __asm__( "evaluxn_29_NEQ2:" );
585 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 616 {
586 u->wst.dat[u->wst.ptr - 4] = b != a; 617 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
618 u->wst.dat[u->wst.ptr - 4] = b != a;
587#ifndef NO_STACK_CHECKS 619#ifndef NO_STACK_CHECKS
588 if(u->wst.ptr < 4) { 620 if(__builtin_expect(u->wst.ptr < 4, 0)) {
589 u->wst.error = 1; 621 u->wst.error = 1;
590 goto error; 622 goto error;
591 } 623 }
592#endif 624#endif
593 u->wst.ptr -= 3; 625 u->wst.ptr -= 3;
626 }
594 break; 627 break;
595 }
596 case 0x2a: /* GTH2 */ 628 case 0x2a: /* GTH2 */
597 { 629 __asm__( "evaluxn_2a_GTH2:" );
598 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 630 {
599 u->wst.dat[u->wst.ptr - 4] = b > a; 631 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
632 u->wst.dat[u->wst.ptr - 4] = b > a;
600#ifndef NO_STACK_CHECKS 633#ifndef NO_STACK_CHECKS
601 if(u->wst.ptr < 4) { 634 if(__builtin_expect(u->wst.ptr < 4, 0)) {
602 u->wst.error = 1; 635 u->wst.error = 1;
603 goto error; 636 goto error;
604 } 637 }
605#endif 638#endif
606 u->wst.ptr -= 3; 639 u->wst.ptr -= 3;
640 }
607 break; 641 break;
608 }
609 case 0x2b: /* LTH2 */ 642 case 0x2b: /* LTH2 */
610 { 643 __asm__( "evaluxn_2b_LTH2:" );
611 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 644 {
612 u->wst.dat[u->wst.ptr - 4] = b < a; 645 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
646 u->wst.dat[u->wst.ptr - 4] = b < a;
613#ifndef NO_STACK_CHECKS 647#ifndef NO_STACK_CHECKS
614 if(u->wst.ptr < 4) { 648 if(__builtin_expect(u->wst.ptr < 4, 0)) {
615 u->wst.error = 1; 649 u->wst.error = 1;
616 goto error; 650 goto error;
617 } 651 }
618#endif 652#endif
619 u->wst.ptr -= 3; 653 u->wst.ptr -= 3;
654 }
620 break; 655 break;
621 }
622 case 0x2c: /* JMP2 */ 656 case 0x2c: /* JMP2 */
623 { 657 __asm__( "evaluxn_2c_JMP2:" );
624 u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 658 {
659 u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
625#ifndef NO_STACK_CHECKS 660#ifndef NO_STACK_CHECKS
626 if(u->wst.ptr < 2) { 661 if(__builtin_expect(u->wst.ptr < 2, 0)) {
627 u->wst.error = 1; 662 u->wst.error = 1;
628 goto error; 663 goto error;
629 } 664 }
630#endif 665#endif
631 u->wst.ptr -= 2; 666 u->wst.ptr -= 2;
667 }
632 break; 668 break;
633 }
634 case 0x2d: /* JCN2 */ 669 case 0x2d: /* JCN2 */
635 { 670 __asm__( "evaluxn_2d_JCN2:" );
636 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 671 {
637 if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; 672 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
673 if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a;
638#ifndef NO_STACK_CHECKS 674#ifndef NO_STACK_CHECKS
639 if(u->wst.ptr < 3) { 675 if(__builtin_expect(u->wst.ptr < 3, 0)) {
640 u->wst.error = 1; 676 u->wst.error = 1;
641 goto error; 677 goto error;
642 } 678 }
643#endif 679#endif
644 u->wst.ptr -= 3; 680 u->wst.ptr -= 3;
681 }
645 break; 682 break;
646 }
647 case 0x2e: /* JSR2 */ 683 case 0x2e: /* JSR2 */
648 { 684 __asm__( "evaluxn_2e_JSR2:" );
649 u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; 685 {
650 u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; 686 u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8;
651 u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 687 u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff;
688 u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
652#ifndef NO_STACK_CHECKS 689#ifndef NO_STACK_CHECKS
653 if(u->wst.ptr < 2) { 690 if(__builtin_expect(u->wst.ptr < 2, 0)) {
654 u->wst.error = 1; 691 u->wst.error = 1;
655 goto error; 692 goto error;
656 } 693 }
657#endif 694#endif
658 u->wst.ptr -= 2; 695 u->wst.ptr -= 2;
659#ifndef NO_STACK_CHECKS 696#ifndef NO_STACK_CHECKS
660 if(u->rst.ptr > 253) { 697 if(__builtin_expect(u->rst.ptr > 253, 0)) {
661 u->rst.error = 2; 698 u->rst.error = 2;
662 goto error; 699 goto error;
663 } 700 }
664#endif 701#endif
665 u->rst.ptr += 2; 702 u->rst.ptr += 2;
703 }
666 break; 704 break;
667 }
668 case 0x2f: /* STH2 */ 705 case 0x2f: /* STH2 */
669 { 706 __asm__( "evaluxn_2f_STH2:" );
670 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 707 {
671 u->rst.dat[u->rst.ptr] = a >> 8; 708 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
672 u->rst.dat[u->rst.ptr + 1] = a & 0xff; 709 u->rst.dat[u->rst.ptr] = b;
710 u->rst.dat[u->rst.ptr + 1] = a;
673#ifndef NO_STACK_CHECKS 711#ifndef NO_STACK_CHECKS
674 if(u->wst.ptr < 2) { 712 if(__builtin_expect(u->wst.ptr < 2, 0)) {
675 u->wst.error = 1; 713 u->wst.error = 1;
676 goto error; 714 goto error;
677 } 715 }
678#endif 716#endif
679 u->wst.ptr -= 2; 717 u->wst.ptr -= 2;
680#ifndef NO_STACK_CHECKS 718#ifndef NO_STACK_CHECKS
681 if(u->rst.ptr > 253) { 719 if(__builtin_expect(u->rst.ptr > 253, 0)) {
682 u->rst.error = 2; 720 u->rst.error = 2;
683 goto error; 721 goto error;
684 } 722 }
685#endif 723#endif
686 u->rst.ptr += 2; 724 u->rst.ptr += 2;
725 }
687 break; 726 break;
688 }
689 case 0x30: /* LDZ2 */ 727 case 0x30: /* LDZ2 */
690 { 728 __asm__( "evaluxn_30_LDZ2:" );
691 u8 a = u->wst.dat[u->wst.ptr - 1]; 729 {
692 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); 730 u8 a = u->wst.dat[u->wst.ptr - 1];
693 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a + 1); 731 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a);
732 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a + 1);
694#ifndef NO_STACK_CHECKS 733#ifndef NO_STACK_CHECKS
695 if(u->wst.ptr < 1) { 734 if(__builtin_expect(u->wst.ptr < 1, 0)) {
696 u->wst.error = 1; 735 u->wst.error = 1;
697 goto error; 736 goto error;
698 } 737 }
699 if(u->wst.ptr > 254) { 738 if(__builtin_expect(u->wst.ptr > 254, 0)) {
700 u->wst.error = 2; 739 u->wst.error = 2;
701 goto error; 740 goto error;
702 } 741 }
703#endif 742#endif
704 u->wst.ptr += 1; 743 u->wst.ptr += 1;
744 }
705 break; 745 break;
706 }
707 case 0x31: /* STZ2 */ 746 case 0x31: /* STZ2 */
708 { 747 __asm__( "evaluxn_31_STZ2:" );
709 u8 a = u->wst.dat[u->wst.ptr - 1]; 748 {
710 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); 749 u8 a = u->wst.dat[u->wst.ptr - 1];
711 mempoke16(u->ram.dat, a, b); 750 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8));
751 mempoke16(u->ram.dat, a, b);
712#ifndef NO_STACK_CHECKS 752#ifndef NO_STACK_CHECKS
713 if(u->wst.ptr < 3) { 753 if(__builtin_expect(u->wst.ptr < 3, 0)) {
714 u->wst.error = 1; 754 u->wst.error = 1;
715 goto error; 755 goto error;
716 } 756 }
717#endif 757#endif
718 u->wst.ptr -= 3; 758 u->wst.ptr -= 3;
759 }
719 break; 760 break;
720 }
721 case 0x32: /* LDR2 */ 761 case 0x32: /* LDR2 */
722 { 762 __asm__( "evaluxn_32_LDR2:" );
723 u8 a = u->wst.dat[u->wst.ptr - 1]; 763 {
724 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); 764 u8 a = u->wst.dat[u->wst.ptr - 1];
725 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1); 765 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a);
766 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1);
726#ifndef NO_STACK_CHECKS 767#ifndef NO_STACK_CHECKS
727 if(u->wst.ptr < 1) { 768 if(__builtin_expect(u->wst.ptr < 1, 0)) {
728 u->wst.error = 1; 769 u->wst.error = 1;
729 goto error; 770 goto error;
730 } 771 }
731 if(u->wst.ptr > 254) { 772 if(__builtin_expect(u->wst.ptr > 254, 0)) {
732 u->wst.error = 2; 773 u->wst.error = 2;
733 goto error; 774 goto error;
734 } 775 }
735#endif 776#endif
736 u->wst.ptr += 1; 777 u->wst.ptr += 1;
778 }
737 break; 779 break;
738 }
739 case 0x33: /* STR2 */ 780 case 0x33: /* STR2 */
740 { 781 __asm__( "evaluxn_33_STR2:" );
741 u8 a = u->wst.dat[u->wst.ptr - 1]; 782 {
742 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); 783 u8 a = u->wst.dat[u->wst.ptr - 1];
743 mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b); 784 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8));
785 mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b);
744#ifndef NO_STACK_CHECKS 786#ifndef NO_STACK_CHECKS
745 if(u->wst.ptr < 3) { 787 if(__builtin_expect(u->wst.ptr < 3, 0)) {
746 u->wst.error = 1; 788 u->wst.error = 1;
747 goto error; 789 goto error;
748 } 790 }
749#endif 791#endif
750 u->wst.ptr -= 3; 792 u->wst.ptr -= 3;
793 }
751 break; 794 break;
752 }
753 case 0x34: /* LDA2 */ 795 case 0x34: /* LDA2 */
754 { 796 __asm__( "evaluxn_34_LDA2:" );
755 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 797 {
756 u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); 798 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
757 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a + 1); 799 u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a);
800 u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a + 1);
758#ifndef NO_STACK_CHECKS 801#ifndef NO_STACK_CHECKS
759 if(u->wst.ptr < 2) { 802 if(__builtin_expect(u->wst.ptr < 2, 0)) {
760 u->wst.error = 1; 803 u->wst.error = 1;
761 goto error; 804 goto error;
762 } 805 }
763#endif 806#endif
807 }
764 break; 808 break;
765 }
766 case 0x35: /* STA2 */ 809 case 0x35: /* STA2 */
767 { 810 __asm__( "evaluxn_35_STA2:" );
768 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 811 {
769 u16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 812 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
770 mempoke16(u->ram.dat, a, b); 813 u16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
814 mempoke16(u->ram.dat, a, b);
771#ifndef NO_STACK_CHECKS 815#ifndef NO_STACK_CHECKS
772 if(u->wst.ptr < 4) { 816 if(__builtin_expect(u->wst.ptr < 4, 0)) {
773 u->wst.error = 1; 817 u->wst.error = 1;
774 goto error; 818 goto error;
775 } 819 }
776#endif 820#endif
777 u->wst.ptr -= 4; 821 u->wst.ptr -= 4;
822 }
778 break; 823 break;
779 }
780 case 0x36: /* DEI2 */ 824 case 0x36: /* DEI2 */
781 { 825 __asm__( "evaluxn_36_DEI2:" );
782 u8 a = u->wst.dat[u->wst.ptr - 1]; 826 {
783 u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); 827 u8 a = u->wst.dat[u->wst.ptr - 1];
784 u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); 828 u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a);
829 u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a + 1);
785#ifndef NO_STACK_CHECKS 830#ifndef NO_STACK_CHECKS
786 if(u->wst.ptr < 1) { 831 if(__builtin_expect(u->wst.ptr < 1, 0)) {
787 u->wst.error = 1; 832 u->wst.error = 1;
788 goto error; 833 goto error;
789 } 834 }
790 if(u->wst.ptr > 254) { 835 if(__builtin_expect(u->wst.ptr > 254, 0)) {
791 u->wst.error = 2; 836 u->wst.error = 2;
792 goto error; 837 goto error;
793 } 838 }
794#endif 839#endif
795 u->wst.ptr += 1; 840 u->wst.ptr += 1;
841 }
796 break; 842 break;
797 }
798 case 0x37: /* DEO2 */ 843 case 0x37: /* DEO2 */
799 { 844 __asm__( "evaluxn_37_DEO2:" );
800 u8 a = u->wst.dat[u->wst.ptr - 1]; 845 {
801 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); 846 u8 a = u->wst.dat[u->wst.ptr - 1];
802 devpoke16(&u->dev[a >> 4], a, b); 847 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8));
848 devpoke16(&u->dev[a >> 4], a, b);
803#ifndef NO_STACK_CHECKS 849#ifndef NO_STACK_CHECKS
804 if(u->wst.ptr < 3) { 850 if(__builtin_expect(u->wst.ptr < 3, 0)) {
805 u->wst.error = 1; 851 u->wst.error = 1;
806 goto error; 852 goto error;
807 } 853 }
808#endif 854#endif
809 u->wst.ptr -= 3; 855 u->wst.ptr -= 3;
856 }
810 break; 857 break;
811 }
812 case 0x38: /* ADD2 */ 858 case 0x38: /* ADD2 */
813 { 859 __asm__( "evaluxn_38_ADD2:" );
814 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 860 {
815 u->wst.dat[u->wst.ptr - 4] = (b + a) >> 8; 861 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
816 u->wst.dat[u->wst.ptr - 3] = (b + a) & 0xff; 862 u->wst.dat[u->wst.ptr - 4] = (b + a) >> 8;
863 u->wst.dat[u->wst.ptr - 3] = (b + a) & 0xff;
817#ifndef NO_STACK_CHECKS 864#ifndef NO_STACK_CHECKS
818 if(u->wst.ptr < 4) { 865 if(__builtin_expect(u->wst.ptr < 4, 0)) {
819 u->wst.error = 1; 866 u->wst.error = 1;
820 goto error; 867 goto error;
821 } 868 }
822#endif 869#endif
823 u->wst.ptr -= 2; 870 u->wst.ptr -= 2;
871 }
824 break; 872 break;
825 }
826 case 0x39: /* SUB2 */ 873 case 0x39: /* SUB2 */
827 { 874 __asm__( "evaluxn_39_SUB2:" );
828 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 875 {
829 u->wst.dat[u->wst.ptr - 4] = (b - a) >> 8; 876 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
830 u->wst.dat[u->wst.ptr - 3] = (b - a) & 0xff; 877 u->wst.dat[u->wst.ptr - 4] = (b - a) >> 8;
878 u->wst.dat[u->wst.ptr - 3] = (b - a) & 0xff;
831#ifndef NO_STACK_CHECKS 879#ifndef NO_STACK_CHECKS
832 if(u->wst.ptr < 4) { 880 if(__builtin_expect(u->wst.ptr < 4, 0)) {
833 u->wst.error = 1; 881 u->wst.error = 1;
834 goto error; 882 goto error;
835 } 883 }
836#endif 884#endif
837 u->wst.ptr -= 2; 885 u->wst.ptr -= 2;
886 }
838 break; 887 break;
839 }
840 case 0x3a: /* MUL2 */ 888 case 0x3a: /* MUL2 */
841 { 889 __asm__( "evaluxn_3a_MUL2:" );
842 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 890 {
843 u->wst.dat[u->wst.ptr - 4] = (b * a) >> 8; 891 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
844 u->wst.dat[u->wst.ptr - 3] = (b * a) & 0xff; 892 u->wst.dat[u->wst.ptr - 4] = (b * a) >> 8;
893 u->wst.dat[u->wst.ptr - 3] = (b * a) & 0xff;
845#ifndef NO_STACK_CHECKS 894#ifndef NO_STACK_CHECKS
846 if(u->wst.ptr < 4) { 895 if(__builtin_expect(u->wst.ptr < 4, 0)) {
847 u->wst.error = 1; 896 u->wst.error = 1;
848 goto error; 897 goto error;
849 } 898 }
850#endif 899#endif
851 u->wst.ptr -= 2; 900 u->wst.ptr -= 2;
901 }
852 break; 902 break;
853 }
854 case 0x3b: /* DIV2 */ 903 case 0x3b: /* DIV2 */
855 { 904 __asm__( "evaluxn_3b_DIV2:" );
856 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 905 {
857 u->wst.dat[u->wst.ptr - 4] = (b / a) >> 8; 906 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
858 u->wst.dat[u->wst.ptr - 3] = (b / a) & 0xff; 907 u->wst.dat[u->wst.ptr - 4] = (b / a) >> 8;
908 u->wst.dat[u->wst.ptr - 3] = (b / a) & 0xff;
859#ifndef NO_STACK_CHECKS 909#ifndef NO_STACK_CHECKS
860 if(u->wst.ptr < 4) { 910 if(__builtin_expect(u->wst.ptr < 4, 0)) {
861 u->wst.error = 1; 911 u->wst.error = 1;
862 goto error; 912 goto error;
863 } 913 }
864#endif 914#endif
865 u->wst.ptr -= 2; 915 u->wst.ptr -= 2;
916 }
866 break; 917 break;
867 }
868 case 0x3c: /* AND2 */ 918 case 0x3c: /* AND2 */
869 { 919 __asm__( "evaluxn_3c_AND2:" );
870 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; 920 {
871 u->wst.dat[u->wst.ptr - 4] = d & b; 921 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
872 u->wst.dat[u->wst.ptr - 3] = c & a; 922 u->wst.dat[u->wst.ptr - 4] = d & b;
923 u->wst.dat[u->wst.ptr - 3] = c & a;
873#ifndef NO_STACK_CHECKS 924#ifndef NO_STACK_CHECKS
874 if(u->wst.ptr < 4) { 925 if(__builtin_expect(u->wst.ptr < 4, 0)) {
875 u->wst.error = 1; 926 u->wst.error = 1;
876 goto error; 927 goto error;
877 } 928 }
878#endif 929#endif
879 u->wst.ptr -= 2; 930 u->wst.ptr -= 2;
931 }
880 break; 932 break;
881 }
882 case 0x3d: /* ORA2 */ 933 case 0x3d: /* ORA2 */
883 { 934 __asm__( "evaluxn_3d_ORA2:" );
884 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; 935 {
885 u->wst.dat[u->wst.ptr - 4] = d | b; 936 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
886 u->wst.dat[u->wst.ptr - 3] = c | a; 937 u->wst.dat[u->wst.ptr - 4] = d | b;
938 u->wst.dat[u->wst.ptr - 3] = c | a;
887#ifndef NO_STACK_CHECKS 939#ifndef NO_STACK_CHECKS
888 if(u->wst.ptr < 4) { 940 if(__builtin_expect(u->wst.ptr < 4, 0)) {
889 u->wst.error = 1; 941 u->wst.error = 1;
890 goto error; 942 goto error;
891 } 943 }
892#endif 944#endif
893 u->wst.ptr -= 2; 945 u->wst.ptr -= 2;
946 }
894 break; 947 break;
895 }
896 case 0x3e: /* EOR2 */ 948 case 0x3e: /* EOR2 */
897 { 949 __asm__( "evaluxn_3e_EOR2:" );
898 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; 950 {
899 u->wst.dat[u->wst.ptr - 4] = d ^ b; 951 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
900 u->wst.dat[u->wst.ptr - 3] = c ^ a; 952 u->wst.dat[u->wst.ptr - 4] = d ^ b;
953 u->wst.dat[u->wst.ptr - 3] = c ^ a;
901#ifndef NO_STACK_CHECKS 954#ifndef NO_STACK_CHECKS
902 if(u->wst.ptr < 4) { 955 if(__builtin_expect(u->wst.ptr < 4, 0)) {
903 u->wst.error = 1; 956 u->wst.error = 1;
904 goto error; 957 goto error;
905 } 958 }
906#endif 959#endif
907 u->wst.ptr -= 2; 960 u->wst.ptr -= 2;
961 }
908 break; 962 break;
909 }
910 case 0x3f: /* SFT2 */ 963 case 0x3f: /* SFT2 */
911 { 964 __asm__( "evaluxn_3f_SFT2:" );
912 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 965 {
913 u->wst.dat[u->wst.ptr - 4] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; 966 u8 a = u->wst.dat[u->wst.ptr - 1];
914 u->wst.dat[u->wst.ptr - 3] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; 967 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8));
968 u->wst.dat[u->wst.ptr - 3] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) >> 8;
969 u->wst.dat[u->wst.ptr - 2] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) & 0xff;
915#ifndef NO_STACK_CHECKS 970#ifndef NO_STACK_CHECKS
916 if(u->wst.ptr < 4) { 971 if(__builtin_expect(u->wst.ptr < 3, 0)) {
917 u->wst.error = 1; 972 u->wst.error = 1;
918 goto error; 973 goto error;
919 } 974 }
920#endif 975#endif
921 u->wst.ptr -= 2; 976 u->wst.ptr -= 1;
977 }
922 break; 978 break;
923 }
924 case 0x41: /* LITr */ 979 case 0x41: /* LITr */
925 case 0xc1: /* LITkr */ 980 case 0xc1: /* LITkr */
926 { 981 __asm__( "evaluxn_41_LITr:" );
927 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); 982 {
983 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++);
928#ifndef NO_STACK_CHECKS 984#ifndef NO_STACK_CHECKS
929 if(u->rst.ptr > 254) { 985 if(__builtin_expect(u->rst.ptr > 254, 0)) {
930 u->rst.error = 2; 986 u->rst.error = 2;
931 goto error; 987 goto error;
932 } 988 }
933#endif 989#endif
934 u->rst.ptr += 1; 990 u->rst.ptr += 1;
991 }
935 break; 992 break;
936 }
937 case 0x43: /* POPr */ 993 case 0x43: /* POPr */
938 { 994 __asm__( "evaluxn_43_POPr:" );
939 u->rst.dat[u->rst.ptr - 1]; 995 {
996 u->rst.dat[u->rst.ptr - 1];
940#ifndef NO_STACK_CHECKS 997#ifndef NO_STACK_CHECKS
941 if(u->rst.ptr < 1) { 998 if(__builtin_expect(u->rst.ptr < 1, 0)) {
942 u->rst.error = 1; 999 u->rst.error = 1;
943 goto error; 1000 goto error;
944 } 1001 }
945#endif 1002#endif
946 u->rst.ptr -= 1; 1003 u->rst.ptr -= 1;
1004 }
947 break; 1005 break;
948 }
949 case 0x44: /* DUPr */ 1006 case 0x44: /* DUPr */
950 { 1007 __asm__( "evaluxn_44_DUPr:" );
951 u8 a = u->rst.dat[u->rst.ptr - 1]; 1008 {
952 u->rst.dat[u->rst.ptr - 1] = a; 1009 u8 a = u->rst.dat[u->rst.ptr - 1];
953 u->rst.dat[u->rst.ptr] = a; 1010 u->rst.dat[u->rst.ptr] = a;
954#ifndef NO_STACK_CHECKS 1011#ifndef NO_STACK_CHECKS
955 if(u->rst.ptr < 1) { 1012 if(__builtin_expect(u->rst.ptr < 1, 0)) {
956 u->rst.error = 1; 1013 u->rst.error = 1;
957 goto error; 1014 goto error;
958 } 1015 }
959 if(u->rst.ptr > 254) { 1016 if(__builtin_expect(u->rst.ptr > 254, 0)) {
960 u->rst.error = 2; 1017 u->rst.error = 2;
961 goto error; 1018 goto error;
962 } 1019 }
963#endif 1020#endif
964 u->rst.ptr += 1; 1021 u->rst.ptr += 1;
1022 }
965 break; 1023 break;
966 }
967 case 0x45: /* SWPr */ 1024 case 0x45: /* SWPr */
968 { 1025 __asm__( "evaluxn_45_SWPr:" );
969 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1026 {
970 u->rst.dat[u->rst.ptr - 2] = a; 1027 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
971 u->rst.dat[u->rst.ptr - 1] = b; 1028 u->rst.dat[u->rst.ptr - 2] = a;
1029 u->rst.dat[u->rst.ptr - 1] = b;
972#ifndef NO_STACK_CHECKS 1030#ifndef NO_STACK_CHECKS
973 if(u->rst.ptr < 2) { 1031 if(__builtin_expect(u->rst.ptr < 2, 0)) {
974 u->rst.error = 1; 1032 u->rst.error = 1;
975 goto error; 1033 goto error;
976 } 1034 }
977#endif 1035#endif
1036 }
978 break; 1037 break;
979 }
980 case 0x46: /* OVRr */ 1038 case 0x46: /* OVRr */
981 { 1039 __asm__( "evaluxn_46_OVRr:" );
982 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1040 {
983 u->rst.dat[u->rst.ptr - 2] = b; 1041 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
984 u->rst.dat[u->rst.ptr - 1] = a; 1042 u->rst.dat[u->rst.ptr] = b;
985 u->rst.dat[u->rst.ptr] = b;
986#ifndef NO_STACK_CHECKS 1043#ifndef NO_STACK_CHECKS
987 if(u->rst.ptr < 2) { 1044 if(__builtin_expect(u->rst.ptr < 2, 0)) {
988 u->rst.error = 1; 1045 u->rst.error = 1;
989 goto error; 1046 goto error;
990 } 1047 }
991 if(u->rst.ptr > 254) { 1048 if(__builtin_expect(u->rst.ptr > 254, 0)) {
992 u->rst.error = 2; 1049 u->rst.error = 2;
993 goto error; 1050 goto error;
994 } 1051 }
995#endif 1052#endif
996 u->rst.ptr += 1; 1053 u->rst.ptr += 1;
1054 }
997 break; 1055 break;
998 }
999 case 0x47: /* ROTr */ 1056 case 0x47: /* ROTr */
1000 { 1057 __asm__( "evaluxn_47_ROTr:" );
1001 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3]; 1058 {
1002 u->rst.dat[u->rst.ptr - 3] = b; 1059 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3];
1003 u->rst.dat[u->rst.ptr - 2] = a; 1060 u->rst.dat[u->rst.ptr - 3] = b;
1004 u->rst.dat[u->rst.ptr - 1] = c; 1061 u->rst.dat[u->rst.ptr - 2] = a;
1062 u->rst.dat[u->rst.ptr - 1] = c;
1005#ifndef NO_STACK_CHECKS 1063#ifndef NO_STACK_CHECKS
1006 if(u->rst.ptr < 3) { 1064 if(__builtin_expect(u->rst.ptr < 3, 0)) {
1007 u->rst.error = 1; 1065 u->rst.error = 1;
1008 goto error; 1066 goto error;
1009 } 1067 }
1010#endif 1068#endif
1069 }
1011 break; 1070 break;
1012 }
1013 case 0x48: /* EQUr */ 1071 case 0x48: /* EQUr */
1014 { 1072 __asm__( "evaluxn_48_EQUr:" );
1015 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1073 {
1016 u->rst.dat[u->rst.ptr - 2] = b == a; 1074 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1075 u->rst.dat[u->rst.ptr - 2] = b == a;
1017#ifndef NO_STACK_CHECKS 1076#ifndef NO_STACK_CHECKS
1018 if(u->rst.ptr < 2) { 1077 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1019 u->rst.error = 1; 1078 u->rst.error = 1;
1020 goto error; 1079 goto error;
1021 } 1080 }
1022#endif 1081#endif
1023 u->rst.ptr -= 1; 1082 u->rst.ptr -= 1;
1083 }
1024 break; 1084 break;
1025 }
1026 case 0x49: /* NEQr */ 1085 case 0x49: /* NEQr */
1027 { 1086 __asm__( "evaluxn_49_NEQr:" );
1028 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1087 {
1029 u->rst.dat[u->rst.ptr - 2] = b != a; 1088 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1089 u->rst.dat[u->rst.ptr - 2] = b != a;
1030#ifndef NO_STACK_CHECKS 1090#ifndef NO_STACK_CHECKS
1031 if(u->rst.ptr < 2) { 1091 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1032 u->rst.error = 1; 1092 u->rst.error = 1;
1033 goto error; 1093 goto error;
1034 } 1094 }
1035#endif 1095#endif
1036 u->rst.ptr -= 1; 1096 u->rst.ptr -= 1;
1097 }
1037 break; 1098 break;
1038 }
1039 case 0x4a: /* GTHr */ 1099 case 0x4a: /* GTHr */
1040 { 1100 __asm__( "evaluxn_4a_GTHr:" );
1041 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1101 {
1042 u->rst.dat[u->rst.ptr - 2] = b > a; 1102 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1103 u->rst.dat[u->rst.ptr - 2] = b > a;
1043#ifndef NO_STACK_CHECKS 1104#ifndef NO_STACK_CHECKS
1044 if(u->rst.ptr < 2) { 1105 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1045 u->rst.error = 1; 1106 u->rst.error = 1;
1046 goto error; 1107 goto error;
1047 } 1108 }
1048#endif 1109#endif
1049 u->rst.ptr -= 1; 1110 u->rst.ptr -= 1;
1111 }
1050 break; 1112 break;
1051 }
1052 case 0x4b: /* LTHr */ 1113 case 0x4b: /* LTHr */
1053 { 1114 __asm__( "evaluxn_4b_LTHr:" );
1054 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1115 {
1055 u->rst.dat[u->rst.ptr - 2] = b < a; 1116 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1117 u->rst.dat[u->rst.ptr - 2] = b < a;
1056#ifndef NO_STACK_CHECKS 1118#ifndef NO_STACK_CHECKS
1057 if(u->rst.ptr < 2) { 1119 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1058 u->rst.error = 1; 1120 u->rst.error = 1;
1059 goto error; 1121 goto error;
1060 } 1122 }
1061#endif 1123#endif
1062 u->rst.ptr -= 1; 1124 u->rst.ptr -= 1;
1125 }
1063 break; 1126 break;
1064 }
1065 case 0x4c: /* JMPr */ 1127 case 0x4c: /* JMPr */
1066 { 1128 __asm__( "evaluxn_4c_JMPr:" );
1067 u8 a = u->rst.dat[u->rst.ptr - 1]; 1129 {
1068 u->ram.ptr += (s8)a; 1130 u8 a = u->rst.dat[u->rst.ptr - 1];
1131 u->ram.ptr += (s8)a;
1069#ifndef NO_STACK_CHECKS 1132#ifndef NO_STACK_CHECKS
1070 if(u->rst.ptr < 1) { 1133 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1071 u->rst.error = 1; 1134 u->rst.error = 1;
1072 goto error; 1135 goto error;
1073 } 1136 }
1074#endif 1137#endif
1075 u->rst.ptr -= 1; 1138 u->rst.ptr -= 1;
1139 }
1076 break; 1140 break;
1077 }
1078 case 0x4d: /* JCNr */ 1141 case 0x4d: /* JCNr */
1079 { 1142 __asm__( "evaluxn_4d_JCNr:" );
1080 u8 a = u->rst.dat[u->rst.ptr - 1]; 1143 {
1081 if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (s8)a; 1144 u8 a = u->rst.dat[u->rst.ptr - 1];
1145 if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (s8)a;
1082#ifndef NO_STACK_CHECKS 1146#ifndef NO_STACK_CHECKS
1083 if(u->rst.ptr < 2) { 1147 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1084 u->rst.error = 1; 1148 u->rst.error = 1;
1085 goto error; 1149 goto error;
1086 } 1150 }
1087#endif 1151#endif
1088 u->rst.ptr -= 2; 1152 u->rst.ptr -= 2;
1153 }
1089 break; 1154 break;
1090 }
1091 case 0x4e: /* JSRr */ 1155 case 0x4e: /* JSRr */
1092 { 1156 __asm__( "evaluxn_4e_JSRr:" );
1093 u8 a = u->rst.dat[u->rst.ptr - 1]; 1157 {
1094 u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; 1158 u8 a = u->rst.dat[u->rst.ptr - 1];
1095 u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; 1159 u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8;
1096 u->ram.ptr += (s8)a; 1160 u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff;
1161 u->ram.ptr += (s8)a;
1097#ifndef NO_STACK_CHECKS 1162#ifndef NO_STACK_CHECKS
1098 if(u->rst.ptr < 1) { 1163 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1099 u->rst.error = 1; 1164 u->rst.error = 1;
1100 goto error; 1165 goto error;
1101 } 1166 }
1102#endif 1167#endif
1103 u->rst.ptr -= 1; 1168 u->rst.ptr -= 1;
1104#ifndef NO_STACK_CHECKS 1169#ifndef NO_STACK_CHECKS
1105 if(u->wst.ptr > 253) { 1170 if(__builtin_expect(u->wst.ptr > 253, 0)) {
1106 u->wst.error = 2; 1171 u->wst.error = 2;
1107 goto error; 1172 goto error;
1108 } 1173 }
1109#endif 1174#endif
1110 u->wst.ptr += 2; 1175 u->wst.ptr += 2;
1176 }
1111 break; 1177 break;
1112 }
1113 case 0x4f: /* STHr */ 1178 case 0x4f: /* STHr */
1114 { 1179 __asm__( "evaluxn_4f_STHr:" );
1115 u8 a = u->rst.dat[u->rst.ptr - 1]; 1180 {
1116 u->wst.dat[u->wst.ptr] = a; 1181 u8 a = u->rst.dat[u->rst.ptr - 1];
1182 u->wst.dat[u->wst.ptr] = a;
1117#ifndef NO_STACK_CHECKS 1183#ifndef NO_STACK_CHECKS
1118 if(u->rst.ptr < 1) { 1184 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1119 u->rst.error = 1; 1185 u->rst.error = 1;
1120 goto error; 1186 goto error;
1121 } 1187 }
1122#endif 1188#endif
1123 u->rst.ptr -= 1; 1189 u->rst.ptr -= 1;
1124#ifndef NO_STACK_CHECKS 1190#ifndef NO_STACK_CHECKS
1125 if(u->wst.ptr > 254) { 1191 if(__builtin_expect(u->wst.ptr > 254, 0)) {
1126 u->wst.error = 2; 1192 u->wst.error = 2;
1127 goto error; 1193 goto error;
1128 } 1194 }
1129#endif 1195#endif
1130 u->wst.ptr += 1; 1196 u->wst.ptr += 1;
1197 }
1131 break; 1198 break;
1132 }
1133 case 0x50: /* LDZr */ 1199 case 0x50: /* LDZr */
1134 { 1200 __asm__( "evaluxn_50_LDZr:" );
1135 u8 a = u->rst.dat[u->rst.ptr - 1]; 1201 {
1136 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); 1202 u8 a = u->rst.dat[u->rst.ptr - 1];
1203 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a);
1137#ifndef NO_STACK_CHECKS 1204#ifndef NO_STACK_CHECKS
1138 if(u->rst.ptr < 1) { 1205 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1139 u->rst.error = 1; 1206 u->rst.error = 1;
1140 goto error; 1207 goto error;
1141 } 1208 }
1142#endif 1209#endif
1210 }
1143 break; 1211 break;
1144 }
1145 case 0x51: /* STZr */ 1212 case 0x51: /* STZr */
1146 { 1213 __asm__( "evaluxn_51_STZr:" );
1147 u8 a = u->rst.dat[u->rst.ptr - 1]; 1214 {
1148 u8 b = u->rst.dat[u->rst.ptr - 2]; 1215 u8 a = u->rst.dat[u->rst.ptr - 1];
1149 mempoke8(u->ram.dat, a, b); 1216 u8 b = u->rst.dat[u->rst.ptr - 2];
1217 mempoke8(u->ram.dat, a, b);
1150#ifndef NO_STACK_CHECKS 1218#ifndef NO_STACK_CHECKS
1151 if(u->rst.ptr < 2) { 1219 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1152 u->rst.error = 1; 1220 u->rst.error = 1;
1153 goto error; 1221 goto error;
1154 } 1222 }
1155#endif 1223#endif
1156 u->rst.ptr -= 2; 1224 u->rst.ptr -= 2;
1225 }
1157 break; 1226 break;
1158 }
1159 case 0x52: /* LDRr */ 1227 case 0x52: /* LDRr */
1160 { 1228 __asm__( "evaluxn_52_LDRr:" );
1161 u8 a = u->rst.dat[u->rst.ptr - 1]; 1229 {
1162 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); 1230 u8 a = u->rst.dat[u->rst.ptr - 1];
1231 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a);
1163#ifndef NO_STACK_CHECKS 1232#ifndef NO_STACK_CHECKS
1164 if(u->rst.ptr < 1) { 1233 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1165 u->rst.error = 1; 1234 u->rst.error = 1;
1166 goto error; 1235 goto error;
1167 } 1236 }
1168#endif 1237#endif
1238 }
1169 break; 1239 break;
1170 }
1171 case 0x53: /* STRr */ 1240 case 0x53: /* STRr */
1172 { 1241 __asm__( "evaluxn_53_STRr:" );
1173 u8 a = u->rst.dat[u->rst.ptr - 1]; 1242 {
1174 u8 b = u->rst.dat[u->rst.ptr - 2]; 1243 u8 a = u->rst.dat[u->rst.ptr - 1];
1175 mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b); 1244 u8 b = u->rst.dat[u->rst.ptr - 2];
1245 mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b);
1176#ifndef NO_STACK_CHECKS 1246#ifndef NO_STACK_CHECKS
1177 if(u->rst.ptr < 2) { 1247 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1178 u->rst.error = 1; 1248 u->rst.error = 1;
1179 goto error; 1249 goto error;
1180 } 1250 }
1181#endif 1251#endif
1182 u->rst.ptr -= 2; 1252 u->rst.ptr -= 2;
1253 }
1183 break; 1254 break;
1184 }
1185 case 0x54: /* LDAr */ 1255 case 0x54: /* LDAr */
1186 { 1256 __asm__( "evaluxn_54_LDAr:" );
1187 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1257 {
1188 u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); 1258 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
1259 u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a);
1189#ifndef NO_STACK_CHECKS 1260#ifndef NO_STACK_CHECKS
1190 if(u->rst.ptr < 2) { 1261 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1191 u->rst.error = 1; 1262 u->rst.error = 1;
1192 goto error; 1263 goto error;
1193 } 1264 }
1194#endif 1265#endif
1195 u->rst.ptr -= 1; 1266 u->rst.ptr -= 1;
1267 }
1196 break; 1268 break;
1197 }
1198 case 0x55: /* STAr */ 1269 case 0x55: /* STAr */
1199 { 1270 __asm__( "evaluxn_55_STAr:" );
1200 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1271 {
1201 u8 b = u->rst.dat[u->rst.ptr - 3]; 1272 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
1202 mempoke8(u->ram.dat, a, b); 1273 u8 b = u->rst.dat[u->rst.ptr - 3];
1274 mempoke8(u->ram.dat, a, b);
1203#ifndef NO_STACK_CHECKS 1275#ifndef NO_STACK_CHECKS
1204 if(u->rst.ptr < 3) { 1276 if(__builtin_expect(u->rst.ptr < 3, 0)) {
1205 u->rst.error = 1; 1277 u->rst.error = 1;
1206 goto error; 1278 goto error;
1207 } 1279 }
1208#endif 1280#endif
1209 u->rst.ptr -= 3; 1281 u->rst.ptr -= 3;
1282 }
1210 break; 1283 break;
1211 }
1212 case 0x56: /* DEIr */ 1284 case 0x56: /* DEIr */
1213 { 1285 __asm__( "evaluxn_56_DEIr:" );
1214 u8 a = u->rst.dat[u->rst.ptr - 1]; 1286 {
1215 u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); 1287 u8 a = u->rst.dat[u->rst.ptr - 1];
1288 u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a);
1216#ifndef NO_STACK_CHECKS 1289#ifndef NO_STACK_CHECKS
1217 if(u->rst.ptr < 1) { 1290 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1218 u->rst.error = 1; 1291 u->rst.error = 1;
1219 goto error; 1292 goto error;
1220 } 1293 }
1221#endif 1294#endif
1295 }
1222 break; 1296 break;
1223 }
1224 case 0x57: /* DEOr */ 1297 case 0x57: /* DEOr */
1225 { 1298 __asm__( "evaluxn_57_DEOr:" );
1226 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1299 {
1227 devpoke8(&u->dev[a >> 4], a, b); 1300 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1301 devpoke8(&u->dev[a >> 4], a, b);
1228#ifndef NO_STACK_CHECKS 1302#ifndef NO_STACK_CHECKS
1229 if(u->rst.ptr < 2) { 1303 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1230 u->rst.error = 1; 1304 u->rst.error = 1;
1231 goto error; 1305 goto error;
1232 } 1306 }
1233#endif 1307#endif
1234 u->rst.ptr -= 2; 1308 u->rst.ptr -= 2;
1309 }
1235 break; 1310 break;
1236 }
1237 case 0x58: /* ADDr */ 1311 case 0x58: /* ADDr */
1238 { 1312 __asm__( "evaluxn_58_ADDr:" );
1239 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1313 {
1240 u->rst.dat[u->rst.ptr - 2] = b + a; 1314 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1315 u->rst.dat[u->rst.ptr - 2] = b + a;
1241#ifndef NO_STACK_CHECKS 1316#ifndef NO_STACK_CHECKS
1242 if(u->rst.ptr < 2) { 1317 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1243 u->rst.error = 1; 1318 u->rst.error = 1;
1244 goto error; 1319 goto error;
1245 } 1320 }
1246#endif 1321#endif
1247 u->rst.ptr -= 1; 1322 u->rst.ptr -= 1;
1323 }
1248 break; 1324 break;
1249 }
1250 case 0x59: /* SUBr */ 1325 case 0x59: /* SUBr */
1251 { 1326 __asm__( "evaluxn_59_SUBr:" );
1252 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1327 {
1253 u->rst.dat[u->rst.ptr - 2] = b - a; 1328 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1329 u->rst.dat[u->rst.ptr - 2] = b - a;
1254#ifndef NO_STACK_CHECKS 1330#ifndef NO_STACK_CHECKS
1255 if(u->rst.ptr < 2) { 1331 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1256 u->rst.error = 1; 1332 u->rst.error = 1;
1257 goto error; 1333 goto error;
1258 } 1334 }
1259#endif 1335#endif
1260 u->rst.ptr -= 1; 1336 u->rst.ptr -= 1;
1337 }
1261 break; 1338 break;
1262 }
1263 case 0x5a: /* MULr */ 1339 case 0x5a: /* MULr */
1264 { 1340 __asm__( "evaluxn_5a_MULr:" );
1265 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1341 {
1266 u->rst.dat[u->rst.ptr - 2] = b * a; 1342 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1343 u->rst.dat[u->rst.ptr - 2] = b * a;
1267#ifndef NO_STACK_CHECKS 1344#ifndef NO_STACK_CHECKS
1268 if(u->rst.ptr < 2) { 1345 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1269 u->rst.error = 1; 1346 u->rst.error = 1;
1270 goto error; 1347 goto error;
1271 } 1348 }
1272#endif 1349#endif
1273 u->rst.ptr -= 1; 1350 u->rst.ptr -= 1;
1351 }
1274 break; 1352 break;
1275 }
1276 case 0x5b: /* DIVr */ 1353 case 0x5b: /* DIVr */
1277 { 1354 __asm__( "evaluxn_5b_DIVr:" );
1278 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1355 {
1279 u->rst.dat[u->rst.ptr - 2] = b / a; 1356 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1357 u->rst.dat[u->rst.ptr - 2] = b / a;
1280#ifndef NO_STACK_CHECKS 1358#ifndef NO_STACK_CHECKS
1281 if(u->rst.ptr < 2) { 1359 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1282 u->rst.error = 1; 1360 u->rst.error = 1;
1283 goto error; 1361 goto error;
1284 } 1362 }
1285#endif 1363#endif
1286 u->rst.ptr -= 1; 1364 u->rst.ptr -= 1;
1365 }
1287 break; 1366 break;
1288 }
1289 case 0x5c: /* ANDr */ 1367 case 0x5c: /* ANDr */
1290 { 1368 __asm__( "evaluxn_5c_ANDr:" );
1291 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1369 {
1292 u->rst.dat[u->rst.ptr - 2] = b & a; 1370 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1371 u->rst.dat[u->rst.ptr - 2] = b & a;
1293#ifndef NO_STACK_CHECKS 1372#ifndef NO_STACK_CHECKS
1294 if(u->rst.ptr < 2) { 1373 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1295 u->rst.error = 1; 1374 u->rst.error = 1;
1296 goto error; 1375 goto error;
1297 } 1376 }
1298#endif 1377#endif
1299 u->rst.ptr -= 1; 1378 u->rst.ptr -= 1;
1379 }
1300 break; 1380 break;
1301 }
1302 case 0x5d: /* ORAr */ 1381 case 0x5d: /* ORAr */
1303 { 1382 __asm__( "evaluxn_5d_ORAr:" );
1304 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1383 {
1305 u->rst.dat[u->rst.ptr - 2] = b | a; 1384 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1385 u->rst.dat[u->rst.ptr - 2] = b | a;
1306#ifndef NO_STACK_CHECKS 1386#ifndef NO_STACK_CHECKS
1307 if(u->rst.ptr < 2) { 1387 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1308 u->rst.error = 1; 1388 u->rst.error = 1;
1309 goto error; 1389 goto error;
1310 } 1390 }
1311#endif 1391#endif
1312 u->rst.ptr -= 1; 1392 u->rst.ptr -= 1;
1393 }
1313 break; 1394 break;
1314 }
1315 case 0x5e: /* EORr */ 1395 case 0x5e: /* EORr */
1316 { 1396 __asm__( "evaluxn_5e_EORr:" );
1317 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1397 {
1318 u->rst.dat[u->rst.ptr - 2] = b ^ a; 1398 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1399 u->rst.dat[u->rst.ptr - 2] = b ^ a;
1319#ifndef NO_STACK_CHECKS 1400#ifndef NO_STACK_CHECKS
1320 if(u->rst.ptr < 2) { 1401 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1321 u->rst.error = 1; 1402 u->rst.error = 1;
1322 goto error; 1403 goto error;
1323 } 1404 }
1324#endif 1405#endif
1325 u->rst.ptr -= 1; 1406 u->rst.ptr -= 1;
1407 }
1326 break; 1408 break;
1327 }
1328 case 0x5f: /* SFTr */ 1409 case 0x5f: /* SFTr */
1329 { 1410 __asm__( "evaluxn_5f_SFTr:" );
1330 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 1411 {
1331 u->rst.dat[u->rst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4); 1412 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1413 u->rst.dat[u->rst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4);
1332#ifndef NO_STACK_CHECKS 1414#ifndef NO_STACK_CHECKS
1333 if(u->rst.ptr < 2) { 1415 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1334 u->rst.error = 1; 1416 u->rst.error = 1;
1335 goto error; 1417 goto error;
1336 } 1418 }
1337#endif 1419#endif
1338 u->rst.ptr -= 1; 1420 u->rst.ptr -= 1;
1421 }
1339 break; 1422 break;
1340 }
1341 case 0x61: /* LIT2r */ 1423 case 0x61: /* LIT2r */
1342 case 0xe1: /* LIT2kr */ 1424 case 0xe1: /* LIT2kr */
1343 { 1425 __asm__( "evaluxn_61_LIT2r:" );
1344 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++); 1426 {
1345 u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr++); 1427 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr++);
1428 u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr++);
1346#ifndef NO_STACK_CHECKS 1429#ifndef NO_STACK_CHECKS
1347 if(u->rst.ptr > 253) { 1430 if(__builtin_expect(u->rst.ptr > 253, 0)) {
1348 u->rst.error = 2; 1431 u->rst.error = 2;
1349 goto error; 1432 goto error;
1350 } 1433 }
1351#endif 1434#endif
1352 u->rst.ptr += 2; 1435 u->rst.ptr += 2;
1436 }
1353 break; 1437 break;
1354 }
1355 case 0x63: /* POP2r */ 1438 case 0x63: /* POP2r */
1356 { 1439 __asm__( "evaluxn_63_POP2r:" );
1357 (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1440 {
1441 (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
1358#ifndef NO_STACK_CHECKS 1442#ifndef NO_STACK_CHECKS
1359 if(u->rst.ptr < 2) { 1443 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1360 u->rst.error = 1; 1444 u->rst.error = 1;
1361 goto error; 1445 goto error;
1362 } 1446 }
1363#endif 1447#endif
1364 u->rst.ptr -= 2; 1448 u->rst.ptr -= 2;
1449 }
1365 break; 1450 break;
1366 }
1367 case 0x64: /* DUP2r */ 1451 case 0x64: /* DUP2r */
1368 { 1452 __asm__( "evaluxn_64_DUP2r:" );
1369 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1453 {
1370 u->rst.dat[u->rst.ptr - 2] = a >> 8; 1454 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1371 u->rst.dat[u->rst.ptr - 1] = a & 0xff; 1455 u->rst.dat[u->rst.ptr] = b;
1372 u->rst.dat[u->rst.ptr] = a >> 8; 1456 u->rst.dat[u->rst.ptr + 1] = a;
1373 u->rst.dat[u->rst.ptr + 1] = a & 0xff;
1374#ifndef NO_STACK_CHECKS 1457#ifndef NO_STACK_CHECKS
1375 if(u->rst.ptr < 2) { 1458 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1376 u->rst.error = 1; 1459 u->rst.error = 1;
1377 goto error; 1460 goto error;
1378 } 1461 }
1379 if(u->rst.ptr > 253) { 1462 if(__builtin_expect(u->rst.ptr > 253, 0)) {
1380 u->rst.error = 2; 1463 u->rst.error = 2;
1381 goto error; 1464 goto error;
1382 } 1465 }
1383#endif 1466#endif
1384 u->rst.ptr += 2; 1467 u->rst.ptr += 2;
1468 }
1385 break; 1469 break;
1386 }
1387 case 0x65: /* SWP2r */ 1470 case 0x65: /* SWP2r */
1388 { 1471 __asm__( "evaluxn_65_SWP2r:" );
1389 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1472 {
1390 u->rst.dat[u->rst.ptr - 4] = a >> 8; 1473 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
1391 u->rst.dat[u->rst.ptr - 3] = a & 0xff; 1474 u->rst.dat[u->rst.ptr - 4] = b;
1392 u->rst.dat[u->rst.ptr - 2] = b >> 8; 1475 u->rst.dat[u->rst.ptr - 3] = a;
1393 u->rst.dat[u->rst.ptr - 1] = b & 0xff; 1476 u->rst.dat[u->rst.ptr - 2] = d;
1477 u->rst.dat[u->rst.ptr - 1] = c;
1394#ifndef NO_STACK_CHECKS 1478#ifndef NO_STACK_CHECKS
1395 if(u->rst.ptr < 4) { 1479 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1396 u->rst.error = 1; 1480 u->rst.error = 1;
1397 goto error; 1481 goto error;
1398 } 1482 }
1399#endif 1483#endif
1484 }
1400 break; 1485 break;
1401 }
1402 case 0x66: /* OVR2r */ 1486 case 0x66: /* OVR2r */
1403 { 1487 __asm__( "evaluxn_66_OVR2r:" );
1404 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1488 {
1405 u->rst.dat[u->rst.ptr - 4] = b >> 8; 1489 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
1406 u->rst.dat[u->rst.ptr - 3] = b & 0xff; 1490 u->rst.dat[u->rst.ptr] = d;
1407 u->rst.dat[u->rst.ptr - 2] = a >> 8; 1491 u->rst.dat[u->rst.ptr + 1] = c;
1408 u->rst.dat[u->rst.ptr - 1] = a & 0xff;
1409 u->rst.dat[u->rst.ptr] = b >> 8;
1410 u->rst.dat[u->rst.ptr + 1] = b & 0xff;
1411#ifndef NO_STACK_CHECKS 1492#ifndef NO_STACK_CHECKS
1412 if(u->rst.ptr < 4) { 1493 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1413 u->rst.error = 1; 1494 u->rst.error = 1;
1414 goto error; 1495 goto error;
1415 } 1496 }
1416 if(u->rst.ptr > 253) { 1497 if(__builtin_expect(u->rst.ptr > 253, 0)) {
1417 u->rst.error = 2; 1498 u->rst.error = 2;
1418 goto error; 1499 goto error;
1419 } 1500 }
1420#endif 1501#endif
1421 u->rst.ptr += 2; 1502 u->rst.ptr += 2;
1503 }
1422 break; 1504 break;
1423 }
1424 case 0x67: /* ROT2r */ 1505 case 0x67: /* ROT2r */
1425 { 1506 __asm__( "evaluxn_67_ROT2r:" );
1426 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)), c = (u->rst.dat[u->rst.ptr - 5] | (u->rst.dat[u->rst.ptr - 6] << 8)); 1507 {
1427 u->rst.dat[u->rst.ptr - 6] = b >> 8; 1508 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4], e = u->rst.dat[u->rst.ptr - 5], f = u->rst.dat[u->rst.ptr - 6];
1428 u->rst.dat[u->rst.ptr - 5] = b & 0xff; 1509 u->rst.dat[u->rst.ptr - 6] = d;
1429 u->rst.dat[u->rst.ptr - 4] = a >> 8; 1510 u->rst.dat[u->rst.ptr - 5] = c;
1430 u->rst.dat[u->rst.ptr - 3] = a & 0xff; 1511 u->rst.dat[u->rst.ptr - 4] = b;
1431 u->rst.dat[u->rst.ptr - 2] = c >> 8; 1512 u->rst.dat[u->rst.ptr - 3] = a;
1432 u->rst.dat[u->rst.ptr - 1] = c & 0xff; 1513 u->rst.dat[u->rst.ptr - 2] = f;
1514 u->rst.dat[u->rst.ptr - 1] = e;
1433#ifndef NO_STACK_CHECKS 1515#ifndef NO_STACK_CHECKS
1434 if(u->rst.ptr < 6) { 1516 if(__builtin_expect(u->rst.ptr < 6, 0)) {
1435 u->rst.error = 1; 1517 u->rst.error = 1;
1436 goto error; 1518 goto error;
1437 } 1519 }
1438#endif 1520#endif
1521 }
1439 break; 1522 break;
1440 }
1441 case 0x68: /* EQU2r */ 1523 case 0x68: /* EQU2r */
1442 { 1524 __asm__( "evaluxn_68_EQU2r:" );
1443 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1525 {
1444 u->rst.dat[u->rst.ptr - 4] = b == a; 1526 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1527 u->rst.dat[u->rst.ptr - 4] = b == a;
1445#ifndef NO_STACK_CHECKS 1528#ifndef NO_STACK_CHECKS
1446 if(u->rst.ptr < 4) { 1529 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1447 u->rst.error = 1; 1530 u->rst.error = 1;
1448 goto error; 1531 goto error;
1449 } 1532 }
1450#endif 1533#endif
1451 u->rst.ptr -= 3; 1534 u->rst.ptr -= 3;
1535 }
1452 break; 1536 break;
1453 }
1454 case 0x69: /* NEQ2r */ 1537 case 0x69: /* NEQ2r */
1455 { 1538 __asm__( "evaluxn_69_NEQ2r:" );
1456 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1539 {
1457 u->rst.dat[u->rst.ptr - 4] = b != a; 1540 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1541 u->rst.dat[u->rst.ptr - 4] = b != a;
1458#ifndef NO_STACK_CHECKS 1542#ifndef NO_STACK_CHECKS
1459 if(u->rst.ptr < 4) { 1543 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1460 u->rst.error = 1; 1544 u->rst.error = 1;
1461 goto error; 1545 goto error;
1462 } 1546 }
1463#endif 1547#endif
1464 u->rst.ptr -= 3; 1548 u->rst.ptr -= 3;
1549 }
1465 break; 1550 break;
1466 }
1467 case 0x6a: /* GTH2r */ 1551 case 0x6a: /* GTH2r */
1468 { 1552 __asm__( "evaluxn_6a_GTH2r:" );
1469 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1553 {
1470 u->rst.dat[u->rst.ptr - 4] = b > a; 1554 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1555 u->rst.dat[u->rst.ptr - 4] = b > a;
1471#ifndef NO_STACK_CHECKS 1556#ifndef NO_STACK_CHECKS
1472 if(u->rst.ptr < 4) { 1557 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1473 u->rst.error = 1; 1558 u->rst.error = 1;
1474 goto error; 1559 goto error;
1475 } 1560 }
1476#endif 1561#endif
1477 u->rst.ptr -= 3; 1562 u->rst.ptr -= 3;
1563 }
1478 break; 1564 break;
1479 }
1480 case 0x6b: /* LTH2r */ 1565 case 0x6b: /* LTH2r */
1481 { 1566 __asm__( "evaluxn_6b_LTH2r:" );
1482 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1567 {
1483 u->rst.dat[u->rst.ptr - 4] = b < a; 1568 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1569 u->rst.dat[u->rst.ptr - 4] = b < a;
1484#ifndef NO_STACK_CHECKS 1570#ifndef NO_STACK_CHECKS
1485 if(u->rst.ptr < 4) { 1571 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1486 u->rst.error = 1; 1572 u->rst.error = 1;
1487 goto error; 1573 goto error;
1488 } 1574 }
1489#endif 1575#endif
1490 u->rst.ptr -= 3; 1576 u->rst.ptr -= 3;
1577 }
1491 break; 1578 break;
1492 }
1493 case 0x6c: /* JMP2r */ 1579 case 0x6c: /* JMP2r */
1494 { 1580 __asm__( "evaluxn_6c_JMP2r:" );
1495 u->ram.ptr = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1581 {
1582 u->ram.ptr = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
1496#ifndef NO_STACK_CHECKS 1583#ifndef NO_STACK_CHECKS
1497 if(u->rst.ptr < 2) { 1584 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1498 u->rst.error = 1; 1585 u->rst.error = 1;
1499 goto error; 1586 goto error;
1500 } 1587 }
1501#endif 1588#endif
1502 u->rst.ptr -= 2; 1589 u->rst.ptr -= 2;
1590 }
1503 break; 1591 break;
1504 }
1505 case 0x6d: /* JCN2r */ 1592 case 0x6d: /* JCN2r */
1506 { 1593 __asm__( "evaluxn_6d_JCN2r:" );
1507 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1594 {
1508 if(u->rst.dat[u->rst.ptr - 3]) u->ram.ptr = a; 1595 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
1596 if(u->rst.dat[u->rst.ptr - 3]) u->ram.ptr = a;
1509#ifndef NO_STACK_CHECKS 1597#ifndef NO_STACK_CHECKS
1510 if(u->rst.ptr < 3) { 1598 if(__builtin_expect(u->rst.ptr < 3, 0)) {
1511 u->rst.error = 1; 1599 u->rst.error = 1;
1512 goto error; 1600 goto error;
1513 } 1601 }
1514#endif 1602#endif
1515 u->rst.ptr -= 3; 1603 u->rst.ptr -= 3;
1604 }
1516 break; 1605 break;
1517 }
1518 case 0x6e: /* JSR2r */ 1606 case 0x6e: /* JSR2r */
1519 { 1607 __asm__( "evaluxn_6e_JSR2r:" );
1520 u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; 1608 {
1521 u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; 1609 u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8;
1522 u->ram.ptr = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1610 u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff;
1611 u->ram.ptr = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
1523#ifndef NO_STACK_CHECKS 1612#ifndef NO_STACK_CHECKS
1524 if(u->rst.ptr < 2) { 1613 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1525 u->rst.error = 1; 1614 u->rst.error = 1;
1526 goto error; 1615 goto error;
1527 } 1616 }
1528#endif 1617#endif
1529 u->rst.ptr -= 2; 1618 u->rst.ptr -= 2;
1530#ifndef NO_STACK_CHECKS 1619#ifndef NO_STACK_CHECKS
1531 if(u->wst.ptr > 253) { 1620 if(__builtin_expect(u->wst.ptr > 253, 0)) {
1532 u->wst.error = 2; 1621 u->wst.error = 2;
1533 goto error; 1622 goto error;
1534 } 1623 }
1535#endif 1624#endif
1536 u->wst.ptr += 2; 1625 u->wst.ptr += 2;
1626 }
1537 break; 1627 break;
1538 }
1539 case 0x6f: /* STH2r */ 1628 case 0x6f: /* STH2r */
1540 { 1629 __asm__( "evaluxn_6f_STH2r:" );
1541 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1630 {
1542 u->wst.dat[u->wst.ptr] = a >> 8; 1631 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
1543 u->wst.dat[u->wst.ptr + 1] = a & 0xff; 1632 u->wst.dat[u->wst.ptr] = b;
1633 u->wst.dat[u->wst.ptr + 1] = a;
1544#ifndef NO_STACK_CHECKS 1634#ifndef NO_STACK_CHECKS
1545 if(u->rst.ptr < 2) { 1635 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1546 u->rst.error = 1; 1636 u->rst.error = 1;
1547 goto error; 1637 goto error;
1548 } 1638 }
1549#endif 1639#endif
1550 u->rst.ptr -= 2; 1640 u->rst.ptr -= 2;
1551#ifndef NO_STACK_CHECKS 1641#ifndef NO_STACK_CHECKS
1552 if(u->wst.ptr > 253) { 1642 if(__builtin_expect(u->wst.ptr > 253, 0)) {
1553 u->wst.error = 2; 1643 u->wst.error = 2;
1554 goto error; 1644 goto error;
1555 } 1645 }
1556#endif 1646#endif
1557 u->wst.ptr += 2; 1647 u->wst.ptr += 2;
1648 }
1558 break; 1649 break;
1559 }
1560 case 0x70: /* LDZ2r */ 1650 case 0x70: /* LDZ2r */
1561 { 1651 __asm__( "evaluxn_70_LDZ2r:" );
1562 u8 a = u->rst.dat[u->rst.ptr - 1]; 1652 {
1563 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); 1653 u8 a = u->rst.dat[u->rst.ptr - 1];
1564 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a + 1); 1654 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a);
1655 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a + 1);
1565#ifndef NO_STACK_CHECKS 1656#ifndef NO_STACK_CHECKS
1566 if(u->rst.ptr < 1) { 1657 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1567 u->rst.error = 1; 1658 u->rst.error = 1;
1568 goto error; 1659 goto error;
1569 } 1660 }
1570 if(u->rst.ptr > 254) { 1661 if(__builtin_expect(u->rst.ptr > 254, 0)) {
1571 u->rst.error = 2; 1662 u->rst.error = 2;
1572 goto error; 1663 goto error;
1573 } 1664 }
1574#endif 1665#endif
1575 u->rst.ptr += 1; 1666 u->rst.ptr += 1;
1667 }
1576 break; 1668 break;
1577 }
1578 case 0x71: /* STZ2r */ 1669 case 0x71: /* STZ2r */
1579 { 1670 __asm__( "evaluxn_71_STZ2r:" );
1580 u8 a = u->rst.dat[u->rst.ptr - 1]; 1671 {
1581 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); 1672 u8 a = u->rst.dat[u->rst.ptr - 1];
1582 mempoke16(u->ram.dat, a, b); 1673 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8));
1674 mempoke16(u->ram.dat, a, b);
1583#ifndef NO_STACK_CHECKS 1675#ifndef NO_STACK_CHECKS
1584 if(u->rst.ptr < 3) { 1676 if(__builtin_expect(u->rst.ptr < 3, 0)) {
1585 u->rst.error = 1; 1677 u->rst.error = 1;
1586 goto error; 1678 goto error;
1587 } 1679 }
1588#endif 1680#endif
1589 u->rst.ptr -= 3; 1681 u->rst.ptr -= 3;
1682 }
1590 break; 1683 break;
1591 }
1592 case 0x72: /* LDR2r */ 1684 case 0x72: /* LDR2r */
1593 { 1685 __asm__( "evaluxn_72_LDR2r:" );
1594 u8 a = u->rst.dat[u->rst.ptr - 1]; 1686 {
1595 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); 1687 u8 a = u->rst.dat[u->rst.ptr - 1];
1596 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1); 1688 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a);
1689 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1);
1597#ifndef NO_STACK_CHECKS 1690#ifndef NO_STACK_CHECKS
1598 if(u->rst.ptr < 1) { 1691 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1599 u->rst.error = 1; 1692 u->rst.error = 1;
1600 goto error; 1693 goto error;
1601 } 1694 }
1602 if(u->rst.ptr > 254) { 1695 if(__builtin_expect(u->rst.ptr > 254, 0)) {
1603 u->rst.error = 2; 1696 u->rst.error = 2;
1604 goto error; 1697 goto error;
1605 } 1698 }
1606#endif 1699#endif
1607 u->rst.ptr += 1; 1700 u->rst.ptr += 1;
1701 }
1608 break; 1702 break;
1609 }
1610 case 0x73: /* STR2r */ 1703 case 0x73: /* STR2r */
1611 { 1704 __asm__( "evaluxn_73_STR2r:" );
1612 u8 a = u->rst.dat[u->rst.ptr - 1]; 1705 {
1613 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); 1706 u8 a = u->rst.dat[u->rst.ptr - 1];
1614 mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b); 1707 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8));
1708 mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b);
1615#ifndef NO_STACK_CHECKS 1709#ifndef NO_STACK_CHECKS
1616 if(u->rst.ptr < 3) { 1710 if(__builtin_expect(u->rst.ptr < 3, 0)) {
1617 u->rst.error = 1; 1711 u->rst.error = 1;
1618 goto error; 1712 goto error;
1619 } 1713 }
1620#endif 1714#endif
1621 u->rst.ptr -= 3; 1715 u->rst.ptr -= 3;
1716 }
1622 break; 1717 break;
1623 }
1624 case 0x74: /* LDA2r */ 1718 case 0x74: /* LDA2r */
1625 { 1719 __asm__( "evaluxn_74_LDA2r:" );
1626 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1720 {
1627 u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); 1721 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
1628 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a + 1); 1722 u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a);
1723 u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a + 1);
1629#ifndef NO_STACK_CHECKS 1724#ifndef NO_STACK_CHECKS
1630 if(u->rst.ptr < 2) { 1725 if(__builtin_expect(u->rst.ptr < 2, 0)) {
1631 u->rst.error = 1; 1726 u->rst.error = 1;
1632 goto error; 1727 goto error;
1633 } 1728 }
1634#endif 1729#endif
1730 }
1635 break; 1731 break;
1636 }
1637 case 0x75: /* STA2r */ 1732 case 0x75: /* STA2r */
1638 { 1733 __asm__( "evaluxn_75_STA2r:" );
1639 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 1734 {
1640 u16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1735 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
1641 mempoke16(u->ram.dat, a, b); 1736 u16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1737 mempoke16(u->ram.dat, a, b);
1642#ifndef NO_STACK_CHECKS 1738#ifndef NO_STACK_CHECKS
1643 if(u->rst.ptr < 4) { 1739 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1644 u->rst.error = 1; 1740 u->rst.error = 1;
1645 goto error; 1741 goto error;
1646 } 1742 }
1647#endif 1743#endif
1648 u->rst.ptr -= 4; 1744 u->rst.ptr -= 4;
1745 }
1649 break; 1746 break;
1650 }
1651 case 0x76: /* DEI2r */ 1747 case 0x76: /* DEI2r */
1652 { 1748 __asm__( "evaluxn_76_DEI2r:" );
1653 u8 a = u->rst.dat[u->rst.ptr - 1]; 1749 {
1654 u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); 1750 u8 a = u->rst.dat[u->rst.ptr - 1];
1655 u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); 1751 u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a);
1752 u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a + 1);
1656#ifndef NO_STACK_CHECKS 1753#ifndef NO_STACK_CHECKS
1657 if(u->rst.ptr < 1) { 1754 if(__builtin_expect(u->rst.ptr < 1, 0)) {
1658 u->rst.error = 1; 1755 u->rst.error = 1;
1659 goto error; 1756 goto error;
1660 } 1757 }
1661 if(u->rst.ptr > 254) { 1758 if(__builtin_expect(u->rst.ptr > 254, 0)) {
1662 u->rst.error = 2; 1759 u->rst.error = 2;
1663 goto error; 1760 goto error;
1664 } 1761 }
1665#endif 1762#endif
1666 u->rst.ptr += 1; 1763 u->rst.ptr += 1;
1764 }
1667 break; 1765 break;
1668 }
1669 case 0x77: /* DEO2r */ 1766 case 0x77: /* DEO2r */
1670 { 1767 __asm__( "evaluxn_77_DEO2r:" );
1671 u8 a = u->rst.dat[u->rst.ptr - 1]; 1768 {
1672 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); 1769 u8 a = u->rst.dat[u->rst.ptr - 1];
1673 devpoke16(&u->dev[a >> 4], a, b); 1770 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8));
1771 devpoke16(&u->dev[a >> 4], a, b);
1674#ifndef NO_STACK_CHECKS 1772#ifndef NO_STACK_CHECKS
1675 if(u->rst.ptr < 3) { 1773 if(__builtin_expect(u->rst.ptr < 3, 0)) {
1676 u->rst.error = 1; 1774 u->rst.error = 1;
1677 goto error; 1775 goto error;
1678 } 1776 }
1679#endif 1777#endif
1680 u->rst.ptr -= 3; 1778 u->rst.ptr -= 3;
1779 }
1681 break; 1780 break;
1682 }
1683 case 0x78: /* ADD2r */ 1781 case 0x78: /* ADD2r */
1684 { 1782 __asm__( "evaluxn_78_ADD2r:" );
1685 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1783 {
1686 u->rst.dat[u->rst.ptr - 4] = (b + a) >> 8; 1784 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1687 u->rst.dat[u->rst.ptr - 3] = (b + a) & 0xff; 1785 u->rst.dat[u->rst.ptr - 4] = (b + a) >> 8;
1786 u->rst.dat[u->rst.ptr - 3] = (b + a) & 0xff;
1688#ifndef NO_STACK_CHECKS 1787#ifndef NO_STACK_CHECKS
1689 if(u->rst.ptr < 4) { 1788 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1690 u->rst.error = 1; 1789 u->rst.error = 1;
1691 goto error; 1790 goto error;
1692 } 1791 }
1693#endif 1792#endif
1694 u->rst.ptr -= 2; 1793 u->rst.ptr -= 2;
1794 }
1695 break; 1795 break;
1696 }
1697 case 0x79: /* SUB2r */ 1796 case 0x79: /* SUB2r */
1698 { 1797 __asm__( "evaluxn_79_SUB2r:" );
1699 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1798 {
1700 u->rst.dat[u->rst.ptr - 4] = (b - a) >> 8; 1799 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1701 u->rst.dat[u->rst.ptr - 3] = (b - a) & 0xff; 1800 u->rst.dat[u->rst.ptr - 4] = (b - a) >> 8;
1801 u->rst.dat[u->rst.ptr - 3] = (b - a) & 0xff;
1702#ifndef NO_STACK_CHECKS 1802#ifndef NO_STACK_CHECKS
1703 if(u->rst.ptr < 4) { 1803 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1704 u->rst.error = 1; 1804 u->rst.error = 1;
1705 goto error; 1805 goto error;
1706 } 1806 }
1707#endif 1807#endif
1708 u->rst.ptr -= 2; 1808 u->rst.ptr -= 2;
1809 }
1709 break; 1810 break;
1710 }
1711 case 0x7a: /* MUL2r */ 1811 case 0x7a: /* MUL2r */
1712 { 1812 __asm__( "evaluxn_7a_MUL2r:" );
1713 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1813 {
1714 u->rst.dat[u->rst.ptr - 4] = (b * a) >> 8; 1814 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1715 u->rst.dat[u->rst.ptr - 3] = (b * a) & 0xff; 1815 u->rst.dat[u->rst.ptr - 4] = (b * a) >> 8;
1816 u->rst.dat[u->rst.ptr - 3] = (b * a) & 0xff;
1716#ifndef NO_STACK_CHECKS 1817#ifndef NO_STACK_CHECKS
1717 if(u->rst.ptr < 4) { 1818 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1718 u->rst.error = 1; 1819 u->rst.error = 1;
1719 goto error; 1820 goto error;
1720 } 1821 }
1721#endif 1822#endif
1722 u->rst.ptr -= 2; 1823 u->rst.ptr -= 2;
1824 }
1723 break; 1825 break;
1724 }
1725 case 0x7b: /* DIV2r */ 1826 case 0x7b: /* DIV2r */
1726 { 1827 __asm__( "evaluxn_7b_DIV2r:" );
1727 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1828 {
1728 u->rst.dat[u->rst.ptr - 4] = (b / a) >> 8; 1829 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
1729 u->rst.dat[u->rst.ptr - 3] = (b / a) & 0xff; 1830 u->rst.dat[u->rst.ptr - 4] = (b / a) >> 8;
1831 u->rst.dat[u->rst.ptr - 3] = (b / a) & 0xff;
1730#ifndef NO_STACK_CHECKS 1832#ifndef NO_STACK_CHECKS
1731 if(u->rst.ptr < 4) { 1833 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1732 u->rst.error = 1; 1834 u->rst.error = 1;
1733 goto error; 1835 goto error;
1734 } 1836 }
1735#endif 1837#endif
1736 u->rst.ptr -= 2; 1838 u->rst.ptr -= 2;
1839 }
1737 break; 1840 break;
1738 }
1739 case 0x7c: /* AND2r */ 1841 case 0x7c: /* AND2r */
1740 { 1842 __asm__( "evaluxn_7c_AND2r:" );
1741 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4]; 1843 {
1742 u->rst.dat[u->rst.ptr - 4] = d & b; 1844 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
1743 u->rst.dat[u->rst.ptr - 3] = c & a; 1845 u->rst.dat[u->rst.ptr - 4] = d & b;
1846 u->rst.dat[u->rst.ptr - 3] = c & a;
1744#ifndef NO_STACK_CHECKS 1847#ifndef NO_STACK_CHECKS
1745 if(u->rst.ptr < 4) { 1848 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1746 u->rst.error = 1; 1849 u->rst.error = 1;
1747 goto error; 1850 goto error;
1748 } 1851 }
1749#endif 1852#endif
1750 u->rst.ptr -= 2; 1853 u->rst.ptr -= 2;
1854 }
1751 break; 1855 break;
1752 }
1753 case 0x7d: /* ORA2r */ 1856 case 0x7d: /* ORA2r */
1754 { 1857 __asm__( "evaluxn_7d_ORA2r:" );
1755 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4]; 1858 {
1756 u->rst.dat[u->rst.ptr - 4] = d | b; 1859 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
1757 u->rst.dat[u->rst.ptr - 3] = c | a; 1860 u->rst.dat[u->rst.ptr - 4] = d | b;
1861 u->rst.dat[u->rst.ptr - 3] = c | a;
1758#ifndef NO_STACK_CHECKS 1862#ifndef NO_STACK_CHECKS
1759 if(u->rst.ptr < 4) { 1863 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1760 u->rst.error = 1; 1864 u->rst.error = 1;
1761 goto error; 1865 goto error;
1762 } 1866 }
1763#endif 1867#endif
1764 u->rst.ptr -= 2; 1868 u->rst.ptr -= 2;
1869 }
1765 break; 1870 break;
1766 }
1767 case 0x7e: /* EOR2r */ 1871 case 0x7e: /* EOR2r */
1768 { 1872 __asm__( "evaluxn_7e_EOR2r:" );
1769 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4]; 1873 {
1770 u->rst.dat[u->rst.ptr - 4] = d ^ b; 1874 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
1771 u->rst.dat[u->rst.ptr - 3] = c ^ a; 1875 u->rst.dat[u->rst.ptr - 4] = d ^ b;
1876 u->rst.dat[u->rst.ptr - 3] = c ^ a;
1772#ifndef NO_STACK_CHECKS 1877#ifndef NO_STACK_CHECKS
1773 if(u->rst.ptr < 4) { 1878 if(__builtin_expect(u->rst.ptr < 4, 0)) {
1774 u->rst.error = 1; 1879 u->rst.error = 1;
1775 goto error; 1880 goto error;
1776 } 1881 }
1777#endif 1882#endif
1778 u->rst.ptr -= 2; 1883 u->rst.ptr -= 2;
1884 }
1779 break; 1885 break;
1780 }
1781 case 0x7f: /* SFT2r */ 1886 case 0x7f: /* SFT2r */
1782 { 1887 __asm__( "evaluxn_7f_SFT2r:" );
1783 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 1888 {
1784 u->rst.dat[u->rst.ptr - 4] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; 1889 u8 a = u->rst.dat[u->rst.ptr - 1];
1785 u->rst.dat[u->rst.ptr - 3] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; 1890 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8));
1891 u->rst.dat[u->rst.ptr - 3] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) >> 8;
1892 u->rst.dat[u->rst.ptr - 2] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) & 0xff;
1786#ifndef NO_STACK_CHECKS 1893#ifndef NO_STACK_CHECKS
1787 if(u->rst.ptr < 4) { 1894 if(__builtin_expect(u->rst.ptr < 3, 0)) {
1788 u->rst.error = 1; 1895 u->rst.error = 1;
1789 goto error; 1896 goto error;
1790 } 1897 }
1791#endif 1898#endif
1792 u->rst.ptr -= 2; 1899 u->rst.ptr -= 1;
1900 }
1793 break; 1901 break;
1794 }
1795 case 0x83: /* POPk */ 1902 case 0x83: /* POPk */
1796 { 1903 __asm__( "evaluxn_83_POPk:" );
1797 u->wst.dat[u->wst.ptr - 1]; 1904 {
1905 u->wst.dat[u->wst.ptr - 1];
1798#ifndef NO_STACK_CHECKS 1906#ifndef NO_STACK_CHECKS
1799 if(u->wst.ptr < 1) { 1907 if(__builtin_expect(u->wst.ptr < 1, 0)) {
1800 u->wst.error = 1; 1908 u->wst.error = 1;
1801 goto error; 1909 goto error;
1802 } 1910 }
1803#endif 1911#endif
1912 }
1804 break; 1913 break;
1805 }
1806 case 0x84: /* DUPk */ 1914 case 0x84: /* DUPk */
1807 { 1915 __asm__( "evaluxn_84_DUPk:" );
1808 u8 a = u->wst.dat[u->wst.ptr - 1]; 1916 {
1809 u->wst.dat[u->wst.ptr] = a; 1917 u8 a = u->wst.dat[u->wst.ptr - 1];
1810 u->wst.dat[u->wst.ptr + 1] = a; 1918 u->wst.dat[u->wst.ptr] = a;
1919 u->wst.dat[u->wst.ptr + 1] = a;
1811#ifndef NO_STACK_CHECKS 1920#ifndef NO_STACK_CHECKS
1812 if(u->wst.ptr < 1) { 1921 if(__builtin_expect(u->wst.ptr < 1, 0)) {
1813 u->wst.error = 1; 1922 u->wst.error = 1;
1814 goto error; 1923 goto error;
1815 } 1924 }
1816 if(u->wst.ptr > 253) { 1925 if(__builtin_expect(u->wst.ptr > 253, 0)) {
1817 u->wst.error = 2; 1926 u->wst.error = 2;
1818 goto error; 1927 goto error;
1819 } 1928 }
1820#endif 1929#endif
1821 u->wst.ptr += 2; 1930 u->wst.ptr += 2;
1931 }
1822 break; 1932 break;
1823 }
1824 case 0x85: /* SWPk */ 1933 case 0x85: /* SWPk */
1825 { 1934 __asm__( "evaluxn_85_SWPk:" );
1826 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 1935 {
1827 u->wst.dat[u->wst.ptr] = a; 1936 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
1828 u->wst.dat[u->wst.ptr + 1] = b; 1937 u->wst.dat[u->wst.ptr] = a;
1938 u->wst.dat[u->wst.ptr + 1] = b;
1829#ifndef NO_STACK_CHECKS 1939#ifndef NO_STACK_CHECKS
1830 if(u->wst.ptr < 2) { 1940 if(__builtin_expect(u->wst.ptr < 2, 0)) {
1831 u->wst.error = 1; 1941 u->wst.error = 1;
1832 goto error; 1942 goto error;
1833 } 1943 }
1834 if(u->wst.ptr > 253) { 1944 if(__builtin_expect(u->wst.ptr > 253, 0)) {
1835 u->wst.error = 2; 1945 u->wst.error = 2;
1836 goto error; 1946 goto error;
1837 } 1947 }
1838#endif 1948#endif
1839 u->wst.ptr += 2; 1949 u->wst.ptr += 2;
1950 }
1840 break; 1951 break;
1841 }
1842 case 0x86: /* OVRk */ 1952 case 0x86: /* OVRk */
1843 { 1953 __asm__( "evaluxn_86_OVRk:" );
1844 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 1954 {
1845 u->wst.dat[u->wst.ptr] = b; 1955 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
1846 u->wst.dat[u->wst.ptr + 1] = a; 1956 u->wst.dat[u->wst.ptr] = b;
1847 u->wst.dat[u->wst.ptr + 2] = b; 1957 u->wst.dat[u->wst.ptr + 1] = a;
1958 u->wst.dat[u->wst.ptr + 2] = b;
1848#ifndef NO_STACK_CHECKS 1959#ifndef NO_STACK_CHECKS
1849 if(u->wst.ptr < 2) { 1960 if(__builtin_expect(u->wst.ptr < 2, 0)) {
1850 u->wst.error = 1; 1961 u->wst.error = 1;
1851 goto error; 1962 goto error;
1852 } 1963 }
1853 if(u->wst.ptr > 252) { 1964 if(__builtin_expect(u->wst.ptr > 252, 0)) {
1854 u->wst.error = 2; 1965 u->wst.error = 2;
1855 goto error; 1966 goto error;
1856 } 1967 }
1857#endif 1968#endif
1858 u->wst.ptr += 3; 1969 u->wst.ptr += 3;
1970 }
1859 break; 1971 break;
1860 }
1861 case 0x87: /* ROTk */ 1972 case 0x87: /* ROTk */
1862 { 1973 __asm__( "evaluxn_87_ROTk:" );
1863 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3]; 1974 {
1864 u->wst.dat[u->wst.ptr] = b; 1975 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3];
1865 u->wst.dat[u->wst.ptr + 1] = a; 1976 u->wst.dat[u->wst.ptr] = b;
1866 u->wst.dat[u->wst.ptr + 2] = c; 1977 u->wst.dat[u->wst.ptr + 1] = a;
1978 u->wst.dat[u->wst.ptr + 2] = c;
1867#ifndef NO_STACK_CHECKS 1979#ifndef NO_STACK_CHECKS
1868 if(u->wst.ptr < 3) { 1980 if(__builtin_expect(u->wst.ptr < 3, 0)) {
1869 u->wst.error = 1; 1981 u->wst.error = 1;
1870 goto error; 1982 goto error;
1871 } 1983 }
1872 if(u->wst.ptr > 252) { 1984 if(__builtin_expect(u->wst.ptr > 252, 0)) {
1873 u->wst.error = 2; 1985 u->wst.error = 2;
1874 goto error; 1986 goto error;
1875 } 1987 }
1876#endif 1988#endif
1877 u->wst.ptr += 3; 1989 u->wst.ptr += 3;
1990 }
1878 break; 1991 break;
1879 }
1880 case 0x88: /* EQUk */ 1992 case 0x88: /* EQUk */
1881 { 1993 __asm__( "evaluxn_88_EQUk:" );
1882 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 1994 {
1883 u->wst.dat[u->wst.ptr] = b == a; 1995 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
1996 u->wst.dat[u->wst.ptr] = b == a;
1884#ifndef NO_STACK_CHECKS 1997#ifndef NO_STACK_CHECKS
1885 if(u->wst.ptr < 2) { 1998 if(__builtin_expect(u->wst.ptr < 2, 0)) {
1886 u->wst.error = 1; 1999 u->wst.error = 1;
1887 goto error; 2000 goto error;
1888 } 2001 }
1889 if(u->wst.ptr > 254) { 2002 if(__builtin_expect(u->wst.ptr > 254, 0)) {
1890 u->wst.error = 2; 2003 u->wst.error = 2;
1891 goto error; 2004 goto error;
1892 } 2005 }
1893#endif 2006#endif
1894 u->wst.ptr += 1; 2007 u->wst.ptr += 1;
2008 }
1895 break; 2009 break;
1896 }
1897 case 0x89: /* NEQk */ 2010 case 0x89: /* NEQk */
1898 { 2011 __asm__( "evaluxn_89_NEQk:" );
1899 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2012 {
1900 u->wst.dat[u->wst.ptr] = b != a; 2013 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2014 u->wst.dat[u->wst.ptr] = b != a;
1901#ifndef NO_STACK_CHECKS 2015#ifndef NO_STACK_CHECKS
1902 if(u->wst.ptr < 2) { 2016 if(__builtin_expect(u->wst.ptr < 2, 0)) {
1903 u->wst.error = 1; 2017 u->wst.error = 1;
1904 goto error; 2018 goto error;
1905 } 2019 }
1906 if(u->wst.ptr > 254) { 2020 if(__builtin_expect(u->wst.ptr > 254, 0)) {
1907 u->wst.error = 2; 2021 u->wst.error = 2;
1908 goto error; 2022 goto error;
1909 } 2023 }
1910#endif 2024#endif
1911 u->wst.ptr += 1; 2025 u->wst.ptr += 1;
2026 }
1912 break; 2027 break;
1913 }
1914 case 0x8a: /* GTHk */ 2028 case 0x8a: /* GTHk */
1915 { 2029 __asm__( "evaluxn_8a_GTHk:" );
1916 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2030 {
1917 u->wst.dat[u->wst.ptr] = b > a; 2031 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2032 u->wst.dat[u->wst.ptr] = b > a;
1918#ifndef NO_STACK_CHECKS 2033#ifndef NO_STACK_CHECKS
1919 if(u->wst.ptr < 2) { 2034 if(__builtin_expect(u->wst.ptr < 2, 0)) {
1920 u->wst.error = 1; 2035 u->wst.error = 1;
1921 goto error; 2036 goto error;
1922 } 2037 }
1923 if(u->wst.ptr > 254) { 2038 if(__builtin_expect(u->wst.ptr > 254, 0)) {
1924 u->wst.error = 2; 2039 u->wst.error = 2;
1925 goto error; 2040 goto error;
1926 } 2041 }
1927#endif 2042#endif
1928 u->wst.ptr += 1; 2043 u->wst.ptr += 1;
2044 }
1929 break; 2045 break;
1930 }
1931 case 0x8b: /* LTHk */ 2046 case 0x8b: /* LTHk */
1932 { 2047 __asm__( "evaluxn_8b_LTHk:" );
1933 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2048 {
1934 u->wst.dat[u->wst.ptr] = b < a; 2049 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2050 u->wst.dat[u->wst.ptr] = b < a;
1935#ifndef NO_STACK_CHECKS 2051#ifndef NO_STACK_CHECKS
1936 if(u->wst.ptr < 2) { 2052 if(__builtin_expect(u->wst.ptr < 2, 0)) {
1937 u->wst.error = 1; 2053 u->wst.error = 1;
1938 goto error; 2054 goto error;
1939 } 2055 }
1940 if(u->wst.ptr > 254) { 2056 if(__builtin_expect(u->wst.ptr > 254, 0)) {
1941 u->wst.error = 2; 2057 u->wst.error = 2;
1942 goto error; 2058 goto error;
1943 } 2059 }
1944#endif 2060#endif
1945 u->wst.ptr += 1; 2061 u->wst.ptr += 1;
2062 }
1946 break; 2063 break;
1947 }
1948 case 0x8c: /* JMPk */ 2064 case 0x8c: /* JMPk */
1949 { 2065 __asm__( "evaluxn_8c_JMPk:" );
1950 u8 a = u->wst.dat[u->wst.ptr - 1]; 2066 {
1951 u->ram.ptr += (s8)a; 2067 u8 a = u->wst.dat[u->wst.ptr - 1];
2068 u->ram.ptr += (s8)a;
1952#ifndef NO_STACK_CHECKS 2069#ifndef NO_STACK_CHECKS
1953 if(u->wst.ptr < 1) { 2070 if(__builtin_expect(u->wst.ptr < 1, 0)) {
1954 u->wst.error = 1; 2071 u->wst.error = 1;
1955 goto error; 2072 goto error;
1956 } 2073 }
1957#endif 2074#endif
2075 }
1958 break; 2076 break;
1959 }
1960 case 0x8d: /* JCNk */ 2077 case 0x8d: /* JCNk */
1961 { 2078 __asm__( "evaluxn_8d_JCNk:" );
1962 u8 a = u->wst.dat[u->wst.ptr - 1]; 2079 {
1963 if(u->wst.dat[u->wst.ptr - 2]) u->ram.ptr += (s8)a; 2080 u8 a = u->wst.dat[u->wst.ptr - 1];
2081 if(u->wst.dat[u->wst.ptr - 2]) u->ram.ptr += (s8)a;
1964#ifndef NO_STACK_CHECKS 2082#ifndef NO_STACK_CHECKS
1965 if(u->wst.ptr < 2) { 2083 if(__builtin_expect(u->wst.ptr < 2, 0)) {
1966 u->wst.error = 1; 2084 u->wst.error = 1;
1967 goto error; 2085 goto error;
1968 } 2086 }
1969#endif 2087#endif
2088 }
1970 break; 2089 break;
1971 }
1972 case 0x8e: /* JSRk */ 2090 case 0x8e: /* JSRk */
1973 { 2091 __asm__( "evaluxn_8e_JSRk:" );
1974 u8 a = u->wst.dat[u->wst.ptr - 1]; 2092 {
1975 u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; 2093 u8 a = u->wst.dat[u->wst.ptr - 1];
1976 u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; 2094 u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8;
1977 u->ram.ptr += (s8)a; 2095 u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff;
2096 u->ram.ptr += (s8)a;
1978#ifndef NO_STACK_CHECKS 2097#ifndef NO_STACK_CHECKS
1979 if(u->wst.ptr < 1) { 2098 if(__builtin_expect(u->wst.ptr < 1, 0)) {
1980 u->wst.error = 1; 2099 u->wst.error = 1;
1981 goto error; 2100 goto error;
1982 } 2101 }
2102 if(__builtin_expect(u->rst.ptr > 253, 0)) {
2103 u->rst.error = 2;
2104 goto error;
2105 }
1983#endif 2106#endif
1984#ifndef NO_STACK_CHECKS 2107 u->rst.ptr += 2;
1985 if(u->rst.ptr > 253) {
1986 u->rst.error = 2;
1987 goto error;
1988 } 2108 }
1989#endif
1990 u->rst.ptr += 2;
1991 break; 2109 break;
1992 }
1993 case 0x8f: /* STHk */ 2110 case 0x8f: /* STHk */
1994 { 2111 __asm__( "evaluxn_8f_STHk:" );
1995 u8 a = u->wst.dat[u->wst.ptr - 1]; 2112 {
1996 u->rst.dat[u->rst.ptr] = a; 2113 u8 a = u->wst.dat[u->wst.ptr - 1];
2114 u->rst.dat[u->rst.ptr] = a;
1997#ifndef NO_STACK_CHECKS 2115#ifndef NO_STACK_CHECKS
1998 if(u->wst.ptr < 1) { 2116 if(__builtin_expect(u->wst.ptr < 1, 0)) {
1999 u->wst.error = 1; 2117 u->wst.error = 1;
2000 goto error; 2118 goto error;
2001 } 2119 }
2120 if(__builtin_expect(u->rst.ptr > 254, 0)) {
2121 u->rst.error = 2;
2122 goto error;
2123 }
2002#endif 2124#endif
2003#ifndef NO_STACK_CHECKS 2125 u->rst.ptr += 1;
2004 if(u->rst.ptr > 254) {
2005 u->rst.error = 2;
2006 goto error;
2007 } 2126 }
2008#endif
2009 u->rst.ptr += 1;
2010 break; 2127 break;
2011 }
2012 case 0x90: /* LDZk */ 2128 case 0x90: /* LDZk */
2013 { 2129 __asm__( "evaluxn_90_LDZk:" );
2014 u8 a = u->wst.dat[u->wst.ptr - 1]; 2130 {
2015 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); 2131 u8 a = u->wst.dat[u->wst.ptr - 1];
2132 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a);
2016#ifndef NO_STACK_CHECKS 2133#ifndef NO_STACK_CHECKS
2017 if(u->wst.ptr < 1) { 2134 if(__builtin_expect(u->wst.ptr < 1, 0)) {
2018 u->wst.error = 1; 2135 u->wst.error = 1;
2019 goto error; 2136 goto error;
2020 } 2137 }
2021 if(u->wst.ptr > 254) { 2138 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2022 u->wst.error = 2; 2139 u->wst.error = 2;
2023 goto error; 2140 goto error;
2024 } 2141 }
2025#endif 2142#endif
2026 u->wst.ptr += 1; 2143 u->wst.ptr += 1;
2144 }
2027 break; 2145 break;
2028 }
2029 case 0x91: /* STZk */ 2146 case 0x91: /* STZk */
2030 { 2147 __asm__( "evaluxn_91_STZk:" );
2031 u8 a = u->wst.dat[u->wst.ptr - 1]; 2148 {
2032 u8 b = u->wst.dat[u->wst.ptr - 2]; 2149 u8 a = u->wst.dat[u->wst.ptr - 1];
2033 mempoke8(u->ram.dat, a, b); 2150 u8 b = u->wst.dat[u->wst.ptr - 2];
2151 mempoke8(u->ram.dat, a, b);
2034#ifndef NO_STACK_CHECKS 2152#ifndef NO_STACK_CHECKS
2035 if(u->wst.ptr < 2) { 2153 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2036 u->wst.error = 1; 2154 u->wst.error = 1;
2037 goto error; 2155 goto error;
2038 } 2156 }
2039#endif 2157#endif
2158 }
2040 break; 2159 break;
2041 }
2042 case 0x92: /* LDRk */ 2160 case 0x92: /* LDRk */
2043 { 2161 __asm__( "evaluxn_92_LDRk:" );
2044 u8 a = u->wst.dat[u->wst.ptr - 1]; 2162 {
2045 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); 2163 u8 a = u->wst.dat[u->wst.ptr - 1];
2164 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a);
2046#ifndef NO_STACK_CHECKS 2165#ifndef NO_STACK_CHECKS
2047 if(u->wst.ptr < 1) { 2166 if(__builtin_expect(u->wst.ptr < 1, 0)) {
2048 u->wst.error = 1; 2167 u->wst.error = 1;
2049 goto error; 2168 goto error;
2050 } 2169 }
2051 if(u->wst.ptr > 254) { 2170 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2052 u->wst.error = 2; 2171 u->wst.error = 2;
2053 goto error; 2172 goto error;
2054 } 2173 }
2055#endif 2174#endif
2056 u->wst.ptr += 1; 2175 u->wst.ptr += 1;
2176 }
2057 break; 2177 break;
2058 }
2059 case 0x93: /* STRk */ 2178 case 0x93: /* STRk */
2060 { 2179 __asm__( "evaluxn_93_STRk:" );
2061 u8 a = u->wst.dat[u->wst.ptr - 1]; 2180 {
2062 u8 b = u->wst.dat[u->wst.ptr - 2]; 2181 u8 a = u->wst.dat[u->wst.ptr - 1];
2063 mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b); 2182 u8 b = u->wst.dat[u->wst.ptr - 2];
2183 mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b);
2064#ifndef NO_STACK_CHECKS 2184#ifndef NO_STACK_CHECKS
2065 if(u->wst.ptr < 2) { 2185 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2066 u->wst.error = 1; 2186 u->wst.error = 1;
2067 goto error; 2187 goto error;
2068 } 2188 }
2069#endif 2189#endif
2190 }
2070 break; 2191 break;
2071 }
2072 case 0x94: /* LDAk */ 2192 case 0x94: /* LDAk */
2073 { 2193 __asm__( "evaluxn_94_LDAk:" );
2074 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2194 {
2075 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); 2195 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
2196 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a);
2076#ifndef NO_STACK_CHECKS 2197#ifndef NO_STACK_CHECKS
2077 if(u->wst.ptr < 2) { 2198 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2078 u->wst.error = 1; 2199 u->wst.error = 1;
2079 goto error; 2200 goto error;
2080 } 2201 }
2081 if(u->wst.ptr > 254) { 2202 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2082 u->wst.error = 2; 2203 u->wst.error = 2;
2083 goto error; 2204 goto error;
2084 } 2205 }
2085#endif 2206#endif
2086 u->wst.ptr += 1; 2207 u->wst.ptr += 1;
2208 }
2087 break; 2209 break;
2088 }
2089 case 0x95: /* STAk */ 2210 case 0x95: /* STAk */
2090 { 2211 __asm__( "evaluxn_95_STAk:" );
2091 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2212 {
2092 u8 b = u->wst.dat[u->wst.ptr - 3]; 2213 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
2093 mempoke8(u->ram.dat, a, b); 2214 u8 b = u->wst.dat[u->wst.ptr - 3];
2215 mempoke8(u->ram.dat, a, b);
2094#ifndef NO_STACK_CHECKS 2216#ifndef NO_STACK_CHECKS
2095 if(u->wst.ptr < 3) { 2217 if(__builtin_expect(u->wst.ptr < 3, 0)) {
2096 u->wst.error = 1; 2218 u->wst.error = 1;
2097 goto error; 2219 goto error;
2098 } 2220 }
2099#endif 2221#endif
2222 }
2100 break; 2223 break;
2101 }
2102 case 0x96: /* DEIk */ 2224 case 0x96: /* DEIk */
2103 { 2225 __asm__( "evaluxn_96_DEIk:" );
2104 u8 a = u->wst.dat[u->wst.ptr - 1]; 2226 {
2105 u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); 2227 u8 a = u->wst.dat[u->wst.ptr - 1];
2228 u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a);
2106#ifndef NO_STACK_CHECKS 2229#ifndef NO_STACK_CHECKS
2107 if(u->wst.ptr < 1) { 2230 if(__builtin_expect(u->wst.ptr < 1, 0)) {
2108 u->wst.error = 1; 2231 u->wst.error = 1;
2109 goto error; 2232 goto error;
2110 } 2233 }
2111 if(u->wst.ptr > 254) { 2234 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2112 u->wst.error = 2; 2235 u->wst.error = 2;
2113 goto error; 2236 goto error;
2114 } 2237 }
2115#endif 2238#endif
2116 u->wst.ptr += 1; 2239 u->wst.ptr += 1;
2240 }
2117 break; 2241 break;
2118 }
2119 case 0x97: /* DEOk */ 2242 case 0x97: /* DEOk */
2120 { 2243 __asm__( "evaluxn_97_DEOk:" );
2121 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2244 {
2122 devpoke8(&u->dev[a >> 4], a, b); 2245 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2246 devpoke8(&u->dev[a >> 4], a, b);
2123#ifndef NO_STACK_CHECKS 2247#ifndef NO_STACK_CHECKS
2124 if(u->wst.ptr < 2) { 2248 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2125 u->wst.error = 1; 2249 u->wst.error = 1;
2126 goto error; 2250 goto error;
2127 } 2251 }
2128#endif 2252#endif
2253 }
2129 break; 2254 break;
2130 }
2131 case 0x98: /* ADDk */ 2255 case 0x98: /* ADDk */
2132 { 2256 __asm__( "evaluxn_98_ADDk:" );
2133 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2257 {
2134 u->wst.dat[u->wst.ptr] = b + a; 2258 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2259 u->wst.dat[u->wst.ptr] = b + a;
2135#ifndef NO_STACK_CHECKS 2260#ifndef NO_STACK_CHECKS
2136 if(u->wst.ptr < 2) { 2261 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2137 u->wst.error = 1; 2262 u->wst.error = 1;
2138 goto error; 2263 goto error;
2139 } 2264 }
2140 if(u->wst.ptr > 254) { 2265 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2141 u->wst.error = 2; 2266 u->wst.error = 2;
2142 goto error; 2267 goto error;
2143 } 2268 }
2144#endif 2269#endif
2145 u->wst.ptr += 1; 2270 u->wst.ptr += 1;
2271 }
2146 break; 2272 break;
2147 }
2148 case 0x99: /* SUBk */ 2273 case 0x99: /* SUBk */
2149 { 2274 __asm__( "evaluxn_99_SUBk:" );
2150 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2275 {
2151 u->wst.dat[u->wst.ptr] = b - a; 2276 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2277 u->wst.dat[u->wst.ptr] = b - a;
2152#ifndef NO_STACK_CHECKS 2278#ifndef NO_STACK_CHECKS
2153 if(u->wst.ptr < 2) { 2279 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2154 u->wst.error = 1; 2280 u->wst.error = 1;
2155 goto error; 2281 goto error;
2156 } 2282 }
2157 if(u->wst.ptr > 254) { 2283 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2158 u->wst.error = 2; 2284 u->wst.error = 2;
2159 goto error; 2285 goto error;
2160 } 2286 }
2161#endif 2287#endif
2162 u->wst.ptr += 1; 2288 u->wst.ptr += 1;
2289 }
2163 break; 2290 break;
2164 }
2165 case 0x9a: /* MULk */ 2291 case 0x9a: /* MULk */
2166 { 2292 __asm__( "evaluxn_9a_MULk:" );
2167 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2293 {
2168 u->wst.dat[u->wst.ptr] = b * a; 2294 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2295 u->wst.dat[u->wst.ptr] = b * a;
2169#ifndef NO_STACK_CHECKS 2296#ifndef NO_STACK_CHECKS
2170 if(u->wst.ptr < 2) { 2297 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2171 u->wst.error = 1; 2298 u->wst.error = 1;
2172 goto error; 2299 goto error;
2173 } 2300 }
2174 if(u->wst.ptr > 254) { 2301 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2175 u->wst.error = 2; 2302 u->wst.error = 2;
2176 goto error; 2303 goto error;
2177 } 2304 }
2178#endif 2305#endif
2179 u->wst.ptr += 1; 2306 u->wst.ptr += 1;
2307 }
2180 break; 2308 break;
2181 }
2182 case 0x9b: /* DIVk */ 2309 case 0x9b: /* DIVk */
2183 { 2310 __asm__( "evaluxn_9b_DIVk:" );
2184 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2311 {
2185 u->wst.dat[u->wst.ptr] = b / a; 2312 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2313 u->wst.dat[u->wst.ptr] = b / a;
2186#ifndef NO_STACK_CHECKS 2314#ifndef NO_STACK_CHECKS
2187 if(u->wst.ptr < 2) { 2315 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2188 u->wst.error = 1; 2316 u->wst.error = 1;
2189 goto error; 2317 goto error;
2190 } 2318 }
2191 if(u->wst.ptr > 254) { 2319 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2192 u->wst.error = 2; 2320 u->wst.error = 2;
2193 goto error; 2321 goto error;
2194 } 2322 }
2195#endif 2323#endif
2196 u->wst.ptr += 1; 2324 u->wst.ptr += 1;
2325 }
2197 break; 2326 break;
2198 }
2199 case 0x9c: /* ANDk */ 2327 case 0x9c: /* ANDk */
2200 { 2328 __asm__( "evaluxn_9c_ANDk:" );
2201 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2329 {
2202 u->wst.dat[u->wst.ptr] = b & a; 2330 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2331 u->wst.dat[u->wst.ptr] = b & a;
2203#ifndef NO_STACK_CHECKS 2332#ifndef NO_STACK_CHECKS
2204 if(u->wst.ptr < 2) { 2333 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2205 u->wst.error = 1; 2334 u->wst.error = 1;
2206 goto error; 2335 goto error;
2207 } 2336 }
2208 if(u->wst.ptr > 254) { 2337 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2209 u->wst.error = 2; 2338 u->wst.error = 2;
2210 goto error; 2339 goto error;
2211 } 2340 }
2212#endif 2341#endif
2213 u->wst.ptr += 1; 2342 u->wst.ptr += 1;
2343 }
2214 break; 2344 break;
2215 }
2216 case 0x9d: /* ORAk */ 2345 case 0x9d: /* ORAk */
2217 { 2346 __asm__( "evaluxn_9d_ORAk:" );
2218 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2347 {
2219 u->wst.dat[u->wst.ptr] = b | a; 2348 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2349 u->wst.dat[u->wst.ptr] = b | a;
2220#ifndef NO_STACK_CHECKS 2350#ifndef NO_STACK_CHECKS
2221 if(u->wst.ptr < 2) { 2351 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2222 u->wst.error = 1; 2352 u->wst.error = 1;
2223 goto error; 2353 goto error;
2224 } 2354 }
2225 if(u->wst.ptr > 254) { 2355 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2226 u->wst.error = 2; 2356 u->wst.error = 2;
2227 goto error; 2357 goto error;
2228 } 2358 }
2229#endif 2359#endif
2230 u->wst.ptr += 1; 2360 u->wst.ptr += 1;
2361 }
2231 break; 2362 break;
2232 }
2233 case 0x9e: /* EORk */ 2363 case 0x9e: /* EORk */
2234 { 2364 __asm__( "evaluxn_9e_EORk:" );
2235 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2365 {
2236 u->wst.dat[u->wst.ptr] = b ^ a; 2366 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2367 u->wst.dat[u->wst.ptr] = b ^ a;
2237#ifndef NO_STACK_CHECKS 2368#ifndef NO_STACK_CHECKS
2238 if(u->wst.ptr < 2) { 2369 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2239 u->wst.error = 1; 2370 u->wst.error = 1;
2240 goto error; 2371 goto error;
2241 } 2372 }
2242 if(u->wst.ptr > 254) { 2373 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2243 u->wst.error = 2; 2374 u->wst.error = 2;
2244 goto error; 2375 goto error;
2245 } 2376 }
2246#endif 2377#endif
2247 u->wst.ptr += 1; 2378 u->wst.ptr += 1;
2379 }
2248 break; 2380 break;
2249 }
2250 case 0x9f: /* SFTk */ 2381 case 0x9f: /* SFTk */
2251 { 2382 __asm__( "evaluxn_9f_SFTk:" );
2252 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; 2383 {
2253 u->wst.dat[u->wst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4); 2384 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2385 u->wst.dat[u->wst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4);
2254#ifndef NO_STACK_CHECKS 2386#ifndef NO_STACK_CHECKS
2255 if(u->wst.ptr < 2) { 2387 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2256 u->wst.error = 1; 2388 u->wst.error = 1;
2257 goto error; 2389 goto error;
2258 } 2390 }
2259 if(u->wst.ptr > 254) { 2391 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2260 u->wst.error = 2; 2392 u->wst.error = 2;
2261 goto error; 2393 goto error;
2262 } 2394 }
2263#endif 2395#endif
2264 u->wst.ptr += 1; 2396 u->wst.ptr += 1;
2397 }
2265 break; 2398 break;
2266 }
2267 case 0xa3: /* POP2k */ 2399 case 0xa3: /* POP2k */
2268 { 2400 __asm__( "evaluxn_a3_POP2k:" );
2269 (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2401 {
2402 (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
2270#ifndef NO_STACK_CHECKS 2403#ifndef NO_STACK_CHECKS
2271 if(u->wst.ptr < 2) { 2404 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2272 u->wst.error = 1; 2405 u->wst.error = 1;
2273 goto error; 2406 goto error;
2274 } 2407 }
2275#endif 2408#endif
2409 }
2276 break; 2410 break;
2277 }
2278 case 0xa4: /* DUP2k */ 2411 case 0xa4: /* DUP2k */
2279 { 2412 __asm__( "evaluxn_a4_DUP2k:" );
2280 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2413 {
2281 u->wst.dat[u->wst.ptr] = a >> 8; 2414 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2282 u->wst.dat[u->wst.ptr + 1] = a & 0xff; 2415 u->wst.dat[u->wst.ptr] = b;
2283 u->wst.dat[u->wst.ptr + 2] = a >> 8; 2416 u->wst.dat[u->wst.ptr + 1] = a;
2284 u->wst.dat[u->wst.ptr + 3] = a & 0xff; 2417 u->wst.dat[u->wst.ptr + 2] = b;
2285#ifndef NO_STACK_CHECKS 2418 u->wst.dat[u->wst.ptr + 3] = a;
2286 if(u->wst.ptr < 2) { 2419#ifndef NO_STACK_CHECKS
2287 u->wst.error = 1; 2420 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2288 goto error; 2421 u->wst.error = 1;
2422 goto error;
2423 }
2424 if(__builtin_expect(u->wst.ptr > 251, 0)) {
2425 u->wst.error = 2;
2426 goto error;
2427 }
2428#endif
2429 u->wst.ptr += 4;
2289 } 2430 }
2290 if(u->wst.ptr > 251) {
2291 u->wst.error = 2;
2292 goto error;
2293 }
2294#endif
2295 u->wst.ptr += 4;
2296 break; 2431 break;
2297 }
2298 case 0xa5: /* SWP2k */ 2432 case 0xa5: /* SWP2k */
2299 { 2433 __asm__( "evaluxn_a5_SWP2k:" );
2300 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2434 {
2301 u->wst.dat[u->wst.ptr] = a >> 8; 2435 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
2302 u->wst.dat[u->wst.ptr + 1] = a & 0xff; 2436 u->wst.dat[u->wst.ptr] = b;
2303 u->wst.dat[u->wst.ptr + 2] = b >> 8; 2437 u->wst.dat[u->wst.ptr + 1] = a;
2304 u->wst.dat[u->wst.ptr + 3] = b & 0xff; 2438 u->wst.dat[u->wst.ptr + 2] = d;
2305#ifndef NO_STACK_CHECKS 2439 u->wst.dat[u->wst.ptr + 3] = c;
2306 if(u->wst.ptr < 4) { 2440#ifndef NO_STACK_CHECKS
2307 u->wst.error = 1; 2441 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2308 goto error; 2442 u->wst.error = 1;
2309 } 2443 goto error;
2310 if(u->wst.ptr > 251) { 2444 }
2311 u->wst.error = 2; 2445 if(__builtin_expect(u->wst.ptr > 251, 0)) {
2312 goto error; 2446 u->wst.error = 2;
2447 goto error;
2448 }
2449#endif
2450 u->wst.ptr += 4;
2313 } 2451 }
2314#endif
2315 u->wst.ptr += 4;
2316 break; 2452 break;
2317 }
2318 case 0xa6: /* OVR2k */ 2453 case 0xa6: /* OVR2k */
2319 { 2454 __asm__( "evaluxn_a6_OVR2k:" );
2320 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2455 {
2321 u->wst.dat[u->wst.ptr] = b >> 8; 2456 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
2322 u->wst.dat[u->wst.ptr + 1] = b & 0xff; 2457 u->wst.dat[u->wst.ptr] = d;
2323 u->wst.dat[u->wst.ptr + 2] = a >> 8; 2458 u->wst.dat[u->wst.ptr + 1] = c;
2324 u->wst.dat[u->wst.ptr + 3] = a & 0xff; 2459 u->wst.dat[u->wst.ptr + 2] = b;
2325 u->wst.dat[u->wst.ptr + 4] = b >> 8; 2460 u->wst.dat[u->wst.ptr + 3] = a;
2326 u->wst.dat[u->wst.ptr + 5] = b & 0xff; 2461 u->wst.dat[u->wst.ptr + 4] = d;
2327#ifndef NO_STACK_CHECKS 2462 u->wst.dat[u->wst.ptr + 5] = c;
2328 if(u->wst.ptr < 4) { 2463#ifndef NO_STACK_CHECKS
2329 u->wst.error = 1; 2464 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2330 goto error; 2465 u->wst.error = 1;
2331 } 2466 goto error;
2332 if(u->wst.ptr > 249) { 2467 }
2333 u->wst.error = 2; 2468 if(__builtin_expect(u->wst.ptr > 249, 0)) {
2334 goto error; 2469 u->wst.error = 2;
2470 goto error;
2471 }
2472#endif
2473 u->wst.ptr += 6;
2335 } 2474 }
2336#endif
2337 u->wst.ptr += 6;
2338 break; 2475 break;
2339 }
2340 case 0xa7: /* ROT2k */ 2476 case 0xa7: /* ROT2k */
2341 { 2477 __asm__( "evaluxn_a7_ROT2k:" );
2342 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)), c = (u->wst.dat[u->wst.ptr - 5] | (u->wst.dat[u->wst.ptr - 6] << 8)); 2478 {
2343 u->wst.dat[u->wst.ptr] = b >> 8; 2479 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4], e = u->wst.dat[u->wst.ptr - 5], f = u->wst.dat[u->wst.ptr - 6];
2344 u->wst.dat[u->wst.ptr + 1] = b & 0xff; 2480 u->wst.dat[u->wst.ptr] = d;
2345 u->wst.dat[u->wst.ptr + 2] = a >> 8; 2481 u->wst.dat[u->wst.ptr + 1] = c;
2346 u->wst.dat[u->wst.ptr + 3] = a & 0xff; 2482 u->wst.dat[u->wst.ptr + 2] = b;
2347 u->wst.dat[u->wst.ptr + 4] = c >> 8; 2483 u->wst.dat[u->wst.ptr + 3] = a;
2348 u->wst.dat[u->wst.ptr + 5] = c & 0xff; 2484 u->wst.dat[u->wst.ptr + 4] = f;
2349#ifndef NO_STACK_CHECKS 2485 u->wst.dat[u->wst.ptr + 5] = e;
2350 if(u->wst.ptr < 6) { 2486#ifndef NO_STACK_CHECKS
2351 u->wst.error = 1; 2487 if(__builtin_expect(u->wst.ptr < 6, 0)) {
2352 goto error; 2488 u->wst.error = 1;
2353 } 2489 goto error;
2354 if(u->wst.ptr > 249) { 2490 }
2355 u->wst.error = 2; 2491 if(__builtin_expect(u->wst.ptr > 249, 0)) {
2356 goto error; 2492 u->wst.error = 2;
2493 goto error;
2494 }
2495#endif
2496 u->wst.ptr += 6;
2357 } 2497 }
2358#endif
2359 u->wst.ptr += 6;
2360 break; 2498 break;
2361 }
2362 case 0xa8: /* EQU2k */ 2499 case 0xa8: /* EQU2k */
2363 { 2500 __asm__( "evaluxn_a8_EQU2k:" );
2364 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2501 {
2365 u->wst.dat[u->wst.ptr] = b == a; 2502 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2503 u->wst.dat[u->wst.ptr] = b == a;
2366#ifndef NO_STACK_CHECKS 2504#ifndef NO_STACK_CHECKS
2367 if(u->wst.ptr < 4) { 2505 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2368 u->wst.error = 1; 2506 u->wst.error = 1;
2369 goto error; 2507 goto error;
2370 } 2508 }
2371 if(u->wst.ptr > 254) { 2509 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2372 u->wst.error = 2; 2510 u->wst.error = 2;
2373 goto error; 2511 goto error;
2374 } 2512 }
2375#endif 2513#endif
2376 u->wst.ptr += 1; 2514 u->wst.ptr += 1;
2515 }
2377 break; 2516 break;
2378 }
2379 case 0xa9: /* NEQ2k */ 2517 case 0xa9: /* NEQ2k */
2380 { 2518 __asm__( "evaluxn_a9_NEQ2k:" );
2381 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2519 {
2382 u->wst.dat[u->wst.ptr] = b != a; 2520 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2521 u->wst.dat[u->wst.ptr] = b != a;
2383#ifndef NO_STACK_CHECKS 2522#ifndef NO_STACK_CHECKS
2384 if(u->wst.ptr < 4) { 2523 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2385 u->wst.error = 1; 2524 u->wst.error = 1;
2386 goto error; 2525 goto error;
2387 } 2526 }
2388 if(u->wst.ptr > 254) { 2527 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2389 u->wst.error = 2; 2528 u->wst.error = 2;
2390 goto error; 2529 goto error;
2391 } 2530 }
2392#endif 2531#endif
2393 u->wst.ptr += 1; 2532 u->wst.ptr += 1;
2533 }
2394 break; 2534 break;
2395 }
2396 case 0xaa: /* GTH2k */ 2535 case 0xaa: /* GTH2k */
2397 { 2536 __asm__( "evaluxn_aa_GTH2k:" );
2398 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2537 {
2399 u->wst.dat[u->wst.ptr] = b > a; 2538 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2539 u->wst.dat[u->wst.ptr] = b > a;
2400#ifndef NO_STACK_CHECKS 2540#ifndef NO_STACK_CHECKS
2401 if(u->wst.ptr < 4) { 2541 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2402 u->wst.error = 1; 2542 u->wst.error = 1;
2403 goto error; 2543 goto error;
2404 } 2544 }
2405 if(u->wst.ptr > 254) { 2545 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2406 u->wst.error = 2; 2546 u->wst.error = 2;
2407 goto error; 2547 goto error;
2408 } 2548 }
2409#endif 2549#endif
2410 u->wst.ptr += 1; 2550 u->wst.ptr += 1;
2551 }
2411 break; 2552 break;
2412 }
2413 case 0xab: /* LTH2k */ 2553 case 0xab: /* LTH2k */
2414 { 2554 __asm__( "evaluxn_ab_LTH2k:" );
2415 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2555 {
2416 u->wst.dat[u->wst.ptr] = b < a; 2556 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2557 u->wst.dat[u->wst.ptr] = b < a;
2417#ifndef NO_STACK_CHECKS 2558#ifndef NO_STACK_CHECKS
2418 if(u->wst.ptr < 4) { 2559 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2419 u->wst.error = 1; 2560 u->wst.error = 1;
2420 goto error; 2561 goto error;
2421 } 2562 }
2422 if(u->wst.ptr > 254) { 2563 if(__builtin_expect(u->wst.ptr > 254, 0)) {
2423 u->wst.error = 2; 2564 u->wst.error = 2;
2424 goto error; 2565 goto error;
2425 } 2566 }
2426#endif 2567#endif
2427 u->wst.ptr += 1; 2568 u->wst.ptr += 1;
2569 }
2428 break; 2570 break;
2429 }
2430 case 0xac: /* JMP2k */ 2571 case 0xac: /* JMP2k */
2431 { 2572 __asm__( "evaluxn_ac_JMP2k:" );
2432 u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2573 {
2574 u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
2433#ifndef NO_STACK_CHECKS 2575#ifndef NO_STACK_CHECKS
2434 if(u->wst.ptr < 2) { 2576 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2435 u->wst.error = 1; 2577 u->wst.error = 1;
2436 goto error; 2578 goto error;
2437 } 2579 }
2438#endif 2580#endif
2581 }
2439 break; 2582 break;
2440 }
2441 case 0xad: /* JCN2k */ 2583 case 0xad: /* JCN2k */
2442 { 2584 __asm__( "evaluxn_ad_JCN2k:" );
2443 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2585 {
2444 if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; 2586 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
2587 if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a;
2445#ifndef NO_STACK_CHECKS 2588#ifndef NO_STACK_CHECKS
2446 if(u->wst.ptr < 3) { 2589 if(__builtin_expect(u->wst.ptr < 3, 0)) {
2447 u->wst.error = 1; 2590 u->wst.error = 1;
2448 goto error; 2591 goto error;
2449 } 2592 }
2450#endif 2593#endif
2594 }
2451 break; 2595 break;
2452 }
2453 case 0xae: /* JSR2k */ 2596 case 0xae: /* JSR2k */
2454 { 2597 __asm__( "evaluxn_ae_JSR2k:" );
2455 u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; 2598 {
2456 u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; 2599 u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8;
2457 u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2600 u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff;
2601 u->ram.ptr = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
2458#ifndef NO_STACK_CHECKS 2602#ifndef NO_STACK_CHECKS
2459 if(u->wst.ptr < 2) { 2603 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2460 u->wst.error = 1; 2604 u->wst.error = 1;
2461 goto error; 2605 goto error;
2462 } 2606 }
2607 if(__builtin_expect(u->rst.ptr > 253, 0)) {
2608 u->rst.error = 2;
2609 goto error;
2610 }
2463#endif 2611#endif
2464#ifndef NO_STACK_CHECKS 2612 u->rst.ptr += 2;
2465 if(u->rst.ptr > 253) {
2466 u->rst.error = 2;
2467 goto error;
2468 } 2613 }
2469#endif
2470 u->rst.ptr += 2;
2471 break; 2614 break;
2472 }
2473 case 0xaf: /* STH2k */ 2615 case 0xaf: /* STH2k */
2474 { 2616 __asm__( "evaluxn_af_STH2k:" );
2475 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2617 {
2476 u->rst.dat[u->rst.ptr] = a >> 8; 2618 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2];
2477 u->rst.dat[u->rst.ptr + 1] = a & 0xff; 2619 u->rst.dat[u->rst.ptr] = b;
2620 u->rst.dat[u->rst.ptr + 1] = a;
2478#ifndef NO_STACK_CHECKS 2621#ifndef NO_STACK_CHECKS
2479 if(u->wst.ptr < 2) { 2622 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2480 u->wst.error = 1; 2623 u->wst.error = 1;
2481 goto error; 2624 goto error;
2482 } 2625 }
2626 if(__builtin_expect(u->rst.ptr > 253, 0)) {
2627 u->rst.error = 2;
2628 goto error;
2629 }
2483#endif 2630#endif
2484#ifndef NO_STACK_CHECKS 2631 u->rst.ptr += 2;
2485 if(u->rst.ptr > 253) {
2486 u->rst.error = 2;
2487 goto error;
2488 } 2632 }
2489#endif
2490 u->rst.ptr += 2;
2491 break; 2633 break;
2492 }
2493 case 0xb0: /* LDZ2k */ 2634 case 0xb0: /* LDZ2k */
2494 { 2635 __asm__( "evaluxn_b0_LDZ2k:" );
2495 u8 a = u->wst.dat[u->wst.ptr - 1]; 2636 {
2496 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); 2637 u8 a = u->wst.dat[u->wst.ptr - 1];
2497 u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); 2638 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a);
2639 u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1);
2498#ifndef NO_STACK_CHECKS 2640#ifndef NO_STACK_CHECKS
2499 if(u->wst.ptr < 1) { 2641 if(__builtin_expect(u->wst.ptr < 1, 0)) {
2500 u->wst.error = 1; 2642 u->wst.error = 1;
2501 goto error; 2643 goto error;
2502 } 2644 }
2503 if(u->wst.ptr > 253) { 2645 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2504 u->wst.error = 2; 2646 u->wst.error = 2;
2505 goto error; 2647 goto error;
2506 } 2648 }
2507#endif 2649#endif
2508 u->wst.ptr += 2; 2650 u->wst.ptr += 2;
2651 }
2509 break; 2652 break;
2510 }
2511 case 0xb1: /* STZ2k */ 2653 case 0xb1: /* STZ2k */
2512 { 2654 __asm__( "evaluxn_b1_STZ2k:" );
2513 u8 a = u->wst.dat[u->wst.ptr - 1]; 2655 {
2514 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); 2656 u8 a = u->wst.dat[u->wst.ptr - 1];
2515 mempoke16(u->ram.dat, a, b); 2657 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8));
2658 mempoke16(u->ram.dat, a, b);
2516#ifndef NO_STACK_CHECKS 2659#ifndef NO_STACK_CHECKS
2517 if(u->wst.ptr < 3) { 2660 if(__builtin_expect(u->wst.ptr < 3, 0)) {
2518 u->wst.error = 1; 2661 u->wst.error = 1;
2519 goto error; 2662 goto error;
2520 } 2663 }
2521#endif 2664#endif
2665 }
2522 break; 2666 break;
2523 }
2524 case 0xb2: /* LDR2k */ 2667 case 0xb2: /* LDR2k */
2525 { 2668 __asm__( "evaluxn_b2_LDR2k:" );
2526 u8 a = u->wst.dat[u->wst.ptr - 1]; 2669 {
2527 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); 2670 u8 a = u->wst.dat[u->wst.ptr - 1];
2528 u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1); 2671 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a);
2672 u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1);
2529#ifndef NO_STACK_CHECKS 2673#ifndef NO_STACK_CHECKS
2530 if(u->wst.ptr < 1) { 2674 if(__builtin_expect(u->wst.ptr < 1, 0)) {
2531 u->wst.error = 1; 2675 u->wst.error = 1;
2532 goto error; 2676 goto error;
2533 } 2677 }
2534 if(u->wst.ptr > 253) { 2678 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2535 u->wst.error = 2; 2679 u->wst.error = 2;
2536 goto error; 2680 goto error;
2537 } 2681 }
2538#endif 2682#endif
2539 u->wst.ptr += 2; 2683 u->wst.ptr += 2;
2684 }
2540 break; 2685 break;
2541 }
2542 case 0xb3: /* STR2k */ 2686 case 0xb3: /* STR2k */
2543 { 2687 __asm__( "evaluxn_b3_STR2k:" );
2544 u8 a = u->wst.dat[u->wst.ptr - 1]; 2688 {
2545 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); 2689 u8 a = u->wst.dat[u->wst.ptr - 1];
2546 mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b); 2690 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8));
2691 mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b);
2547#ifndef NO_STACK_CHECKS 2692#ifndef NO_STACK_CHECKS
2548 if(u->wst.ptr < 3) { 2693 if(__builtin_expect(u->wst.ptr < 3, 0)) {
2549 u->wst.error = 1; 2694 u->wst.error = 1;
2550 goto error; 2695 goto error;
2551 } 2696 }
2552#endif 2697#endif
2698 }
2553 break; 2699 break;
2554 }
2555 case 0xb4: /* LDA2k */ 2700 case 0xb4: /* LDA2k */
2556 { 2701 __asm__( "evaluxn_b4_LDA2k:" );
2557 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2702 {
2558 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); 2703 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
2559 u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); 2704 u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a);
2705 u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1);
2560#ifndef NO_STACK_CHECKS 2706#ifndef NO_STACK_CHECKS
2561 if(u->wst.ptr < 2) { 2707 if(__builtin_expect(u->wst.ptr < 2, 0)) {
2562 u->wst.error = 1; 2708 u->wst.error = 1;
2563 goto error; 2709 goto error;
2564 } 2710 }
2565 if(u->wst.ptr > 253) { 2711 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2566 u->wst.error = 2; 2712 u->wst.error = 2;
2567 goto error; 2713 goto error;
2568 } 2714 }
2569#endif 2715#endif
2570 u->wst.ptr += 2; 2716 u->wst.ptr += 2;
2717 }
2571 break; 2718 break;
2572 }
2573 case 0xb5: /* STA2k */ 2719 case 0xb5: /* STA2k */
2574 { 2720 __asm__( "evaluxn_b5_STA2k:" );
2575 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); 2721 {
2576 u16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2722 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8));
2577 mempoke16(u->ram.dat, a, b); 2723 u16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2724 mempoke16(u->ram.dat, a, b);
2578#ifndef NO_STACK_CHECKS 2725#ifndef NO_STACK_CHECKS
2579 if(u->wst.ptr < 4) { 2726 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2580 u->wst.error = 1; 2727 u->wst.error = 1;
2581 goto error; 2728 goto error;
2582 } 2729 }
2583#endif 2730#endif
2731 }
2584 break; 2732 break;
2585 }
2586 case 0xb6: /* DEI2k */ 2733 case 0xb6: /* DEI2k */
2587 { 2734 __asm__( "evaluxn_b6_DEI2k:" );
2588 u8 a = u->wst.dat[u->wst.ptr - 1]; 2735 {
2589 u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); 2736 u8 a = u->wst.dat[u->wst.ptr - 1];
2590 u->wst.dat[u->wst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); 2737 u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a);
2738 u->wst.dat[u->wst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1);
2591#ifndef NO_STACK_CHECKS 2739#ifndef NO_STACK_CHECKS
2592 if(u->wst.ptr < 1) { 2740 if(__builtin_expect(u->wst.ptr < 1, 0)) {
2593 u->wst.error = 1; 2741 u->wst.error = 1;
2594 goto error; 2742 goto error;
2595 } 2743 }
2596 if(u->wst.ptr > 253) { 2744 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2597 u->wst.error = 2; 2745 u->wst.error = 2;
2598 goto error; 2746 goto error;
2599 } 2747 }
2600#endif 2748#endif
2601 u->wst.ptr += 2; 2749 u->wst.ptr += 2;
2750 }
2602 break; 2751 break;
2603 }
2604 case 0xb7: /* DEO2k */ 2752 case 0xb7: /* DEO2k */
2605 { 2753 __asm__( "evaluxn_b7_DEO2k:" );
2606 u8 a = u->wst.dat[u->wst.ptr - 1]; 2754 {
2607 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); 2755 u8 a = u->wst.dat[u->wst.ptr - 1];
2608 devpoke16(&u->dev[a >> 4], a, b); 2756 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8));
2757 devpoke16(&u->dev[a >> 4], a, b);
2609#ifndef NO_STACK_CHECKS 2758#ifndef NO_STACK_CHECKS
2610 if(u->wst.ptr < 3) { 2759 if(__builtin_expect(u->wst.ptr < 3, 0)) {
2611 u->wst.error = 1; 2760 u->wst.error = 1;
2612 goto error; 2761 goto error;
2613 } 2762 }
2614#endif 2763#endif
2764 }
2615 break; 2765 break;
2616 }
2617 case 0xb8: /* ADD2k */ 2766 case 0xb8: /* ADD2k */
2618 { 2767 __asm__( "evaluxn_b8_ADD2k:" );
2619 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2768 {
2620 u->wst.dat[u->wst.ptr] = (b + a) >> 8; 2769 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2621 u->wst.dat[u->wst.ptr + 1] = (b + a) & 0xff; 2770 u->wst.dat[u->wst.ptr] = (b + a) >> 8;
2771 u->wst.dat[u->wst.ptr + 1] = (b + a) & 0xff;
2622#ifndef NO_STACK_CHECKS 2772#ifndef NO_STACK_CHECKS
2623 if(u->wst.ptr < 4) { 2773 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2624 u->wst.error = 1; 2774 u->wst.error = 1;
2625 goto error; 2775 goto error;
2626 } 2776 }
2627 if(u->wst.ptr > 253) { 2777 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2628 u->wst.error = 2; 2778 u->wst.error = 2;
2629 goto error; 2779 goto error;
2630 } 2780 }
2631#endif 2781#endif
2632 u->wst.ptr += 2; 2782 u->wst.ptr += 2;
2783 }
2633 break; 2784 break;
2634 }
2635 case 0xb9: /* SUB2k */ 2785 case 0xb9: /* SUB2k */
2636 { 2786 __asm__( "evaluxn_b9_SUB2k:" );
2637 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2787 {
2638 u->wst.dat[u->wst.ptr] = (b - a) >> 8; 2788 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2639 u->wst.dat[u->wst.ptr + 1] = (b - a) & 0xff; 2789 u->wst.dat[u->wst.ptr] = (b - a) >> 8;
2790 u->wst.dat[u->wst.ptr + 1] = (b - a) & 0xff;
2640#ifndef NO_STACK_CHECKS 2791#ifndef NO_STACK_CHECKS
2641 if(u->wst.ptr < 4) { 2792 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2642 u->wst.error = 1; 2793 u->wst.error = 1;
2643 goto error; 2794 goto error;
2644 } 2795 }
2645 if(u->wst.ptr > 253) { 2796 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2646 u->wst.error = 2; 2797 u->wst.error = 2;
2647 goto error; 2798 goto error;
2648 } 2799 }
2649#endif 2800#endif
2650 u->wst.ptr += 2; 2801 u->wst.ptr += 2;
2802 }
2651 break; 2803 break;
2652 }
2653 case 0xba: /* MUL2k */ 2804 case 0xba: /* MUL2k */
2654 { 2805 __asm__( "evaluxn_ba_MUL2k:" );
2655 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2806 {
2656 u->wst.dat[u->wst.ptr] = (b * a) >> 8; 2807 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2657 u->wst.dat[u->wst.ptr + 1] = (b * a) & 0xff; 2808 u->wst.dat[u->wst.ptr] = (b * a) >> 8;
2809 u->wst.dat[u->wst.ptr + 1] = (b * a) & 0xff;
2658#ifndef NO_STACK_CHECKS 2810#ifndef NO_STACK_CHECKS
2659 if(u->wst.ptr < 4) { 2811 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2660 u->wst.error = 1; 2812 u->wst.error = 1;
2661 goto error; 2813 goto error;
2662 } 2814 }
2663 if(u->wst.ptr > 253) { 2815 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2664 u->wst.error = 2; 2816 u->wst.error = 2;
2665 goto error; 2817 goto error;
2666 } 2818 }
2667#endif 2819#endif
2668 u->wst.ptr += 2; 2820 u->wst.ptr += 2;
2821 }
2669 break; 2822 break;
2670 }
2671 case 0xbb: /* DIV2k */ 2823 case 0xbb: /* DIV2k */
2672 { 2824 __asm__( "evaluxn_bb_DIV2k:" );
2673 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2825 {
2674 u->wst.dat[u->wst.ptr] = (b / a) >> 8; 2826 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8));
2675 u->wst.dat[u->wst.ptr + 1] = (b / a) & 0xff; 2827 u->wst.dat[u->wst.ptr] = (b / a) >> 8;
2828 u->wst.dat[u->wst.ptr + 1] = (b / a) & 0xff;
2676#ifndef NO_STACK_CHECKS 2829#ifndef NO_STACK_CHECKS
2677 if(u->wst.ptr < 4) { 2830 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2678 u->wst.error = 1; 2831 u->wst.error = 1;
2679 goto error; 2832 goto error;
2680 } 2833 }
2681 if(u->wst.ptr > 253) { 2834 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2682 u->wst.error = 2; 2835 u->wst.error = 2;
2683 goto error; 2836 goto error;
2684 } 2837 }
2685#endif 2838#endif
2686 u->wst.ptr += 2; 2839 u->wst.ptr += 2;
2840 }
2687 break; 2841 break;
2688 }
2689 case 0xbc: /* AND2k */ 2842 case 0xbc: /* AND2k */
2690 { 2843 __asm__( "evaluxn_bc_AND2k:" );
2691 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; 2844 {
2692 u->wst.dat[u->wst.ptr] = d & b; 2845 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
2693 u->wst.dat[u->wst.ptr + 1] = c & a; 2846 u->wst.dat[u->wst.ptr] = d & b;
2847 u->wst.dat[u->wst.ptr + 1] = c & a;
2694#ifndef NO_STACK_CHECKS 2848#ifndef NO_STACK_CHECKS
2695 if(u->wst.ptr < 4) { 2849 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2696 u->wst.error = 1; 2850 u->wst.error = 1;
2697 goto error; 2851 goto error;
2698 } 2852 }
2699 if(u->wst.ptr > 253) { 2853 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2700 u->wst.error = 2; 2854 u->wst.error = 2;
2701 goto error; 2855 goto error;
2702 } 2856 }
2703#endif 2857#endif
2704 u->wst.ptr += 2; 2858 u->wst.ptr += 2;
2859 }
2705 break; 2860 break;
2706 }
2707 case 0xbd: /* ORA2k */ 2861 case 0xbd: /* ORA2k */
2708 { 2862 __asm__( "evaluxn_bd_ORA2k:" );
2709 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; 2863 {
2710 u->wst.dat[u->wst.ptr] = d | b; 2864 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
2711 u->wst.dat[u->wst.ptr + 1] = c | a; 2865 u->wst.dat[u->wst.ptr] = d | b;
2866 u->wst.dat[u->wst.ptr + 1] = c | a;
2712#ifndef NO_STACK_CHECKS 2867#ifndef NO_STACK_CHECKS
2713 if(u->wst.ptr < 4) { 2868 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2714 u->wst.error = 1; 2869 u->wst.error = 1;
2715 goto error; 2870 goto error;
2716 } 2871 }
2717 if(u->wst.ptr > 253) { 2872 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2718 u->wst.error = 2; 2873 u->wst.error = 2;
2719 goto error; 2874 goto error;
2720 } 2875 }
2721#endif 2876#endif
2722 u->wst.ptr += 2; 2877 u->wst.ptr += 2;
2878 }
2723 break; 2879 break;
2724 }
2725 case 0xbe: /* EOR2k */ 2880 case 0xbe: /* EOR2k */
2726 { 2881 __asm__( "evaluxn_be_EOR2k:" );
2727 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4]; 2882 {
2728 u->wst.dat[u->wst.ptr] = d ^ b; 2883 u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3], d = u->wst.dat[u->wst.ptr - 4];
2729 u->wst.dat[u->wst.ptr + 1] = c ^ a; 2884 u->wst.dat[u->wst.ptr] = d ^ b;
2885 u->wst.dat[u->wst.ptr + 1] = c ^ a;
2730#ifndef NO_STACK_CHECKS 2886#ifndef NO_STACK_CHECKS
2731 if(u->wst.ptr < 4) { 2887 if(__builtin_expect(u->wst.ptr < 4, 0)) {
2732 u->wst.error = 1; 2888 u->wst.error = 1;
2733 goto error; 2889 goto error;
2734 } 2890 }
2735 if(u->wst.ptr > 253) { 2891 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2736 u->wst.error = 2; 2892 u->wst.error = 2;
2737 goto error; 2893 goto error;
2738 } 2894 }
2739#endif 2895#endif
2740 u->wst.ptr += 2; 2896 u->wst.ptr += 2;
2897 }
2741 break; 2898 break;
2742 }
2743 case 0xbf: /* SFT2k */ 2899 case 0xbf: /* SFT2k */
2744 { 2900 __asm__( "evaluxn_bf_SFT2k:" );
2745 u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)), b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); 2901 {
2746 u->wst.dat[u->wst.ptr] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; 2902 u8 a = u->wst.dat[u->wst.ptr - 1];
2747 u->wst.dat[u->wst.ptr + 1] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; 2903 u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8));
2904 u->wst.dat[u->wst.ptr] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) >> 8;
2905 u->wst.dat[u->wst.ptr + 1] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) & 0xff;
2748#ifndef NO_STACK_CHECKS 2906#ifndef NO_STACK_CHECKS
2749 if(u->wst.ptr < 4) { 2907 if(__builtin_expect(u->wst.ptr < 3, 0)) {
2750 u->wst.error = 1; 2908 u->wst.error = 1;
2751 goto error; 2909 goto error;
2752 } 2910 }
2753 if(u->wst.ptr > 253) { 2911 if(__builtin_expect(u->wst.ptr > 253, 0)) {
2754 u->wst.error = 2; 2912 u->wst.error = 2;
2755 goto error; 2913 goto error;
2756 } 2914 }
2757#endif 2915#endif
2758 u->wst.ptr += 2; 2916 u->wst.ptr += 2;
2917 }
2759 break; 2918 break;
2760 }
2761 case 0xc3: /* POPkr */ 2919 case 0xc3: /* POPkr */
2762 { 2920 __asm__( "evaluxn_c3_POPkr:" );
2763 u->rst.dat[u->rst.ptr - 1]; 2921 {
2922 u->rst.dat[u->rst.ptr - 1];
2764#ifndef NO_STACK_CHECKS 2923#ifndef NO_STACK_CHECKS
2765 if(u->rst.ptr < 1) { 2924 if(__builtin_expect(u->rst.ptr < 1, 0)) {
2766 u->rst.error = 1; 2925 u->rst.error = 1;
2767 goto error; 2926 goto error;
2768 } 2927 }
2769#endif 2928#endif
2929 }
2770 break; 2930 break;
2771 }
2772 case 0xc4: /* DUPkr */ 2931 case 0xc4: /* DUPkr */
2773 { 2932 __asm__( "evaluxn_c4_DUPkr:" );
2774 u8 a = u->rst.dat[u->rst.ptr - 1]; 2933 {
2775 u->rst.dat[u->rst.ptr] = a; 2934 u8 a = u->rst.dat[u->rst.ptr - 1];
2776 u->rst.dat[u->rst.ptr + 1] = a; 2935 u->rst.dat[u->rst.ptr] = a;
2936 u->rst.dat[u->rst.ptr + 1] = a;
2777#ifndef NO_STACK_CHECKS 2937#ifndef NO_STACK_CHECKS
2778 if(u->rst.ptr < 1) { 2938 if(__builtin_expect(u->rst.ptr < 1, 0)) {
2779 u->rst.error = 1; 2939 u->rst.error = 1;
2780 goto error; 2940 goto error;
2781 } 2941 }
2782 if(u->rst.ptr > 253) { 2942 if(__builtin_expect(u->rst.ptr > 253, 0)) {
2783 u->rst.error = 2; 2943 u->rst.error = 2;
2784 goto error; 2944 goto error;
2785 } 2945 }
2786#endif 2946#endif
2787 u->rst.ptr += 2; 2947 u->rst.ptr += 2;
2948 }
2788 break; 2949 break;
2789 }
2790 case 0xc5: /* SWPkr */ 2950 case 0xc5: /* SWPkr */
2791 { 2951 __asm__( "evaluxn_c5_SWPkr:" );
2792 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 2952 {
2793 u->rst.dat[u->rst.ptr] = a; 2953 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
2794 u->rst.dat[u->rst.ptr + 1] = b; 2954 u->rst.dat[u->rst.ptr] = a;
2955 u->rst.dat[u->rst.ptr + 1] = b;
2795#ifndef NO_STACK_CHECKS 2956#ifndef NO_STACK_CHECKS
2796 if(u->rst.ptr < 2) { 2957 if(__builtin_expect(u->rst.ptr < 2, 0)) {
2797 u->rst.error = 1; 2958 u->rst.error = 1;
2798 goto error; 2959 goto error;
2799 } 2960 }
2800 if(u->rst.ptr > 253) { 2961 if(__builtin_expect(u->rst.ptr > 253, 0)) {
2801 u->rst.error = 2; 2962 u->rst.error = 2;
2802 goto error; 2963 goto error;
2803 } 2964 }
2804#endif 2965#endif
2805 u->rst.ptr += 2; 2966 u->rst.ptr += 2;
2967 }
2806 break; 2968 break;
2807 }
2808 case 0xc6: /* OVRkr */ 2969 case 0xc6: /* OVRkr */
2809 { 2970 __asm__( "evaluxn_c6_OVRkr:" );
2810 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 2971 {
2811 u->rst.dat[u->rst.ptr] = b; 2972 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
2812 u->rst.dat[u->rst.ptr + 1] = a; 2973 u->rst.dat[u->rst.ptr] = b;
2813 u->rst.dat[u->rst.ptr + 2] = b; 2974 u->rst.dat[u->rst.ptr + 1] = a;
2975 u->rst.dat[u->rst.ptr + 2] = b;
2814#ifndef NO_STACK_CHECKS 2976#ifndef NO_STACK_CHECKS
2815 if(u->rst.ptr < 2) { 2977 if(__builtin_expect(u->rst.ptr < 2, 0)) {
2816 u->rst.error = 1; 2978 u->rst.error = 1;
2817 goto error; 2979 goto error;
2818 } 2980 }
2819 if(u->rst.ptr > 252) { 2981 if(__builtin_expect(u->rst.ptr > 252, 0)) {
2820 u->rst.error = 2; 2982 u->rst.error = 2;
2821 goto error; 2983 goto error;
2822 } 2984 }
2823#endif 2985#endif
2824 u->rst.ptr += 3; 2986 u->rst.ptr += 3;
2987 }
2825 break; 2988 break;
2826 }
2827 case 0xc7: /* ROTkr */ 2989 case 0xc7: /* ROTkr */
2828 { 2990 __asm__( "evaluxn_c7_ROTkr:" );
2829 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3]; 2991 {
2830 u->rst.dat[u->rst.ptr] = b; 2992 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3];
2831 u->rst.dat[u->rst.ptr + 1] = a; 2993 u->rst.dat[u->rst.ptr] = b;
2832 u->rst.dat[u->rst.ptr + 2] = c; 2994 u->rst.dat[u->rst.ptr + 1] = a;
2995 u->rst.dat[u->rst.ptr + 2] = c;
2833#ifndef NO_STACK_CHECKS 2996#ifndef NO_STACK_CHECKS
2834 if(u->rst.ptr < 3) { 2997 if(__builtin_expect(u->rst.ptr < 3, 0)) {
2835 u->rst.error = 1; 2998 u->rst.error = 1;
2836 goto error; 2999 goto error;
2837 } 3000 }
2838 if(u->rst.ptr > 252) { 3001 if(__builtin_expect(u->rst.ptr > 252, 0)) {
2839 u->rst.error = 2; 3002 u->rst.error = 2;
2840 goto error; 3003 goto error;
2841 } 3004 }
2842#endif 3005#endif
2843 u->rst.ptr += 3; 3006 u->rst.ptr += 3;
3007 }
2844 break; 3008 break;
2845 }
2846 case 0xc8: /* EQUkr */ 3009 case 0xc8: /* EQUkr */
2847 { 3010 __asm__( "evaluxn_c8_EQUkr:" );
2848 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3011 {
2849 u->rst.dat[u->rst.ptr] = b == a; 3012 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3013 u->rst.dat[u->rst.ptr] = b == a;
2850#ifndef NO_STACK_CHECKS 3014#ifndef NO_STACK_CHECKS
2851 if(u->rst.ptr < 2) { 3015 if(__builtin_expect(u->rst.ptr < 2, 0)) {
2852 u->rst.error = 1; 3016 u->rst.error = 1;
2853 goto error; 3017 goto error;
2854 } 3018 }
2855 if(u->rst.ptr > 254) { 3019 if(__builtin_expect(u->rst.ptr > 254, 0)) {
2856 u->rst.error = 2; 3020 u->rst.error = 2;
2857 goto error; 3021 goto error;
2858 } 3022 }
2859#endif 3023#endif
2860 u->rst.ptr += 1; 3024 u->rst.ptr += 1;
3025 }
2861 break; 3026 break;
2862 }
2863 case 0xc9: /* NEQkr */ 3027 case 0xc9: /* NEQkr */
2864 { 3028 __asm__( "evaluxn_c9_NEQkr:" );
2865 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3029 {
2866 u->rst.dat[u->rst.ptr] = b != a; 3030 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3031 u->rst.dat[u->rst.ptr] = b != a;
2867#ifndef NO_STACK_CHECKS 3032#ifndef NO_STACK_CHECKS
2868 if(u->rst.ptr < 2) { 3033 if(__builtin_expect(u->rst.ptr < 2, 0)) {
2869 u->rst.error = 1; 3034 u->rst.error = 1;
2870 goto error; 3035 goto error;
2871 } 3036 }
2872 if(u->rst.ptr > 254) { 3037 if(__builtin_expect(u->rst.ptr > 254, 0)) {
2873 u->rst.error = 2; 3038 u->rst.error = 2;
2874 goto error; 3039 goto error;
2875 } 3040 }
2876#endif 3041#endif
2877 u->rst.ptr += 1; 3042 u->rst.ptr += 1;
3043 }
2878 break; 3044 break;
2879 }
2880 case 0xca: /* GTHkr */ 3045 case 0xca: /* GTHkr */
2881 { 3046 __asm__( "evaluxn_ca_GTHkr:" );
2882 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3047 {
2883 u->rst.dat[u->rst.ptr] = b > a; 3048 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3049 u->rst.dat[u->rst.ptr] = b > a;
2884#ifndef NO_STACK_CHECKS 3050#ifndef NO_STACK_CHECKS
2885 if(u->rst.ptr < 2) { 3051 if(__builtin_expect(u->rst.ptr < 2, 0)) {
2886 u->rst.error = 1; 3052 u->rst.error = 1;
2887 goto error; 3053 goto error;
2888 } 3054 }
2889 if(u->rst.ptr > 254) { 3055 if(__builtin_expect(u->rst.ptr > 254, 0)) {
2890 u->rst.error = 2; 3056 u->rst.error = 2;
2891 goto error; 3057 goto error;
2892 } 3058 }
2893#endif 3059#endif
2894 u->rst.ptr += 1; 3060 u->rst.ptr += 1;
3061 }
2895 break; 3062 break;
2896 }
2897 case 0xcb: /* LTHkr */ 3063 case 0xcb: /* LTHkr */
2898 { 3064 __asm__( "evaluxn_cb_LTHkr:" );
2899 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3065 {
2900 u->rst.dat[u->rst.ptr] = b < a; 3066 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3067 u->rst.dat[u->rst.ptr] = b < a;
2901#ifndef NO_STACK_CHECKS 3068#ifndef NO_STACK_CHECKS
2902 if(u->rst.ptr < 2) { 3069 if(__builtin_expect(u->rst.ptr < 2, 0)) {
2903 u->rst.error = 1; 3070 u->rst.error = 1;
2904 goto error; 3071 goto error;
2905 } 3072 }
2906 if(u->rst.ptr > 254) { 3073 if(__builtin_expect(u->rst.ptr > 254, 0)) {
2907 u->rst.error = 2; 3074 u->rst.error = 2;
2908 goto error; 3075 goto error;
2909 } 3076 }
2910#endif 3077#endif
2911 u->rst.ptr += 1; 3078 u->rst.ptr += 1;
3079 }
2912 break; 3080 break;
2913 }
2914 case 0xcc: /* JMPkr */ 3081 case 0xcc: /* JMPkr */
2915 { 3082 __asm__( "evaluxn_cc_JMPkr:" );
2916 u8 a = u->rst.dat[u->rst.ptr - 1]; 3083 {
2917 u->ram.ptr += (s8)a; 3084 u8 a = u->rst.dat[u->rst.ptr - 1];
3085 u->ram.ptr += (s8)a;
2918#ifndef NO_STACK_CHECKS 3086#ifndef NO_STACK_CHECKS
2919 if(u->rst.ptr < 1) { 3087 if(__builtin_expect(u->rst.ptr < 1, 0)) {
2920 u->rst.error = 1; 3088 u->rst.error = 1;
2921 goto error; 3089 goto error;
2922 } 3090 }
2923#endif 3091#endif
3092 }
2924 break; 3093 break;
2925 }
2926 case 0xcd: /* JCNkr */ 3094 case 0xcd: /* JCNkr */
2927 { 3095 __asm__( "evaluxn_cd_JCNkr:" );
2928 u8 a = u->rst.dat[u->rst.ptr - 1]; 3096 {
2929 if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (s8)a; 3097 u8 a = u->rst.dat[u->rst.ptr - 1];
3098 if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (s8)a;
2930#ifndef NO_STACK_CHECKS 3099#ifndef NO_STACK_CHECKS
2931 if(u->rst.ptr < 2) { 3100 if(__builtin_expect(u->rst.ptr < 2, 0)) {
2932 u->rst.error = 1; 3101 u->rst.error = 1;
2933 goto error; 3102 goto error;
2934 } 3103 }
2935#endif 3104#endif
3105 }
2936 break; 3106 break;
2937 }
2938 case 0xce: /* JSRkr */ 3107 case 0xce: /* JSRkr */
2939 { 3108 __asm__( "evaluxn_ce_JSRkr:" );
2940 u8 a = u->rst.dat[u->rst.ptr - 1]; 3109 {
2941 u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; 3110 u8 a = u->rst.dat[u->rst.ptr - 1];
2942 u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; 3111 u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8;
2943 u->ram.ptr += (s8)a; 3112 u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff;
3113 u->ram.ptr += (s8)a;
2944#ifndef NO_STACK_CHECKS 3114#ifndef NO_STACK_CHECKS
2945 if(u->rst.ptr < 1) { 3115 if(__builtin_expect(u->rst.ptr < 1, 0)) {
2946 u->rst.error = 1; 3116 u->rst.error = 1;
2947 goto error; 3117 goto error;
2948 } 3118 }
3119 if(__builtin_expect(u->wst.ptr > 253, 0)) {
3120 u->wst.error = 2;
3121 goto error;
3122 }
2949#endif 3123#endif
2950#ifndef NO_STACK_CHECKS 3124 u->wst.ptr += 2;
2951 if(u->wst.ptr > 253) {
2952 u->wst.error = 2;
2953 goto error;
2954 } 3125 }
2955#endif
2956 u->wst.ptr += 2;
2957 break; 3126 break;
2958 }
2959 case 0xcf: /* STHkr */ 3127 case 0xcf: /* STHkr */
2960 { 3128 __asm__( "evaluxn_cf_STHkr:" );
2961 u8 a = u->rst.dat[u->rst.ptr - 1]; 3129 {
2962 u->wst.dat[u->wst.ptr] = a; 3130 u8 a = u->rst.dat[u->rst.ptr - 1];
3131 u->wst.dat[u->wst.ptr] = a;
2963#ifndef NO_STACK_CHECKS 3132#ifndef NO_STACK_CHECKS
2964 if(u->rst.ptr < 1) { 3133 if(__builtin_expect(u->rst.ptr < 1, 0)) {
2965 u->rst.error = 1; 3134 u->rst.error = 1;
2966 goto error; 3135 goto error;
2967 } 3136 }
3137 if(__builtin_expect(u->wst.ptr > 254, 0)) {
3138 u->wst.error = 2;
3139 goto error;
3140 }
2968#endif 3141#endif
2969#ifndef NO_STACK_CHECKS 3142 u->wst.ptr += 1;
2970 if(u->wst.ptr > 254) {
2971 u->wst.error = 2;
2972 goto error;
2973 } 3143 }
2974#endif
2975 u->wst.ptr += 1;
2976 break; 3144 break;
2977 }
2978 case 0xd0: /* LDZkr */ 3145 case 0xd0: /* LDZkr */
2979 { 3146 __asm__( "evaluxn_d0_LDZkr:" );
2980 u8 a = u->rst.dat[u->rst.ptr - 1]; 3147 {
2981 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); 3148 u8 a = u->rst.dat[u->rst.ptr - 1];
3149 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a);
2982#ifndef NO_STACK_CHECKS 3150#ifndef NO_STACK_CHECKS
2983 if(u->rst.ptr < 1) { 3151 if(__builtin_expect(u->rst.ptr < 1, 0)) {
2984 u->rst.error = 1; 3152 u->rst.error = 1;
2985 goto error; 3153 goto error;
2986 } 3154 }
2987 if(u->rst.ptr > 254) { 3155 if(__builtin_expect(u->rst.ptr > 254, 0)) {
2988 u->rst.error = 2; 3156 u->rst.error = 2;
2989 goto error; 3157 goto error;
2990 } 3158 }
2991#endif 3159#endif
2992 u->rst.ptr += 1; 3160 u->rst.ptr += 1;
3161 }
2993 break; 3162 break;
2994 }
2995 case 0xd1: /* STZkr */ 3163 case 0xd1: /* STZkr */
2996 { 3164 __asm__( "evaluxn_d1_STZkr:" );
2997 u8 a = u->rst.dat[u->rst.ptr - 1]; 3165 {
2998 u8 b = u->rst.dat[u->rst.ptr - 2]; 3166 u8 a = u->rst.dat[u->rst.ptr - 1];
2999 mempoke8(u->ram.dat, a, b); 3167 u8 b = u->rst.dat[u->rst.ptr - 2];
3168 mempoke8(u->ram.dat, a, b);
3000#ifndef NO_STACK_CHECKS 3169#ifndef NO_STACK_CHECKS
3001 if(u->rst.ptr < 2) { 3170 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3002 u->rst.error = 1; 3171 u->rst.error = 1;
3003 goto error; 3172 goto error;
3004 } 3173 }
3005#endif 3174#endif
3175 }
3006 break; 3176 break;
3007 }
3008 case 0xd2: /* LDRkr */ 3177 case 0xd2: /* LDRkr */
3009 { 3178 __asm__( "evaluxn_d2_LDRkr:" );
3010 u8 a = u->rst.dat[u->rst.ptr - 1]; 3179 {
3011 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); 3180 u8 a = u->rst.dat[u->rst.ptr - 1];
3181 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a);
3012#ifndef NO_STACK_CHECKS 3182#ifndef NO_STACK_CHECKS
3013 if(u->rst.ptr < 1) { 3183 if(__builtin_expect(u->rst.ptr < 1, 0)) {
3014 u->rst.error = 1; 3184 u->rst.error = 1;
3015 goto error; 3185 goto error;
3016 } 3186 }
3017 if(u->rst.ptr > 254) { 3187 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3018 u->rst.error = 2; 3188 u->rst.error = 2;
3019 goto error; 3189 goto error;
3020 } 3190 }
3021#endif 3191#endif
3022 u->rst.ptr += 1; 3192 u->rst.ptr += 1;
3193 }
3023 break; 3194 break;
3024 }
3025 case 0xd3: /* STRkr */ 3195 case 0xd3: /* STRkr */
3026 { 3196 __asm__( "evaluxn_d3_STRkr:" );
3027 u8 a = u->rst.dat[u->rst.ptr - 1]; 3197 {
3028 u8 b = u->rst.dat[u->rst.ptr - 2]; 3198 u8 a = u->rst.dat[u->rst.ptr - 1];
3029 mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b); 3199 u8 b = u->rst.dat[u->rst.ptr - 2];
3200 mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b);
3030#ifndef NO_STACK_CHECKS 3201#ifndef NO_STACK_CHECKS
3031 if(u->rst.ptr < 2) { 3202 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3032 u->rst.error = 1; 3203 u->rst.error = 1;
3033 goto error; 3204 goto error;
3034 } 3205 }
3035#endif 3206#endif
3207 }
3036 break; 3208 break;
3037 }
3038 case 0xd4: /* LDAkr */ 3209 case 0xd4: /* LDAkr */
3039 { 3210 __asm__( "evaluxn_d4_LDAkr:" );
3040 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3211 {
3041 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); 3212 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
3213 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a);
3042#ifndef NO_STACK_CHECKS 3214#ifndef NO_STACK_CHECKS
3043 if(u->rst.ptr < 2) { 3215 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3044 u->rst.error = 1; 3216 u->rst.error = 1;
3045 goto error; 3217 goto error;
3046 } 3218 }
3047 if(u->rst.ptr > 254) { 3219 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3048 u->rst.error = 2; 3220 u->rst.error = 2;
3049 goto error; 3221 goto error;
3050 } 3222 }
3051#endif 3223#endif
3052 u->rst.ptr += 1; 3224 u->rst.ptr += 1;
3225 }
3053 break; 3226 break;
3054 }
3055 case 0xd5: /* STAkr */ 3227 case 0xd5: /* STAkr */
3056 { 3228 __asm__( "evaluxn_d5_STAkr:" );
3057 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3229 {
3058 u8 b = u->rst.dat[u->rst.ptr - 3]; 3230 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
3059 mempoke8(u->ram.dat, a, b); 3231 u8 b = u->rst.dat[u->rst.ptr - 3];
3232 mempoke8(u->ram.dat, a, b);
3060#ifndef NO_STACK_CHECKS 3233#ifndef NO_STACK_CHECKS
3061 if(u->rst.ptr < 3) { 3234 if(__builtin_expect(u->rst.ptr < 3, 0)) {
3062 u->rst.error = 1; 3235 u->rst.error = 1;
3063 goto error; 3236 goto error;
3064 } 3237 }
3065#endif 3238#endif
3239 }
3066 break; 3240 break;
3067 }
3068 case 0xd6: /* DEIkr */ 3241 case 0xd6: /* DEIkr */
3069 { 3242 __asm__( "evaluxn_d6_DEIkr:" );
3070 u8 a = u->rst.dat[u->rst.ptr - 1]; 3243 {
3071 u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); 3244 u8 a = u->rst.dat[u->rst.ptr - 1];
3245 u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a);
3072#ifndef NO_STACK_CHECKS 3246#ifndef NO_STACK_CHECKS
3073 if(u->rst.ptr < 1) { 3247 if(__builtin_expect(u->rst.ptr < 1, 0)) {
3074 u->rst.error = 1; 3248 u->rst.error = 1;
3075 goto error; 3249 goto error;
3076 } 3250 }
3077 if(u->rst.ptr > 254) { 3251 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3078 u->rst.error = 2; 3252 u->rst.error = 2;
3079 goto error; 3253 goto error;
3080 } 3254 }
3081#endif 3255#endif
3082 u->rst.ptr += 1; 3256 u->rst.ptr += 1;
3257 }
3083 break; 3258 break;
3084 }
3085 case 0xd7: /* DEOkr */ 3259 case 0xd7: /* DEOkr */
3086 { 3260 __asm__( "evaluxn_d7_DEOkr:" );
3087 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3261 {
3088 devpoke8(&u->dev[a >> 4], a, b); 3262 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3263 devpoke8(&u->dev[a >> 4], a, b);
3089#ifndef NO_STACK_CHECKS 3264#ifndef NO_STACK_CHECKS
3090 if(u->rst.ptr < 2) { 3265 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3091 u->rst.error = 1; 3266 u->rst.error = 1;
3092 goto error; 3267 goto error;
3093 } 3268 }
3094#endif 3269#endif
3270 }
3095 break; 3271 break;
3096 }
3097 case 0xd8: /* ADDkr */ 3272 case 0xd8: /* ADDkr */
3098 { 3273 __asm__( "evaluxn_d8_ADDkr:" );
3099 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3274 {
3100 u->rst.dat[u->rst.ptr] = b + a; 3275 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3276 u->rst.dat[u->rst.ptr] = b + a;
3101#ifndef NO_STACK_CHECKS 3277#ifndef NO_STACK_CHECKS
3102 if(u->rst.ptr < 2) { 3278 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3103 u->rst.error = 1; 3279 u->rst.error = 1;
3104 goto error; 3280 goto error;
3105 } 3281 }
3106 if(u->rst.ptr > 254) { 3282 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3107 u->rst.error = 2; 3283 u->rst.error = 2;
3108 goto error; 3284 goto error;
3109 } 3285 }
3110#endif 3286#endif
3111 u->rst.ptr += 1; 3287 u->rst.ptr += 1;
3288 }
3112 break; 3289 break;
3113 }
3114 case 0xd9: /* SUBkr */ 3290 case 0xd9: /* SUBkr */
3115 { 3291 __asm__( "evaluxn_d9_SUBkr:" );
3116 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3292 {
3117 u->rst.dat[u->rst.ptr] = b - a; 3293 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3294 u->rst.dat[u->rst.ptr] = b - a;
3118#ifndef NO_STACK_CHECKS 3295#ifndef NO_STACK_CHECKS
3119 if(u->rst.ptr < 2) { 3296 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3120 u->rst.error = 1; 3297 u->rst.error = 1;
3121 goto error; 3298 goto error;
3122 } 3299 }
3123 if(u->rst.ptr > 254) { 3300 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3124 u->rst.error = 2; 3301 u->rst.error = 2;
3125 goto error; 3302 goto error;
3126 } 3303 }
3127#endif 3304#endif
3128 u->rst.ptr += 1; 3305 u->rst.ptr += 1;
3306 }
3129 break; 3307 break;
3130 }
3131 case 0xda: /* MULkr */ 3308 case 0xda: /* MULkr */
3132 { 3309 __asm__( "evaluxn_da_MULkr:" );
3133 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3310 {
3134 u->rst.dat[u->rst.ptr] = b * a; 3311 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3312 u->rst.dat[u->rst.ptr] = b * a;
3135#ifndef NO_STACK_CHECKS 3313#ifndef NO_STACK_CHECKS
3136 if(u->rst.ptr < 2) { 3314 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3137 u->rst.error = 1; 3315 u->rst.error = 1;
3138 goto error; 3316 goto error;
3139 } 3317 }
3140 if(u->rst.ptr > 254) { 3318 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3141 u->rst.error = 2; 3319 u->rst.error = 2;
3142 goto error; 3320 goto error;
3143 } 3321 }
3144#endif 3322#endif
3145 u->rst.ptr += 1; 3323 u->rst.ptr += 1;
3324 }
3146 break; 3325 break;
3147 }
3148 case 0xdb: /* DIVkr */ 3326 case 0xdb: /* DIVkr */
3149 { 3327 __asm__( "evaluxn_db_DIVkr:" );
3150 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3328 {
3151 u->rst.dat[u->rst.ptr] = b / a; 3329 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3330 u->rst.dat[u->rst.ptr] = b / a;
3152#ifndef NO_STACK_CHECKS 3331#ifndef NO_STACK_CHECKS
3153 if(u->rst.ptr < 2) { 3332 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3154 u->rst.error = 1; 3333 u->rst.error = 1;
3155 goto error; 3334 goto error;
3156 } 3335 }
3157 if(u->rst.ptr > 254) { 3336 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3158 u->rst.error = 2; 3337 u->rst.error = 2;
3159 goto error; 3338 goto error;
3160 } 3339 }
3161#endif 3340#endif
3162 u->rst.ptr += 1; 3341 u->rst.ptr += 1;
3342 }
3163 break; 3343 break;
3164 }
3165 case 0xdc: /* ANDkr */ 3344 case 0xdc: /* ANDkr */
3166 { 3345 __asm__( "evaluxn_dc_ANDkr:" );
3167 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3346 {
3168 u->rst.dat[u->rst.ptr] = b & a; 3347 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3348 u->rst.dat[u->rst.ptr] = b & a;
3169#ifndef NO_STACK_CHECKS 3349#ifndef NO_STACK_CHECKS
3170 if(u->rst.ptr < 2) { 3350 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3171 u->rst.error = 1; 3351 u->rst.error = 1;
3172 goto error; 3352 goto error;
3173 } 3353 }
3174 if(u->rst.ptr > 254) { 3354 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3175 u->rst.error = 2; 3355 u->rst.error = 2;
3176 goto error; 3356 goto error;
3177 } 3357 }
3178#endif 3358#endif
3179 u->rst.ptr += 1; 3359 u->rst.ptr += 1;
3360 }
3180 break; 3361 break;
3181 }
3182 case 0xdd: /* ORAkr */ 3362 case 0xdd: /* ORAkr */
3183 { 3363 __asm__( "evaluxn_dd_ORAkr:" );
3184 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3364 {
3185 u->rst.dat[u->rst.ptr] = b | a; 3365 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3366 u->rst.dat[u->rst.ptr] = b | a;
3186#ifndef NO_STACK_CHECKS 3367#ifndef NO_STACK_CHECKS
3187 if(u->rst.ptr < 2) { 3368 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3188 u->rst.error = 1; 3369 u->rst.error = 1;
3189 goto error; 3370 goto error;
3190 } 3371 }
3191 if(u->rst.ptr > 254) { 3372 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3192 u->rst.error = 2; 3373 u->rst.error = 2;
3193 goto error; 3374 goto error;
3194 } 3375 }
3195#endif 3376#endif
3196 u->rst.ptr += 1; 3377 u->rst.ptr += 1;
3378 }
3197 break; 3379 break;
3198 }
3199 case 0xde: /* EORkr */ 3380 case 0xde: /* EORkr */
3200 { 3381 __asm__( "evaluxn_de_EORkr:" );
3201 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3382 {
3202 u->rst.dat[u->rst.ptr] = b ^ a; 3383 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3384 u->rst.dat[u->rst.ptr] = b ^ a;
3203#ifndef NO_STACK_CHECKS 3385#ifndef NO_STACK_CHECKS
3204 if(u->rst.ptr < 2) { 3386 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3205 u->rst.error = 1; 3387 u->rst.error = 1;
3206 goto error; 3388 goto error;
3207 } 3389 }
3208 if(u->rst.ptr > 254) { 3390 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3209 u->rst.error = 2; 3391 u->rst.error = 2;
3210 goto error; 3392 goto error;
3211 } 3393 }
3212#endif 3394#endif
3213 u->rst.ptr += 1; 3395 u->rst.ptr += 1;
3396 }
3214 break; 3397 break;
3215 }
3216 case 0xdf: /* SFTkr */ 3398 case 0xdf: /* SFTkr */
3217 { 3399 __asm__( "evaluxn_df_SFTkr:" );
3218 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; 3400 {
3219 u->rst.dat[u->rst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4); 3401 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3402 u->rst.dat[u->rst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4);
3220#ifndef NO_STACK_CHECKS 3403#ifndef NO_STACK_CHECKS
3221 if(u->rst.ptr < 2) { 3404 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3222 u->rst.error = 1; 3405 u->rst.error = 1;
3223 goto error; 3406 goto error;
3224 } 3407 }
3225 if(u->rst.ptr > 254) { 3408 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3226 u->rst.error = 2; 3409 u->rst.error = 2;
3227 goto error; 3410 goto error;
3228 } 3411 }
3229#endif 3412#endif
3230 u->rst.ptr += 1; 3413 u->rst.ptr += 1;
3414 }
3231 break; 3415 break;
3232 }
3233 case 0xe3: /* POP2kr */ 3416 case 0xe3: /* POP2kr */
3234 { 3417 __asm__( "evaluxn_e3_POP2kr:" );
3235 (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3418 {
3419 (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
3236#ifndef NO_STACK_CHECKS 3420#ifndef NO_STACK_CHECKS
3237 if(u->rst.ptr < 2) { 3421 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3238 u->rst.error = 1; 3422 u->rst.error = 1;
3239 goto error; 3423 goto error;
3240 } 3424 }
3241#endif 3425#endif
3426 }
3242 break; 3427 break;
3243 }
3244 case 0xe4: /* DUP2kr */ 3428 case 0xe4: /* DUP2kr */
3245 { 3429 __asm__( "evaluxn_e4_DUP2kr:" );
3246 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3430 {
3247 u->rst.dat[u->rst.ptr] = a >> 8; 3431 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3248 u->rst.dat[u->rst.ptr + 1] = a & 0xff; 3432 u->rst.dat[u->rst.ptr] = b;
3249 u->rst.dat[u->rst.ptr + 2] = a >> 8; 3433 u->rst.dat[u->rst.ptr + 1] = a;
3250 u->rst.dat[u->rst.ptr + 3] = a & 0xff; 3434 u->rst.dat[u->rst.ptr + 2] = b;
3251#ifndef NO_STACK_CHECKS 3435 u->rst.dat[u->rst.ptr + 3] = a;
3252 if(u->rst.ptr < 2) { 3436#ifndef NO_STACK_CHECKS
3253 u->rst.error = 1; 3437 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3254 goto error; 3438 u->rst.error = 1;
3255 } 3439 goto error;
3256 if(u->rst.ptr > 251) { 3440 }
3257 u->rst.error = 2; 3441 if(__builtin_expect(u->rst.ptr > 251, 0)) {
3258 goto error; 3442 u->rst.error = 2;
3443 goto error;
3444 }
3445#endif
3446 u->rst.ptr += 4;
3259 } 3447 }
3260#endif
3261 u->rst.ptr += 4;
3262 break; 3448 break;
3263 }
3264 case 0xe5: /* SWP2kr */ 3449 case 0xe5: /* SWP2kr */
3265 { 3450 __asm__( "evaluxn_e5_SWP2kr:" );
3266 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3451 {
3267 u->rst.dat[u->rst.ptr] = a >> 8; 3452 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
3268 u->rst.dat[u->rst.ptr + 1] = a & 0xff; 3453 u->rst.dat[u->rst.ptr] = b;
3269 u->rst.dat[u->rst.ptr + 2] = b >> 8; 3454 u->rst.dat[u->rst.ptr + 1] = a;
3270 u->rst.dat[u->rst.ptr + 3] = b & 0xff; 3455 u->rst.dat[u->rst.ptr + 2] = d;
3271#ifndef NO_STACK_CHECKS 3456 u->rst.dat[u->rst.ptr + 3] = c;
3272 if(u->rst.ptr < 4) { 3457#ifndef NO_STACK_CHECKS
3273 u->rst.error = 1; 3458 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3274 goto error; 3459 u->rst.error = 1;
3275 } 3460 goto error;
3276 if(u->rst.ptr > 251) { 3461 }
3277 u->rst.error = 2; 3462 if(__builtin_expect(u->rst.ptr > 251, 0)) {
3278 goto error; 3463 u->rst.error = 2;
3464 goto error;
3465 }
3466#endif
3467 u->rst.ptr += 4;
3279 } 3468 }
3280#endif
3281 u->rst.ptr += 4;
3282 break; 3469 break;
3283 }
3284 case 0xe6: /* OVR2kr */ 3470 case 0xe6: /* OVR2kr */
3285 { 3471 __asm__( "evaluxn_e6_OVR2kr:" );
3286 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3472 {
3287 u->rst.dat[u->rst.ptr] = b >> 8; 3473 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
3288 u->rst.dat[u->rst.ptr + 1] = b & 0xff; 3474 u->rst.dat[u->rst.ptr] = d;
3289 u->rst.dat[u->rst.ptr + 2] = a >> 8; 3475 u->rst.dat[u->rst.ptr + 1] = c;
3290 u->rst.dat[u->rst.ptr + 3] = a & 0xff; 3476 u->rst.dat[u->rst.ptr + 2] = b;
3291 u->rst.dat[u->rst.ptr + 4] = b >> 8; 3477 u->rst.dat[u->rst.ptr + 3] = a;
3292 u->rst.dat[u->rst.ptr + 5] = b & 0xff; 3478 u->rst.dat[u->rst.ptr + 4] = d;
3293#ifndef NO_STACK_CHECKS 3479 u->rst.dat[u->rst.ptr + 5] = c;
3294 if(u->rst.ptr < 4) { 3480#ifndef NO_STACK_CHECKS
3295 u->rst.error = 1; 3481 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3296 goto error; 3482 u->rst.error = 1;
3297 } 3483 goto error;
3298 if(u->rst.ptr > 249) { 3484 }
3299 u->rst.error = 2; 3485 if(__builtin_expect(u->rst.ptr > 249, 0)) {
3300 goto error; 3486 u->rst.error = 2;
3487 goto error;
3488 }
3489#endif
3490 u->rst.ptr += 6;
3301 } 3491 }
3302#endif
3303 u->rst.ptr += 6;
3304 break; 3492 break;
3305 }
3306 case 0xe7: /* ROT2kr */ 3493 case 0xe7: /* ROT2kr */
3307 { 3494 __asm__( "evaluxn_e7_ROT2kr:" );
3308 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)), c = (u->rst.dat[u->rst.ptr - 5] | (u->rst.dat[u->rst.ptr - 6] << 8)); 3495 {
3309 u->rst.dat[u->rst.ptr] = b >> 8; 3496 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4], e = u->rst.dat[u->rst.ptr - 5], f = u->rst.dat[u->rst.ptr - 6];
3310 u->rst.dat[u->rst.ptr + 1] = b & 0xff; 3497 u->rst.dat[u->rst.ptr] = d;
3311 u->rst.dat[u->rst.ptr + 2] = a >> 8; 3498 u->rst.dat[u->rst.ptr + 1] = c;
3312 u->rst.dat[u->rst.ptr + 3] = a & 0xff; 3499 u->rst.dat[u->rst.ptr + 2] = b;
3313 u->rst.dat[u->rst.ptr + 4] = c >> 8; 3500 u->rst.dat[u->rst.ptr + 3] = a;
3314 u->rst.dat[u->rst.ptr + 5] = c & 0xff; 3501 u->rst.dat[u->rst.ptr + 4] = f;
3315#ifndef NO_STACK_CHECKS 3502 u->rst.dat[u->rst.ptr + 5] = e;
3316 if(u->rst.ptr < 6) { 3503#ifndef NO_STACK_CHECKS
3317 u->rst.error = 1; 3504 if(__builtin_expect(u->rst.ptr < 6, 0)) {
3318 goto error; 3505 u->rst.error = 1;
3506 goto error;
3507 }
3508 if(__builtin_expect(u->rst.ptr > 249, 0)) {
3509 u->rst.error = 2;
3510 goto error;
3511 }
3512#endif
3513 u->rst.ptr += 6;
3319 } 3514 }
3320 if(u->rst.ptr > 249) {
3321 u->rst.error = 2;
3322 goto error;
3323 }
3324#endif
3325 u->rst.ptr += 6;
3326 break; 3515 break;
3327 }
3328 case 0xe8: /* EQU2kr */ 3516 case 0xe8: /* EQU2kr */
3329 { 3517 __asm__( "evaluxn_e8_EQU2kr:" );
3330 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3518 {
3331 u->rst.dat[u->rst.ptr] = b == a; 3519 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3520 u->rst.dat[u->rst.ptr] = b == a;
3332#ifndef NO_STACK_CHECKS 3521#ifndef NO_STACK_CHECKS
3333 if(u->rst.ptr < 4) { 3522 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3334 u->rst.error = 1; 3523 u->rst.error = 1;
3335 goto error; 3524 goto error;
3336 } 3525 }
3337 if(u->rst.ptr > 254) { 3526 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3338 u->rst.error = 2; 3527 u->rst.error = 2;
3339 goto error; 3528 goto error;
3340 } 3529 }
3341#endif 3530#endif
3342 u->rst.ptr += 1; 3531 u->rst.ptr += 1;
3532 }
3343 break; 3533 break;
3344 }
3345 case 0xe9: /* NEQ2kr */ 3534 case 0xe9: /* NEQ2kr */
3346 { 3535 __asm__( "evaluxn_e9_NEQ2kr:" );
3347 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3536 {
3348 u->rst.dat[u->rst.ptr] = b != a; 3537 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3538 u->rst.dat[u->rst.ptr] = b != a;
3349#ifndef NO_STACK_CHECKS 3539#ifndef NO_STACK_CHECKS
3350 if(u->rst.ptr < 4) { 3540 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3351 u->rst.error = 1; 3541 u->rst.error = 1;
3352 goto error; 3542 goto error;
3353 } 3543 }
3354 if(u->rst.ptr > 254) { 3544 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3355 u->rst.error = 2; 3545 u->rst.error = 2;
3356 goto error; 3546 goto error;
3357 } 3547 }
3358#endif 3548#endif
3359 u->rst.ptr += 1; 3549 u->rst.ptr += 1;
3550 }
3360 break; 3551 break;
3361 }
3362 case 0xea: /* GTH2kr */ 3552 case 0xea: /* GTH2kr */
3363 { 3553 __asm__( "evaluxn_ea_GTH2kr:" );
3364 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3554 {
3365 u->rst.dat[u->rst.ptr] = b > a; 3555 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3556 u->rst.dat[u->rst.ptr] = b > a;
3366#ifndef NO_STACK_CHECKS 3557#ifndef NO_STACK_CHECKS
3367 if(u->rst.ptr < 4) { 3558 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3368 u->rst.error = 1; 3559 u->rst.error = 1;
3369 goto error; 3560 goto error;
3370 } 3561 }
3371 if(u->rst.ptr > 254) { 3562 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3372 u->rst.error = 2; 3563 u->rst.error = 2;
3373 goto error; 3564 goto error;
3374 } 3565 }
3375#endif 3566#endif
3376 u->rst.ptr += 1; 3567 u->rst.ptr += 1;
3568 }
3377 break; 3569 break;
3378 }
3379 case 0xeb: /* LTH2kr */ 3570 case 0xeb: /* LTH2kr */
3380 { 3571 __asm__( "evaluxn_eb_LTH2kr:" );
3381 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3572 {
3382 u->rst.dat[u->rst.ptr] = b < a; 3573 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3574 u->rst.dat[u->rst.ptr] = b < a;
3383#ifndef NO_STACK_CHECKS 3575#ifndef NO_STACK_CHECKS
3384 if(u->rst.ptr < 4) { 3576 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3385 u->rst.error = 1; 3577 u->rst.error = 1;
3386 goto error; 3578 goto error;
3387 } 3579 }
3388 if(u->rst.ptr > 254) { 3580 if(__builtin_expect(u->rst.ptr > 254, 0)) {
3389 u->rst.error = 2; 3581 u->rst.error = 2;
3390 goto error; 3582 goto error;
3391 } 3583 }
3392#endif 3584#endif
3393 u->rst.ptr += 1; 3585 u->rst.ptr += 1;
3586 }
3394 break; 3587 break;
3395 }
3396 case 0xec: /* JMP2kr */ 3588 case 0xec: /* JMP2kr */
3397 { 3589 __asm__( "evaluxn_ec_JMP2kr:" );
3398 u->ram.ptr = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3590 {
3591 u->ram.ptr = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
3399#ifndef NO_STACK_CHECKS 3592#ifndef NO_STACK_CHECKS
3400 if(u->rst.ptr < 2) { 3593 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3401 u->rst.error = 1; 3594 u->rst.error = 1;
3402 goto error; 3595 goto error;
3403 } 3596 }
3404#endif 3597#endif
3598 }
3405 break; 3599 break;
3406 }
3407 case 0xed: /* JCN2kr */ 3600 case 0xed: /* JCN2kr */
3408 { 3601 __asm__( "evaluxn_ed_JCN2kr:" );
3409 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3602 {
3410 if(u->rst.dat[u->rst.ptr - 3]) u->ram.ptr = a; 3603 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
3604 if(u->rst.dat[u->rst.ptr - 3]) u->ram.ptr = a;
3411#ifndef NO_STACK_CHECKS 3605#ifndef NO_STACK_CHECKS
3412 if(u->rst.ptr < 3) { 3606 if(__builtin_expect(u->rst.ptr < 3, 0)) {
3413 u->rst.error = 1; 3607 u->rst.error = 1;
3414 goto error; 3608 goto error;
3415 } 3609 }
3416#endif 3610#endif
3611 }
3417 break; 3612 break;
3418 }
3419 case 0xee: /* JSR2kr */ 3613 case 0xee: /* JSR2kr */
3420 { 3614 __asm__( "evaluxn_ee_JSR2kr:" );
3421 u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; 3615 {
3422 u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; 3616 u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8;
3423 u->ram.ptr = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3617 u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff;
3618 u->ram.ptr = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
3424#ifndef NO_STACK_CHECKS 3619#ifndef NO_STACK_CHECKS
3425 if(u->rst.ptr < 2) { 3620 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3426 u->rst.error = 1; 3621 u->rst.error = 1;
3427 goto error; 3622 goto error;
3428 } 3623 }
3624 if(__builtin_expect(u->wst.ptr > 253, 0)) {
3625 u->wst.error = 2;
3626 goto error;
3627 }
3429#endif 3628#endif
3430#ifndef NO_STACK_CHECKS 3629 u->wst.ptr += 2;
3431 if(u->wst.ptr > 253) {
3432 u->wst.error = 2;
3433 goto error;
3434 } 3630 }
3435#endif
3436 u->wst.ptr += 2;
3437 break; 3631 break;
3438 }
3439 case 0xef: /* STH2kr */ 3632 case 0xef: /* STH2kr */
3440 { 3633 __asm__( "evaluxn_ef_STH2kr:" );
3441 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3634 {
3442 u->wst.dat[u->wst.ptr] = a >> 8; 3635 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2];
3443 u->wst.dat[u->wst.ptr + 1] = a & 0xff; 3636 u->wst.dat[u->wst.ptr] = b;
3637 u->wst.dat[u->wst.ptr + 1] = a;
3444#ifndef NO_STACK_CHECKS 3638#ifndef NO_STACK_CHECKS
3445 if(u->rst.ptr < 2) { 3639 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3446 u->rst.error = 1; 3640 u->rst.error = 1;
3447 goto error; 3641 goto error;
3448 } 3642 }
3643 if(__builtin_expect(u->wst.ptr > 253, 0)) {
3644 u->wst.error = 2;
3645 goto error;
3646 }
3449#endif 3647#endif
3450#ifndef NO_STACK_CHECKS 3648 u->wst.ptr += 2;
3451 if(u->wst.ptr > 253) {
3452 u->wst.error = 2;
3453 goto error;
3454 } 3649 }
3455#endif
3456 u->wst.ptr += 2;
3457 break; 3650 break;
3458 }
3459 case 0xf0: /* LDZ2kr */ 3651 case 0xf0: /* LDZ2kr */
3460 { 3652 __asm__( "evaluxn_f0_LDZ2kr:" );
3461 u8 a = u->rst.dat[u->rst.ptr - 1]; 3653 {
3462 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); 3654 u8 a = u->rst.dat[u->rst.ptr - 1];
3463 u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1); 3655 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a);
3656 u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1);
3464#ifndef NO_STACK_CHECKS 3657#ifndef NO_STACK_CHECKS
3465 if(u->rst.ptr < 1) { 3658 if(__builtin_expect(u->rst.ptr < 1, 0)) {
3466 u->rst.error = 1; 3659 u->rst.error = 1;
3467 goto error; 3660 goto error;
3468 } 3661 }
3469 if(u->rst.ptr > 253) { 3662 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3470 u->rst.error = 2; 3663 u->rst.error = 2;
3471 goto error; 3664 goto error;
3472 } 3665 }
3473#endif 3666#endif
3474 u->rst.ptr += 2; 3667 u->rst.ptr += 2;
3668 }
3475 break; 3669 break;
3476 }
3477 case 0xf1: /* STZ2kr */ 3670 case 0xf1: /* STZ2kr */
3478 { 3671 __asm__( "evaluxn_f1_STZ2kr:" );
3479 u8 a = u->rst.dat[u->rst.ptr - 1]; 3672 {
3480 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); 3673 u8 a = u->rst.dat[u->rst.ptr - 1];
3481 mempoke16(u->ram.dat, a, b); 3674 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8));
3675 mempoke16(u->ram.dat, a, b);
3482#ifndef NO_STACK_CHECKS 3676#ifndef NO_STACK_CHECKS
3483 if(u->rst.ptr < 3) { 3677 if(__builtin_expect(u->rst.ptr < 3, 0)) {
3484 u->rst.error = 1; 3678 u->rst.error = 1;
3485 goto error; 3679 goto error;
3486 } 3680 }
3487#endif 3681#endif
3682 }
3488 break; 3683 break;
3489 }
3490 case 0xf2: /* LDR2kr */ 3684 case 0xf2: /* LDR2kr */
3491 { 3685 __asm__( "evaluxn_f2_LDR2kr:" );
3492 u8 a = u->rst.dat[u->rst.ptr - 1]; 3686 {
3493 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); 3687 u8 a = u->rst.dat[u->rst.ptr - 1];
3494 u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1); 3688 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a);
3689 u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1);
3495#ifndef NO_STACK_CHECKS 3690#ifndef NO_STACK_CHECKS
3496 if(u->rst.ptr < 1) { 3691 if(__builtin_expect(u->rst.ptr < 1, 0)) {
3497 u->rst.error = 1; 3692 u->rst.error = 1;
3498 goto error; 3693 goto error;
3499 } 3694 }
3500 if(u->rst.ptr > 253) { 3695 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3501 u->rst.error = 2; 3696 u->rst.error = 2;
3502 goto error; 3697 goto error;
3503 } 3698 }
3504#endif 3699#endif
3505 u->rst.ptr += 2; 3700 u->rst.ptr += 2;
3701 }
3506 break; 3702 break;
3507 }
3508 case 0xf3: /* STR2kr */ 3703 case 0xf3: /* STR2kr */
3509 { 3704 __asm__( "evaluxn_f3_STR2kr:" );
3510 u8 a = u->rst.dat[u->rst.ptr - 1]; 3705 {
3511 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); 3706 u8 a = u->rst.dat[u->rst.ptr - 1];
3512 mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b); 3707 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8));
3708 mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b);
3513#ifndef NO_STACK_CHECKS 3709#ifndef NO_STACK_CHECKS
3514 if(u->rst.ptr < 3) { 3710 if(__builtin_expect(u->rst.ptr < 3, 0)) {
3515 u->rst.error = 1; 3711 u->rst.error = 1;
3516 goto error; 3712 goto error;
3517 } 3713 }
3518#endif 3714#endif
3715 }
3519 break; 3716 break;
3520 }
3521 case 0xf4: /* LDA2kr */ 3717 case 0xf4: /* LDA2kr */
3522 { 3718 __asm__( "evaluxn_f4_LDA2kr:" );
3523 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3719 {
3524 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); 3720 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
3525 u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1); 3721 u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a);
3722 u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1);
3526#ifndef NO_STACK_CHECKS 3723#ifndef NO_STACK_CHECKS
3527 if(u->rst.ptr < 2) { 3724 if(__builtin_expect(u->rst.ptr < 2, 0)) {
3528 u->rst.error = 1; 3725 u->rst.error = 1;
3529 goto error; 3726 goto error;
3530 } 3727 }
3531 if(u->rst.ptr > 253) { 3728 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3532 u->rst.error = 2; 3729 u->rst.error = 2;
3533 goto error; 3730 goto error;
3534 } 3731 }
3535#endif 3732#endif
3536 u->rst.ptr += 2; 3733 u->rst.ptr += 2;
3734 }
3537 break; 3735 break;
3538 }
3539 case 0xf5: /* STA2kr */ 3736 case 0xf5: /* STA2kr */
3540 { 3737 __asm__( "evaluxn_f5_STA2kr:" );
3541 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); 3738 {
3542 u16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3739 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8));
3543 mempoke16(u->ram.dat, a, b); 3740 u16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3741 mempoke16(u->ram.dat, a, b);
3544#ifndef NO_STACK_CHECKS 3742#ifndef NO_STACK_CHECKS
3545 if(u->rst.ptr < 4) { 3743 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3546 u->rst.error = 1; 3744 u->rst.error = 1;
3547 goto error; 3745 goto error;
3548 } 3746 }
3549#endif 3747#endif
3748 }
3550 break; 3749 break;
3551 }
3552 case 0xf6: /* DEI2kr */ 3750 case 0xf6: /* DEI2kr */
3553 { 3751 __asm__( "evaluxn_f6_DEI2kr:" );
3554 u8 a = u->rst.dat[u->rst.ptr - 1]; 3752 {
3555 u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); 3753 u8 a = u->rst.dat[u->rst.ptr - 1];
3556 u->rst.dat[u->rst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); 3754 u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a);
3755 u->rst.dat[u->rst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1);
3557#ifndef NO_STACK_CHECKS 3756#ifndef NO_STACK_CHECKS
3558 if(u->rst.ptr < 1) { 3757 if(__builtin_expect(u->rst.ptr < 1, 0)) {
3559 u->rst.error = 1; 3758 u->rst.error = 1;
3560 goto error; 3759 goto error;
3561 } 3760 }
3562 if(u->rst.ptr > 253) { 3761 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3563 u->rst.error = 2; 3762 u->rst.error = 2;
3564 goto error; 3763 goto error;
3565 } 3764 }
3566#endif 3765#endif
3567 u->rst.ptr += 2; 3766 u->rst.ptr += 2;
3767 }
3568 break; 3768 break;
3569 }
3570 case 0xf7: /* DEO2kr */ 3769 case 0xf7: /* DEO2kr */
3571 { 3770 __asm__( "evaluxn_f7_DEO2kr:" );
3572 u8 a = u->rst.dat[u->rst.ptr - 1]; 3771 {
3573 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); 3772 u8 a = u->rst.dat[u->rst.ptr - 1];
3574 devpoke16(&u->dev[a >> 4], a, b); 3773 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8));
3774 devpoke16(&u->dev[a >> 4], a, b);
3575#ifndef NO_STACK_CHECKS 3775#ifndef NO_STACK_CHECKS
3576 if(u->rst.ptr < 3) { 3776 if(__builtin_expect(u->rst.ptr < 3, 0)) {
3577 u->rst.error = 1; 3777 u->rst.error = 1;
3578 goto error; 3778 goto error;
3579 } 3779 }
3580#endif 3780#endif
3781 }
3581 break; 3782 break;
3582 }
3583 case 0xf8: /* ADD2kr */ 3783 case 0xf8: /* ADD2kr */
3584 { 3784 __asm__( "evaluxn_f8_ADD2kr:" );
3585 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3785 {
3586 u->rst.dat[u->rst.ptr] = (b + a) >> 8; 3786 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3587 u->rst.dat[u->rst.ptr + 1] = (b + a) & 0xff; 3787 u->rst.dat[u->rst.ptr] = (b + a) >> 8;
3788 u->rst.dat[u->rst.ptr + 1] = (b + a) & 0xff;
3588#ifndef NO_STACK_CHECKS 3789#ifndef NO_STACK_CHECKS
3589 if(u->rst.ptr < 4) { 3790 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3590 u->rst.error = 1; 3791 u->rst.error = 1;
3591 goto error; 3792 goto error;
3592 } 3793 }
3593 if(u->rst.ptr > 253) { 3794 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3594 u->rst.error = 2; 3795 u->rst.error = 2;
3595 goto error; 3796 goto error;
3596 } 3797 }
3597#endif 3798#endif
3598 u->rst.ptr += 2; 3799 u->rst.ptr += 2;
3800 }
3599 break; 3801 break;
3600 }
3601 case 0xf9: /* SUB2kr */ 3802 case 0xf9: /* SUB2kr */
3602 { 3803 __asm__( "evaluxn_f9_SUB2kr:" );
3603 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3804 {
3604 u->rst.dat[u->rst.ptr] = (b - a) >> 8; 3805 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3605 u->rst.dat[u->rst.ptr + 1] = (b - a) & 0xff; 3806 u->rst.dat[u->rst.ptr] = (b - a) >> 8;
3807 u->rst.dat[u->rst.ptr + 1] = (b - a) & 0xff;
3606#ifndef NO_STACK_CHECKS 3808#ifndef NO_STACK_CHECKS
3607 if(u->rst.ptr < 4) { 3809 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3608 u->rst.error = 1; 3810 u->rst.error = 1;
3609 goto error; 3811 goto error;
3610 } 3812 }
3611 if(u->rst.ptr > 253) { 3813 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3612 u->rst.error = 2; 3814 u->rst.error = 2;
3613 goto error; 3815 goto error;
3614 } 3816 }
3615#endif 3817#endif
3616 u->rst.ptr += 2; 3818 u->rst.ptr += 2;
3819 }
3617 break; 3820 break;
3618 }
3619 case 0xfa: /* MUL2kr */ 3821 case 0xfa: /* MUL2kr */
3620 { 3822 __asm__( "evaluxn_fa_MUL2kr:" );
3621 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3823 {
3622 u->rst.dat[u->rst.ptr] = (b * a) >> 8; 3824 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3623 u->rst.dat[u->rst.ptr + 1] = (b * a) & 0xff; 3825 u->rst.dat[u->rst.ptr] = (b * a) >> 8;
3826 u->rst.dat[u->rst.ptr + 1] = (b * a) & 0xff;
3624#ifndef NO_STACK_CHECKS 3827#ifndef NO_STACK_CHECKS
3625 if(u->rst.ptr < 4) { 3828 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3626 u->rst.error = 1; 3829 u->rst.error = 1;
3627 goto error; 3830 goto error;
3628 } 3831 }
3629 if(u->rst.ptr > 253) { 3832 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3630 u->rst.error = 2; 3833 u->rst.error = 2;
3631 goto error; 3834 goto error;
3632 } 3835 }
3633#endif 3836#endif
3634 u->rst.ptr += 2; 3837 u->rst.ptr += 2;
3838 }
3635 break; 3839 break;
3636 }
3637 case 0xfb: /* DIV2kr */ 3840 case 0xfb: /* DIV2kr */
3638 { 3841 __asm__( "evaluxn_fb_DIV2kr:" );
3639 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3842 {
3640 u->rst.dat[u->rst.ptr] = (b / a) >> 8; 3843 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8));
3641 u->rst.dat[u->rst.ptr + 1] = (b / a) & 0xff; 3844 u->rst.dat[u->rst.ptr] = (b / a) >> 8;
3845 u->rst.dat[u->rst.ptr + 1] = (b / a) & 0xff;
3642#ifndef NO_STACK_CHECKS 3846#ifndef NO_STACK_CHECKS
3643 if(u->rst.ptr < 4) { 3847 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3644 u->rst.error = 1; 3848 u->rst.error = 1;
3645 goto error; 3849 goto error;
3646 } 3850 }
3647 if(u->rst.ptr > 253) { 3851 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3648 u->rst.error = 2; 3852 u->rst.error = 2;
3649 goto error; 3853 goto error;
3650 } 3854 }
3651#endif 3855#endif
3652 u->rst.ptr += 2; 3856 u->rst.ptr += 2;
3857 }
3653 break; 3858 break;
3654 }
3655 case 0xfc: /* AND2kr */ 3859 case 0xfc: /* AND2kr */
3656 { 3860 __asm__( "evaluxn_fc_AND2kr:" );
3657 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4]; 3861 {
3658 u->rst.dat[u->rst.ptr] = d & b; 3862 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
3659 u->rst.dat[u->rst.ptr + 1] = c & a; 3863 u->rst.dat[u->rst.ptr] = d & b;
3864 u->rst.dat[u->rst.ptr + 1] = c & a;
3660#ifndef NO_STACK_CHECKS 3865#ifndef NO_STACK_CHECKS
3661 if(u->rst.ptr < 4) { 3866 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3662 u->rst.error = 1; 3867 u->rst.error = 1;
3663 goto error; 3868 goto error;
3664 } 3869 }
3665 if(u->rst.ptr > 253) { 3870 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3666 u->rst.error = 2; 3871 u->rst.error = 2;
3667 goto error; 3872 goto error;
3668 } 3873 }
3669#endif 3874#endif
3670 u->rst.ptr += 2; 3875 u->rst.ptr += 2;
3876 }
3671 break; 3877 break;
3672 }
3673 case 0xfd: /* ORA2kr */ 3878 case 0xfd: /* ORA2kr */
3674 { 3879 __asm__( "evaluxn_fd_ORA2kr:" );
3675 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4]; 3880 {
3676 u->rst.dat[u->rst.ptr] = d | b; 3881 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
3677 u->rst.dat[u->rst.ptr + 1] = c | a; 3882 u->rst.dat[u->rst.ptr] = d | b;
3883 u->rst.dat[u->rst.ptr + 1] = c | a;
3678#ifndef NO_STACK_CHECKS 3884#ifndef NO_STACK_CHECKS
3679 if(u->rst.ptr < 4) { 3885 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3680 u->rst.error = 1; 3886 u->rst.error = 1;
3681 goto error; 3887 goto error;
3682 } 3888 }
3683 if(u->rst.ptr > 253) { 3889 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3684 u->rst.error = 2; 3890 u->rst.error = 2;
3685 goto error; 3891 goto error;
3686 } 3892 }
3687#endif 3893#endif
3688 u->rst.ptr += 2; 3894 u->rst.ptr += 2;
3895 }
3689 break; 3896 break;
3690 }
3691 case 0xfe: /* EOR2kr */ 3897 case 0xfe: /* EOR2kr */
3692 { 3898 __asm__( "evaluxn_fe_EOR2kr:" );
3693 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4]; 3899 {
3694 u->rst.dat[u->rst.ptr] = d ^ b; 3900 u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3], d = u->rst.dat[u->rst.ptr - 4];
3695 u->rst.dat[u->rst.ptr + 1] = c ^ a; 3901 u->rst.dat[u->rst.ptr] = d ^ b;
3902 u->rst.dat[u->rst.ptr + 1] = c ^ a;
3696#ifndef NO_STACK_CHECKS 3903#ifndef NO_STACK_CHECKS
3697 if(u->rst.ptr < 4) { 3904 if(__builtin_expect(u->rst.ptr < 4, 0)) {
3698 u->rst.error = 1; 3905 u->rst.error = 1;
3699 goto error; 3906 goto error;
3700 } 3907 }
3701 if(u->rst.ptr > 253) { 3908 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3702 u->rst.error = 2; 3909 u->rst.error = 2;
3703 goto error; 3910 goto error;
3704 } 3911 }
3705#endif 3912#endif
3706 u->rst.ptr += 2; 3913 u->rst.ptr += 2;
3914 }
3707 break; 3915 break;
3708 }
3709 case 0xff: /* SFT2kr */ 3916 case 0xff: /* SFT2kr */
3710 { 3917 __asm__( "evaluxn_ff_SFT2kr:" );
3711 u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)), b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); 3918 {
3712 u->rst.dat[u->rst.ptr] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; 3919 u8 a = u->rst.dat[u->rst.ptr - 1];
3713 u->rst.dat[u->rst.ptr + 1] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; 3920 u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8));
3921 u->rst.dat[u->rst.ptr] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) >> 8;
3922 u->rst.dat[u->rst.ptr + 1] = (b >> (a & 0x0f) << ((a & 0xf0) >> 4)) & 0xff;
3714#ifndef NO_STACK_CHECKS 3923#ifndef NO_STACK_CHECKS
3715 if(u->rst.ptr < 4) { 3924 if(__builtin_expect(u->rst.ptr < 3, 0)) {
3716 u->rst.error = 1; 3925 u->rst.error = 1;
3717 goto error; 3926 goto error;
3718 } 3927 }
3719 if(u->rst.ptr > 253) { 3928 if(__builtin_expect(u->rst.ptr > 253, 0)) {
3720 u->rst.error = 2; 3929 u->rst.error = 2;
3721 goto error; 3930 goto error;
3722 } 3931 }
3723#endif 3932#endif
3724 u->rst.ptr += 2; 3933 u->rst.ptr += 2;
3934 }
3725 break; 3935 break;
3726 }
3727#pragma GCC diagnostic pop 3936#pragma GCC diagnostic pop
3728 } 3937 }
3729 } 3938 }
@@ -3734,27 +3943,6 @@ error:
3734#endif 3943#endif
3735} 3944}
3736 3945
3737int
3738bootuxn(Uxn *u)
3739{
3740 size_t i;
3741 char *cptr = (char *)u;
3742 for(i = 0; i < sizeof(*u); i++)
3743 cptr[i] = 0;
3744 return 1;
3745}
3746
3747int
3748loaduxn(Uxn *u, char *filepath)
3749{
3750 FILE *f;
3751 if(!(f = fopen(filepath, "rb"))) {
3752 return 0;
3753 }
3754 fread(u->ram.dat + PAGE_PROGRAM, sizeof(u->ram.dat) - PAGE_PROGRAM, 1, f);
3755 return 1;
3756}
3757
3758Device * 3946Device *
3759portuxn(Uxn *u, u8 id, char *name, void (*talkfn)(Device *d, u8 b0, u8 w)) 3947portuxn(Uxn *u, u8 id, char *name, void (*talkfn)(Device *d, u8 b0, u8 w))
3760{ 3948{