Nugget
Bare-metal libraries and examples for the original PlayStation
Loading...
Searching...
No Matches
gte-edgecase.c
Go to the documentation of this file.
1// Edge cases and degenerate inputs: division, overflow boundaries,
2// zero matrices, negative Z, FLAG verification per instruction.
3
4// ==========================================================================
5// Division edge cases (tested via RTPS)
6// ==========================================================================
7
8// Division by zero: SZ3=0
9// clang-format off
10
11CESTER_TEST(edge_div_by_zero, gte_tests,
13 gte_set_translation(0, 0, 0);
14 gte_set_screen(0, 0, 200);
15 cop2_put(0, (0 << 16) | 100);
16 cop2_put(1, 0); // VZ0=0 -> SZ3=0
18 cop2_cmd(COP2_RTPS(1, 0));
19 uint32_t sz3, sxy2, flag;
20 cop2_get(19, sz3);
21 cop2_get(14, sxy2);
22 flag = gte_read_flag();
23 ramsyscall_printf("div/0: SZ3=%u SXY2=0x%08x FLAG=0x%08x\n", sz3, sxy2, flag);
24 // SZ3=0, H=200 -> H >= SZ3*2 -> division overflow (FLAG.17)
25 uint32_t f17 = (flag >> 17) & 1;
27)
28
29// H=0: zero numerator
30CESTER_TEST(edge_div_h_zero, gte_tests,
33 gte_set_screen(0, 0, 0); // H=0
34 cop2_put(0, (0 << 16) | 100);
35 cop2_put(1, 1000);
38 uint32_t sxy2, flag;
40 flag = gte_read_flag();
41 int16_t sx = (int16_t)(sxy2 & 0xffff);
42 ramsyscall_printf("H=0: SX=%d FLAG=0x%08x\n", sx, flag);
43 // H=0, SZ3=1000 -> H < SZ3*2 -> no overflow, quotient = 0
44 // SX = OFX/65536 + IR1 * 0 = 0
46 uint32_t f17 = (flag >> 17) & 1;
48)
49
50// Division overflow boundary: H=SZ3*2-1 (just under, no overflow)
51CESTER_TEST(edge_div_boundary_under, gte_tests,
53 gte_set_translation(0, 0, 0);
54 gte_set_screen(0, 0, 199); // H=199
55 cop2_put(0, (0 << 16) | 100);
56 cop2_put(1, 100); // SZ3=100 -> H < 200 -> no overflow
58 cop2_cmd(COP2_RTPS(1, 0));
59 uint32_t flag;
60 flag = gte_read_flag();
61 uint32_t f17 = (flag >> 17) & 1;
62 ramsyscall_printf("div boundary under: H=199 SZ3=100 FLAG.17=%u\n", f17);
64)
65
66// Division overflow boundary: H=SZ3*2 (exactly at overflow)
67CESTER_TEST(edge_div_boundary_at, gte_tests,
69 gte_set_translation(0, 0, 0);
70 gte_set_screen(0, 0, 200); // H=200
71 cop2_put(0, (0 << 16) | 100);
72 cop2_put(1, 100); // SZ3=100 -> H >= 200 -> overflow
74 cop2_cmd(COP2_RTPS(1, 0));
75 uint32_t flag;
76 flag = gte_read_flag();
77 uint32_t f17 = (flag >> 17) & 1;
78 ramsyscall_printf("div boundary at: H=200 SZ3=100 FLAG.17=%u\n", f17);
80)
81
82// Division overflow boundary: H=SZ3*2+1 (just over, definitely overflow)
83CESTER_TEST(edge_div_boundary_over, gte_tests,
85 gte_set_translation(0, 0, 0);
86 gte_set_screen(0, 0, 201); // H=201
87 cop2_put(0, (0 << 16) | 100);
88 cop2_put(1, 100);
90 cop2_cmd(COP2_RTPS(1, 0));
91 uint32_t flag;
92 flag = gte_read_flag();
93 uint32_t f17 = (flag >> 17) & 1;
95)
96
97// ==========================================================================
98// IR saturation boundaries
99// ==========================================================================
100
101// IR at exactly 0x7FFF (max positive, no saturation)
102CESTER_TEST(edge_ir_max_no_sat, gte_tests,
103 cop2_put(8, 0x1000);
104 cop2_put(9, 0x7fff);
105 cop2_put(10, 0x7fff);
106 cop2_put(11, 0x7fff);
107 cop2_put(6, 0x00808080);
110 uint32_t ir1;
112 uint32_t flag = gte_read_flag();
113 // 0x1000 * 0x7FFF >> 12 = 0x7FFF -> no saturation
115 // FLAG.24 (IR1 sat) should NOT be set
116 uint32_t f24 = (flag >> 24) & 1;
118)
119
120// IR just over 0x7FFF (triggers saturation)
121CESTER_TEST(edge_ir_over_max, gte_tests,
122 cop2_put(8, 0x1001); // IR0 = 0x1001 (slightly > 1.0)
123 cop2_put(9, 0x7fff);
124 cop2_put(10, 0x100);
125 cop2_put(11, 0x100);
126 cop2_put(6, 0x00808080);
128 cop2_cmd(COP2_GPF(1, 0));
129 uint32_t ir1;
130 cop2_get(9, ir1);
131 uint32_t flag = gte_read_flag();
132 ramsyscall_printf("IR over max: IR1=0x%04x FLAG=0x%08x\n", ir1 & 0xffff, flag);
133 // 0x1001 * 0x7FFF >> 12 = 0x8000 -> saturates to 0x7FFF
134 cester_assert_uint_eq(0x7fff, ir1);
135 uint32_t f24 = (flag >> 24) & 1;
137)
138
139// ==========================================================================
140// MAC0 overflow boundaries
141// ==========================================================================
142
143// NCLIP with values designed to overflow MAC0
144CESTER_TEST(edge_mac0_positive_overflow, gte_tests,
145 // Maximize cross product: opposing corners of 16-bit range
146 cop2_put(12, (0x7fff << 16) | 0x7fff); // (32767, 32767)
147 cop2_put(13, (0x8000 << 16) | 0x8000); // (-32768, -32768)
148 cop2_put(14, 0x00000000); // (0, 0)
151 int32_t mac0;
152 uint32_t flag;
154 flag = gte_read_flag();
155 // SX0*(SY1-SY2) + SX1*(SY2-SY0) + SX2*(SY0-SY1)
156 // = 32767*(-32768) + (-32768)*(0-32767) + 0
157 // = -1073709056 + (-32768)*(-32767)
158 // = -1073709056 + 1073709056 = 0... hmm, that's zero
159 // Actually: 32767*(-32768-0) + (-32768)*(0-32767) + 0*(32767-(-32768))
160 // = 32767*(-32768) + (-32768)*(-32767)
161 // = -1073709056 + 1073709056 = 0
162 // Need asymmetric triangle for overflow
163 ramsyscall_printf("MAC0 overflow test: MAC0=%d FLAG=0x%08x (F16=%u F15=%u)\n",
164 mac0, flag, (flag >> 16) & 1, (flag >> 15) & 1);
165 // Cancels to zero - no actual overflow despite the test name
168)
169
170// NCLIP that actually overflows MAC0 negatively
171CESTER_TEST(edge_mac0_negative_overflow, gte_tests,
172 // (32767, 32767), (-32768, 32767), (32767, -32768)
173 cop2_put(12, (0x7fff << 16) | 0x7fff);
174 cop2_put(13, (0x7fff << 16) | 0x8000);
175 cop2_put(14, (0x8000 << 16) | 0x7fff);
178 int32_t mac0;
179 uint32_t flag;
180 cop2_get(24, mac0);
181 flag = gte_read_flag();
182 ramsyscall_printf("MAC0 neg overflow: MAC0=%d FLAG=0x%08x\n", mac0, flag);
183 // The cross product should be large negative
184 // FLAG.15 (MAC0 negative overflow) should be set
185 cester_assert_int_eq(-131071, mac0);
186 // FLAG.16 set from intermediate positive overflow in NCLIP's chained additions
187 uint32_t f16 = (flag >> 16) & 1;
188 cester_assert_uint_eq(1, f16);
189)
190
191// ==========================================================================
192// Color saturation boundaries
193// ==========================================================================
194
195// Color output at exactly 255 (no saturation)
196CESTER_TEST(edge_color_at_255, gte_tests,
197 cop2_put(8, 0x1000);
198 cop2_put(9, 0x0ff0); // MAC1 = 0x0ff0, /16 = 255
199 cop2_put(10, 0x0ff0);
200 cop2_put(11, 0x0ff0);
201 cop2_put(6, 0x00808080);
203 cop2_cmd(COP2_GPF(1, 0));
204 uint32_t rgb2, flag;
206 flag = gte_read_flag();
207 uint32_t r_255 = rgb2 & 0xff;
209 uint32_t f21_255 = (flag >> 21) & 1;
210 cester_assert_uint_eq(0, f21_255); // No color saturation flag
211)
212
213// Color output at 256 (saturates to 255, FLAG set)
214CESTER_TEST(edge_color_at_256, gte_tests,
215 cop2_put(8, 0x1000);
216 cop2_put(9, 0x1000); // MAC1 = 0x1000, /16 = 256 -> saturates
217 cop2_put(10, 0x100);
218 cop2_put(11, 0x100);
219 cop2_put(6, 0x00808080);
221 cop2_cmd(COP2_GPF(1, 0));
222 uint32_t rgb2, flag;
223 cop2_get(22, rgb2);
224 flag = gte_read_flag();
225 uint32_t r_256 = rgb2 & 0xff;
226 cester_assert_uint_eq(255, r_256); // saturated to 255
227 uint32_t f21_256 = (flag >> 21) & 1;
228 cester_assert_uint_eq(1, f21_256); // R saturation flag set
229)
230
231// Negative color (saturates to 0, FLAG set)
232CESTER_TEST(edge_color_negative, gte_tests,
233 cop2_put(8, 0x1000);
234 cop2_put(9, 0xffff8000); // IR1 = -32768 -> negative MAC1 -> color=0
235 cop2_put(10, 0x100);
236 cop2_put(11, 0x100);
237 cop2_put(6, 0x00808080);
239 cop2_cmd(COP2_GPF(1, 0));
240 uint32_t rgb2, flag;
241 cop2_get(22, rgb2);
242 flag = gte_read_flag();
243 uint32_t r_neg = rgb2 & 0xff;
244 cester_assert_uint_eq(0, r_neg); // clamped to 0
245 uint32_t f21_neg = (flag >> 21) & 1;
246 cester_assert_uint_eq(1, f21_neg); // Color R saturation flag
247)
248
249// ==========================================================================
250// Screen coordinate saturation
251// ==========================================================================
252
253// SX at exactly 0x3FF (max, no saturation)
254CESTER_TEST(edge_sx_at_max, gte_tests,
256 gte_set_translation(0, 0, 0);
257 cop2_putc(24, 0x3ff << 16); // OFX = 0x3FF in 16.16
258 cop2_putc(25, 0);
259 cop2_putc(26, 0); // H=0 -> quotient=0 -> SX = OFX only
260 cop2_putc(27, 0);
261 cop2_putc(28, 0);
262 cop2_put(0, 0);
263 cop2_put(1, 1000);
265 cop2_cmd(COP2_RTPS(1, 0));
266 uint32_t sxy2, flag;
267 cop2_get(14, sxy2);
268 flag = gte_read_flag();
269 int16_t sx = (int16_t)(sxy2 & 0xffff);
270 cester_assert_int_eq(0x3ff, sx);
271 uint32_t f14 = (flag >> 14) & 1;
272 cester_assert_uint_eq(0, f14); // no saturation
273)
274
275// SX at 0x400 (saturates to 0x3FF)
276CESTER_TEST(edge_sx_over_max, gte_tests,
278 gte_set_translation(0, 0, 0);
279 cop2_putc(24, 0x400 << 16); // OFX = 0x400
280 cop2_putc(25, 0);
281 cop2_putc(26, 0);
282 cop2_putc(27, 0);
283 cop2_putc(28, 0);
284 cop2_put(0, 0);
285 cop2_put(1, 1000);
287 cop2_cmd(COP2_RTPS(1, 0));
288 uint32_t sxy2, flag;
289 cop2_get(14, sxy2);
290 flag = gte_read_flag();
291 int16_t sx = (int16_t)(sxy2 & 0xffff);
292 cester_assert_int_eq(0x3ff, sx); // saturated
293 uint32_t f14 = (flag >> 14) & 1;
295)
296
297// SY at -0x400 (min, no saturation)
298CESTER_TEST(edge_sy_at_min, gte_tests,
300 gte_set_translation(0, 0, 0);
301 cop2_putc(24, 0);
302 cop2_putc(25, (uint32_t)(-0x400) << 16); // OFY = -0x400
303 cop2_putc(26, 0);
304 cop2_putc(27, 0);
305 cop2_putc(28, 0);
306 cop2_put(0, 0);
307 cop2_put(1, 1000);
309 cop2_cmd(COP2_RTPS(1, 0));
310 uint32_t sxy2, flag;
311 cop2_get(14, sxy2);
312 flag = gte_read_flag();
313 int16_t sy = (int16_t)(sxy2 >> 16);
314 cester_assert_int_eq(-0x400, sy);
315 uint32_t f13 = (flag >> 13) & 1;
316 cester_assert_uint_eq(0, f13);
317)
318
319// ==========================================================================
320// Degenerate matrix states
321// ==========================================================================
322
323// Zero rotation matrix: everything should become translation only
324CESTER_TEST(edge_zero_matrix, gte_tests,
330 gte_set_translation(100, 200, 300);
331 cop2_put(0, (0x7fff << 16) | 0x7fff); // large vertex
332 cop2_put(1, 0x7fff);
335 int32_t mac1, mac2, mac3;
339 // Zero matrix * anything = 0, plus translation
343)
344
345// Max magnitude matrix elements
346CESTER_TEST(edge_max_matrix, gte_tests,
347 cop2_putc(0, 0x7fff7fff); // R11=R12=0x7FFF
348 cop2_putc(1, 0x7fff7fff);
349 cop2_putc(2, 0x7fff7fff);
350 cop2_putc(3, 0x7fff7fff);
351 cop2_putc(4, 0x7fff);
352 gte_set_translation(0, 0, 0);
353 cop2_put(0, (0x7fff << 16) | 0x7fff);
354 cop2_put(1, 0x7fff);
357 int32_t mac1;
358 uint32_t flag;
359 cop2_get(25, mac1);
360 flag = gte_read_flag();
361 ramsyscall_printf("max matrix: MAC1=%d FLAG=0x%08x\n", mac1, flag);
362 // 3 * 0x7FFF * 0x7FFF = 3 * 1073676289 = 3221028867
363 // >> 12 = 786380, fits in 32-bit MAC. But 44-bit accumulator overflow?
364 cester_assert_int_eq(786384, mac1);
365 cester_assert_uint_eq(0x81c00000, flag);
366)
367
368// Negative Z in RTPS (behind camera)
369CESTER_TEST(edge_negative_z, gte_tests,
371 gte_set_translation(0, 0, -1000); // TRZ = -1000
372 gte_set_screen(160 << 16, 120 << 16, 200);
373 cop2_put(0, (0 << 16) | 100);
374 cop2_put(1, 0); // VZ=0, MAC3 = TRZ = -1000
376 cop2_cmd(COP2_RTPS(1, 0));
377 uint32_t sz3, flag;
378 int32_t mac3;
380 cop2_get(27, mac3);
381 flag = gte_read_flag();
382 ramsyscall_printf("neg Z: MAC3=%d SZ3=%u FLAG=0x%08x\n", mac3, sz3, flag);
383 // MAC3 = -1000, SZ3 should saturate to 0 (Lm_D clamps to [0, 0xFFFF])
385 cester_assert_uint_eq(0, sz3); // saturated
386 uint32_t f18 = (flag >> 18) & 1;
387 cester_assert_uint_eq(1, f18); // OTZ/SZ3 saturation
388)
389
390// SQR of -0x8000 (minimum 16-bit signed)
391CESTER_TEST(edge_sqr_min_negative, gte_tests,
392 cop2_put(9, 0xffff8000); // IR1 = -32768
393 cop2_put(10, 0);
394 cop2_put(11, 0);
396 cop2_cmd(COP2_SQR(0, 0));
397 int32_t mac1;
398 uint32_t flag;
399 cop2_get(25, mac1);
400 flag = gte_read_flag();
401 // (-32768)^2 = 1073741824 = 0x40000000 (fits in 32-bit signed)
402 ramsyscall_printf("SQR(-32768): MAC1=%d FLAG=0x%08x\n", mac1, flag);
403 cester_assert_int_eq(1073741824, mac1);
404)
405
406// GPL with negative MAC base
407CESTER_TEST(edge_gpl_negative_base, gte_tests,
408 cop2_put(25, -10000); // MAC1 = -10000
409 cop2_put(26, -20000);
410 cop2_put(27, -30000);
411 cop2_put(8, 0x1000); // IR0 = 1.0
412 cop2_put(9, 100);
413 cop2_put(10, 200);
414 cop2_put(11, 300);
415 cop2_put(6, 0x00808080);
418 int32_t mac1, mac2, mac3;
419 cop2_get(25, mac1);
420 cop2_get(26, mac2);
421 cop2_get(27, mac3);
422 // GPL sf=1: MAC = (old_MAC << 12 + IR0*IR) >> 12
423 // = ((-10000 << 12) + 4096*100) >> 12
424 // = (-40960000 + 409600) >> 12
425 // = -40550400 >> 12 = -9900
428 cester_assert_int_eq(-29700, mac3);
429)
430
431// ==========================================================================
432// FLAG cleared at instruction start
433// ==========================================================================
434
435// Verify FLAG is reset to 0 at the start of each GTE instruction,
436// not accumulating from previous instructions
437CESTER_TEST(edge_flag_cleared_each_instruction, gte_tests,
438 // First: trigger IR1 saturation via GPF
439 cop2_put(8, 0x1001);
440 cop2_put(9, 0x7fff);
441 cop2_put(10, 0x100);
442 cop2_put(11, 0x100);
443 cop2_put(6, 0x00808080);
445 cop2_cmd(COP2_GPF(1, 0));
446 uint32_t flag1 = gte_read_flag();
447 uint32_t f24_1 = (flag1 >> 24) & 1;
448 cester_assert_uint_eq(1, f24_1); // IR1 saturated
449
450 // Now: run a clean GPF that should NOT trigger any flags
451 cop2_put(8, 0x1000);
452 cop2_put(9, 0x100);
453 cop2_put(10, 0x100);
454 cop2_put(11, 0x100);
455 cop2_put(6, 0x00808080);
456 // Do NOT call gte_clear_flag() - the instruction should clear it itself
457 cop2_cmd(COP2_GPF(1, 0));
458 uint32_t flag2 = gte_read_flag();
459 // FLAG should be 0 - the instruction clears it at start
460 cester_assert_uint_eq(0, flag2);
461)
462
463// ==========================================================================
464// IR0 saturation boundary
465// ==========================================================================
466
467// IR0 at exactly 0x1000 (max, no saturation)
468CESTER_TEST(edge_ir0_at_max, gte_tests,
470 gte_set_translation(0, 0, 0);
471 cop2_putc(24, 0);
472 cop2_putc(25, 0);
473 cop2_putc(26, 200);
474 cop2_putc(27, 0); // DQA = 0
475 cop2_putc(28, 0x1000000); // DQB = 0x1000000 -> MAC0=DQB, IR0=DQB>>12=0x1000
476 cop2_put(0, 0);
477 cop2_put(1, 1000);
479 cop2_cmd(COP2_RTPS(1, 0));
480 uint32_t ir0, flag;
482 flag = gte_read_flag();
483 ramsyscall_printf("IR0 max: IR0=0x%04x FLAG=0x%08x\n", ir0 & 0xffff, flag);
484 // IR0 should be exactly 0x1000
485 uint32_t f12 = (flag >> 12) & 1;
486 cester_assert_uint_eq(0, f12); // no saturation
487)
488
489// ==========================================================================
490// OTZ saturation boundary
491// ==========================================================================
492
493// OTZ at exactly 0xFFFF (max, triggers saturation)
494CESTER_TEST(edge_otz_at_max, gte_tests,
495 // Need MAC0 >> 12 = 0xFFFF -> MAC0 = 0xFFFF << 12 = 0xFFFF000
496 // ZSF3 * (SZ1+SZ2+SZ3) = 0xFFFF000
497 // Use ZSF3 = 0x1000, SZ_sum = 0xFFFF -> each SZ = 0x5555
498 cop2_put(17, 0x5555);
499 cop2_put(18, 0x5555);
500 cop2_put(19, 0x5555);
501 cop2_putc(29, 0x1000);
504 uint32_t otz, flag;
505 cop2_get(7, otz);
506 flag = gte_read_flag();
507 ramsyscall_printf("OTZ max: OTZ=%u FLAG=0x%08x\n", otz, flag);
508 // 0x5555*3 = 0xFFFF, * 0x1000 = 0xFFFF000, >> 12 = 0xFFFF
509 cester_assert_uint_eq(0xffff, otz);
510)
511
512// ==========================================================================
513// Depth cue inner clamp (FC - input can go negative)
514// ==========================================================================
515
516// DPCS where FC << input color (FC-input negative, inner lm=0 clamp)
517CESTER_TEST(edge_depthcue_fc_less_than_input, gte_tests,
518 gte_set_far_color(0, 0, 0); // FC = 0 (dark fog)
519 cop2_put(6, 0x00ffffff); // RGBC: R=G=B=0xFF (bright)
520 cop2_put(8, 0x0800); // IR0 = 0.5
523 int32_t mac1;
524 uint32_t rgb2, flag;
525 cop2_get(25, mac1);
526 cop2_get(22, rgb2);
527 flag = gte_read_flag();
528 ramsyscall_printf("DPCS FC<input: MAC1=%d RGB2=0x%08x FLAG=0x%08x\n", mac1, rgb2, flag);
529 // FC=0, R=0xFF: diff = (0<<12) - (0xFF<<16) = -0xFF0000 (negative)
530 // Inner clamp (lm=0): clamps to [-0x8000, 0x7FFF]
531 // Then IR0 * clamped_diff + R<<16 -> should produce intermediate result
534 cester_assert_uint_eq(0x00000000, flag);
535)
536
537// ==========================================================================
538// INTPL where FC < IR (interpolation goes backward)
539// ==========================================================================
540
541CESTER_TEST(edge_intpl_fc_less_than_ir, gte_tests,
542 gte_set_far_color(0, 0, 0); // FC = 0
543 cop2_put(9, 0x1000); // IR = 0x1000 (> FC)
544 cop2_put(10, 0x1000);
545 cop2_put(11, 0x1000);
546 cop2_put(8, 0x0800); // IR0 = 0.5
547 cop2_put(6, 0x00808080);
549 cop2_cmd(COP2_INTPL(1, 0));
550 int32_t mac1;
551 uint32_t flag;
552 cop2_get(25, mac1);
553 flag = gte_read_flag();
554 ramsyscall_printf("INTPL FC<IR: MAC1=%d FLAG=0x%08x\n", mac1, flag);
555 // IR=0x1000, FC=0, IR0=0.5
556 // diff = (0<<12) - (0x1000<<12) = -0x1000000
557 // inner clamp: -0x1000000 >> 12 = -0x1000 -> clamped to -0x1000 (in range)
558 // MAC = 0x1000<<12 + 0x800 * (-0x1000) = 0x1000000 + (-0x800000)
559 // >> 12 = (0x800000) >> 12 = 0x800 = 2048
561 cester_assert_uint_eq(0x00000000, flag);
562)
#define COP2_INTPL(sf, lm)
Definition cop2.h:142
#define cop2_cmd(op)
Definition cop2.h:175
#define COP2_GPL(sf, lm)
Definition cop2.h:169
#define COP2_V_V0
Definition cop2.h:70
#define COP2_CV_NONE
Definition cop2.h:79
#define cop2_put(reg, val)
Definition cop2.h:191
#define COP2_SQR(sf, lm)
Definition cop2.h:161
#define COP2_MX_RT
Definition cop2.h:64
#define COP2_GPF(sf, lm)
Definition cop2.h:168
#define COP2_NCLIP
Definition cop2.h:133
#define cop2_putc(reg, val)
Definition cop2.h:205
#define COP2_RTPS(sf, lm)
Definition cop2.h:129
#define COP2_AVSZ3
Definition cop2.h:164
#define COP2_DPCS(sf, lm)
Definition cop2.h:139
#define COP2_MVMVA(sf, mx, v, cv, lm)
Definition cop2.h:145
#define cop2_get(reg, dest)
Definition cop2.h:198
#define COP2_CV_TR
Definition cop2.h:76
int32_t mac1
Definition gte-edgecase.c:335
uint32_t f21_255
Definition gte-edgecase.c:209
ramsyscall_printf("H=0: SX=%d FLAG=0x%08x\n", sx, flag)
gte_set_identity_rotation()
uint32_t ir1
Definition gte-edgecase.c:110
uint32_t sz3
Definition gte-edgecase.c:377
gte_set_far_color(0, 0, 0)
uint32_t sxy2
Definition gte-edgecase.c:38
uint32_t f17
Definition gte-edgecase.c:46
cester_assert_uint_eq(0, f17)
uint32_t f12
Definition gte-edgecase.c:485
uint32_t f14
Definition gte-edgecase.c:293
gte_tests
Definition gte-edgecase.c:30
uint32_t r_255
Definition gte-edgecase.c:207
uint32_t f18
Definition gte-edgecase.c:386
int16_t sx
Definition gte-edgecase.c:41
uint32_t r_neg
Definition gte-edgecase.c:243
uint32_t flag
Definition gte-edgecase.c:38
int32_t mac2
Definition gte-edgecase.c:335
gte_set_translation(0, 0, 0)
cester_assert_int_eq(0, sx)
gte_set_screen(0, 0, 0)
gte_clear_flag()
uint32_t ir0
Definition gte-edgecase.c:480
CESTER_TEST(edge_div_by_zero, gte_tests, gte_set_identity_rotation();gte_set_translation(0, 0, 0);gte_set_screen(0, 0, 200);cop2_put(0,(0<< 16)|100);cop2_put(1, 0);gte_clear_flag();cop2_cmd(COP2_RTPS(1, 0));uint32_t sz3, sxy2, flag;cop2_get(19, sz3);cop2_get(14, sxy2);flag=gte_read_flag();ramsyscall_printf("div/0: SZ3=%u SXY2=0x%08x FLAG=0x%08x\n", sz3, sxy2, flag);uint32_t f17=(flag > > 17) &1;cester_assert_uint_eq(1, f17);) CESTER_TEST(edge_div_h_zero
int32_t mac3
Definition gte-edgecase.c:335
uint32_t f24
Definition gte-edgecase.c:116
uint32_t rgb2
Definition gte-edgecase.c:204
int32_t mac0
Definition gte-edgecase.c:151
uint32_t f21_neg
Definition gte-edgecase.c:245
int16_t sy
Definition gte-rtps.c:38