diff --git a/code/duffle/gte.h b/code/duffle/gte.h index d23ce9c..dbfea64 100644 --- a/code/duffle/gte.h +++ b/code/duffle/gte.h @@ -647,6 +647,8 @@ enum { asm_clobber: clb_system, rlit(R_T4_Code), rlit(R_T5_Code), rlit(R_T6_Code) \ ) -// TODO(Ed): Resolve magic number. -/* PsyQ Compliant AVSZ3 Command Word */ -#define gte_cmdw_avsz3 (gte_cmd_base | 0x0158002D) +/* PsyQ compatibility bits for AVSZ3 (Bits 20, 22, 24 must be set) */ +#define gte_cmdw_psyq_avsz3_compat (0x15 << 20) +#define gte_cmd_avsz3 0x2D + +#define gte_cmdw_avsz3 (gte_cmd_base | enc_gte_cmd(gte_cmd_avsz3) | gte_cmdw_psyq_avsz3_compat) diff --git a/code/duffle/lottes_tape.h b/code/duffle/lottes_tape.h index 1c64090..18232f6 100644 --- a/code/duffle/lottes_tape.h +++ b/code/duffle/lottes_tape.h @@ -99,11 +99,11 @@ internal Code CodeBlob_(atom_floor_tri) { nop, nop, /* Wait for NCLIP to finish */ /* 4. Check NCLIP. - Temporarily disabled backface culling to ensure floor is visible regardless of winding! - To re-enable: replace the two nops below with `branch_le_zero(R_T0, 30)` */ + If MAC0 <= 0 (Backface), branch to end. + Target is 29 instructions past the delay slot. */ gte_mf(R_T0, C2_MAC0), nop, /* <--- FILL LOAD DELAY SLOT */ - nop, /* branch_le_zero(R_T0, 30), <-- CULLING DISABLED */ + branch_le_zero(R_T0, 29), /* <--- CULLING RE-ENABLED */ nop, /* <--- DELAY SLOT (Index 0) */ /* 5. Store Primitive Data */ @@ -131,7 +131,7 @@ internal Code CodeBlob_(atom_floor_tri) { /* CORRECTED DMA TAG LOGIC */ /* 18 (1) */ shift_ll( R_T1, R_T1, 2), - /* 19 (2) */ add_u( R_T1, R_T1, R_T6), /* T1 = &OrderingTable[OTZ] */ + /* 19 (2) */ add_u( R_T1, R_T1, R_T6), /* T1 = & OrderingTable[OTZ] */ /* 20 (3) */ load_word( R_AT, R_T1, 0), /* AT = current head (old_ot) */ /* 21 (4) */ load_ui( R_V0, 0x0400), /* V0 = 0x04000000 (Length = 4) */ diff --git a/code/gte_hello/hello_gte.c b/code/gte_hello/hello_gte.c index ffc2d52..a8b95c3 100644 --- a/code/gte_hello/hello_gte.c +++ b/code/gte_hello/hello_gte.c @@ -288,6 +288,12 @@ void update(PrimitiveArena* pa, U4* ordering_buf) // Draw floor tape method if (1) { + m3s2_rotation (& static_mem.floor.rot, & static_mem.tform_world); + m3s2_translation(& static_mem.tform_world, & static_mem.floor.pos); + m3s2_scale (& static_mem.tform_world, & static_mem.floor.scale); + gte_matrix_set_rotation (& static_mem.tform_world); + gte_matrix_set_translation(& static_mem.tform_world); + LP_ U4 mem_temp_tape[512]; // Buffer for function addresses FArena tape_arena; farena_init(&tape_arena, slice_ut(mem_temp_tape, S_(mem_temp_tape)));