diff options
Diffstat (limited to 'src/uxn/uxn.c')
-rw-r--r-- | src/uxn/uxn.c | 558 |
1 files changed, 279 insertions, 279 deletions
diff --git a/src/uxn/uxn.c b/src/uxn/uxn.c index e8ae9f7..2b541d1 100644 --- a/src/uxn/uxn.c +++ b/src/uxn/uxn.c | |||
@@ -17,9 +17,9 @@ WITH REGARD TO THIS SOFTWARE. | |||
17 | 17 | ||
18 | IWRAM_CODE | 18 | IWRAM_CODE |
19 | int | 19 | int |
20 | evaluxn(Uxn *u, Uint16 vec) | 20 | evaluxn(Uxn *u, u16 vec) |
21 | { | 21 | { |
22 | Uint8 instr; | 22 | u8 instr; |
23 | u->ram.ptr = vec; | 23 | u->ram.ptr = vec; |
24 | while(u->ram.ptr) { | 24 | while(u->ram.ptr) { |
25 | instr = u->ram.dat[u->ram.ptr++]; | 25 | instr = u->ram.dat[u->ram.ptr++]; |
@@ -77,7 +77,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
77 | } | 77 | } |
78 | case 0x04: /* DUP */ | 78 | case 0x04: /* DUP */ |
79 | { | 79 | { |
80 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 80 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
81 | u->wst.dat[u->wst.ptr - 1] = a; | 81 | u->wst.dat[u->wst.ptr - 1] = a; |
82 | u->wst.dat[u->wst.ptr] = a; | 82 | u->wst.dat[u->wst.ptr] = a; |
83 | #ifndef NO_STACK_CHECKS | 83 | #ifndef NO_STACK_CHECKS |
@@ -95,7 +95,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
95 | } | 95 | } |
96 | case 0x05: /* SWP */ | 96 | case 0x05: /* SWP */ |
97 | { | 97 | { |
98 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 98 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
99 | u->wst.dat[u->wst.ptr - 2] = a; | 99 | u->wst.dat[u->wst.ptr - 2] = a; |
100 | u->wst.dat[u->wst.ptr - 1] = b; | 100 | u->wst.dat[u->wst.ptr - 1] = b; |
101 | #ifndef NO_STACK_CHECKS | 101 | #ifndef NO_STACK_CHECKS |
@@ -108,7 +108,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
108 | } | 108 | } |
109 | case 0x06: /* OVR */ | 109 | case 0x06: /* OVR */ |
110 | { | 110 | { |
111 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 111 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
112 | u->wst.dat[u->wst.ptr - 2] = b; | 112 | u->wst.dat[u->wst.ptr - 2] = b; |
113 | u->wst.dat[u->wst.ptr - 1] = a; | 113 | u->wst.dat[u->wst.ptr - 1] = a; |
114 | u->wst.dat[u->wst.ptr] = b; | 114 | u->wst.dat[u->wst.ptr] = b; |
@@ -127,7 +127,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
127 | } | 127 | } |
128 | case 0x07: /* ROT */ | 128 | case 0x07: /* ROT */ |
129 | { | 129 | { |
130 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3]; | 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]; |
131 | u->wst.dat[u->wst.ptr - 3] = b; | 131 | u->wst.dat[u->wst.ptr - 3] = b; |
132 | u->wst.dat[u->wst.ptr - 2] = a; | 132 | u->wst.dat[u->wst.ptr - 2] = a; |
133 | u->wst.dat[u->wst.ptr - 1] = c; | 133 | u->wst.dat[u->wst.ptr - 1] = c; |
@@ -141,7 +141,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
141 | } | 141 | } |
142 | case 0x08: /* EQU */ | 142 | case 0x08: /* EQU */ |
143 | { | 143 | { |
144 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 144 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
145 | u->wst.dat[u->wst.ptr - 2] = b == a; | 145 | u->wst.dat[u->wst.ptr - 2] = b == a; |
146 | #ifndef NO_STACK_CHECKS | 146 | #ifndef NO_STACK_CHECKS |
147 | if(u->wst.ptr < 2) { | 147 | if(u->wst.ptr < 2) { |
@@ -154,7 +154,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
154 | } | 154 | } |
155 | case 0x09: /* NEQ */ | 155 | case 0x09: /* NEQ */ |
156 | { | 156 | { |
157 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 157 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
158 | u->wst.dat[u->wst.ptr - 2] = b != a; | 158 | u->wst.dat[u->wst.ptr - 2] = b != a; |
159 | #ifndef NO_STACK_CHECKS | 159 | #ifndef NO_STACK_CHECKS |
160 | if(u->wst.ptr < 2) { | 160 | if(u->wst.ptr < 2) { |
@@ -167,7 +167,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
167 | } | 167 | } |
168 | case 0x0a: /* GTH */ | 168 | case 0x0a: /* GTH */ |
169 | { | 169 | { |
170 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 170 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
171 | u->wst.dat[u->wst.ptr - 2] = b > a; | 171 | u->wst.dat[u->wst.ptr - 2] = b > a; |
172 | #ifndef NO_STACK_CHECKS | 172 | #ifndef NO_STACK_CHECKS |
173 | if(u->wst.ptr < 2) { | 173 | if(u->wst.ptr < 2) { |
@@ -180,7 +180,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
180 | } | 180 | } |
181 | case 0x0b: /* LTH */ | 181 | case 0x0b: /* LTH */ |
182 | { | 182 | { |
183 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 183 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
184 | u->wst.dat[u->wst.ptr - 2] = b < a; | 184 | u->wst.dat[u->wst.ptr - 2] = b < a; |
185 | #ifndef NO_STACK_CHECKS | 185 | #ifndef NO_STACK_CHECKS |
186 | if(u->wst.ptr < 2) { | 186 | if(u->wst.ptr < 2) { |
@@ -193,8 +193,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
193 | } | 193 | } |
194 | case 0x0c: /* JMP */ | 194 | case 0x0c: /* JMP */ |
195 | { | 195 | { |
196 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 196 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
197 | u->ram.ptr += (Sint8)a; | 197 | u->ram.ptr += (s8)a; |
198 | #ifndef NO_STACK_CHECKS | 198 | #ifndef NO_STACK_CHECKS |
199 | if(u->wst.ptr < 1) { | 199 | if(u->wst.ptr < 1) { |
200 | u->wst.error = 1; | 200 | u->wst.error = 1; |
@@ -206,8 +206,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
206 | } | 206 | } |
207 | case 0x0d: /* JCN */ | 207 | case 0x0d: /* JCN */ |
208 | { | 208 | { |
209 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 209 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
210 | if(u->wst.dat[u->wst.ptr - 2]) u->ram.ptr += (Sint8)a; | 210 | if(u->wst.dat[u->wst.ptr - 2]) u->ram.ptr += (s8)a; |
211 | #ifndef NO_STACK_CHECKS | 211 | #ifndef NO_STACK_CHECKS |
212 | if(u->wst.ptr < 2) { | 212 | if(u->wst.ptr < 2) { |
213 | u->wst.error = 1; | 213 | u->wst.error = 1; |
@@ -219,10 +219,10 @@ evaluxn(Uxn *u, Uint16 vec) | |||
219 | } | 219 | } |
220 | case 0x0e: /* JSR */ | 220 | case 0x0e: /* JSR */ |
221 | { | 221 | { |
222 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 222 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
223 | u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; | 223 | u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; |
224 | u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; | 224 | u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; |
225 | u->ram.ptr += (Sint8)a; | 225 | u->ram.ptr += (s8)a; |
226 | #ifndef NO_STACK_CHECKS | 226 | #ifndef NO_STACK_CHECKS |
227 | if(u->wst.ptr < 1) { | 227 | if(u->wst.ptr < 1) { |
228 | u->wst.error = 1; | 228 | u->wst.error = 1; |
@@ -241,7 +241,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
241 | } | 241 | } |
242 | case 0x0f: /* STH */ | 242 | case 0x0f: /* STH */ |
243 | { | 243 | { |
244 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 244 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
245 | u->rst.dat[u->rst.ptr] = a; | 245 | u->rst.dat[u->rst.ptr] = a; |
246 | #ifndef NO_STACK_CHECKS | 246 | #ifndef NO_STACK_CHECKS |
247 | if(u->wst.ptr < 1) { | 247 | if(u->wst.ptr < 1) { |
@@ -261,7 +261,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
261 | } | 261 | } |
262 | case 0x10: /* LDZ */ | 262 | case 0x10: /* LDZ */ |
263 | { | 263 | { |
264 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 264 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
265 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); | 265 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); |
266 | #ifndef NO_STACK_CHECKS | 266 | #ifndef NO_STACK_CHECKS |
267 | if(u->wst.ptr < 1) { | 267 | if(u->wst.ptr < 1) { |
@@ -273,8 +273,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
273 | } | 273 | } |
274 | case 0x11: /* STZ */ | 274 | case 0x11: /* STZ */ |
275 | { | 275 | { |
276 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 276 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
277 | Uint8 b = u->wst.dat[u->wst.ptr - 2]; | 277 | u8 b = u->wst.dat[u->wst.ptr - 2]; |
278 | mempoke8(u->ram.dat, a, b); | 278 | mempoke8(u->ram.dat, a, b); |
279 | #ifndef NO_STACK_CHECKS | 279 | #ifndef NO_STACK_CHECKS |
280 | if(u->wst.ptr < 2) { | 280 | if(u->wst.ptr < 2) { |
@@ -287,8 +287,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
287 | } | 287 | } |
288 | case 0x12: /* LDR */ | 288 | case 0x12: /* LDR */ |
289 | { | 289 | { |
290 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 290 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
291 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); | 291 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); |
292 | #ifndef NO_STACK_CHECKS | 292 | #ifndef NO_STACK_CHECKS |
293 | if(u->wst.ptr < 1) { | 293 | if(u->wst.ptr < 1) { |
294 | u->wst.error = 1; | 294 | u->wst.error = 1; |
@@ -299,9 +299,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
299 | } | 299 | } |
300 | case 0x13: /* STR */ | 300 | case 0x13: /* STR */ |
301 | { | 301 | { |
302 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 302 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
303 | Uint8 b = u->wst.dat[u->wst.ptr - 2]; | 303 | u8 b = u->wst.dat[u->wst.ptr - 2]; |
304 | mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); | 304 | mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b); |
305 | #ifndef NO_STACK_CHECKS | 305 | #ifndef NO_STACK_CHECKS |
306 | if(u->wst.ptr < 2) { | 306 | if(u->wst.ptr < 2) { |
307 | u->wst.error = 1; | 307 | u->wst.error = 1; |
@@ -313,7 +313,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
313 | } | 313 | } |
314 | case 0x14: /* LDA */ | 314 | case 0x14: /* LDA */ |
315 | { | 315 | { |
316 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 316 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
317 | u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); | 317 | u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); |
318 | #ifndef NO_STACK_CHECKS | 318 | #ifndef NO_STACK_CHECKS |
319 | if(u->wst.ptr < 2) { | 319 | if(u->wst.ptr < 2) { |
@@ -326,8 +326,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
326 | } | 326 | } |
327 | case 0x15: /* STA */ | 327 | case 0x15: /* STA */ |
328 | { | 328 | { |
329 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 329 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
330 | Uint8 b = u->wst.dat[u->wst.ptr - 3]; | 330 | u8 b = u->wst.dat[u->wst.ptr - 3]; |
331 | mempoke8(u->ram.dat, a, b); | 331 | mempoke8(u->ram.dat, a, b); |
332 | #ifndef NO_STACK_CHECKS | 332 | #ifndef NO_STACK_CHECKS |
333 | if(u->wst.ptr < 3) { | 333 | if(u->wst.ptr < 3) { |
@@ -340,7 +340,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
340 | } | 340 | } |
341 | case 0x16: /* DEI */ | 341 | case 0x16: /* DEI */ |
342 | { | 342 | { |
343 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 343 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
344 | u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); | 344 | u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
345 | #ifndef NO_STACK_CHECKS | 345 | #ifndef NO_STACK_CHECKS |
346 | if(u->wst.ptr < 1) { | 346 | if(u->wst.ptr < 1) { |
@@ -352,7 +352,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
352 | } | 352 | } |
353 | case 0x17: /* DEO */ | 353 | case 0x17: /* DEO */ |
354 | { | 354 | { |
355 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 355 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
356 | devpoke8(&u->dev[a >> 4], a, b); | 356 | devpoke8(&u->dev[a >> 4], a, b); |
357 | #ifndef NO_STACK_CHECKS | 357 | #ifndef NO_STACK_CHECKS |
358 | if(u->wst.ptr < 2) { | 358 | if(u->wst.ptr < 2) { |
@@ -365,7 +365,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
365 | } | 365 | } |
366 | case 0x18: /* ADD */ | 366 | case 0x18: /* ADD */ |
367 | { | 367 | { |
368 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 368 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
369 | u->wst.dat[u->wst.ptr - 2] = b + a; | 369 | u->wst.dat[u->wst.ptr - 2] = b + a; |
370 | #ifndef NO_STACK_CHECKS | 370 | #ifndef NO_STACK_CHECKS |
371 | if(u->wst.ptr < 2) { | 371 | if(u->wst.ptr < 2) { |
@@ -378,7 +378,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
378 | } | 378 | } |
379 | case 0x19: /* SUB */ | 379 | case 0x19: /* SUB */ |
380 | { | 380 | { |
381 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 381 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
382 | u->wst.dat[u->wst.ptr - 2] = b - a; | 382 | u->wst.dat[u->wst.ptr - 2] = b - a; |
383 | #ifndef NO_STACK_CHECKS | 383 | #ifndef NO_STACK_CHECKS |
384 | if(u->wst.ptr < 2) { | 384 | if(u->wst.ptr < 2) { |
@@ -391,7 +391,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
391 | } | 391 | } |
392 | case 0x1a: /* MUL */ | 392 | case 0x1a: /* MUL */ |
393 | { | 393 | { |
394 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 394 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
395 | u->wst.dat[u->wst.ptr - 2] = b * a; | 395 | u->wst.dat[u->wst.ptr - 2] = b * a; |
396 | #ifndef NO_STACK_CHECKS | 396 | #ifndef NO_STACK_CHECKS |
397 | if(u->wst.ptr < 2) { | 397 | if(u->wst.ptr < 2) { |
@@ -404,7 +404,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
404 | } | 404 | } |
405 | case 0x1b: /* DIV */ | 405 | case 0x1b: /* DIV */ |
406 | { | 406 | { |
407 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 407 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
408 | u->wst.dat[u->wst.ptr - 2] = b / a; | 408 | u->wst.dat[u->wst.ptr - 2] = b / a; |
409 | #ifndef NO_STACK_CHECKS | 409 | #ifndef NO_STACK_CHECKS |
410 | if(u->wst.ptr < 2) { | 410 | if(u->wst.ptr < 2) { |
@@ -417,7 +417,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
417 | } | 417 | } |
418 | case 0x1c: /* AND */ | 418 | case 0x1c: /* AND */ |
419 | { | 419 | { |
420 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 420 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
421 | u->wst.dat[u->wst.ptr - 2] = b & a; | 421 | u->wst.dat[u->wst.ptr - 2] = b & a; |
422 | #ifndef NO_STACK_CHECKS | 422 | #ifndef NO_STACK_CHECKS |
423 | if(u->wst.ptr < 2) { | 423 | if(u->wst.ptr < 2) { |
@@ -430,7 +430,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
430 | } | 430 | } |
431 | case 0x1d: /* ORA */ | 431 | case 0x1d: /* ORA */ |
432 | { | 432 | { |
433 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 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; | 434 | u->wst.dat[u->wst.ptr - 2] = b | a; |
435 | #ifndef NO_STACK_CHECKS | 435 | #ifndef NO_STACK_CHECKS |
436 | if(u->wst.ptr < 2) { | 436 | if(u->wst.ptr < 2) { |
@@ -443,7 +443,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
443 | } | 443 | } |
444 | case 0x1e: /* EOR */ | 444 | case 0x1e: /* EOR */ |
445 | { | 445 | { |
446 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 446 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
447 | u->wst.dat[u->wst.ptr - 2] = b ^ a; | 447 | u->wst.dat[u->wst.ptr - 2] = b ^ a; |
448 | #ifndef NO_STACK_CHECKS | 448 | #ifndef NO_STACK_CHECKS |
449 | if(u->wst.ptr < 2) { | 449 | if(u->wst.ptr < 2) { |
@@ -456,7 +456,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
456 | } | 456 | } |
457 | case 0x1f: /* SFT */ | 457 | case 0x1f: /* SFT */ |
458 | { | 458 | { |
459 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 459 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
460 | u->wst.dat[u->wst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4); | 460 | u->wst.dat[u->wst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4); |
461 | #ifndef NO_STACK_CHECKS | 461 | #ifndef NO_STACK_CHECKS |
462 | if(u->wst.ptr < 2) { | 462 | if(u->wst.ptr < 2) { |
@@ -495,7 +495,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
495 | } | 495 | } |
496 | case 0x24: /* DUP2 */ | 496 | case 0x24: /* DUP2 */ |
497 | { | 497 | { |
498 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 498 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
499 | u->wst.dat[u->wst.ptr - 2] = a >> 8; | 499 | u->wst.dat[u->wst.ptr - 2] = a >> 8; |
500 | u->wst.dat[u->wst.ptr - 1] = a & 0xff; | 500 | u->wst.dat[u->wst.ptr - 1] = a & 0xff; |
501 | u->wst.dat[u->wst.ptr] = a >> 8; | 501 | u->wst.dat[u->wst.ptr] = a >> 8; |
@@ -515,7 +515,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
515 | } | 515 | } |
516 | case 0x25: /* SWP2 */ | 516 | case 0x25: /* SWP2 */ |
517 | { | 517 | { |
518 | Uint16 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)); | 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)); |
519 | u->wst.dat[u->wst.ptr - 4] = a >> 8; | 519 | u->wst.dat[u->wst.ptr - 4] = a >> 8; |
520 | u->wst.dat[u->wst.ptr - 3] = a & 0xff; | 520 | u->wst.dat[u->wst.ptr - 3] = a & 0xff; |
521 | u->wst.dat[u->wst.ptr - 2] = b >> 8; | 521 | u->wst.dat[u->wst.ptr - 2] = b >> 8; |
@@ -530,7 +530,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
530 | } | 530 | } |
531 | case 0x26: /* OVR2 */ | 531 | case 0x26: /* OVR2 */ |
532 | { | 532 | { |
533 | Uint16 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)); | 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)); |
534 | u->wst.dat[u->wst.ptr - 4] = b >> 8; | 534 | u->wst.dat[u->wst.ptr - 4] = b >> 8; |
535 | u->wst.dat[u->wst.ptr - 3] = b & 0xff; | 535 | u->wst.dat[u->wst.ptr - 3] = b & 0xff; |
536 | u->wst.dat[u->wst.ptr - 2] = a >> 8; | 536 | u->wst.dat[u->wst.ptr - 2] = a >> 8; |
@@ -552,7 +552,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
552 | } | 552 | } |
553 | case 0x27: /* ROT2 */ | 553 | case 0x27: /* ROT2 */ |
554 | { | 554 | { |
555 | Uint16 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)); | 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)); |
556 | u->wst.dat[u->wst.ptr - 6] = b >> 8; | 556 | u->wst.dat[u->wst.ptr - 6] = b >> 8; |
557 | u->wst.dat[u->wst.ptr - 5] = b & 0xff; | 557 | u->wst.dat[u->wst.ptr - 5] = b & 0xff; |
558 | u->wst.dat[u->wst.ptr - 4] = a >> 8; | 558 | u->wst.dat[u->wst.ptr - 4] = a >> 8; |
@@ -569,7 +569,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
569 | } | 569 | } |
570 | case 0x28: /* EQU2 */ | 570 | case 0x28: /* EQU2 */ |
571 | { | 571 | { |
572 | Uint16 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)); | 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)); |
573 | u->wst.dat[u->wst.ptr - 4] = b == a; | 573 | u->wst.dat[u->wst.ptr - 4] = b == a; |
574 | #ifndef NO_STACK_CHECKS | 574 | #ifndef NO_STACK_CHECKS |
575 | if(u->wst.ptr < 4) { | 575 | if(u->wst.ptr < 4) { |
@@ -582,7 +582,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
582 | } | 582 | } |
583 | case 0x29: /* NEQ2 */ | 583 | case 0x29: /* NEQ2 */ |
584 | { | 584 | { |
585 | Uint16 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)); | 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)); |
586 | u->wst.dat[u->wst.ptr - 4] = b != a; | 586 | u->wst.dat[u->wst.ptr - 4] = b != a; |
587 | #ifndef NO_STACK_CHECKS | 587 | #ifndef NO_STACK_CHECKS |
588 | if(u->wst.ptr < 4) { | 588 | if(u->wst.ptr < 4) { |
@@ -595,7 +595,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
595 | } | 595 | } |
596 | case 0x2a: /* GTH2 */ | 596 | case 0x2a: /* GTH2 */ |
597 | { | 597 | { |
598 | Uint16 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)); | 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)); |
599 | u->wst.dat[u->wst.ptr - 4] = b > a; | 599 | u->wst.dat[u->wst.ptr - 4] = b > a; |
600 | #ifndef NO_STACK_CHECKS | 600 | #ifndef NO_STACK_CHECKS |
601 | if(u->wst.ptr < 4) { | 601 | if(u->wst.ptr < 4) { |
@@ -608,7 +608,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
608 | } | 608 | } |
609 | case 0x2b: /* LTH2 */ | 609 | case 0x2b: /* LTH2 */ |
610 | { | 610 | { |
611 | Uint16 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)); | 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)); |
612 | u->wst.dat[u->wst.ptr - 4] = b < a; | 612 | u->wst.dat[u->wst.ptr - 4] = b < a; |
613 | #ifndef NO_STACK_CHECKS | 613 | #ifndef NO_STACK_CHECKS |
614 | if(u->wst.ptr < 4) { | 614 | if(u->wst.ptr < 4) { |
@@ -633,7 +633,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
633 | } | 633 | } |
634 | case 0x2d: /* JCN2 */ | 634 | case 0x2d: /* JCN2 */ |
635 | { | 635 | { |
636 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 636 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
637 | if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; | 637 | if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; |
638 | #ifndef NO_STACK_CHECKS | 638 | #ifndef NO_STACK_CHECKS |
639 | if(u->wst.ptr < 3) { | 639 | if(u->wst.ptr < 3) { |
@@ -667,7 +667,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
667 | } | 667 | } |
668 | case 0x2f: /* STH2 */ | 668 | case 0x2f: /* STH2 */ |
669 | { | 669 | { |
670 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 670 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
671 | u->rst.dat[u->rst.ptr] = a >> 8; | 671 | u->rst.dat[u->rst.ptr] = a >> 8; |
672 | u->rst.dat[u->rst.ptr + 1] = a & 0xff; | 672 | u->rst.dat[u->rst.ptr + 1] = a & 0xff; |
673 | #ifndef NO_STACK_CHECKS | 673 | #ifndef NO_STACK_CHECKS |
@@ -688,7 +688,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
688 | } | 688 | } |
689 | case 0x30: /* LDZ2 */ | 689 | case 0x30: /* LDZ2 */ |
690 | { | 690 | { |
691 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 691 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
692 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); | 692 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a); |
693 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a + 1); | 693 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a + 1); |
694 | #ifndef NO_STACK_CHECKS | 694 | #ifndef NO_STACK_CHECKS |
@@ -706,8 +706,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
706 | } | 706 | } |
707 | case 0x31: /* STZ2 */ | 707 | case 0x31: /* STZ2 */ |
708 | { | 708 | { |
709 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 709 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
710 | Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); | 710 | u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
711 | mempoke16(u->ram.dat, a, b); | 711 | mempoke16(u->ram.dat, a, b); |
712 | #ifndef NO_STACK_CHECKS | 712 | #ifndef NO_STACK_CHECKS |
713 | if(u->wst.ptr < 3) { | 713 | if(u->wst.ptr < 3) { |
@@ -720,9 +720,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
720 | } | 720 | } |
721 | case 0x32: /* LDR2 */ | 721 | case 0x32: /* LDR2 */ |
722 | { | 722 | { |
723 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 723 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
724 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); | 724 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); |
725 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); | 725 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1); |
726 | #ifndef NO_STACK_CHECKS | 726 | #ifndef NO_STACK_CHECKS |
727 | if(u->wst.ptr < 1) { | 727 | if(u->wst.ptr < 1) { |
728 | u->wst.error = 1; | 728 | u->wst.error = 1; |
@@ -738,9 +738,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
738 | } | 738 | } |
739 | case 0x33: /* STR2 */ | 739 | case 0x33: /* STR2 */ |
740 | { | 740 | { |
741 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 741 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
742 | Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); | 742 | u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
743 | mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); | 743 | mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b); |
744 | #ifndef NO_STACK_CHECKS | 744 | #ifndef NO_STACK_CHECKS |
745 | if(u->wst.ptr < 3) { | 745 | if(u->wst.ptr < 3) { |
746 | u->wst.error = 1; | 746 | u->wst.error = 1; |
@@ -752,7 +752,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
752 | } | 752 | } |
753 | case 0x34: /* LDA2 */ | 753 | case 0x34: /* LDA2 */ |
754 | { | 754 | { |
755 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 755 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
756 | u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); | 756 | u->wst.dat[u->wst.ptr - 2] = mempeek8(u->ram.dat, a); |
757 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a + 1); | 757 | u->wst.dat[u->wst.ptr - 1] = mempeek8(u->ram.dat, a + 1); |
758 | #ifndef NO_STACK_CHECKS | 758 | #ifndef NO_STACK_CHECKS |
@@ -765,8 +765,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
765 | } | 765 | } |
766 | case 0x35: /* STA2 */ | 766 | case 0x35: /* STA2 */ |
767 | { | 767 | { |
768 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 768 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
769 | Uint16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); | 769 | u16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
770 | mempoke16(u->ram.dat, a, b); | 770 | mempoke16(u->ram.dat, a, b); |
771 | #ifndef NO_STACK_CHECKS | 771 | #ifndef NO_STACK_CHECKS |
772 | if(u->wst.ptr < 4) { | 772 | if(u->wst.ptr < 4) { |
@@ -779,7 +779,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
779 | } | 779 | } |
780 | case 0x36: /* DEI2 */ | 780 | case 0x36: /* DEI2 */ |
781 | { | 781 | { |
782 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 782 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
783 | u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); | 783 | u->wst.dat[u->wst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
784 | u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); | 784 | u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); |
785 | #ifndef NO_STACK_CHECKS | 785 | #ifndef NO_STACK_CHECKS |
@@ -797,8 +797,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
797 | } | 797 | } |
798 | case 0x37: /* DEO2 */ | 798 | case 0x37: /* DEO2 */ |
799 | { | 799 | { |
800 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 800 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
801 | Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); | 801 | u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
802 | devpoke16(&u->dev[a >> 4], a, b); | 802 | devpoke16(&u->dev[a >> 4], a, b); |
803 | #ifndef NO_STACK_CHECKS | 803 | #ifndef NO_STACK_CHECKS |
804 | if(u->wst.ptr < 3) { | 804 | if(u->wst.ptr < 3) { |
@@ -811,7 +811,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
811 | } | 811 | } |
812 | case 0x38: /* ADD2 */ | 812 | case 0x38: /* ADD2 */ |
813 | { | 813 | { |
814 | Uint16 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)); | 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)); |
815 | u->wst.dat[u->wst.ptr - 4] = (b + a) >> 8; | 815 | u->wst.dat[u->wst.ptr - 4] = (b + a) >> 8; |
816 | u->wst.dat[u->wst.ptr - 3] = (b + a) & 0xff; | 816 | u->wst.dat[u->wst.ptr - 3] = (b + a) & 0xff; |
817 | #ifndef NO_STACK_CHECKS | 817 | #ifndef NO_STACK_CHECKS |
@@ -825,7 +825,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
825 | } | 825 | } |
826 | case 0x39: /* SUB2 */ | 826 | case 0x39: /* SUB2 */ |
827 | { | 827 | { |
828 | Uint16 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)); | 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)); |
829 | u->wst.dat[u->wst.ptr - 4] = (b - a) >> 8; | 829 | u->wst.dat[u->wst.ptr - 4] = (b - a) >> 8; |
830 | u->wst.dat[u->wst.ptr - 3] = (b - a) & 0xff; | 830 | u->wst.dat[u->wst.ptr - 3] = (b - a) & 0xff; |
831 | #ifndef NO_STACK_CHECKS | 831 | #ifndef NO_STACK_CHECKS |
@@ -839,7 +839,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
839 | } | 839 | } |
840 | case 0x3a: /* MUL2 */ | 840 | case 0x3a: /* MUL2 */ |
841 | { | 841 | { |
842 | Uint16 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)); | 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)); |
843 | u->wst.dat[u->wst.ptr - 4] = (b * a) >> 8; | 843 | u->wst.dat[u->wst.ptr - 4] = (b * a) >> 8; |
844 | u->wst.dat[u->wst.ptr - 3] = (b * a) & 0xff; | 844 | u->wst.dat[u->wst.ptr - 3] = (b * a) & 0xff; |
845 | #ifndef NO_STACK_CHECKS | 845 | #ifndef NO_STACK_CHECKS |
@@ -853,7 +853,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
853 | } | 853 | } |
854 | case 0x3b: /* DIV2 */ | 854 | case 0x3b: /* DIV2 */ |
855 | { | 855 | { |
856 | Uint16 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)); | 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)); |
857 | u->wst.dat[u->wst.ptr - 4] = (b / a) >> 8; | 857 | u->wst.dat[u->wst.ptr - 4] = (b / a) >> 8; |
858 | u->wst.dat[u->wst.ptr - 3] = (b / a) & 0xff; | 858 | u->wst.dat[u->wst.ptr - 3] = (b / a) & 0xff; |
859 | #ifndef NO_STACK_CHECKS | 859 | #ifndef NO_STACK_CHECKS |
@@ -867,7 +867,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
867 | } | 867 | } |
868 | case 0x3c: /* AND2 */ | 868 | case 0x3c: /* AND2 */ |
869 | { | 869 | { |
870 | Uint8 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]; | 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]; |
871 | u->wst.dat[u->wst.ptr - 4] = d & b; | 871 | u->wst.dat[u->wst.ptr - 4] = d & b; |
872 | u->wst.dat[u->wst.ptr - 3] = c & a; | 872 | u->wst.dat[u->wst.ptr - 3] = c & a; |
873 | #ifndef NO_STACK_CHECKS | 873 | #ifndef NO_STACK_CHECKS |
@@ -881,7 +881,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
881 | } | 881 | } |
882 | case 0x3d: /* ORA2 */ | 882 | case 0x3d: /* ORA2 */ |
883 | { | 883 | { |
884 | Uint8 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]; | 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]; |
885 | u->wst.dat[u->wst.ptr - 4] = d | b; | 885 | u->wst.dat[u->wst.ptr - 4] = d | b; |
886 | u->wst.dat[u->wst.ptr - 3] = c | a; | 886 | u->wst.dat[u->wst.ptr - 3] = c | a; |
887 | #ifndef NO_STACK_CHECKS | 887 | #ifndef NO_STACK_CHECKS |
@@ -895,7 +895,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
895 | } | 895 | } |
896 | case 0x3e: /* EOR2 */ | 896 | case 0x3e: /* EOR2 */ |
897 | { | 897 | { |
898 | Uint8 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]; | 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]; |
899 | u->wst.dat[u->wst.ptr - 4] = d ^ b; | 899 | u->wst.dat[u->wst.ptr - 4] = d ^ b; |
900 | u->wst.dat[u->wst.ptr - 3] = c ^ a; | 900 | u->wst.dat[u->wst.ptr - 3] = c ^ a; |
901 | #ifndef NO_STACK_CHECKS | 901 | #ifndef NO_STACK_CHECKS |
@@ -909,7 +909,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
909 | } | 909 | } |
910 | case 0x3f: /* SFT2 */ | 910 | case 0x3f: /* SFT2 */ |
911 | { | 911 | { |
912 | Uint16 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)); | 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)); |
913 | u->wst.dat[u->wst.ptr - 4] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; | 913 | u->wst.dat[u->wst.ptr - 4] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; |
914 | u->wst.dat[u->wst.ptr - 3] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; | 914 | u->wst.dat[u->wst.ptr - 3] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; |
915 | #ifndef NO_STACK_CHECKS | 915 | #ifndef NO_STACK_CHECKS |
@@ -948,7 +948,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
948 | } | 948 | } |
949 | case 0x44: /* DUPr */ | 949 | case 0x44: /* DUPr */ |
950 | { | 950 | { |
951 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 951 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
952 | u->rst.dat[u->rst.ptr - 1] = a; | 952 | u->rst.dat[u->rst.ptr - 1] = a; |
953 | u->rst.dat[u->rst.ptr] = a; | 953 | u->rst.dat[u->rst.ptr] = a; |
954 | #ifndef NO_STACK_CHECKS | 954 | #ifndef NO_STACK_CHECKS |
@@ -966,7 +966,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
966 | } | 966 | } |
967 | case 0x45: /* SWPr */ | 967 | case 0x45: /* SWPr */ |
968 | { | 968 | { |
969 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 969 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
970 | u->rst.dat[u->rst.ptr - 2] = a; | 970 | u->rst.dat[u->rst.ptr - 2] = a; |
971 | u->rst.dat[u->rst.ptr - 1] = b; | 971 | u->rst.dat[u->rst.ptr - 1] = b; |
972 | #ifndef NO_STACK_CHECKS | 972 | #ifndef NO_STACK_CHECKS |
@@ -979,7 +979,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
979 | } | 979 | } |
980 | case 0x46: /* OVRr */ | 980 | case 0x46: /* OVRr */ |
981 | { | 981 | { |
982 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 982 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
983 | u->rst.dat[u->rst.ptr - 2] = b; | 983 | u->rst.dat[u->rst.ptr - 2] = b; |
984 | u->rst.dat[u->rst.ptr - 1] = a; | 984 | u->rst.dat[u->rst.ptr - 1] = a; |
985 | u->rst.dat[u->rst.ptr] = b; | 985 | u->rst.dat[u->rst.ptr] = b; |
@@ -998,7 +998,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
998 | } | 998 | } |
999 | case 0x47: /* ROTr */ | 999 | case 0x47: /* ROTr */ |
1000 | { | 1000 | { |
1001 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3]; | 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]; |
1002 | u->rst.dat[u->rst.ptr - 3] = b; | 1002 | u->rst.dat[u->rst.ptr - 3] = b; |
1003 | u->rst.dat[u->rst.ptr - 2] = a; | 1003 | u->rst.dat[u->rst.ptr - 2] = a; |
1004 | u->rst.dat[u->rst.ptr - 1] = c; | 1004 | u->rst.dat[u->rst.ptr - 1] = c; |
@@ -1012,7 +1012,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1012 | } | 1012 | } |
1013 | case 0x48: /* EQUr */ | 1013 | case 0x48: /* EQUr */ |
1014 | { | 1014 | { |
1015 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1015 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1016 | u->rst.dat[u->rst.ptr - 2] = b == a; | 1016 | u->rst.dat[u->rst.ptr - 2] = b == a; |
1017 | #ifndef NO_STACK_CHECKS | 1017 | #ifndef NO_STACK_CHECKS |
1018 | if(u->rst.ptr < 2) { | 1018 | if(u->rst.ptr < 2) { |
@@ -1025,7 +1025,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1025 | } | 1025 | } |
1026 | case 0x49: /* NEQr */ | 1026 | case 0x49: /* NEQr */ |
1027 | { | 1027 | { |
1028 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1028 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1029 | u->rst.dat[u->rst.ptr - 2] = b != a; | 1029 | u->rst.dat[u->rst.ptr - 2] = b != a; |
1030 | #ifndef NO_STACK_CHECKS | 1030 | #ifndef NO_STACK_CHECKS |
1031 | if(u->rst.ptr < 2) { | 1031 | if(u->rst.ptr < 2) { |
@@ -1038,7 +1038,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1038 | } | 1038 | } |
1039 | case 0x4a: /* GTHr */ | 1039 | case 0x4a: /* GTHr */ |
1040 | { | 1040 | { |
1041 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1041 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1042 | u->rst.dat[u->rst.ptr - 2] = b > a; | 1042 | u->rst.dat[u->rst.ptr - 2] = b > a; |
1043 | #ifndef NO_STACK_CHECKS | 1043 | #ifndef NO_STACK_CHECKS |
1044 | if(u->rst.ptr < 2) { | 1044 | if(u->rst.ptr < 2) { |
@@ -1051,7 +1051,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1051 | } | 1051 | } |
1052 | case 0x4b: /* LTHr */ | 1052 | case 0x4b: /* LTHr */ |
1053 | { | 1053 | { |
1054 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1054 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1055 | u->rst.dat[u->rst.ptr - 2] = b < a; | 1055 | u->rst.dat[u->rst.ptr - 2] = b < a; |
1056 | #ifndef NO_STACK_CHECKS | 1056 | #ifndef NO_STACK_CHECKS |
1057 | if(u->rst.ptr < 2) { | 1057 | if(u->rst.ptr < 2) { |
@@ -1064,8 +1064,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1064 | } | 1064 | } |
1065 | case 0x4c: /* JMPr */ | 1065 | case 0x4c: /* JMPr */ |
1066 | { | 1066 | { |
1067 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1067 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1068 | u->ram.ptr += (Sint8)a; | 1068 | u->ram.ptr += (s8)a; |
1069 | #ifndef NO_STACK_CHECKS | 1069 | #ifndef NO_STACK_CHECKS |
1070 | if(u->rst.ptr < 1) { | 1070 | if(u->rst.ptr < 1) { |
1071 | u->rst.error = 1; | 1071 | u->rst.error = 1; |
@@ -1077,8 +1077,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1077 | } | 1077 | } |
1078 | case 0x4d: /* JCNr */ | 1078 | case 0x4d: /* JCNr */ |
1079 | { | 1079 | { |
1080 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1080 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1081 | if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (Sint8)a; | 1081 | if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (s8)a; |
1082 | #ifndef NO_STACK_CHECKS | 1082 | #ifndef NO_STACK_CHECKS |
1083 | if(u->rst.ptr < 2) { | 1083 | if(u->rst.ptr < 2) { |
1084 | u->rst.error = 1; | 1084 | u->rst.error = 1; |
@@ -1090,10 +1090,10 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1090 | } | 1090 | } |
1091 | case 0x4e: /* JSRr */ | 1091 | case 0x4e: /* JSRr */ |
1092 | { | 1092 | { |
1093 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1093 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1094 | u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; | 1094 | u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; |
1095 | u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; | 1095 | u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; |
1096 | u->ram.ptr += (Sint8)a; | 1096 | u->ram.ptr += (s8)a; |
1097 | #ifndef NO_STACK_CHECKS | 1097 | #ifndef NO_STACK_CHECKS |
1098 | if(u->rst.ptr < 1) { | 1098 | if(u->rst.ptr < 1) { |
1099 | u->rst.error = 1; | 1099 | u->rst.error = 1; |
@@ -1112,7 +1112,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1112 | } | 1112 | } |
1113 | case 0x4f: /* STHr */ | 1113 | case 0x4f: /* STHr */ |
1114 | { | 1114 | { |
1115 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1115 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1116 | u->wst.dat[u->wst.ptr] = a; | 1116 | u->wst.dat[u->wst.ptr] = a; |
1117 | #ifndef NO_STACK_CHECKS | 1117 | #ifndef NO_STACK_CHECKS |
1118 | if(u->rst.ptr < 1) { | 1118 | if(u->rst.ptr < 1) { |
@@ -1132,7 +1132,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1132 | } | 1132 | } |
1133 | case 0x50: /* LDZr */ | 1133 | case 0x50: /* LDZr */ |
1134 | { | 1134 | { |
1135 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1135 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1136 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); | 1136 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); |
1137 | #ifndef NO_STACK_CHECKS | 1137 | #ifndef NO_STACK_CHECKS |
1138 | if(u->rst.ptr < 1) { | 1138 | if(u->rst.ptr < 1) { |
@@ -1144,8 +1144,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1144 | } | 1144 | } |
1145 | case 0x51: /* STZr */ | 1145 | case 0x51: /* STZr */ |
1146 | { | 1146 | { |
1147 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1147 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1148 | Uint8 b = u->rst.dat[u->rst.ptr - 2]; | 1148 | u8 b = u->rst.dat[u->rst.ptr - 2]; |
1149 | mempoke8(u->ram.dat, a, b); | 1149 | mempoke8(u->ram.dat, a, b); |
1150 | #ifndef NO_STACK_CHECKS | 1150 | #ifndef NO_STACK_CHECKS |
1151 | if(u->rst.ptr < 2) { | 1151 | if(u->rst.ptr < 2) { |
@@ -1158,8 +1158,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1158 | } | 1158 | } |
1159 | case 0x52: /* LDRr */ | 1159 | case 0x52: /* LDRr */ |
1160 | { | 1160 | { |
1161 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1161 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1162 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); | 1162 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); |
1163 | #ifndef NO_STACK_CHECKS | 1163 | #ifndef NO_STACK_CHECKS |
1164 | if(u->rst.ptr < 1) { | 1164 | if(u->rst.ptr < 1) { |
1165 | u->rst.error = 1; | 1165 | u->rst.error = 1; |
@@ -1170,9 +1170,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1170 | } | 1170 | } |
1171 | case 0x53: /* STRr */ | 1171 | case 0x53: /* STRr */ |
1172 | { | 1172 | { |
1173 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1173 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1174 | Uint8 b = u->rst.dat[u->rst.ptr - 2]; | 1174 | u8 b = u->rst.dat[u->rst.ptr - 2]; |
1175 | mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); | 1175 | mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b); |
1176 | #ifndef NO_STACK_CHECKS | 1176 | #ifndef NO_STACK_CHECKS |
1177 | if(u->rst.ptr < 2) { | 1177 | if(u->rst.ptr < 2) { |
1178 | u->rst.error = 1; | 1178 | u->rst.error = 1; |
@@ -1184,7 +1184,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1184 | } | 1184 | } |
1185 | case 0x54: /* LDAr */ | 1185 | case 0x54: /* LDAr */ |
1186 | { | 1186 | { |
1187 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 1187 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
1188 | u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); | 1188 | u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); |
1189 | #ifndef NO_STACK_CHECKS | 1189 | #ifndef NO_STACK_CHECKS |
1190 | if(u->rst.ptr < 2) { | 1190 | if(u->rst.ptr < 2) { |
@@ -1197,8 +1197,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1197 | } | 1197 | } |
1198 | case 0x55: /* STAr */ | 1198 | case 0x55: /* STAr */ |
1199 | { | 1199 | { |
1200 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 1200 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
1201 | Uint8 b = u->rst.dat[u->rst.ptr - 3]; | 1201 | u8 b = u->rst.dat[u->rst.ptr - 3]; |
1202 | mempoke8(u->ram.dat, a, b); | 1202 | mempoke8(u->ram.dat, a, b); |
1203 | #ifndef NO_STACK_CHECKS | 1203 | #ifndef NO_STACK_CHECKS |
1204 | if(u->rst.ptr < 3) { | 1204 | if(u->rst.ptr < 3) { |
@@ -1211,7 +1211,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1211 | } | 1211 | } |
1212 | case 0x56: /* DEIr */ | 1212 | case 0x56: /* DEIr */ |
1213 | { | 1213 | { |
1214 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1214 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1215 | u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); | 1215 | u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
1216 | #ifndef NO_STACK_CHECKS | 1216 | #ifndef NO_STACK_CHECKS |
1217 | if(u->rst.ptr < 1) { | 1217 | if(u->rst.ptr < 1) { |
@@ -1223,7 +1223,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1223 | } | 1223 | } |
1224 | case 0x57: /* DEOr */ | 1224 | case 0x57: /* DEOr */ |
1225 | { | 1225 | { |
1226 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1226 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1227 | devpoke8(&u->dev[a >> 4], a, b); | 1227 | devpoke8(&u->dev[a >> 4], a, b); |
1228 | #ifndef NO_STACK_CHECKS | 1228 | #ifndef NO_STACK_CHECKS |
1229 | if(u->rst.ptr < 2) { | 1229 | if(u->rst.ptr < 2) { |
@@ -1236,7 +1236,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1236 | } | 1236 | } |
1237 | case 0x58: /* ADDr */ | 1237 | case 0x58: /* ADDr */ |
1238 | { | 1238 | { |
1239 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1239 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1240 | u->rst.dat[u->rst.ptr - 2] = b + a; | 1240 | u->rst.dat[u->rst.ptr - 2] = b + a; |
1241 | #ifndef NO_STACK_CHECKS | 1241 | #ifndef NO_STACK_CHECKS |
1242 | if(u->rst.ptr < 2) { | 1242 | if(u->rst.ptr < 2) { |
@@ -1249,7 +1249,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1249 | } | 1249 | } |
1250 | case 0x59: /* SUBr */ | 1250 | case 0x59: /* SUBr */ |
1251 | { | 1251 | { |
1252 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1252 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1253 | u->rst.dat[u->rst.ptr - 2] = b - a; | 1253 | u->rst.dat[u->rst.ptr - 2] = b - a; |
1254 | #ifndef NO_STACK_CHECKS | 1254 | #ifndef NO_STACK_CHECKS |
1255 | if(u->rst.ptr < 2) { | 1255 | if(u->rst.ptr < 2) { |
@@ -1262,7 +1262,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1262 | } | 1262 | } |
1263 | case 0x5a: /* MULr */ | 1263 | case 0x5a: /* MULr */ |
1264 | { | 1264 | { |
1265 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1265 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1266 | u->rst.dat[u->rst.ptr - 2] = b * a; | 1266 | u->rst.dat[u->rst.ptr - 2] = b * a; |
1267 | #ifndef NO_STACK_CHECKS | 1267 | #ifndef NO_STACK_CHECKS |
1268 | if(u->rst.ptr < 2) { | 1268 | if(u->rst.ptr < 2) { |
@@ -1275,7 +1275,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1275 | } | 1275 | } |
1276 | case 0x5b: /* DIVr */ | 1276 | case 0x5b: /* DIVr */ |
1277 | { | 1277 | { |
1278 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1278 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1279 | u->rst.dat[u->rst.ptr - 2] = b / a; | 1279 | u->rst.dat[u->rst.ptr - 2] = b / a; |
1280 | #ifndef NO_STACK_CHECKS | 1280 | #ifndef NO_STACK_CHECKS |
1281 | if(u->rst.ptr < 2) { | 1281 | if(u->rst.ptr < 2) { |
@@ -1288,7 +1288,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1288 | } | 1288 | } |
1289 | case 0x5c: /* ANDr */ | 1289 | case 0x5c: /* ANDr */ |
1290 | { | 1290 | { |
1291 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1291 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1292 | u->rst.dat[u->rst.ptr - 2] = b & a; | 1292 | u->rst.dat[u->rst.ptr - 2] = b & a; |
1293 | #ifndef NO_STACK_CHECKS | 1293 | #ifndef NO_STACK_CHECKS |
1294 | if(u->rst.ptr < 2) { | 1294 | if(u->rst.ptr < 2) { |
@@ -1301,7 +1301,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1301 | } | 1301 | } |
1302 | case 0x5d: /* ORAr */ | 1302 | case 0x5d: /* ORAr */ |
1303 | { | 1303 | { |
1304 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1304 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1305 | u->rst.dat[u->rst.ptr - 2] = b | a; | 1305 | u->rst.dat[u->rst.ptr - 2] = b | a; |
1306 | #ifndef NO_STACK_CHECKS | 1306 | #ifndef NO_STACK_CHECKS |
1307 | if(u->rst.ptr < 2) { | 1307 | if(u->rst.ptr < 2) { |
@@ -1314,7 +1314,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1314 | } | 1314 | } |
1315 | case 0x5e: /* EORr */ | 1315 | case 0x5e: /* EORr */ |
1316 | { | 1316 | { |
1317 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1317 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1318 | u->rst.dat[u->rst.ptr - 2] = b ^ a; | 1318 | u->rst.dat[u->rst.ptr - 2] = b ^ a; |
1319 | #ifndef NO_STACK_CHECKS | 1319 | #ifndef NO_STACK_CHECKS |
1320 | if(u->rst.ptr < 2) { | 1320 | if(u->rst.ptr < 2) { |
@@ -1327,7 +1327,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1327 | } | 1327 | } |
1328 | case 0x5f: /* SFTr */ | 1328 | case 0x5f: /* SFTr */ |
1329 | { | 1329 | { |
1330 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 1330 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
1331 | u->rst.dat[u->rst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4); | 1331 | u->rst.dat[u->rst.ptr - 2] = b >> (a & 0x07) << ((a & 0x70) >> 4); |
1332 | #ifndef NO_STACK_CHECKS | 1332 | #ifndef NO_STACK_CHECKS |
1333 | if(u->rst.ptr < 2) { | 1333 | if(u->rst.ptr < 2) { |
@@ -1366,7 +1366,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1366 | } | 1366 | } |
1367 | case 0x64: /* DUP2r */ | 1367 | case 0x64: /* DUP2r */ |
1368 | { | 1368 | { |
1369 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 1369 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
1370 | u->rst.dat[u->rst.ptr - 2] = a >> 8; | 1370 | u->rst.dat[u->rst.ptr - 2] = a >> 8; |
1371 | u->rst.dat[u->rst.ptr - 1] = a & 0xff; | 1371 | u->rst.dat[u->rst.ptr - 1] = a & 0xff; |
1372 | u->rst.dat[u->rst.ptr] = a >> 8; | 1372 | u->rst.dat[u->rst.ptr] = a >> 8; |
@@ -1386,7 +1386,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1386 | } | 1386 | } |
1387 | case 0x65: /* SWP2r */ | 1387 | case 0x65: /* SWP2r */ |
1388 | { | 1388 | { |
1389 | Uint16 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)); | 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)); |
1390 | u->rst.dat[u->rst.ptr - 4] = a >> 8; | 1390 | u->rst.dat[u->rst.ptr - 4] = a >> 8; |
1391 | u->rst.dat[u->rst.ptr - 3] = a & 0xff; | 1391 | u->rst.dat[u->rst.ptr - 3] = a & 0xff; |
1392 | u->rst.dat[u->rst.ptr - 2] = b >> 8; | 1392 | u->rst.dat[u->rst.ptr - 2] = b >> 8; |
@@ -1401,7 +1401,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1401 | } | 1401 | } |
1402 | case 0x66: /* OVR2r */ | 1402 | case 0x66: /* OVR2r */ |
1403 | { | 1403 | { |
1404 | Uint16 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)); | 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)); |
1405 | u->rst.dat[u->rst.ptr - 4] = b >> 8; | 1405 | u->rst.dat[u->rst.ptr - 4] = b >> 8; |
1406 | u->rst.dat[u->rst.ptr - 3] = b & 0xff; | 1406 | u->rst.dat[u->rst.ptr - 3] = b & 0xff; |
1407 | u->rst.dat[u->rst.ptr - 2] = a >> 8; | 1407 | u->rst.dat[u->rst.ptr - 2] = a >> 8; |
@@ -1423,7 +1423,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1423 | } | 1423 | } |
1424 | case 0x67: /* ROT2r */ | 1424 | case 0x67: /* ROT2r */ |
1425 | { | 1425 | { |
1426 | Uint16 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)); | 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)); |
1427 | u->rst.dat[u->rst.ptr - 6] = b >> 8; | 1427 | u->rst.dat[u->rst.ptr - 6] = b >> 8; |
1428 | u->rst.dat[u->rst.ptr - 5] = b & 0xff; | 1428 | u->rst.dat[u->rst.ptr - 5] = b & 0xff; |
1429 | u->rst.dat[u->rst.ptr - 4] = a >> 8; | 1429 | u->rst.dat[u->rst.ptr - 4] = a >> 8; |
@@ -1440,7 +1440,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1440 | } | 1440 | } |
1441 | case 0x68: /* EQU2r */ | 1441 | case 0x68: /* EQU2r */ |
1442 | { | 1442 | { |
1443 | Uint16 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)); | 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)); |
1444 | u->rst.dat[u->rst.ptr - 4] = b == a; | 1444 | u->rst.dat[u->rst.ptr - 4] = b == a; |
1445 | #ifndef NO_STACK_CHECKS | 1445 | #ifndef NO_STACK_CHECKS |
1446 | if(u->rst.ptr < 4) { | 1446 | if(u->rst.ptr < 4) { |
@@ -1453,7 +1453,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1453 | } | 1453 | } |
1454 | case 0x69: /* NEQ2r */ | 1454 | case 0x69: /* NEQ2r */ |
1455 | { | 1455 | { |
1456 | Uint16 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)); | 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)); |
1457 | u->rst.dat[u->rst.ptr - 4] = b != a; | 1457 | u->rst.dat[u->rst.ptr - 4] = b != a; |
1458 | #ifndef NO_STACK_CHECKS | 1458 | #ifndef NO_STACK_CHECKS |
1459 | if(u->rst.ptr < 4) { | 1459 | if(u->rst.ptr < 4) { |
@@ -1466,7 +1466,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1466 | } | 1466 | } |
1467 | case 0x6a: /* GTH2r */ | 1467 | case 0x6a: /* GTH2r */ |
1468 | { | 1468 | { |
1469 | Uint16 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)); | 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)); |
1470 | u->rst.dat[u->rst.ptr - 4] = b > a; | 1470 | u->rst.dat[u->rst.ptr - 4] = b > a; |
1471 | #ifndef NO_STACK_CHECKS | 1471 | #ifndef NO_STACK_CHECKS |
1472 | if(u->rst.ptr < 4) { | 1472 | if(u->rst.ptr < 4) { |
@@ -1479,7 +1479,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1479 | } | 1479 | } |
1480 | case 0x6b: /* LTH2r */ | 1480 | case 0x6b: /* LTH2r */ |
1481 | { | 1481 | { |
1482 | Uint16 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)); | 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)); |
1483 | u->rst.dat[u->rst.ptr - 4] = b < a; | 1483 | u->rst.dat[u->rst.ptr - 4] = b < a; |
1484 | #ifndef NO_STACK_CHECKS | 1484 | #ifndef NO_STACK_CHECKS |
1485 | if(u->rst.ptr < 4) { | 1485 | if(u->rst.ptr < 4) { |
@@ -1504,7 +1504,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1504 | } | 1504 | } |
1505 | case 0x6d: /* JCN2r */ | 1505 | case 0x6d: /* JCN2r */ |
1506 | { | 1506 | { |
1507 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 1507 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
1508 | if(u->rst.dat[u->rst.ptr - 3]) u->ram.ptr = a; | 1508 | if(u->rst.dat[u->rst.ptr - 3]) u->ram.ptr = a; |
1509 | #ifndef NO_STACK_CHECKS | 1509 | #ifndef NO_STACK_CHECKS |
1510 | if(u->rst.ptr < 3) { | 1510 | if(u->rst.ptr < 3) { |
@@ -1538,7 +1538,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1538 | } | 1538 | } |
1539 | case 0x6f: /* STH2r */ | 1539 | case 0x6f: /* STH2r */ |
1540 | { | 1540 | { |
1541 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 1541 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
1542 | u->wst.dat[u->wst.ptr] = a >> 8; | 1542 | u->wst.dat[u->wst.ptr] = a >> 8; |
1543 | u->wst.dat[u->wst.ptr + 1] = a & 0xff; | 1543 | u->wst.dat[u->wst.ptr + 1] = a & 0xff; |
1544 | #ifndef NO_STACK_CHECKS | 1544 | #ifndef NO_STACK_CHECKS |
@@ -1559,7 +1559,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1559 | } | 1559 | } |
1560 | case 0x70: /* LDZ2r */ | 1560 | case 0x70: /* LDZ2r */ |
1561 | { | 1561 | { |
1562 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1562 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1563 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); | 1563 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a); |
1564 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a + 1); | 1564 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a + 1); |
1565 | #ifndef NO_STACK_CHECKS | 1565 | #ifndef NO_STACK_CHECKS |
@@ -1577,8 +1577,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1577 | } | 1577 | } |
1578 | case 0x71: /* STZ2r */ | 1578 | case 0x71: /* STZ2r */ |
1579 | { | 1579 | { |
1580 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1580 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1581 | Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); | 1581 | u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
1582 | mempoke16(u->ram.dat, a, b); | 1582 | mempoke16(u->ram.dat, a, b); |
1583 | #ifndef NO_STACK_CHECKS | 1583 | #ifndef NO_STACK_CHECKS |
1584 | if(u->rst.ptr < 3) { | 1584 | if(u->rst.ptr < 3) { |
@@ -1591,9 +1591,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1591 | } | 1591 | } |
1592 | case 0x72: /* LDR2r */ | 1592 | case 0x72: /* LDR2r */ |
1593 | { | 1593 | { |
1594 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1594 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1595 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); | 1595 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); |
1596 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); | 1596 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1); |
1597 | #ifndef NO_STACK_CHECKS | 1597 | #ifndef NO_STACK_CHECKS |
1598 | if(u->rst.ptr < 1) { | 1598 | if(u->rst.ptr < 1) { |
1599 | u->rst.error = 1; | 1599 | u->rst.error = 1; |
@@ -1609,9 +1609,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1609 | } | 1609 | } |
1610 | case 0x73: /* STR2r */ | 1610 | case 0x73: /* STR2r */ |
1611 | { | 1611 | { |
1612 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1612 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1613 | Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); | 1613 | u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
1614 | mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); | 1614 | mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b); |
1615 | #ifndef NO_STACK_CHECKS | 1615 | #ifndef NO_STACK_CHECKS |
1616 | if(u->rst.ptr < 3) { | 1616 | if(u->rst.ptr < 3) { |
1617 | u->rst.error = 1; | 1617 | u->rst.error = 1; |
@@ -1623,7 +1623,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1623 | } | 1623 | } |
1624 | case 0x74: /* LDA2r */ | 1624 | case 0x74: /* LDA2r */ |
1625 | { | 1625 | { |
1626 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 1626 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
1627 | u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); | 1627 | u->rst.dat[u->rst.ptr - 2] = mempeek8(u->ram.dat, a); |
1628 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a + 1); | 1628 | u->rst.dat[u->rst.ptr - 1] = mempeek8(u->ram.dat, a + 1); |
1629 | #ifndef NO_STACK_CHECKS | 1629 | #ifndef NO_STACK_CHECKS |
@@ -1636,8 +1636,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1636 | } | 1636 | } |
1637 | case 0x75: /* STA2r */ | 1637 | case 0x75: /* STA2r */ |
1638 | { | 1638 | { |
1639 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 1639 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
1640 | Uint16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); | 1640 | u16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); |
1641 | mempoke16(u->ram.dat, a, b); | 1641 | mempoke16(u->ram.dat, a, b); |
1642 | #ifndef NO_STACK_CHECKS | 1642 | #ifndef NO_STACK_CHECKS |
1643 | if(u->rst.ptr < 4) { | 1643 | if(u->rst.ptr < 4) { |
@@ -1650,7 +1650,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1650 | } | 1650 | } |
1651 | case 0x76: /* DEI2r */ | 1651 | case 0x76: /* DEI2r */ |
1652 | { | 1652 | { |
1653 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1653 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1654 | u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); | 1654 | u->rst.dat[u->rst.ptr - 1] = devpeek8(&u->dev[a >> 4], a); |
1655 | u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); | 1655 | u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a + 1); |
1656 | #ifndef NO_STACK_CHECKS | 1656 | #ifndef NO_STACK_CHECKS |
@@ -1668,8 +1668,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1668 | } | 1668 | } |
1669 | case 0x77: /* DEO2r */ | 1669 | case 0x77: /* DEO2r */ |
1670 | { | 1670 | { |
1671 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 1671 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
1672 | Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); | 1672 | u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
1673 | devpoke16(&u->dev[a >> 4], a, b); | 1673 | devpoke16(&u->dev[a >> 4], a, b); |
1674 | #ifndef NO_STACK_CHECKS | 1674 | #ifndef NO_STACK_CHECKS |
1675 | if(u->rst.ptr < 3) { | 1675 | if(u->rst.ptr < 3) { |
@@ -1682,7 +1682,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1682 | } | 1682 | } |
1683 | case 0x78: /* ADD2r */ | 1683 | case 0x78: /* ADD2r */ |
1684 | { | 1684 | { |
1685 | Uint16 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)); | 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)); |
1686 | u->rst.dat[u->rst.ptr - 4] = (b + a) >> 8; | 1686 | u->rst.dat[u->rst.ptr - 4] = (b + a) >> 8; |
1687 | u->rst.dat[u->rst.ptr - 3] = (b + a) & 0xff; | 1687 | u->rst.dat[u->rst.ptr - 3] = (b + a) & 0xff; |
1688 | #ifndef NO_STACK_CHECKS | 1688 | #ifndef NO_STACK_CHECKS |
@@ -1696,7 +1696,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1696 | } | 1696 | } |
1697 | case 0x79: /* SUB2r */ | 1697 | case 0x79: /* SUB2r */ |
1698 | { | 1698 | { |
1699 | Uint16 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)); | 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)); |
1700 | u->rst.dat[u->rst.ptr - 4] = (b - a) >> 8; | 1700 | u->rst.dat[u->rst.ptr - 4] = (b - a) >> 8; |
1701 | u->rst.dat[u->rst.ptr - 3] = (b - a) & 0xff; | 1701 | u->rst.dat[u->rst.ptr - 3] = (b - a) & 0xff; |
1702 | #ifndef NO_STACK_CHECKS | 1702 | #ifndef NO_STACK_CHECKS |
@@ -1710,7 +1710,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1710 | } | 1710 | } |
1711 | case 0x7a: /* MUL2r */ | 1711 | case 0x7a: /* MUL2r */ |
1712 | { | 1712 | { |
1713 | Uint16 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)); | 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)); |
1714 | u->rst.dat[u->rst.ptr - 4] = (b * a) >> 8; | 1714 | u->rst.dat[u->rst.ptr - 4] = (b * a) >> 8; |
1715 | u->rst.dat[u->rst.ptr - 3] = (b * a) & 0xff; | 1715 | u->rst.dat[u->rst.ptr - 3] = (b * a) & 0xff; |
1716 | #ifndef NO_STACK_CHECKS | 1716 | #ifndef NO_STACK_CHECKS |
@@ -1724,7 +1724,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1724 | } | 1724 | } |
1725 | case 0x7b: /* DIV2r */ | 1725 | case 0x7b: /* DIV2r */ |
1726 | { | 1726 | { |
1727 | Uint16 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)); | 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)); |
1728 | u->rst.dat[u->rst.ptr - 4] = (b / a) >> 8; | 1728 | u->rst.dat[u->rst.ptr - 4] = (b / a) >> 8; |
1729 | u->rst.dat[u->rst.ptr - 3] = (b / a) & 0xff; | 1729 | u->rst.dat[u->rst.ptr - 3] = (b / a) & 0xff; |
1730 | #ifndef NO_STACK_CHECKS | 1730 | #ifndef NO_STACK_CHECKS |
@@ -1738,7 +1738,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1738 | } | 1738 | } |
1739 | case 0x7c: /* AND2r */ | 1739 | case 0x7c: /* AND2r */ |
1740 | { | 1740 | { |
1741 | Uint8 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]; | 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]; |
1742 | u->rst.dat[u->rst.ptr - 4] = d & b; | 1742 | u->rst.dat[u->rst.ptr - 4] = d & b; |
1743 | u->rst.dat[u->rst.ptr - 3] = c & a; | 1743 | u->rst.dat[u->rst.ptr - 3] = c & a; |
1744 | #ifndef NO_STACK_CHECKS | 1744 | #ifndef NO_STACK_CHECKS |
@@ -1752,7 +1752,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1752 | } | 1752 | } |
1753 | case 0x7d: /* ORA2r */ | 1753 | case 0x7d: /* ORA2r */ |
1754 | { | 1754 | { |
1755 | Uint8 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]; | 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]; |
1756 | u->rst.dat[u->rst.ptr - 4] = d | b; | 1756 | u->rst.dat[u->rst.ptr - 4] = d | b; |
1757 | u->rst.dat[u->rst.ptr - 3] = c | a; | 1757 | u->rst.dat[u->rst.ptr - 3] = c | a; |
1758 | #ifndef NO_STACK_CHECKS | 1758 | #ifndef NO_STACK_CHECKS |
@@ -1766,7 +1766,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1766 | } | 1766 | } |
1767 | case 0x7e: /* EOR2r */ | 1767 | case 0x7e: /* EOR2r */ |
1768 | { | 1768 | { |
1769 | Uint8 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]; | 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]; |
1770 | u->rst.dat[u->rst.ptr - 4] = d ^ b; | 1770 | u->rst.dat[u->rst.ptr - 4] = d ^ b; |
1771 | u->rst.dat[u->rst.ptr - 3] = c ^ a; | 1771 | u->rst.dat[u->rst.ptr - 3] = c ^ a; |
1772 | #ifndef NO_STACK_CHECKS | 1772 | #ifndef NO_STACK_CHECKS |
@@ -1780,7 +1780,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1780 | } | 1780 | } |
1781 | case 0x7f: /* SFT2r */ | 1781 | case 0x7f: /* SFT2r */ |
1782 | { | 1782 | { |
1783 | Uint16 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 | 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)); |
1784 | u->rst.dat[u->rst.ptr - 4] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; | 1784 | u->rst.dat[u->rst.ptr - 4] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; |
1785 | u->rst.dat[u->rst.ptr - 3] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; | 1785 | u->rst.dat[u->rst.ptr - 3] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; |
1786 | #ifndef NO_STACK_CHECKS | 1786 | #ifndef NO_STACK_CHECKS |
@@ -1805,7 +1805,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1805 | } | 1805 | } |
1806 | case 0x84: /* DUPk */ | 1806 | case 0x84: /* DUPk */ |
1807 | { | 1807 | { |
1808 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 1808 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
1809 | u->wst.dat[u->wst.ptr] = a; | 1809 | u->wst.dat[u->wst.ptr] = a; |
1810 | u->wst.dat[u->wst.ptr + 1] = a; | 1810 | u->wst.dat[u->wst.ptr + 1] = a; |
1811 | #ifndef NO_STACK_CHECKS | 1811 | #ifndef NO_STACK_CHECKS |
@@ -1823,7 +1823,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1823 | } | 1823 | } |
1824 | case 0x85: /* SWPk */ | 1824 | case 0x85: /* SWPk */ |
1825 | { | 1825 | { |
1826 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 1826 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
1827 | u->wst.dat[u->wst.ptr] = a; | 1827 | u->wst.dat[u->wst.ptr] = a; |
1828 | u->wst.dat[u->wst.ptr + 1] = b; | 1828 | u->wst.dat[u->wst.ptr + 1] = b; |
1829 | #ifndef NO_STACK_CHECKS | 1829 | #ifndef NO_STACK_CHECKS |
@@ -1841,7 +1841,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1841 | } | 1841 | } |
1842 | case 0x86: /* OVRk */ | 1842 | case 0x86: /* OVRk */ |
1843 | { | 1843 | { |
1844 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 1844 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
1845 | u->wst.dat[u->wst.ptr] = b; | 1845 | u->wst.dat[u->wst.ptr] = b; |
1846 | u->wst.dat[u->wst.ptr + 1] = a; | 1846 | u->wst.dat[u->wst.ptr + 1] = a; |
1847 | u->wst.dat[u->wst.ptr + 2] = b; | 1847 | u->wst.dat[u->wst.ptr + 2] = b; |
@@ -1860,7 +1860,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1860 | } | 1860 | } |
1861 | case 0x87: /* ROTk */ | 1861 | case 0x87: /* ROTk */ |
1862 | { | 1862 | { |
1863 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2], c = u->wst.dat[u->wst.ptr - 3]; | 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]; |
1864 | u->wst.dat[u->wst.ptr] = b; | 1864 | u->wst.dat[u->wst.ptr] = b; |
1865 | u->wst.dat[u->wst.ptr + 1] = a; | 1865 | u->wst.dat[u->wst.ptr + 1] = a; |
1866 | u->wst.dat[u->wst.ptr + 2] = c; | 1866 | u->wst.dat[u->wst.ptr + 2] = c; |
@@ -1879,7 +1879,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1879 | } | 1879 | } |
1880 | case 0x88: /* EQUk */ | 1880 | case 0x88: /* EQUk */ |
1881 | { | 1881 | { |
1882 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 1882 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
1883 | u->wst.dat[u->wst.ptr] = b == a; | 1883 | u->wst.dat[u->wst.ptr] = b == a; |
1884 | #ifndef NO_STACK_CHECKS | 1884 | #ifndef NO_STACK_CHECKS |
1885 | if(u->wst.ptr < 2) { | 1885 | if(u->wst.ptr < 2) { |
@@ -1896,7 +1896,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1896 | } | 1896 | } |
1897 | case 0x89: /* NEQk */ | 1897 | case 0x89: /* NEQk */ |
1898 | { | 1898 | { |
1899 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 1899 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
1900 | u->wst.dat[u->wst.ptr] = b != a; | 1900 | u->wst.dat[u->wst.ptr] = b != a; |
1901 | #ifndef NO_STACK_CHECKS | 1901 | #ifndef NO_STACK_CHECKS |
1902 | if(u->wst.ptr < 2) { | 1902 | if(u->wst.ptr < 2) { |
@@ -1913,7 +1913,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1913 | } | 1913 | } |
1914 | case 0x8a: /* GTHk */ | 1914 | case 0x8a: /* GTHk */ |
1915 | { | 1915 | { |
1916 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 1916 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
1917 | u->wst.dat[u->wst.ptr] = b > a; | 1917 | u->wst.dat[u->wst.ptr] = b > a; |
1918 | #ifndef NO_STACK_CHECKS | 1918 | #ifndef NO_STACK_CHECKS |
1919 | if(u->wst.ptr < 2) { | 1919 | if(u->wst.ptr < 2) { |
@@ -1930,7 +1930,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1930 | } | 1930 | } |
1931 | case 0x8b: /* LTHk */ | 1931 | case 0x8b: /* LTHk */ |
1932 | { | 1932 | { |
1933 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 1933 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
1934 | u->wst.dat[u->wst.ptr] = b < a; | 1934 | u->wst.dat[u->wst.ptr] = b < a; |
1935 | #ifndef NO_STACK_CHECKS | 1935 | #ifndef NO_STACK_CHECKS |
1936 | if(u->wst.ptr < 2) { | 1936 | if(u->wst.ptr < 2) { |
@@ -1947,8 +1947,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1947 | } | 1947 | } |
1948 | case 0x8c: /* JMPk */ | 1948 | case 0x8c: /* JMPk */ |
1949 | { | 1949 | { |
1950 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 1950 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
1951 | u->ram.ptr += (Sint8)a; | 1951 | u->ram.ptr += (s8)a; |
1952 | #ifndef NO_STACK_CHECKS | 1952 | #ifndef NO_STACK_CHECKS |
1953 | if(u->wst.ptr < 1) { | 1953 | if(u->wst.ptr < 1) { |
1954 | u->wst.error = 1; | 1954 | u->wst.error = 1; |
@@ -1959,8 +1959,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1959 | } | 1959 | } |
1960 | case 0x8d: /* JCNk */ | 1960 | case 0x8d: /* JCNk */ |
1961 | { | 1961 | { |
1962 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 1962 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
1963 | if(u->wst.dat[u->wst.ptr - 2]) u->ram.ptr += (Sint8)a; | 1963 | if(u->wst.dat[u->wst.ptr - 2]) u->ram.ptr += (s8)a; |
1964 | #ifndef NO_STACK_CHECKS | 1964 | #ifndef NO_STACK_CHECKS |
1965 | if(u->wst.ptr < 2) { | 1965 | if(u->wst.ptr < 2) { |
1966 | u->wst.error = 1; | 1966 | u->wst.error = 1; |
@@ -1971,10 +1971,10 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1971 | } | 1971 | } |
1972 | case 0x8e: /* JSRk */ | 1972 | case 0x8e: /* JSRk */ |
1973 | { | 1973 | { |
1974 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 1974 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
1975 | u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; | 1975 | u->rst.dat[u->rst.ptr] = u->ram.ptr >> 8; |
1976 | u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; | 1976 | u->rst.dat[u->rst.ptr + 1] = u->ram.ptr & 0xff; |
1977 | u->ram.ptr += (Sint8)a; | 1977 | u->ram.ptr += (s8)a; |
1978 | #ifndef NO_STACK_CHECKS | 1978 | #ifndef NO_STACK_CHECKS |
1979 | if(u->wst.ptr < 1) { | 1979 | if(u->wst.ptr < 1) { |
1980 | u->wst.error = 1; | 1980 | u->wst.error = 1; |
@@ -1992,7 +1992,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
1992 | } | 1992 | } |
1993 | case 0x8f: /* STHk */ | 1993 | case 0x8f: /* STHk */ |
1994 | { | 1994 | { |
1995 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 1995 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
1996 | u->rst.dat[u->rst.ptr] = a; | 1996 | u->rst.dat[u->rst.ptr] = a; |
1997 | #ifndef NO_STACK_CHECKS | 1997 | #ifndef NO_STACK_CHECKS |
1998 | if(u->wst.ptr < 1) { | 1998 | if(u->wst.ptr < 1) { |
@@ -2011,7 +2011,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2011 | } | 2011 | } |
2012 | case 0x90: /* LDZk */ | 2012 | case 0x90: /* LDZk */ |
2013 | { | 2013 | { |
2014 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2014 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2015 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); | 2015 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
2016 | #ifndef NO_STACK_CHECKS | 2016 | #ifndef NO_STACK_CHECKS |
2017 | if(u->wst.ptr < 1) { | 2017 | if(u->wst.ptr < 1) { |
@@ -2028,8 +2028,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2028 | } | 2028 | } |
2029 | case 0x91: /* STZk */ | 2029 | case 0x91: /* STZk */ |
2030 | { | 2030 | { |
2031 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2031 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2032 | Uint8 b = u->wst.dat[u->wst.ptr - 2]; | 2032 | u8 b = u->wst.dat[u->wst.ptr - 2]; |
2033 | mempoke8(u->ram.dat, a, b); | 2033 | mempoke8(u->ram.dat, a, b); |
2034 | #ifndef NO_STACK_CHECKS | 2034 | #ifndef NO_STACK_CHECKS |
2035 | if(u->wst.ptr < 2) { | 2035 | if(u->wst.ptr < 2) { |
@@ -2041,8 +2041,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2041 | } | 2041 | } |
2042 | case 0x92: /* LDRk */ | 2042 | case 0x92: /* LDRk */ |
2043 | { | 2043 | { |
2044 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2044 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2045 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); | 2045 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); |
2046 | #ifndef NO_STACK_CHECKS | 2046 | #ifndef NO_STACK_CHECKS |
2047 | if(u->wst.ptr < 1) { | 2047 | if(u->wst.ptr < 1) { |
2048 | u->wst.error = 1; | 2048 | u->wst.error = 1; |
@@ -2058,9 +2058,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2058 | } | 2058 | } |
2059 | case 0x93: /* STRk */ | 2059 | case 0x93: /* STRk */ |
2060 | { | 2060 | { |
2061 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2061 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2062 | Uint8 b = u->wst.dat[u->wst.ptr - 2]; | 2062 | u8 b = u->wst.dat[u->wst.ptr - 2]; |
2063 | mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); | 2063 | mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b); |
2064 | #ifndef NO_STACK_CHECKS | 2064 | #ifndef NO_STACK_CHECKS |
2065 | if(u->wst.ptr < 2) { | 2065 | if(u->wst.ptr < 2) { |
2066 | u->wst.error = 1; | 2066 | u->wst.error = 1; |
@@ -2071,7 +2071,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2071 | } | 2071 | } |
2072 | case 0x94: /* LDAk */ | 2072 | case 0x94: /* LDAk */ |
2073 | { | 2073 | { |
2074 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 2074 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
2075 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); | 2075 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
2076 | #ifndef NO_STACK_CHECKS | 2076 | #ifndef NO_STACK_CHECKS |
2077 | if(u->wst.ptr < 2) { | 2077 | if(u->wst.ptr < 2) { |
@@ -2088,8 +2088,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2088 | } | 2088 | } |
2089 | case 0x95: /* STAk */ | 2089 | case 0x95: /* STAk */ |
2090 | { | 2090 | { |
2091 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 2091 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
2092 | Uint8 b = u->wst.dat[u->wst.ptr - 3]; | 2092 | u8 b = u->wst.dat[u->wst.ptr - 3]; |
2093 | mempoke8(u->ram.dat, a, b); | 2093 | mempoke8(u->ram.dat, a, b); |
2094 | #ifndef NO_STACK_CHECKS | 2094 | #ifndef NO_STACK_CHECKS |
2095 | if(u->wst.ptr < 3) { | 2095 | if(u->wst.ptr < 3) { |
@@ -2101,7 +2101,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2101 | } | 2101 | } |
2102 | case 0x96: /* DEIk */ | 2102 | case 0x96: /* DEIk */ |
2103 | { | 2103 | { |
2104 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2104 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2105 | u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); | 2105 | u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); |
2106 | #ifndef NO_STACK_CHECKS | 2106 | #ifndef NO_STACK_CHECKS |
2107 | if(u->wst.ptr < 1) { | 2107 | if(u->wst.ptr < 1) { |
@@ -2118,7 +2118,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2118 | } | 2118 | } |
2119 | case 0x97: /* DEOk */ | 2119 | case 0x97: /* DEOk */ |
2120 | { | 2120 | { |
2121 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2121 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2122 | devpoke8(&u->dev[a >> 4], a, b); | 2122 | devpoke8(&u->dev[a >> 4], a, b); |
2123 | #ifndef NO_STACK_CHECKS | 2123 | #ifndef NO_STACK_CHECKS |
2124 | if(u->wst.ptr < 2) { | 2124 | if(u->wst.ptr < 2) { |
@@ -2130,7 +2130,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2130 | } | 2130 | } |
2131 | case 0x98: /* ADDk */ | 2131 | case 0x98: /* ADDk */ |
2132 | { | 2132 | { |
2133 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2133 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2134 | u->wst.dat[u->wst.ptr] = b + a; | 2134 | u->wst.dat[u->wst.ptr] = b + a; |
2135 | #ifndef NO_STACK_CHECKS | 2135 | #ifndef NO_STACK_CHECKS |
2136 | if(u->wst.ptr < 2) { | 2136 | if(u->wst.ptr < 2) { |
@@ -2147,7 +2147,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2147 | } | 2147 | } |
2148 | case 0x99: /* SUBk */ | 2148 | case 0x99: /* SUBk */ |
2149 | { | 2149 | { |
2150 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2150 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2151 | u->wst.dat[u->wst.ptr] = b - a; | 2151 | u->wst.dat[u->wst.ptr] = b - a; |
2152 | #ifndef NO_STACK_CHECKS | 2152 | #ifndef NO_STACK_CHECKS |
2153 | if(u->wst.ptr < 2) { | 2153 | if(u->wst.ptr < 2) { |
@@ -2164,7 +2164,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2164 | } | 2164 | } |
2165 | case 0x9a: /* MULk */ | 2165 | case 0x9a: /* MULk */ |
2166 | { | 2166 | { |
2167 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2167 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2168 | u->wst.dat[u->wst.ptr] = b * a; | 2168 | u->wst.dat[u->wst.ptr] = b * a; |
2169 | #ifndef NO_STACK_CHECKS | 2169 | #ifndef NO_STACK_CHECKS |
2170 | if(u->wst.ptr < 2) { | 2170 | if(u->wst.ptr < 2) { |
@@ -2181,7 +2181,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2181 | } | 2181 | } |
2182 | case 0x9b: /* DIVk */ | 2182 | case 0x9b: /* DIVk */ |
2183 | { | 2183 | { |
2184 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2184 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2185 | u->wst.dat[u->wst.ptr] = b / a; | 2185 | u->wst.dat[u->wst.ptr] = b / a; |
2186 | #ifndef NO_STACK_CHECKS | 2186 | #ifndef NO_STACK_CHECKS |
2187 | if(u->wst.ptr < 2) { | 2187 | if(u->wst.ptr < 2) { |
@@ -2198,7 +2198,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2198 | } | 2198 | } |
2199 | case 0x9c: /* ANDk */ | 2199 | case 0x9c: /* ANDk */ |
2200 | { | 2200 | { |
2201 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2201 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2202 | u->wst.dat[u->wst.ptr] = b & a; | 2202 | u->wst.dat[u->wst.ptr] = b & a; |
2203 | #ifndef NO_STACK_CHECKS | 2203 | #ifndef NO_STACK_CHECKS |
2204 | if(u->wst.ptr < 2) { | 2204 | if(u->wst.ptr < 2) { |
@@ -2215,7 +2215,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2215 | } | 2215 | } |
2216 | case 0x9d: /* ORAk */ | 2216 | case 0x9d: /* ORAk */ |
2217 | { | 2217 | { |
2218 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2218 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2219 | u->wst.dat[u->wst.ptr] = b | a; | 2219 | u->wst.dat[u->wst.ptr] = b | a; |
2220 | #ifndef NO_STACK_CHECKS | 2220 | #ifndef NO_STACK_CHECKS |
2221 | if(u->wst.ptr < 2) { | 2221 | if(u->wst.ptr < 2) { |
@@ -2232,7 +2232,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2232 | } | 2232 | } |
2233 | case 0x9e: /* EORk */ | 2233 | case 0x9e: /* EORk */ |
2234 | { | 2234 | { |
2235 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2235 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2236 | u->wst.dat[u->wst.ptr] = b ^ a; | 2236 | u->wst.dat[u->wst.ptr] = b ^ a; |
2237 | #ifndef NO_STACK_CHECKS | 2237 | #ifndef NO_STACK_CHECKS |
2238 | if(u->wst.ptr < 2) { | 2238 | if(u->wst.ptr < 2) { |
@@ -2249,7 +2249,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2249 | } | 2249 | } |
2250 | case 0x9f: /* SFTk */ | 2250 | case 0x9f: /* SFTk */ |
2251 | { | 2251 | { |
2252 | Uint8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; | 2252 | u8 a = u->wst.dat[u->wst.ptr - 1], b = u->wst.dat[u->wst.ptr - 2]; |
2253 | u->wst.dat[u->wst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4); | 2253 | u->wst.dat[u->wst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4); |
2254 | #ifndef NO_STACK_CHECKS | 2254 | #ifndef NO_STACK_CHECKS |
2255 | if(u->wst.ptr < 2) { | 2255 | if(u->wst.ptr < 2) { |
@@ -2277,7 +2277,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2277 | } | 2277 | } |
2278 | case 0xa4: /* DUP2k */ | 2278 | case 0xa4: /* DUP2k */ |
2279 | { | 2279 | { |
2280 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 2280 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
2281 | u->wst.dat[u->wst.ptr] = a >> 8; | 2281 | u->wst.dat[u->wst.ptr] = a >> 8; |
2282 | u->wst.dat[u->wst.ptr + 1] = a & 0xff; | 2282 | u->wst.dat[u->wst.ptr + 1] = a & 0xff; |
2283 | u->wst.dat[u->wst.ptr + 2] = a >> 8; | 2283 | u->wst.dat[u->wst.ptr + 2] = a >> 8; |
@@ -2297,7 +2297,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2297 | } | 2297 | } |
2298 | case 0xa5: /* SWP2k */ | 2298 | case 0xa5: /* SWP2k */ |
2299 | { | 2299 | { |
2300 | Uint16 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)); | 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)); |
2301 | u->wst.dat[u->wst.ptr] = a >> 8; | 2301 | u->wst.dat[u->wst.ptr] = a >> 8; |
2302 | u->wst.dat[u->wst.ptr + 1] = a & 0xff; | 2302 | u->wst.dat[u->wst.ptr + 1] = a & 0xff; |
2303 | u->wst.dat[u->wst.ptr + 2] = b >> 8; | 2303 | u->wst.dat[u->wst.ptr + 2] = b >> 8; |
@@ -2317,7 +2317,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2317 | } | 2317 | } |
2318 | case 0xa6: /* OVR2k */ | 2318 | case 0xa6: /* OVR2k */ |
2319 | { | 2319 | { |
2320 | Uint16 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)); | 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)); |
2321 | u->wst.dat[u->wst.ptr] = b >> 8; | 2321 | u->wst.dat[u->wst.ptr] = b >> 8; |
2322 | u->wst.dat[u->wst.ptr + 1] = b & 0xff; | 2322 | u->wst.dat[u->wst.ptr + 1] = b & 0xff; |
2323 | u->wst.dat[u->wst.ptr + 2] = a >> 8; | 2323 | u->wst.dat[u->wst.ptr + 2] = a >> 8; |
@@ -2339,7 +2339,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2339 | } | 2339 | } |
2340 | case 0xa7: /* ROT2k */ | 2340 | case 0xa7: /* ROT2k */ |
2341 | { | 2341 | { |
2342 | Uint16 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)); | 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)); |
2343 | u->wst.dat[u->wst.ptr] = b >> 8; | 2343 | u->wst.dat[u->wst.ptr] = b >> 8; |
2344 | u->wst.dat[u->wst.ptr + 1] = b & 0xff; | 2344 | u->wst.dat[u->wst.ptr + 1] = b & 0xff; |
2345 | u->wst.dat[u->wst.ptr + 2] = a >> 8; | 2345 | u->wst.dat[u->wst.ptr + 2] = a >> 8; |
@@ -2361,7 +2361,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2361 | } | 2361 | } |
2362 | case 0xa8: /* EQU2k */ | 2362 | case 0xa8: /* EQU2k */ |
2363 | { | 2363 | { |
2364 | Uint16 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)); | 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)); |
2365 | u->wst.dat[u->wst.ptr] = b == a; | 2365 | u->wst.dat[u->wst.ptr] = b == a; |
2366 | #ifndef NO_STACK_CHECKS | 2366 | #ifndef NO_STACK_CHECKS |
2367 | if(u->wst.ptr < 4) { | 2367 | if(u->wst.ptr < 4) { |
@@ -2378,7 +2378,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2378 | } | 2378 | } |
2379 | case 0xa9: /* NEQ2k */ | 2379 | case 0xa9: /* NEQ2k */ |
2380 | { | 2380 | { |
2381 | Uint16 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)); | 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)); |
2382 | u->wst.dat[u->wst.ptr] = b != a; | 2382 | u->wst.dat[u->wst.ptr] = b != a; |
2383 | #ifndef NO_STACK_CHECKS | 2383 | #ifndef NO_STACK_CHECKS |
2384 | if(u->wst.ptr < 4) { | 2384 | if(u->wst.ptr < 4) { |
@@ -2395,7 +2395,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2395 | } | 2395 | } |
2396 | case 0xaa: /* GTH2k */ | 2396 | case 0xaa: /* GTH2k */ |
2397 | { | 2397 | { |
2398 | Uint16 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)); | 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)); |
2399 | u->wst.dat[u->wst.ptr] = b > a; | 2399 | u->wst.dat[u->wst.ptr] = b > a; |
2400 | #ifndef NO_STACK_CHECKS | 2400 | #ifndef NO_STACK_CHECKS |
2401 | if(u->wst.ptr < 4) { | 2401 | if(u->wst.ptr < 4) { |
@@ -2412,7 +2412,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2412 | } | 2412 | } |
2413 | case 0xab: /* LTH2k */ | 2413 | case 0xab: /* LTH2k */ |
2414 | { | 2414 | { |
2415 | Uint16 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)); | 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)); |
2416 | u->wst.dat[u->wst.ptr] = b < a; | 2416 | u->wst.dat[u->wst.ptr] = b < a; |
2417 | #ifndef NO_STACK_CHECKS | 2417 | #ifndef NO_STACK_CHECKS |
2418 | if(u->wst.ptr < 4) { | 2418 | if(u->wst.ptr < 4) { |
@@ -2440,7 +2440,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2440 | } | 2440 | } |
2441 | case 0xad: /* JCN2k */ | 2441 | case 0xad: /* JCN2k */ |
2442 | { | 2442 | { |
2443 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 2443 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
2444 | if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; | 2444 | if(u->wst.dat[u->wst.ptr - 3]) u->ram.ptr = a; |
2445 | #ifndef NO_STACK_CHECKS | 2445 | #ifndef NO_STACK_CHECKS |
2446 | if(u->wst.ptr < 3) { | 2446 | if(u->wst.ptr < 3) { |
@@ -2472,7 +2472,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2472 | } | 2472 | } |
2473 | case 0xaf: /* STH2k */ | 2473 | case 0xaf: /* STH2k */ |
2474 | { | 2474 | { |
2475 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 2475 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
2476 | u->rst.dat[u->rst.ptr] = a >> 8; | 2476 | u->rst.dat[u->rst.ptr] = a >> 8; |
2477 | u->rst.dat[u->rst.ptr + 1] = a & 0xff; | 2477 | u->rst.dat[u->rst.ptr + 1] = a & 0xff; |
2478 | #ifndef NO_STACK_CHECKS | 2478 | #ifndef NO_STACK_CHECKS |
@@ -2492,7 +2492,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2492 | } | 2492 | } |
2493 | case 0xb0: /* LDZ2k */ | 2493 | case 0xb0: /* LDZ2k */ |
2494 | { | 2494 | { |
2495 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2495 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2496 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); | 2496 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
2497 | u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); | 2497 | u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
2498 | #ifndef NO_STACK_CHECKS | 2498 | #ifndef NO_STACK_CHECKS |
@@ -2510,8 +2510,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2510 | } | 2510 | } |
2511 | case 0xb1: /* STZ2k */ | 2511 | case 0xb1: /* STZ2k */ |
2512 | { | 2512 | { |
2513 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2513 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2514 | Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); | 2514 | u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
2515 | mempoke16(u->ram.dat, a, b); | 2515 | mempoke16(u->ram.dat, a, b); |
2516 | #ifndef NO_STACK_CHECKS | 2516 | #ifndef NO_STACK_CHECKS |
2517 | if(u->wst.ptr < 3) { | 2517 | if(u->wst.ptr < 3) { |
@@ -2523,9 +2523,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2523 | } | 2523 | } |
2524 | case 0xb2: /* LDR2k */ | 2524 | case 0xb2: /* LDR2k */ |
2525 | { | 2525 | { |
2526 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2526 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2527 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); | 2527 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); |
2528 | u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); | 2528 | u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1); |
2529 | #ifndef NO_STACK_CHECKS | 2529 | #ifndef NO_STACK_CHECKS |
2530 | if(u->wst.ptr < 1) { | 2530 | if(u->wst.ptr < 1) { |
2531 | u->wst.error = 1; | 2531 | u->wst.error = 1; |
@@ -2541,9 +2541,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2541 | } | 2541 | } |
2542 | case 0xb3: /* STR2k */ | 2542 | case 0xb3: /* STR2k */ |
2543 | { | 2543 | { |
2544 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2544 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2545 | Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); | 2545 | u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
2546 | mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); | 2546 | mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b); |
2547 | #ifndef NO_STACK_CHECKS | 2547 | #ifndef NO_STACK_CHECKS |
2548 | if(u->wst.ptr < 3) { | 2548 | if(u->wst.ptr < 3) { |
2549 | u->wst.error = 1; | 2549 | u->wst.error = 1; |
@@ -2554,7 +2554,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2554 | } | 2554 | } |
2555 | case 0xb4: /* LDA2k */ | 2555 | case 0xb4: /* LDA2k */ |
2556 | { | 2556 | { |
2557 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 2557 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
2558 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); | 2558 | u->wst.dat[u->wst.ptr] = mempeek8(u->ram.dat, a); |
2559 | u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); | 2559 | u->wst.dat[u->wst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
2560 | #ifndef NO_STACK_CHECKS | 2560 | #ifndef NO_STACK_CHECKS |
@@ -2572,8 +2572,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2572 | } | 2572 | } |
2573 | case 0xb5: /* STA2k */ | 2573 | case 0xb5: /* STA2k */ |
2574 | { | 2574 | { |
2575 | Uint16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); | 2575 | u16 a = (u->wst.dat[u->wst.ptr - 1] | (u->wst.dat[u->wst.ptr - 2] << 8)); |
2576 | Uint16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); | 2576 | u16 b = (u->wst.dat[u->wst.ptr - 3] | (u->wst.dat[u->wst.ptr - 4] << 8)); |
2577 | mempoke16(u->ram.dat, a, b); | 2577 | mempoke16(u->ram.dat, a, b); |
2578 | #ifndef NO_STACK_CHECKS | 2578 | #ifndef NO_STACK_CHECKS |
2579 | if(u->wst.ptr < 4) { | 2579 | if(u->wst.ptr < 4) { |
@@ -2585,7 +2585,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2585 | } | 2585 | } |
2586 | case 0xb6: /* DEI2k */ | 2586 | case 0xb6: /* DEI2k */ |
2587 | { | 2587 | { |
2588 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2588 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2589 | u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); | 2589 | u->wst.dat[u->wst.ptr] = devpeek8(&u->dev[a >> 4], a); |
2590 | u->wst.dat[u->wst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); | 2590 | u->wst.dat[u->wst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); |
2591 | #ifndef NO_STACK_CHECKS | 2591 | #ifndef NO_STACK_CHECKS |
@@ -2603,8 +2603,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2603 | } | 2603 | } |
2604 | case 0xb7: /* DEO2k */ | 2604 | case 0xb7: /* DEO2k */ |
2605 | { | 2605 | { |
2606 | Uint8 a = u->wst.dat[u->wst.ptr - 1]; | 2606 | u8 a = u->wst.dat[u->wst.ptr - 1]; |
2607 | Uint16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); | 2607 | u16 b = (u->wst.dat[u->wst.ptr - 2] | (u->wst.dat[u->wst.ptr - 3] << 8)); |
2608 | devpoke16(&u->dev[a >> 4], a, b); | 2608 | devpoke16(&u->dev[a >> 4], a, b); |
2609 | #ifndef NO_STACK_CHECKS | 2609 | #ifndef NO_STACK_CHECKS |
2610 | if(u->wst.ptr < 3) { | 2610 | if(u->wst.ptr < 3) { |
@@ -2616,7 +2616,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2616 | } | 2616 | } |
2617 | case 0xb8: /* ADD2k */ | 2617 | case 0xb8: /* ADD2k */ |
2618 | { | 2618 | { |
2619 | Uint16 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)); | 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)); |
2620 | u->wst.dat[u->wst.ptr] = (b + a) >> 8; | 2620 | u->wst.dat[u->wst.ptr] = (b + a) >> 8; |
2621 | u->wst.dat[u->wst.ptr + 1] = (b + a) & 0xff; | 2621 | u->wst.dat[u->wst.ptr + 1] = (b + a) & 0xff; |
2622 | #ifndef NO_STACK_CHECKS | 2622 | #ifndef NO_STACK_CHECKS |
@@ -2634,7 +2634,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2634 | } | 2634 | } |
2635 | case 0xb9: /* SUB2k */ | 2635 | case 0xb9: /* SUB2k */ |
2636 | { | 2636 | { |
2637 | Uint16 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)); | 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)); |
2638 | u->wst.dat[u->wst.ptr] = (b - a) >> 8; | 2638 | u->wst.dat[u->wst.ptr] = (b - a) >> 8; |
2639 | u->wst.dat[u->wst.ptr + 1] = (b - a) & 0xff; | 2639 | u->wst.dat[u->wst.ptr + 1] = (b - a) & 0xff; |
2640 | #ifndef NO_STACK_CHECKS | 2640 | #ifndef NO_STACK_CHECKS |
@@ -2652,7 +2652,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2652 | } | 2652 | } |
2653 | case 0xba: /* MUL2k */ | 2653 | case 0xba: /* MUL2k */ |
2654 | { | 2654 | { |
2655 | Uint16 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)); | 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)); |
2656 | u->wst.dat[u->wst.ptr] = (b * a) >> 8; | 2656 | u->wst.dat[u->wst.ptr] = (b * a) >> 8; |
2657 | u->wst.dat[u->wst.ptr + 1] = (b * a) & 0xff; | 2657 | u->wst.dat[u->wst.ptr + 1] = (b * a) & 0xff; |
2658 | #ifndef NO_STACK_CHECKS | 2658 | #ifndef NO_STACK_CHECKS |
@@ -2670,7 +2670,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2670 | } | 2670 | } |
2671 | case 0xbb: /* DIV2k */ | 2671 | case 0xbb: /* DIV2k */ |
2672 | { | 2672 | { |
2673 | Uint16 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)); | 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)); |
2674 | u->wst.dat[u->wst.ptr] = (b / a) >> 8; | 2674 | u->wst.dat[u->wst.ptr] = (b / a) >> 8; |
2675 | u->wst.dat[u->wst.ptr + 1] = (b / a) & 0xff; | 2675 | u->wst.dat[u->wst.ptr + 1] = (b / a) & 0xff; |
2676 | #ifndef NO_STACK_CHECKS | 2676 | #ifndef NO_STACK_CHECKS |
@@ -2688,7 +2688,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2688 | } | 2688 | } |
2689 | case 0xbc: /* AND2k */ | 2689 | case 0xbc: /* AND2k */ |
2690 | { | 2690 | { |
2691 | Uint8 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]; | 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]; |
2692 | u->wst.dat[u->wst.ptr] = d & b; | 2692 | u->wst.dat[u->wst.ptr] = d & b; |
2693 | u->wst.dat[u->wst.ptr + 1] = c & a; | 2693 | u->wst.dat[u->wst.ptr + 1] = c & a; |
2694 | #ifndef NO_STACK_CHECKS | 2694 | #ifndef NO_STACK_CHECKS |
@@ -2706,7 +2706,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2706 | } | 2706 | } |
2707 | case 0xbd: /* ORA2k */ | 2707 | case 0xbd: /* ORA2k */ |
2708 | { | 2708 | { |
2709 | Uint8 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]; | 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]; |
2710 | u->wst.dat[u->wst.ptr] = d | b; | 2710 | u->wst.dat[u->wst.ptr] = d | b; |
2711 | u->wst.dat[u->wst.ptr + 1] = c | a; | 2711 | u->wst.dat[u->wst.ptr + 1] = c | a; |
2712 | #ifndef NO_STACK_CHECKS | 2712 | #ifndef NO_STACK_CHECKS |
@@ -2724,7 +2724,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2724 | } | 2724 | } |
2725 | case 0xbe: /* EOR2k */ | 2725 | case 0xbe: /* EOR2k */ |
2726 | { | 2726 | { |
2727 | Uint8 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]; | 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]; |
2728 | u->wst.dat[u->wst.ptr] = d ^ b; | 2728 | u->wst.dat[u->wst.ptr] = d ^ b; |
2729 | u->wst.dat[u->wst.ptr + 1] = c ^ a; | 2729 | u->wst.dat[u->wst.ptr + 1] = c ^ a; |
2730 | #ifndef NO_STACK_CHECKS | 2730 | #ifndef NO_STACK_CHECKS |
@@ -2742,7 +2742,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2742 | } | 2742 | } |
2743 | case 0xbf: /* SFT2k */ | 2743 | case 0xbf: /* SFT2k */ |
2744 | { | 2744 | { |
2745 | Uint16 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)); | 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)); |
2746 | u->wst.dat[u->wst.ptr] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; | 2746 | u->wst.dat[u->wst.ptr] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; |
2747 | u->wst.dat[u->wst.ptr + 1] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; | 2747 | u->wst.dat[u->wst.ptr + 1] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; |
2748 | #ifndef NO_STACK_CHECKS | 2748 | #ifndef NO_STACK_CHECKS |
@@ -2771,7 +2771,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2771 | } | 2771 | } |
2772 | case 0xc4: /* DUPkr */ | 2772 | case 0xc4: /* DUPkr */ |
2773 | { | 2773 | { |
2774 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 2774 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
2775 | u->rst.dat[u->rst.ptr] = a; | 2775 | u->rst.dat[u->rst.ptr] = a; |
2776 | u->rst.dat[u->rst.ptr + 1] = a; | 2776 | u->rst.dat[u->rst.ptr + 1] = a; |
2777 | #ifndef NO_STACK_CHECKS | 2777 | #ifndef NO_STACK_CHECKS |
@@ -2789,7 +2789,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2789 | } | 2789 | } |
2790 | case 0xc5: /* SWPkr */ | 2790 | case 0xc5: /* SWPkr */ |
2791 | { | 2791 | { |
2792 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 2792 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
2793 | u->rst.dat[u->rst.ptr] = a; | 2793 | u->rst.dat[u->rst.ptr] = a; |
2794 | u->rst.dat[u->rst.ptr + 1] = b; | 2794 | u->rst.dat[u->rst.ptr + 1] = b; |
2795 | #ifndef NO_STACK_CHECKS | 2795 | #ifndef NO_STACK_CHECKS |
@@ -2807,7 +2807,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2807 | } | 2807 | } |
2808 | case 0xc6: /* OVRkr */ | 2808 | case 0xc6: /* OVRkr */ |
2809 | { | 2809 | { |
2810 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 2810 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
2811 | u->rst.dat[u->rst.ptr] = b; | 2811 | u->rst.dat[u->rst.ptr] = b; |
2812 | u->rst.dat[u->rst.ptr + 1] = a; | 2812 | u->rst.dat[u->rst.ptr + 1] = a; |
2813 | u->rst.dat[u->rst.ptr + 2] = b; | 2813 | u->rst.dat[u->rst.ptr + 2] = b; |
@@ -2826,7 +2826,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2826 | } | 2826 | } |
2827 | case 0xc7: /* ROTkr */ | 2827 | case 0xc7: /* ROTkr */ |
2828 | { | 2828 | { |
2829 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2], c = u->rst.dat[u->rst.ptr - 3]; | 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]; |
2830 | u->rst.dat[u->rst.ptr] = b; | 2830 | u->rst.dat[u->rst.ptr] = b; |
2831 | u->rst.dat[u->rst.ptr + 1] = a; | 2831 | u->rst.dat[u->rst.ptr + 1] = a; |
2832 | u->rst.dat[u->rst.ptr + 2] = c; | 2832 | u->rst.dat[u->rst.ptr + 2] = c; |
@@ -2845,7 +2845,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2845 | } | 2845 | } |
2846 | case 0xc8: /* EQUkr */ | 2846 | case 0xc8: /* EQUkr */ |
2847 | { | 2847 | { |
2848 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 2848 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
2849 | u->rst.dat[u->rst.ptr] = b == a; | 2849 | u->rst.dat[u->rst.ptr] = b == a; |
2850 | #ifndef NO_STACK_CHECKS | 2850 | #ifndef NO_STACK_CHECKS |
2851 | if(u->rst.ptr < 2) { | 2851 | if(u->rst.ptr < 2) { |
@@ -2862,7 +2862,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2862 | } | 2862 | } |
2863 | case 0xc9: /* NEQkr */ | 2863 | case 0xc9: /* NEQkr */ |
2864 | { | 2864 | { |
2865 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 2865 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
2866 | u->rst.dat[u->rst.ptr] = b != a; | 2866 | u->rst.dat[u->rst.ptr] = b != a; |
2867 | #ifndef NO_STACK_CHECKS | 2867 | #ifndef NO_STACK_CHECKS |
2868 | if(u->rst.ptr < 2) { | 2868 | if(u->rst.ptr < 2) { |
@@ -2879,7 +2879,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2879 | } | 2879 | } |
2880 | case 0xca: /* GTHkr */ | 2880 | case 0xca: /* GTHkr */ |
2881 | { | 2881 | { |
2882 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 2882 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
2883 | u->rst.dat[u->rst.ptr] = b > a; | 2883 | u->rst.dat[u->rst.ptr] = b > a; |
2884 | #ifndef NO_STACK_CHECKS | 2884 | #ifndef NO_STACK_CHECKS |
2885 | if(u->rst.ptr < 2) { | 2885 | if(u->rst.ptr < 2) { |
@@ -2896,7 +2896,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2896 | } | 2896 | } |
2897 | case 0xcb: /* LTHkr */ | 2897 | case 0xcb: /* LTHkr */ |
2898 | { | 2898 | { |
2899 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 2899 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
2900 | u->rst.dat[u->rst.ptr] = b < a; | 2900 | u->rst.dat[u->rst.ptr] = b < a; |
2901 | #ifndef NO_STACK_CHECKS | 2901 | #ifndef NO_STACK_CHECKS |
2902 | if(u->rst.ptr < 2) { | 2902 | if(u->rst.ptr < 2) { |
@@ -2913,8 +2913,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2913 | } | 2913 | } |
2914 | case 0xcc: /* JMPkr */ | 2914 | case 0xcc: /* JMPkr */ |
2915 | { | 2915 | { |
2916 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 2916 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
2917 | u->ram.ptr += (Sint8)a; | 2917 | u->ram.ptr += (s8)a; |
2918 | #ifndef NO_STACK_CHECKS | 2918 | #ifndef NO_STACK_CHECKS |
2919 | if(u->rst.ptr < 1) { | 2919 | if(u->rst.ptr < 1) { |
2920 | u->rst.error = 1; | 2920 | u->rst.error = 1; |
@@ -2925,8 +2925,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2925 | } | 2925 | } |
2926 | case 0xcd: /* JCNkr */ | 2926 | case 0xcd: /* JCNkr */ |
2927 | { | 2927 | { |
2928 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 2928 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
2929 | if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (Sint8)a; | 2929 | if(u->rst.dat[u->rst.ptr - 2]) u->ram.ptr += (s8)a; |
2930 | #ifndef NO_STACK_CHECKS | 2930 | #ifndef NO_STACK_CHECKS |
2931 | if(u->rst.ptr < 2) { | 2931 | if(u->rst.ptr < 2) { |
2932 | u->rst.error = 1; | 2932 | u->rst.error = 1; |
@@ -2937,10 +2937,10 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2937 | } | 2937 | } |
2938 | case 0xce: /* JSRkr */ | 2938 | case 0xce: /* JSRkr */ |
2939 | { | 2939 | { |
2940 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 2940 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
2941 | u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; | 2941 | u->wst.dat[u->wst.ptr] = u->ram.ptr >> 8; |
2942 | u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; | 2942 | u->wst.dat[u->wst.ptr + 1] = u->ram.ptr & 0xff; |
2943 | u->ram.ptr += (Sint8)a; | 2943 | u->ram.ptr += (s8)a; |
2944 | #ifndef NO_STACK_CHECKS | 2944 | #ifndef NO_STACK_CHECKS |
2945 | if(u->rst.ptr < 1) { | 2945 | if(u->rst.ptr < 1) { |
2946 | u->rst.error = 1; | 2946 | u->rst.error = 1; |
@@ -2958,7 +2958,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2958 | } | 2958 | } |
2959 | case 0xcf: /* STHkr */ | 2959 | case 0xcf: /* STHkr */ |
2960 | { | 2960 | { |
2961 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 2961 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
2962 | u->wst.dat[u->wst.ptr] = a; | 2962 | u->wst.dat[u->wst.ptr] = a; |
2963 | #ifndef NO_STACK_CHECKS | 2963 | #ifndef NO_STACK_CHECKS |
2964 | if(u->rst.ptr < 1) { | 2964 | if(u->rst.ptr < 1) { |
@@ -2977,7 +2977,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2977 | } | 2977 | } |
2978 | case 0xd0: /* LDZkr */ | 2978 | case 0xd0: /* LDZkr */ |
2979 | { | 2979 | { |
2980 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 2980 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
2981 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); | 2981 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
2982 | #ifndef NO_STACK_CHECKS | 2982 | #ifndef NO_STACK_CHECKS |
2983 | if(u->rst.ptr < 1) { | 2983 | if(u->rst.ptr < 1) { |
@@ -2994,8 +2994,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
2994 | } | 2994 | } |
2995 | case 0xd1: /* STZkr */ | 2995 | case 0xd1: /* STZkr */ |
2996 | { | 2996 | { |
2997 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 2997 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
2998 | Uint8 b = u->rst.dat[u->rst.ptr - 2]; | 2998 | u8 b = u->rst.dat[u->rst.ptr - 2]; |
2999 | mempoke8(u->ram.dat, a, b); | 2999 | mempoke8(u->ram.dat, a, b); |
3000 | #ifndef NO_STACK_CHECKS | 3000 | #ifndef NO_STACK_CHECKS |
3001 | if(u->rst.ptr < 2) { | 3001 | if(u->rst.ptr < 2) { |
@@ -3007,8 +3007,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3007 | } | 3007 | } |
3008 | case 0xd2: /* LDRkr */ | 3008 | case 0xd2: /* LDRkr */ |
3009 | { | 3009 | { |
3010 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3010 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3011 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); | 3011 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); |
3012 | #ifndef NO_STACK_CHECKS | 3012 | #ifndef NO_STACK_CHECKS |
3013 | if(u->rst.ptr < 1) { | 3013 | if(u->rst.ptr < 1) { |
3014 | u->rst.error = 1; | 3014 | u->rst.error = 1; |
@@ -3024,9 +3024,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3024 | } | 3024 | } |
3025 | case 0xd3: /* STRkr */ | 3025 | case 0xd3: /* STRkr */ |
3026 | { | 3026 | { |
3027 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3027 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3028 | Uint8 b = u->rst.dat[u->rst.ptr - 2]; | 3028 | u8 b = u->rst.dat[u->rst.ptr - 2]; |
3029 | mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); | 3029 | mempoke8(u->ram.dat, u->ram.ptr + (s8)a, b); |
3030 | #ifndef NO_STACK_CHECKS | 3030 | #ifndef NO_STACK_CHECKS |
3031 | if(u->rst.ptr < 2) { | 3031 | if(u->rst.ptr < 2) { |
3032 | u->rst.error = 1; | 3032 | u->rst.error = 1; |
@@ -3037,7 +3037,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3037 | } | 3037 | } |
3038 | case 0xd4: /* LDAkr */ | 3038 | case 0xd4: /* LDAkr */ |
3039 | { | 3039 | { |
3040 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 3040 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
3041 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); | 3041 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
3042 | #ifndef NO_STACK_CHECKS | 3042 | #ifndef NO_STACK_CHECKS |
3043 | if(u->rst.ptr < 2) { | 3043 | if(u->rst.ptr < 2) { |
@@ -3054,8 +3054,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3054 | } | 3054 | } |
3055 | case 0xd5: /* STAkr */ | 3055 | case 0xd5: /* STAkr */ |
3056 | { | 3056 | { |
3057 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 3057 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
3058 | Uint8 b = u->rst.dat[u->rst.ptr - 3]; | 3058 | u8 b = u->rst.dat[u->rst.ptr - 3]; |
3059 | mempoke8(u->ram.dat, a, b); | 3059 | mempoke8(u->ram.dat, a, b); |
3060 | #ifndef NO_STACK_CHECKS | 3060 | #ifndef NO_STACK_CHECKS |
3061 | if(u->rst.ptr < 3) { | 3061 | if(u->rst.ptr < 3) { |
@@ -3067,7 +3067,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3067 | } | 3067 | } |
3068 | case 0xd6: /* DEIkr */ | 3068 | case 0xd6: /* DEIkr */ |
3069 | { | 3069 | { |
3070 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3070 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3071 | u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); | 3071 | u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); |
3072 | #ifndef NO_STACK_CHECKS | 3072 | #ifndef NO_STACK_CHECKS |
3073 | if(u->rst.ptr < 1) { | 3073 | if(u->rst.ptr < 1) { |
@@ -3084,7 +3084,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3084 | } | 3084 | } |
3085 | case 0xd7: /* DEOkr */ | 3085 | case 0xd7: /* DEOkr */ |
3086 | { | 3086 | { |
3087 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3087 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3088 | devpoke8(&u->dev[a >> 4], a, b); | 3088 | devpoke8(&u->dev[a >> 4], a, b); |
3089 | #ifndef NO_STACK_CHECKS | 3089 | #ifndef NO_STACK_CHECKS |
3090 | if(u->rst.ptr < 2) { | 3090 | if(u->rst.ptr < 2) { |
@@ -3096,7 +3096,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3096 | } | 3096 | } |
3097 | case 0xd8: /* ADDkr */ | 3097 | case 0xd8: /* ADDkr */ |
3098 | { | 3098 | { |
3099 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3099 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3100 | u->rst.dat[u->rst.ptr] = b + a; | 3100 | u->rst.dat[u->rst.ptr] = b + a; |
3101 | #ifndef NO_STACK_CHECKS | 3101 | #ifndef NO_STACK_CHECKS |
3102 | if(u->rst.ptr < 2) { | 3102 | if(u->rst.ptr < 2) { |
@@ -3113,7 +3113,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3113 | } | 3113 | } |
3114 | case 0xd9: /* SUBkr */ | 3114 | case 0xd9: /* SUBkr */ |
3115 | { | 3115 | { |
3116 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3116 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3117 | u->rst.dat[u->rst.ptr] = b - a; | 3117 | u->rst.dat[u->rst.ptr] = b - a; |
3118 | #ifndef NO_STACK_CHECKS | 3118 | #ifndef NO_STACK_CHECKS |
3119 | if(u->rst.ptr < 2) { | 3119 | if(u->rst.ptr < 2) { |
@@ -3130,7 +3130,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3130 | } | 3130 | } |
3131 | case 0xda: /* MULkr */ | 3131 | case 0xda: /* MULkr */ |
3132 | { | 3132 | { |
3133 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3133 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3134 | u->rst.dat[u->rst.ptr] = b * a; | 3134 | u->rst.dat[u->rst.ptr] = b * a; |
3135 | #ifndef NO_STACK_CHECKS | 3135 | #ifndef NO_STACK_CHECKS |
3136 | if(u->rst.ptr < 2) { | 3136 | if(u->rst.ptr < 2) { |
@@ -3147,7 +3147,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3147 | } | 3147 | } |
3148 | case 0xdb: /* DIVkr */ | 3148 | case 0xdb: /* DIVkr */ |
3149 | { | 3149 | { |
3150 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3150 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3151 | u->rst.dat[u->rst.ptr] = b / a; | 3151 | u->rst.dat[u->rst.ptr] = b / a; |
3152 | #ifndef NO_STACK_CHECKS | 3152 | #ifndef NO_STACK_CHECKS |
3153 | if(u->rst.ptr < 2) { | 3153 | if(u->rst.ptr < 2) { |
@@ -3164,7 +3164,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3164 | } | 3164 | } |
3165 | case 0xdc: /* ANDkr */ | 3165 | case 0xdc: /* ANDkr */ |
3166 | { | 3166 | { |
3167 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3167 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3168 | u->rst.dat[u->rst.ptr] = b & a; | 3168 | u->rst.dat[u->rst.ptr] = b & a; |
3169 | #ifndef NO_STACK_CHECKS | 3169 | #ifndef NO_STACK_CHECKS |
3170 | if(u->rst.ptr < 2) { | 3170 | if(u->rst.ptr < 2) { |
@@ -3181,7 +3181,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3181 | } | 3181 | } |
3182 | case 0xdd: /* ORAkr */ | 3182 | case 0xdd: /* ORAkr */ |
3183 | { | 3183 | { |
3184 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3184 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3185 | u->rst.dat[u->rst.ptr] = b | a; | 3185 | u->rst.dat[u->rst.ptr] = b | a; |
3186 | #ifndef NO_STACK_CHECKS | 3186 | #ifndef NO_STACK_CHECKS |
3187 | if(u->rst.ptr < 2) { | 3187 | if(u->rst.ptr < 2) { |
@@ -3198,7 +3198,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3198 | } | 3198 | } |
3199 | case 0xde: /* EORkr */ | 3199 | case 0xde: /* EORkr */ |
3200 | { | 3200 | { |
3201 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3201 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3202 | u->rst.dat[u->rst.ptr] = b ^ a; | 3202 | u->rst.dat[u->rst.ptr] = b ^ a; |
3203 | #ifndef NO_STACK_CHECKS | 3203 | #ifndef NO_STACK_CHECKS |
3204 | if(u->rst.ptr < 2) { | 3204 | if(u->rst.ptr < 2) { |
@@ -3215,7 +3215,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3215 | } | 3215 | } |
3216 | case 0xdf: /* SFTkr */ | 3216 | case 0xdf: /* SFTkr */ |
3217 | { | 3217 | { |
3218 | Uint8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; | 3218 | u8 a = u->rst.dat[u->rst.ptr - 1], b = u->rst.dat[u->rst.ptr - 2]; |
3219 | u->rst.dat[u->rst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4); | 3219 | u->rst.dat[u->rst.ptr] = b >> (a & 0x07) << ((a & 0x70) >> 4); |
3220 | #ifndef NO_STACK_CHECKS | 3220 | #ifndef NO_STACK_CHECKS |
3221 | if(u->rst.ptr < 2) { | 3221 | if(u->rst.ptr < 2) { |
@@ -3243,7 +3243,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3243 | } | 3243 | } |
3244 | case 0xe4: /* DUP2kr */ | 3244 | case 0xe4: /* DUP2kr */ |
3245 | { | 3245 | { |
3246 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 3246 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
3247 | u->rst.dat[u->rst.ptr] = a >> 8; | 3247 | u->rst.dat[u->rst.ptr] = a >> 8; |
3248 | u->rst.dat[u->rst.ptr + 1] = a & 0xff; | 3248 | u->rst.dat[u->rst.ptr + 1] = a & 0xff; |
3249 | u->rst.dat[u->rst.ptr + 2] = a >> 8; | 3249 | u->rst.dat[u->rst.ptr + 2] = a >> 8; |
@@ -3263,7 +3263,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3263 | } | 3263 | } |
3264 | case 0xe5: /* SWP2kr */ | 3264 | case 0xe5: /* SWP2kr */ |
3265 | { | 3265 | { |
3266 | Uint16 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)); | 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)); |
3267 | u->rst.dat[u->rst.ptr] = a >> 8; | 3267 | u->rst.dat[u->rst.ptr] = a >> 8; |
3268 | u->rst.dat[u->rst.ptr + 1] = a & 0xff; | 3268 | u->rst.dat[u->rst.ptr + 1] = a & 0xff; |
3269 | u->rst.dat[u->rst.ptr + 2] = b >> 8; | 3269 | u->rst.dat[u->rst.ptr + 2] = b >> 8; |
@@ -3283,7 +3283,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3283 | } | 3283 | } |
3284 | case 0xe6: /* OVR2kr */ | 3284 | case 0xe6: /* OVR2kr */ |
3285 | { | 3285 | { |
3286 | Uint16 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)); | 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)); |
3287 | u->rst.dat[u->rst.ptr] = b >> 8; | 3287 | u->rst.dat[u->rst.ptr] = b >> 8; |
3288 | u->rst.dat[u->rst.ptr + 1] = b & 0xff; | 3288 | u->rst.dat[u->rst.ptr + 1] = b & 0xff; |
3289 | u->rst.dat[u->rst.ptr + 2] = a >> 8; | 3289 | u->rst.dat[u->rst.ptr + 2] = a >> 8; |
@@ -3305,7 +3305,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3305 | } | 3305 | } |
3306 | case 0xe7: /* ROT2kr */ | 3306 | case 0xe7: /* ROT2kr */ |
3307 | { | 3307 | { |
3308 | Uint16 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)); | 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)); |
3309 | u->rst.dat[u->rst.ptr] = b >> 8; | 3309 | u->rst.dat[u->rst.ptr] = b >> 8; |
3310 | u->rst.dat[u->rst.ptr + 1] = b & 0xff; | 3310 | u->rst.dat[u->rst.ptr + 1] = b & 0xff; |
3311 | u->rst.dat[u->rst.ptr + 2] = a >> 8; | 3311 | u->rst.dat[u->rst.ptr + 2] = a >> 8; |
@@ -3327,7 +3327,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3327 | } | 3327 | } |
3328 | case 0xe8: /* EQU2kr */ | 3328 | case 0xe8: /* EQU2kr */ |
3329 | { | 3329 | { |
3330 | Uint16 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)); | 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)); |
3331 | u->rst.dat[u->rst.ptr] = b == a; | 3331 | u->rst.dat[u->rst.ptr] = b == a; |
3332 | #ifndef NO_STACK_CHECKS | 3332 | #ifndef NO_STACK_CHECKS |
3333 | if(u->rst.ptr < 4) { | 3333 | if(u->rst.ptr < 4) { |
@@ -3344,7 +3344,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3344 | } | 3344 | } |
3345 | case 0xe9: /* NEQ2kr */ | 3345 | case 0xe9: /* NEQ2kr */ |
3346 | { | 3346 | { |
3347 | Uint16 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)); | 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)); |
3348 | u->rst.dat[u->rst.ptr] = b != a; | 3348 | u->rst.dat[u->rst.ptr] = b != a; |
3349 | #ifndef NO_STACK_CHECKS | 3349 | #ifndef NO_STACK_CHECKS |
3350 | if(u->rst.ptr < 4) { | 3350 | if(u->rst.ptr < 4) { |
@@ -3361,7 +3361,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3361 | } | 3361 | } |
3362 | case 0xea: /* GTH2kr */ | 3362 | case 0xea: /* GTH2kr */ |
3363 | { | 3363 | { |
3364 | Uint16 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)); | 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)); |
3365 | u->rst.dat[u->rst.ptr] = b > a; | 3365 | u->rst.dat[u->rst.ptr] = b > a; |
3366 | #ifndef NO_STACK_CHECKS | 3366 | #ifndef NO_STACK_CHECKS |
3367 | if(u->rst.ptr < 4) { | 3367 | if(u->rst.ptr < 4) { |
@@ -3378,7 +3378,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3378 | } | 3378 | } |
3379 | case 0xeb: /* LTH2kr */ | 3379 | case 0xeb: /* LTH2kr */ |
3380 | { | 3380 | { |
3381 | Uint16 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)); | 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)); |
3382 | u->rst.dat[u->rst.ptr] = b < a; | 3382 | u->rst.dat[u->rst.ptr] = b < a; |
3383 | #ifndef NO_STACK_CHECKS | 3383 | #ifndef NO_STACK_CHECKS |
3384 | if(u->rst.ptr < 4) { | 3384 | if(u->rst.ptr < 4) { |
@@ -3406,7 +3406,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3406 | } | 3406 | } |
3407 | case 0xed: /* JCN2kr */ | 3407 | case 0xed: /* JCN2kr */ |
3408 | { | 3408 | { |
3409 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 3409 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
3410 | if(u->rst.dat[u->rst.ptr - 3]) u->ram.ptr = a; | 3410 | if(u->rst.dat[u->rst.ptr - 3]) u->ram.ptr = a; |
3411 | #ifndef NO_STACK_CHECKS | 3411 | #ifndef NO_STACK_CHECKS |
3412 | if(u->rst.ptr < 3) { | 3412 | if(u->rst.ptr < 3) { |
@@ -3438,7 +3438,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3438 | } | 3438 | } |
3439 | case 0xef: /* STH2kr */ | 3439 | case 0xef: /* STH2kr */ |
3440 | { | 3440 | { |
3441 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 3441 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
3442 | u->wst.dat[u->wst.ptr] = a >> 8; | 3442 | u->wst.dat[u->wst.ptr] = a >> 8; |
3443 | u->wst.dat[u->wst.ptr + 1] = a & 0xff; | 3443 | u->wst.dat[u->wst.ptr + 1] = a & 0xff; |
3444 | #ifndef NO_STACK_CHECKS | 3444 | #ifndef NO_STACK_CHECKS |
@@ -3458,7 +3458,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3458 | } | 3458 | } |
3459 | case 0xf0: /* LDZ2kr */ | 3459 | case 0xf0: /* LDZ2kr */ |
3460 | { | 3460 | { |
3461 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3461 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3462 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); | 3462 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
3463 | u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1); | 3463 | u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
3464 | #ifndef NO_STACK_CHECKS | 3464 | #ifndef NO_STACK_CHECKS |
@@ -3476,8 +3476,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3476 | } | 3476 | } |
3477 | case 0xf1: /* STZ2kr */ | 3477 | case 0xf1: /* STZ2kr */ |
3478 | { | 3478 | { |
3479 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3479 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3480 | Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); | 3480 | u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
3481 | mempoke16(u->ram.dat, a, b); | 3481 | mempoke16(u->ram.dat, a, b); |
3482 | #ifndef NO_STACK_CHECKS | 3482 | #ifndef NO_STACK_CHECKS |
3483 | if(u->rst.ptr < 3) { | 3483 | if(u->rst.ptr < 3) { |
@@ -3489,9 +3489,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3489 | } | 3489 | } |
3490 | case 0xf2: /* LDR2kr */ | 3490 | case 0xf2: /* LDR2kr */ |
3491 | { | 3491 | { |
3492 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3492 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3493 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a); | 3493 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a); |
3494 | u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a + 1); | 3494 | u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, u->ram.ptr + (s8)a + 1); |
3495 | #ifndef NO_STACK_CHECKS | 3495 | #ifndef NO_STACK_CHECKS |
3496 | if(u->rst.ptr < 1) { | 3496 | if(u->rst.ptr < 1) { |
3497 | u->rst.error = 1; | 3497 | u->rst.error = 1; |
@@ -3507,9 +3507,9 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3507 | } | 3507 | } |
3508 | case 0xf3: /* STR2kr */ | 3508 | case 0xf3: /* STR2kr */ |
3509 | { | 3509 | { |
3510 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3510 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3511 | Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); | 3511 | u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
3512 | mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); | 3512 | mempoke16(u->ram.dat, u->ram.ptr + (s8)a, b); |
3513 | #ifndef NO_STACK_CHECKS | 3513 | #ifndef NO_STACK_CHECKS |
3514 | if(u->rst.ptr < 3) { | 3514 | if(u->rst.ptr < 3) { |
3515 | u->rst.error = 1; | 3515 | u->rst.error = 1; |
@@ -3520,7 +3520,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3520 | } | 3520 | } |
3521 | case 0xf4: /* LDA2kr */ | 3521 | case 0xf4: /* LDA2kr */ |
3522 | { | 3522 | { |
3523 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 3523 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
3524 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); | 3524 | u->rst.dat[u->rst.ptr] = mempeek8(u->ram.dat, a); |
3525 | u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1); | 3525 | u->rst.dat[u->rst.ptr + 1] = mempeek8(u->ram.dat, a + 1); |
3526 | #ifndef NO_STACK_CHECKS | 3526 | #ifndef NO_STACK_CHECKS |
@@ -3538,8 +3538,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3538 | } | 3538 | } |
3539 | case 0xf5: /* STA2kr */ | 3539 | case 0xf5: /* STA2kr */ |
3540 | { | 3540 | { |
3541 | Uint16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); | 3541 | u16 a = (u->rst.dat[u->rst.ptr - 1] | (u->rst.dat[u->rst.ptr - 2] << 8)); |
3542 | Uint16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); | 3542 | u16 b = (u->rst.dat[u->rst.ptr - 3] | (u->rst.dat[u->rst.ptr - 4] << 8)); |
3543 | mempoke16(u->ram.dat, a, b); | 3543 | mempoke16(u->ram.dat, a, b); |
3544 | #ifndef NO_STACK_CHECKS | 3544 | #ifndef NO_STACK_CHECKS |
3545 | if(u->rst.ptr < 4) { | 3545 | if(u->rst.ptr < 4) { |
@@ -3551,7 +3551,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3551 | } | 3551 | } |
3552 | case 0xf6: /* DEI2kr */ | 3552 | case 0xf6: /* DEI2kr */ |
3553 | { | 3553 | { |
3554 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3554 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3555 | u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); | 3555 | u->rst.dat[u->rst.ptr] = devpeek8(&u->dev[a >> 4], a); |
3556 | u->rst.dat[u->rst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); | 3556 | u->rst.dat[u->rst.ptr + 1] = devpeek8(&u->dev[a >> 4], a + 1); |
3557 | #ifndef NO_STACK_CHECKS | 3557 | #ifndef NO_STACK_CHECKS |
@@ -3569,8 +3569,8 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3569 | } | 3569 | } |
3570 | case 0xf7: /* DEO2kr */ | 3570 | case 0xf7: /* DEO2kr */ |
3571 | { | 3571 | { |
3572 | Uint8 a = u->rst.dat[u->rst.ptr - 1]; | 3572 | u8 a = u->rst.dat[u->rst.ptr - 1]; |
3573 | Uint16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); | 3573 | u16 b = (u->rst.dat[u->rst.ptr - 2] | (u->rst.dat[u->rst.ptr - 3] << 8)); |
3574 | devpoke16(&u->dev[a >> 4], a, b); | 3574 | devpoke16(&u->dev[a >> 4], a, b); |
3575 | #ifndef NO_STACK_CHECKS | 3575 | #ifndef NO_STACK_CHECKS |
3576 | if(u->rst.ptr < 3) { | 3576 | if(u->rst.ptr < 3) { |
@@ -3582,7 +3582,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3582 | } | 3582 | } |
3583 | case 0xf8: /* ADD2kr */ | 3583 | case 0xf8: /* ADD2kr */ |
3584 | { | 3584 | { |
3585 | Uint16 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)); | 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)); |
3586 | u->rst.dat[u->rst.ptr] = (b + a) >> 8; | 3586 | u->rst.dat[u->rst.ptr] = (b + a) >> 8; |
3587 | u->rst.dat[u->rst.ptr + 1] = (b + a) & 0xff; | 3587 | u->rst.dat[u->rst.ptr + 1] = (b + a) & 0xff; |
3588 | #ifndef NO_STACK_CHECKS | 3588 | #ifndef NO_STACK_CHECKS |
@@ -3600,7 +3600,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3600 | } | 3600 | } |
3601 | case 0xf9: /* SUB2kr */ | 3601 | case 0xf9: /* SUB2kr */ |
3602 | { | 3602 | { |
3603 | Uint16 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)); | 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)); |
3604 | u->rst.dat[u->rst.ptr] = (b - a) >> 8; | 3604 | u->rst.dat[u->rst.ptr] = (b - a) >> 8; |
3605 | u->rst.dat[u->rst.ptr + 1] = (b - a) & 0xff; | 3605 | u->rst.dat[u->rst.ptr + 1] = (b - a) & 0xff; |
3606 | #ifndef NO_STACK_CHECKS | 3606 | #ifndef NO_STACK_CHECKS |
@@ -3618,7 +3618,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3618 | } | 3618 | } |
3619 | case 0xfa: /* MUL2kr */ | 3619 | case 0xfa: /* MUL2kr */ |
3620 | { | 3620 | { |
3621 | Uint16 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)); | 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)); |
3622 | u->rst.dat[u->rst.ptr] = (b * a) >> 8; | 3622 | u->rst.dat[u->rst.ptr] = (b * a) >> 8; |
3623 | u->rst.dat[u->rst.ptr + 1] = (b * a) & 0xff; | 3623 | u->rst.dat[u->rst.ptr + 1] = (b * a) & 0xff; |
3624 | #ifndef NO_STACK_CHECKS | 3624 | #ifndef NO_STACK_CHECKS |
@@ -3636,7 +3636,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3636 | } | 3636 | } |
3637 | case 0xfb: /* DIV2kr */ | 3637 | case 0xfb: /* DIV2kr */ |
3638 | { | 3638 | { |
3639 | Uint16 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)); | 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)); |
3640 | u->rst.dat[u->rst.ptr] = (b / a) >> 8; | 3640 | u->rst.dat[u->rst.ptr] = (b / a) >> 8; |
3641 | u->rst.dat[u->rst.ptr + 1] = (b / a) & 0xff; | 3641 | u->rst.dat[u->rst.ptr + 1] = (b / a) & 0xff; |
3642 | #ifndef NO_STACK_CHECKS | 3642 | #ifndef NO_STACK_CHECKS |
@@ -3654,7 +3654,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3654 | } | 3654 | } |
3655 | case 0xfc: /* AND2kr */ | 3655 | case 0xfc: /* AND2kr */ |
3656 | { | 3656 | { |
3657 | Uint8 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]; | 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]; |
3658 | u->rst.dat[u->rst.ptr] = d & b; | 3658 | u->rst.dat[u->rst.ptr] = d & b; |
3659 | u->rst.dat[u->rst.ptr + 1] = c & a; | 3659 | u->rst.dat[u->rst.ptr + 1] = c & a; |
3660 | #ifndef NO_STACK_CHECKS | 3660 | #ifndef NO_STACK_CHECKS |
@@ -3672,7 +3672,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3672 | } | 3672 | } |
3673 | case 0xfd: /* ORA2kr */ | 3673 | case 0xfd: /* ORA2kr */ |
3674 | { | 3674 | { |
3675 | Uint8 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]; | 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]; |
3676 | u->rst.dat[u->rst.ptr] = d | b; | 3676 | u->rst.dat[u->rst.ptr] = d | b; |
3677 | u->rst.dat[u->rst.ptr + 1] = c | a; | 3677 | u->rst.dat[u->rst.ptr + 1] = c | a; |
3678 | #ifndef NO_STACK_CHECKS | 3678 | #ifndef NO_STACK_CHECKS |
@@ -3690,7 +3690,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3690 | } | 3690 | } |
3691 | case 0xfe: /* EOR2kr */ | 3691 | case 0xfe: /* EOR2kr */ |
3692 | { | 3692 | { |
3693 | Uint8 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]; | 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]; |
3694 | u->rst.dat[u->rst.ptr] = d ^ b; | 3694 | u->rst.dat[u->rst.ptr] = d ^ b; |
3695 | u->rst.dat[u->rst.ptr + 1] = c ^ a; | 3695 | u->rst.dat[u->rst.ptr + 1] = c ^ a; |
3696 | #ifndef NO_STACK_CHECKS | 3696 | #ifndef NO_STACK_CHECKS |
@@ -3708,7 +3708,7 @@ evaluxn(Uxn *u, Uint16 vec) | |||
3708 | } | 3708 | } |
3709 | case 0xff: /* SFT2kr */ | 3709 | case 0xff: /* SFT2kr */ |
3710 | { | 3710 | { |
3711 | Uint16 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)); | 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)); |
3712 | u->rst.dat[u->rst.ptr] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; | 3712 | u->rst.dat[u->rst.ptr] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) >> 8; |
3713 | u->rst.dat[u->rst.ptr + 1] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; | 3713 | u->rst.dat[u->rst.ptr + 1] = (b >> (a & 0x000f) << ((a & 0x00f0) >> 4)) & 0xff; |
3714 | #ifndef NO_STACK_CHECKS | 3714 | #ifndef NO_STACK_CHECKS |
@@ -3756,7 +3756,7 @@ loaduxn(Uxn *u, char *filepath) | |||
3756 | } | 3756 | } |
3757 | 3757 | ||
3758 | Device * | 3758 | Device * |
3759 | portuxn(Uxn *u, Uint8 id, char *name, void (*talkfn)(Device *d, Uint8 b0, Uint8 w)) | 3759 | portuxn(Uxn *u, u8 id, char *name, void (*talkfn)(Device *d, u8 b0, u8 w)) |
3760 | { | 3760 | { |
3761 | Device *d = &u->dev[id]; | 3761 | Device *d = &u->dev[id]; |
3762 | d->addr = id * 0x10; | 3762 | d->addr = id * 0x10; |