From 72340811e5d6518e7e904e4cf42306c2a5db97af Mon Sep 17 00:00:00 2001 From: water Date: Sat, 14 Aug 2021 16:49:45 -0400 Subject: [PATCH] decomp decomp --- decompiler/Function/CfgVtx.cpp | 43 +- decompiler/analysis/atomic_op_builder.cpp | 46 +- decompiler/config/all-types.gc | 67 +- .../config/jak1_ntsc_black_label/hacks.jsonc | 11 +- .../jak1_ntsc_black_label/type_casts.jsonc | 21 + .../jak1_ntsc_black_label/var_names.jsonc | 32 + goal_src/engine/camera/cam-update.gc | 44 +- goal_src/engine/gfx/font.gc | 2711 +++++++---------- goal_src/engine/level/level-h.gc | 10 +- goal_src/engine/load/decomp.gc | 306 ++ .../decompiler/reference/decompiler-macros.gc | 8 + .../reference/engine/camera/cam-update_REF.gc | 44 +- .../reference/engine/debug/stats-h_REF.gc | 4 +- .../reference/engine/geometry/geometry_REF.gc | 10 +- .../engine/gfx/sprite/sprite-distort_REF.gc | 6 +- .../reference/engine/gfx/texture_REF.gc | 2 +- .../engine/gfx/tfrag/subdivide_REF.gc | 4 +- .../reference/engine/gfx/vis/bsp_REF.gc | 14 +- .../reference/engine/level/level-h_REF.gc | 4 +- 19 files changed, 1673 insertions(+), 1714 deletions(-) diff --git a/decompiler/Function/CfgVtx.cpp b/decompiler/Function/CfgVtx.cpp index e4d3ca1cfe..6e0110155f 100644 --- a/decompiler/Function/CfgVtx.cpp +++ b/decompiler/Function/CfgVtx.cpp @@ -477,6 +477,10 @@ bool ControlFlowGraph::is_while_loop(CfgVtx* b0, CfgVtx* b1, CfgVtx* b2) { if (!b0 || !b1 || !b2) return false; + if (b0->end_branch.asm_branch || b1->end_branch.asm_branch) { + return false; + } + // check next and prev if (b0->next != b1) return false; @@ -1243,6 +1247,10 @@ bool ControlFlowGraph::clean_up_asm_branches() { } // build new sequence replaced = true; + if (!b0->succ_branch) { + fmt::print("asm missing branch in block {}\n", b0->to_string()); + assert(false); + } m_blocks.at(b0->succ_branch->get_first_block_id())->needs_label = true; auto* new_seq = alloc(); @@ -1410,7 +1418,36 @@ bool ControlFlowGraph::clean_up_asm_branches() { old_seq->parent_claim(seq); return false; - } else { + } else if (!b0_seq && b1_seq) { + replaced = true; + if (!b0->succ_branch) { + fmt::print("bad: {}\n", b0->to_string()); + } + m_blocks.at(b0->succ_branch->get_first_block_id())->needs_label = true; + auto* old_seq = dynamic_cast(b1); + assert(old_seq); + if (b0->succ_branch) { + if (debug_asm_branch) { + fmt::print(" sbp: {}\n", !!b0->succ_branch->parent); + fmt::print(" sb: {}\n", b0->succ_branch->to_string()); + } + b0->succ_branch->replace_preds_with_and_check({b0}, nullptr); + } + + for (auto* p : b0->pred) { + p->replace_succ_and_check(b0, old_seq); + } + old_seq->pred = b0->pred; + old_seq->prev = b0->prev; + if (old_seq->prev) { + old_seq->prev->next = old_seq; + } + + old_seq->seq.insert(old_seq->seq.begin(), b0); + b0->parent_claim(old_seq); + } + + else { lg::error("unhandled sequences in clean_up_asm_branches seq: {} {}", !!b0_seq, !!b1_seq); } } @@ -1985,6 +2022,10 @@ bool ControlFlowGraph::find_cond_n_else() { return true; } + if (b0->end_branch.asm_branch) { + return true; + } + // printf("cne: c0 %s b0 %s\n", c0->to_string().c_str(), b0->to_string().c_str()); // first condition should have the _option_ to fall through to first body diff --git a/decompiler/analysis/atomic_op_builder.cpp b/decompiler/analysis/atomic_op_builder.cpp index 0843955438..b6f8ea42c2 100644 --- a/decompiler/analysis/atomic_op_builder.cpp +++ b/decompiler/analysis/atomic_op_builder.cpp @@ -417,10 +417,11 @@ std::unique_ptr make_branch(const IR2_Condition& condition, const Instruction& delay, bool likely, int dest_label, - int my_idx) { + int my_idx, + bool force_asm) { assert(!likely); auto branch_delay = get_branch_delay(delay, my_idx); - if (branch_delay.is_known()) { + if (!force_asm && branch_delay.is_known()) { return std::make_unique(likely, condition, dest_label, branch_delay, my_idx); } else { auto delay_op = std::shared_ptr(convert_1_allow_asm(delay, my_idx)); @@ -989,7 +990,8 @@ std::unique_ptr convert_jalr_2(const Instruction& i0, const Instructio std::unique_ptr convert_bne_2(const Instruction& i0, const Instruction& i1, int idx, - bool likely) { + bool likely, + bool force_asm) { auto s0 = i0.get_src(0).get_reg(); auto s1 = i0.get_src(1).get_reg(); auto dest = i0.get_src(2).get_label(); @@ -1007,13 +1009,14 @@ std::unique_ptr convert_bne_2(const Instruction& i0, make_src_atom(s1, idx)); condition.make_flipped(); } - return make_branch(condition, i1, likely, dest, idx); + return make_branch(condition, i1, likely, dest, idx, force_asm); } std::unique_ptr convert_beq_2(const Instruction& i0, const Instruction& i1, int idx, - bool likely) { + bool likely, + bool force_asm) { auto s0 = i0.get_src(0).get_reg(); auto s1 = i0.get_src(1).get_reg(); auto dest = i0.get_src(2).get_label(); @@ -1038,7 +1041,7 @@ std::unique_ptr convert_beq_2(const Instruction& i0, IR2_Condition(IR2_Condition::Kind::EQUAL, make_src_atom(s0, idx), make_src_atom(s1, idx)); condition.make_flipped(); } - return make_branch(condition, i1, likely, dest, idx); + return make_branch(condition, i1, likely, dest, idx, force_asm); } std::unique_ptr convert_daddiu_2(const Instruction& i0, const Instruction& i1, int idx) { @@ -1144,6 +1147,14 @@ std::unique_ptr convert_bgez_2(const Instruction& i0, const Instructio i1, false, dest, idx); } +std::unique_ptr convert_blez_2(const Instruction& i0, const Instruction& i1, int idx) { + // blez is never emitted outside of inline asm. + auto dest = i0.get_src(1).get_label(); + return make_asm_branch(IR2_Condition(IR2_Condition::Kind::LEQ_ZERO_SIGNED, + make_src_atom(i0.get_src(0).get_reg(), idx)), + i1, false, dest, idx); +} + std::unique_ptr convert_bgtz_2(const Instruction& i0, const Instruction& i1, int idx) { // bgtz is never emitted outside of inline asm. auto dest = i0.get_src(1).get_label(); @@ -1152,7 +1163,10 @@ std::unique_ptr convert_bgtz_2(const Instruction& i0, const Instructio i1, false, dest, idx); } -std::unique_ptr convert_2(const Instruction& i0, const Instruction& i1, int idx) { +std::unique_ptr convert_2(const Instruction& i0, + const Instruction& i1, + int idx, + bool force_asm_branch) { switch (i0.kind) { case InstructionKind::DIV: return convert_division_2(i0, i1, idx, true); @@ -1161,9 +1175,9 @@ std::unique_ptr convert_2(const Instruction& i0, const Instruction& i1 case InstructionKind::JALR: return convert_jalr_2(i0, i1, idx); case InstructionKind::BNE: - return convert_bne_2(i0, i1, idx, false); + return convert_bne_2(i0, i1, idx, false, force_asm_branch); case InstructionKind::BEQ: - return convert_beq_2(i0, i1, idx, false); + return convert_beq_2(i0, i1, idx, false, force_asm_branch); case InstructionKind::DADDIU: return convert_daddiu_2(i0, i1, idx); case InstructionKind::LUI: @@ -1180,6 +1194,8 @@ std::unique_ptr convert_2(const Instruction& i0, const Instruction& i1 return convert_bgez_2(i0, i1, idx); case InstructionKind::BGTZ: return convert_bgtz_2(i0, i1, idx); + case InstructionKind::BLEZ: + return convert_blez_2(i0, i1, idx); default: return nullptr; } @@ -1326,7 +1342,7 @@ std::unique_ptr convert_slt_3(const Instruction& i0, if (i1.kind == InstructionKind::BEQ) { condition.invert(); } - result = make_branch(condition, i2, false, dest, idx); + result = make_branch(condition, i2, false, dest, idx, false); add_clobber_if_unwritten(*result, temp); return result; } else if (i1.kind == InstructionKind::DADDIU && @@ -1391,7 +1407,7 @@ std::unique_ptr convert_slti_3(const Instruction& i0, if (i1.kind == InstructionKind::BEQ) { condition.invert(); } - result = make_branch(condition, i2, false, dest, idx); + result = make_branch(condition, i2, false, dest, idx, false); add_clobber_if_unwritten(*result, temp); return result; } else if (i1.kind == InstructionKind::DADDIU && @@ -1434,7 +1450,7 @@ std::unique_ptr convert_fp_branch(const Instruction& i0, if (i1.kind == InstructionKind::BC1F) { condition.invert(); } - return make_branch(condition, i2, false, i1.get_src(0).get_label(), idx); + return make_branch(condition, i2, false, i1.get_src(0).get_label(), idx, false); } return nullptr; } @@ -1496,7 +1512,7 @@ std::unique_ptr convert_dsll32_4(const Instruction& i0, assert(i2.get_src(1).is_reg(rr0())); IR2_Condition condition(IR2_Condition::Kind::IS_NOT_PAIR, make_src_atom(arg, idx)); - auto result = make_branch(condition, i3, false, i2.get_src(2).get_label(), idx); + auto result = make_branch(condition, i3, false, i2.get_src(2).get_label(), idx, false); result->add_clobber_reg(temp); return result; } @@ -1518,7 +1534,7 @@ std::unique_ptr convert_fp_branch_with_nop(const Instruction& i0, if (i2.kind == InstructionKind::BC1F) { condition.invert(); } - return make_branch(condition, i3, false, i2.get_src(0).get_label(), idx); + return make_branch(condition, i3, false, i2.get_src(0).get_label(), idx, false); } return nullptr; } @@ -1959,7 +1975,7 @@ int convert_block_to_atomic_ops(int begin_idx, if (!converted && n_instr >= 2) { // try 2 instructions - op = convert_2(instr[0], instr[1], op_idx); + op = convert_2(instr[0], instr[1], op_idx, block_ends_in_asm_branch); if (op) { converted = true; length = 2; diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 281db45696..fa60a2ce3e 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -4838,6 +4838,11 @@ ;; - Types +(defenum vis-info-flag + :bitfield #t + :type uint32 + (waiting-for-load 30) + ) (declare-type bsp-header basic) (deftype level-vis-info (basic) ((level symbol :offset-assert 4) @@ -4852,7 +4857,7 @@ (ramdisk uint32 :offset-assert 40) (vis-bits pointer :offset-assert 44) (current-vis-string uint32 :offset-assert 48) - (vis-string uint8 :dynamic :offset-assert 52) + (vis-string uint32 :dynamic :offset-assert 52) ) :method-count-assert 9 :size-assert #x34 @@ -4967,7 +4972,7 @@ (bsp-name (_type_) symbol 13) (dummy-14 (_type_ object) memory-usage-block 14) (dummy-15 (_type_ vector) symbol 15) - (dummy-16 (_type_ uint uint) none 16) + (update-vis! (_type_ level-vis-info uint uint) symbol 16) (load-continue (_type_) _type_ 17) (load-begin (_type_) _type_ 18) (login (_type_) _type_ 19) @@ -15236,22 +15241,22 @@ :flag-assert #x900000020 ) -; (deftype blerc-block (structure) -; ((output UNKNOWN 848 :offset-assert 0) -; (header blerc-block-header :inline :offset-assert 848) -; ) -; :method-count-assert 9 -; :size-assert #x370 -; :flag-assert #x900000370 -; ) +(deftype blerc-block (structure) + ((output uint8 848 :offset-assert 0) + (header blerc-block-header :inline :offset-assert 848) + ) + :method-count-assert 9 + :size-assert #x370 + :flag-assert #x900000370 + ) -; (deftype blerc-dcache (structure) -; ((repl-mult UNKNOWN 40 :offset-assert 0) -; ) -; :method-count-assert 9 -; :size-assert #x280 -; :flag-assert #x900000280 -; ) +(deftype blerc-dcache (structure) + ((repl-mult vector 40 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x280 + :flag-assert #x900000280 + ) (deftype blerc-globals (structure) ((first uint32 :offset-assert 0) @@ -15267,21 +15272,21 @@ :flag-assert #x900000018 ) -; (deftype blerc-context (structure) -; ((block-a blerc-block :inline :offset-assert 0) -; (dummy UNKNOWN 7312 :offset-assert 880) -; (block-b blerc-block :inline :offset-assert 8192) -; ) -; :method-count-assert 9 -; :size-assert #x2370 -; :flag-assert #x900002370 -; ) +(deftype blerc-context (structure) + ((block-a blerc-block :inline :offset-assert 0) + (dummy uint8 7312 :offset-assert 880) + (block-b blerc-block :inline :offset-assert 8192) + ) + :method-count-assert 9 + :size-assert #x2370 + :flag-assert #x900002370 + ) ;; - Functions (define-extern setup-blerc-chains-for-one-fragment function) (define-extern setup-blerc-chains function) -(define-extern blerc-stats-init function) +(define-extern blerc-stats-init (function none)) (define-extern blerc-init (function none)) (define-extern blerc-a-fragment function) (define-extern dma-from-spr function) @@ -15291,8 +15296,8 @@ ;; - Unknowns -;;(define-extern *blerc-globals* object) ;; unknown type -;;(define-extern *stats-blerc* object) ;; unknown type +(define-extern *blerc-globals* blerc-globals) +(define-extern *stats-blerc* symbol) ;; ---------------------- @@ -15801,8 +15806,8 @@ ;; - Functions -(define-extern unpack-comp-rle function) -(define-extern unpack-comp-huf function) +(define-extern unpack-comp-rle (function (pointer int8) (pointer int8) none)) +(define-extern unpack-comp-huf (function (pointer uint8) (pointer uint8) uint huf-dictionary-node none)) ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc index 85378e8650..ca78098841 100644 --- a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc @@ -189,11 +189,6 @@ "shadow-scissor-edges", "shadow-calc-dual-verts", - // decomp - //"(method 16 level)", // BUG: cfg fails - "unpack-comp-huf", - "unpack-comp-rle", - // background "upload-vis-bits", "background-upload-vu0", @@ -519,6 +514,10 @@ "end-perf-stat-collection": [0], "sprite-draw-distorters": [4, 5], "draw-string":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189], - "get-string-length":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50] + "get-string-length":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], + "unpack-comp-rle":[1, 3, 5, 6], + "(method 16 level)":[ 1, 5, 13, 14, 15, 19, 26, 53], + "unpack-comp-huf":[2, 4, 5, 6, 7, 8, 9] + } } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index ccb82371ab..5cebe6dbb0 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -2153,5 +2153,26 @@ [31, "v1", "int"] ], + "(method 16 level)": [ + [252, "v1", "(pointer uint128)"], + [253, "a1", "(pointer uint128)"], + [255, "a0", "(pointer uint128)"], + [208, "s2", "(pointer uint8)"], + [209, "s2", "(pointer uint8)"], + [210, "s1", "(pointer uint8)"], + [217, "s2", "(pointer uint8)"], + [218, "s1", "(pointer uint8)"], + [79, "a0", "(pointer uint128)"], + [80, "v1", "(pointer uint128)"], + [257, "v1", "(pointer uint16)"], + [222, "s2", "(pointer uint8)"], + [161, "s1", "(pointer uint128)"], + [140, "s1", "(pointer uint128)"] + ], + + "unpack-comp-huf": [ + [[21, 23], "t3", "(pointer uint16)"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index 4cfc3d9937..ce42b06f17 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -3130,5 +3130,37 @@ "add-debug-outline-triangle": { "args":["enable", "bucket", "p0", "p1", "p2", "color"] }, + + "unpack-comp-rle": { + "args":["out", "in"], + "vars":{ + "v1-2":"current-input", + "a2-0":"repeated-value", + "v1-3":"copy-length", + "a2-1":"src-val" + } + }, + + "(method 16 level)": { + "args":["obj", "vis-info"], + "vars":{ + "a0-1":"cam-leaf-idx", + "v1-1":"curr-vis-str", + "s4-0":"desired-vis-str", + "s4-1":"vis-buffer", + "s3-1":"vis-load-result", + "v1-28":"dest-bits", + "a1-3":"len", + "a0-19":"bsp-bits", + "a1-5":"len-qw", + "s2-0":"lower-flag-bits", + "s1-0":"spad-start", + "s0-0":"spad-end", + "s3-2":"list-len", + "v1-49":"list-qwc", + "v0-1":"result" + + } + }, "aaaaaaaaaaaaaaaaaaaaaaa": {} } diff --git a/goal_src/engine/camera/cam-update.gc b/goal_src/engine/camera/cam-update.gc index 3200e2ab5d..6cb8eec59a 100644 --- a/goal_src/engine/camera/cam-update.gc +++ b/goal_src/engine/camera/cam-update.gc @@ -187,48 +187,36 @@ (if (!= (-> s5-1 all-visible?) 'loading) (set! (-> s5-1 all-visible?) #f) ) - (let* ((a0-19 s5-1) - (t9-2 (method-of-object a0-19 dummy-16)) - (a1-17 s4-0) - (a2-1 (-> s4-0 ramdisk)) - ) - (-> s4-0 string-block) - (when (t9-2 a0-19 (the-as uint a1-17) a2-1) - (countdown (v1-40 8) - (let ((a0-22 (-> s5-1 vis-info v1-40))) - (when a0-22 - (if (!= a0-22 s4-0) - (set! (-> a0-22 current-vis-string) (the-as uint -1)) - ) + (when + (update-vis! s5-1 s4-0 (-> s4-0 ramdisk) (-> s4-0 string-block)) + (countdown (v1-40 8) + (let ((a0-22 (-> s5-1 vis-info v1-40))) + (when a0-22 + (if (!= a0-22 s4-0) + (set! (-> a0-22 current-vis-string) (the-as uint -1)) ) ) ) - (set! (-> s5-1 all-visible?) #f) ) + (set! (-> s5-1 all-visible?) #f) ) ) (a0-16 (if (!= (-> s5-1 all-visible?) 'loading) (set! (-> s5-1 all-visible?) #f) ) - (let* ((a0-24 s5-1) - (t9-3 (method-of-object a0-24 dummy-16)) - (a1-21 s3-0) - (a2-2 (-> s3-0 ramdisk)) - ) - (-> s3-0 string-block) - (when (t9-3 a0-24 (the-as uint a1-21) a2-2) - (countdown (v1-50 8) - (let ((a0-27 (-> s5-1 vis-info v1-50))) - (when a0-27 - (if (!= a0-27 s3-0) - (set! (-> a0-27 current-vis-string) (the-as uint -1)) - ) + (when + (update-vis! s5-1 s3-0 (-> s3-0 ramdisk) (-> s3-0 string-block)) + (countdown (v1-50 8) + (let ((a0-27 (-> s5-1 vis-info v1-50))) + (when a0-27 + (if (!= a0-27 s3-0) + (set! (-> a0-27 current-vis-string) (the-as uint -1)) ) ) ) - (set! (-> s5-1 all-visible?) #f) ) + (set! (-> s5-1 all-visible?) #f) ) ) ((and (= (-> s5-1 all-visible?) 'loading) (-> *level* play?)) diff --git a/goal_src/engine/gfx/font.gc b/goal_src/engine/gfx/font.gc index 4969f9ae64..d5af44ea98 100644 --- a/goal_src/engine/gfx/font.gc +++ b/goal_src/engine/gfx/font.gc @@ -5,9 +5,11 @@ ;; name in dgo: font ;; dgos: GAME, ENGINE +;; Font asm macros: +;; these could likely be reimplemented within the OpenGOAL compiler and be faster. + (defmacro .sll (result in sa) `(set! ,result (sext32 (the-as int (shl (logand ,in #xffffffff) ,sa)))) - ;`(set! ,result (shl (the-as int ,in) ,sa)) ) (defmacro .movz (result value check original) @@ -18,6 +20,8 @@ ) (defmacro .movz-128 (result value check original) + "movz, but keeps the upper 64 bits of a 128-bit register the same. + This is undocumented, but the game depends on it." `(let ((temp (new 'stack 'array 'uint64 2))) (set! (-> (the (pointer uint128) temp)) ,original) (if (= ,check 0) @@ -47,7 +51,6 @@ (defmacro .addu (result a b) `(set! ,result (sext32 (logand (+ (the-as int ,a) (the-as int ,b)) #xffffffff))) - ;`(set! ,result (+ (the-as int ,a) (the-as int ,b))) ) (defmacro sext32 (in) @@ -55,15 +58,12 @@ ) (defmacro .sra (result in sa) - ;;`(set! ,result (sext32 (logand #xffffffff (sar (the-as int ,in) ,sa)))) `(set! ,result (sext32 (sar (logand #xffffffff (the-as int ,in)) ,sa))) - ;`(sar (the-as int ,in) ,sa) ) -;; definition for symbol *font12-table*, type (inline-array vector) -(define - *font12-table* +;; font vertex table. +(define *font12-table* (new 'static 'inline-array vector 250 (new 'static 'vector :x 0.0039 :y 0.0019 :z 1.0 :w 15.0) (new 'static 'vector :x 0.0976 :y 0.0019 :z 1.0 :w 15.0) @@ -318,9 +318,7 @@ ) ) -;; definition for symbol *font24-table*, type (inline-array vector) -(define - *font24-table* +(define *font24-table* (new 'static 'inline-array vector 289 (new 'static 'vector :x 0.0039 :y 0.0019 :z 1.0 :w 12.0) (new 'static 'vector :x 0.0976 :y 0.0019 :z 1.0 :w 12.0) @@ -614,153 +612,27 @@ ) ) -(defmacro print-vf (vf &key (name #f)) - "Print out a vf register as a vector." - `(let ((temp (new 'stack 'vector))) - (.svf temp ,vf) - ,(if name - `(format 0 "~A: ~`vector`P~%" (quote ,name) temp) - `(format 0 "~`vector`P~%" temp) - ) - ) - ) - (defun draw-string ((str-in string) (context dma-buffer) (arg2 font-context)) + "Draw a string. Writes dma to the given buffer." (local-vars - (r0 uint128) - (v0-0 float) - (a0-2 int) - (font-table-12 (inline-array vector)) - (a3-6 (inline-array vector)) - (a3-8 (inline-array vector)) - (t0-1 int) - (q-hi-tmpl uint128) - (color-array-prod int) - (q-verts-2t uint128) - (q-verts-2 uint128) - (q-verts-3t uint128) - (q-verts-3 uint128) - (t4-6 int) - (fc-cr uint) - (t4-16 int) - (t4-17 int) - (t4-18 float) - (t4-19 int) - (t4-23 int) - (t4-32 int) - (t4-33 int) - (t4-36 uint128) - (t4-37 uint128) - (q-verts-1t uint128) - (q-verts-1 uint128) - (not-sc-lit1 uint) - (not-sc-~ uint) - (t5-6 int) - (t5-7 int) - (t5-9 int) - (t5-10 uint) - (t5-11 uint) - (t5-13 int) - (t5-14 int) - (t5-17 int) - (t5-18 int) - (t5-19 float) - (t5-20 int) - (t5-23 uint128) - (t5-24 uint) - (t5-25 uint) - (t5-27 int) - (t5-28 int) - (t5-32 uint128) - (t5-33 uint128) - (t5-35 uint128) - (t5-36 uint128) - (t5-39 int) - (t5-40 int) - (t5-41 float) - (t5-42 int) - (t5-45 uint128) - (q-verts-0t uint128) - (q-verts-0 uint128) - (t6-3 uint) - (t6-4 uint) - (t6-5 uint) - (t6-6 uint) - (t6-7 uint) - (t6-10 uint) - (t6-11 uint) - (t6-12 uint) - (t6-13 uint) - (t6-14 uint) - (t6-16 uint) - (t6-20 uint) - (t6-21 uint) - (t6-22 uint) - (t6-23 uint) - (t6-24 uint) - (t6-28 uint128) - (t6-29 uint128) - (t6-31 uint) - (t7-0 uint) - (t7-2 uint) - (t7-3 uint) - (t7-4 uint) - (t7-5 uint) - (t7-6 uint) - (t7-7 uint) - (t7-8 uint) - (t7-9 uint) - (t7-10 uint) - (t7-11 uint) - (t7-12 uint) - (t7-13 uint) - (t7-14 uint) - (t7-15 uint) - (t7-16 uint) - (t7-17 uint) - (t7-18 uint) - (t7-20 uint) - (t7-21 uint) - (t7-22 uint) - (t7-23 uint) - (t7-24 uint) - (t7-25 uint) - (t7-26 uint) - (t7-27 uint) - (t7-28 uint) - (t7-29 uint) - (t7-30 uint) - (t7-31 uint) - (t7-32 uint) - (t7-33 uint) - (t7-34 uint) - (t7-35 uint) - (t7-36 uint) - (t7-38 uint) - (t7-39 uint) - (t7-40 uint) - (t7-41 uint) - (t7-42 uint) - (t7-43 uint) - (t7-44 uint) - (t7-45 uint) - (t7-46 uint) - (t7-47 uint) - (t7-48 uint) - (t7-49 uint) - (t7-50 uint) - (t7-51 uint) - (t7-52 uint) - (t7-53 uint) - (t8-0 uint) - (t8-1 int) - (t8-2 uint) - (t8-3 int) - (t8-4 uint) - (t8-5 int) - (f31-0 none) - ) + (r0 uint128) (v0-0 float) (a0-2 int) (font-table-12 (inline-array vector)) (a3-6 (inline-array vector)) + (a3-8 (inline-array vector)) (t0-1 int) (q-hi-tmpl uint128) (color-array-prod int) (q-verts-2t uint128) + (q-verts-2 uint128) (q-verts-3t uint128) (q-verts-3 uint128) (t4-6 int) (fc-cr uint) (t4-16 int) (t4-17 int) + (t4-18 float) (t4-19 int) (t4-23 int) (t4-32 int) (t4-33 int) (t4-36 uint128) (t4-37 uint128) (q-verts-1t uint128) + (q-verts-1 uint128) (not-sc-lit1 uint) (not-sc-~ uint) (t5-6 int) (t5-7 int) (t5-9 int) (t5-10 uint) (t5-11 uint) + (t5-13 int) (t5-14 int) (t5-17 int) (t5-18 int) (t5-19 float) (t5-20 int) (t5-23 uint128) (t5-24 uint) (t5-25 uint) + (t5-27 int) (t5-28 int) (t5-32 uint128) (t5-33 uint128) (t5-35 uint128) (t5-36 uint128) (t5-39 int) (t5-40 int) + (t5-41 float) (t5-42 int) (t5-45 uint128) (q-verts-0t uint128) (q-verts-0 uint128) (t6-3 uint) (t6-4 uint) (t6-5 uint) + (t6-6 uint) (t6-7 uint) (t6-10 uint) (t6-11 uint) (t6-12 uint) (t6-13 uint) (t6-14 uint) (t6-16 uint) (t6-20 uint) + (t6-21 uint) (t6-22 uint) (t6-23 uint) (t6-24 uint) (t6-28 uint128) (t6-29 uint128) (t6-31 uint) (t7-0 uint) + (t7-2 uint) (t7-3 uint) (t7-4 uint) (t7-5 uint) (t7-6 uint) (t7-7 uint) (t7-8 uint) (t7-9 uint) (t7-10 uint) + (t7-11 uint) (t7-12 uint) (t7-13 uint) (t7-14 uint) (t7-15 uint) (t7-16 uint) (t7-17 uint) (t7-18 uint) (t7-20 uint) + (t7-21 uint) (t7-22 uint) (t7-23 uint) (t7-24 uint) (t7-25 uint) (t7-26 uint) (t7-27 uint) (t7-28 uint) (t7-29 uint) + (t7-30 uint) (t7-31 uint) (t7-32 uint) (t7-33 uint) (t7-34 uint) (t7-35 uint) (t7-36 uint) (t7-38 uint) (t7-39 uint) + (t7-40 uint) (t7-41 uint) (t7-42 uint) (t7-43 uint) (t7-44 uint) (t7-45 uint) (t7-46 uint) (t7-47 uint) (t7-48 uint) + (t7-49 uint) (t7-50 uint) (t7-51 uint) (t7-52 uint) (t7-53 uint) (t8-0 uint) (t8-1 int) (t8-2 uint) (t8-3 int) + (t8-4 uint) (t8-5 int)) (set! r0 (the-as uint128 0)) (rlet ((acc :class vf) @@ -795,1269 +667,968 @@ (vf8 :class vf) (vf9 :class vf) ) - (init-vf0-vector) - (let ((v1-0 *math-camera*)) - (.lvf vf26 (&-> v1-0 hvdf-off quad)) - (.lvf vf27 (&-> v1-0 hvdf-off quad)) - ) - (.add.w.vf vf26 vf26 vf0 :mask #b11) - (.add.w.vf vf26 vf26 vf0 :mask #b1) - (let ((v1-1 (-> arg2 mat))) - (.lvf vf25 (&-> arg2 context-vec quad)) - (.lvf vf23 (&-> arg2 origin quad)) - (.lvf vf24 (&-> arg2 origin quad)) - (.lvf vf28 (&-> v1-1 vector 0 quad)) - (.lvf vf29 (&-> v1-1 vector 1 quad)) - (.lvf vf30 (&-> v1-1 vector 2 quad)) - (.lvf vf31 (&-> v1-1 vector 3 quad)) - ) - (let ((v1-3 *video-parms*)) - (.lvf vf1 (+ (the-as int v1-3) 64)) - ) - (.mul.vf vf25 vf25 vf1 :mask #b11) - (.mul.vf vf23 vf23 vf1 :mask #b11) - (.mul.vf vf24 vf24 vf1 :mask #b11) - (let ((fw *font-work*)) - (set! (-> fw buf) context) - (let ((dma-out (-> context base))) - (set! (-> fw str-ptr) (the-as uint str-in)) - (let ((flags (-> arg2 flags-signed))) - (.mov.vf vf1 vf0) - (.mov.vf vf2 vf0) - (.mov.vf vf3 vf0) - (.mov.vf vf4 vf0) - (set! (-> fw flags) (the-as uint flags)) - (.lvf vf16 (&-> fw size-st1 quad)) - (.lvf vf17 (&-> fw size-st2 quad)) - (.lvf vf18 (&-> fw size-st3 quad)) - (let ((has-flag-size24 (logand flags 32))) - (nop!) - (b! - (nonzero? has-flag-size24) - cfg-2 - :delay - (set! font-table-12 *font12-table*) + (init-vf0-vector) + (let ((v1-0 *math-camera*)) + (.lvf vf26 (&-> v1-0 hvdf-off quad)) + (.lvf vf27 (&-> v1-0 hvdf-off quad)) + ) + (.add.w.vf vf26 vf26 vf0 :mask #b11) + (.add.w.vf vf26 vf26 vf0 :mask #b1) + (let ((v1-1 (-> arg2 mat))) + (.lvf vf25 (&-> arg2 context-vec quad)) + (.lvf vf23 (&-> arg2 origin quad)) + (.lvf vf24 (&-> arg2 origin quad)) + (.lvf vf28 (&-> v1-1 vector 0 quad)) + (.lvf vf29 (&-> v1-1 vector 1 quad)) + (.lvf vf30 (&-> v1-1 vector 2 quad)) + (.lvf vf31 (&-> v1-1 vector 3 quad)) + ) + (let ((v1-3 *video-parms*)) + (.lvf vf1 (+ (the-as int v1-3) 64)) + ) + (.mul.vf vf25 vf25 vf1 :mask #b11) + (.mul.vf vf23 vf23 vf1 :mask #b11) + (.mul.vf vf24 vf24 vf1 :mask #b11) + (let ((fw *font-work*)) + (set! (-> fw buf) context) + (let ((dma-out (-> context base))) + (set! (-> fw str-ptr) (the-as uint str-in)) + (let ((flags (-> arg2 flags-signed))) + (.mov.vf vf1 vf0) + (.mov.vf vf2 vf0) + (.mov.vf vf3 vf0) + (.mov.vf vf4 vf0) + (set! (-> fw flags) (the-as uint flags)) + (.lvf vf16 (&-> fw size-st1 quad)) + (.lvf vf17 (&-> fw size-st2 quad)) + (.lvf vf18 (&-> fw size-st3 quad)) + (let ((has-flag-size24 (logand flags 32))) + (b! + (nonzero? has-flag-size24) + cfg-2 + :delay + (set! font-table-12 *font12-table*) + ) + ) + (let ((font-table-to-use font-table-12)) + (.lvf vf13 (&-> fw size1-small quad)) + (.lvf vf14 (&-> fw size2-small quad)) + (.lvf vf15 (&-> fw size3-small quad)) + (let ((q-lo-tmpl (-> fw small-font-lo-tmpl-qw))) + (b! #t cfg-3 :delay (set! q-hi-tmpl (-> fw small-font-hi-tmpl-qw))) + (label cfg-2) + (set! font-table-to-use *font24-table*) + (.lvf vf13 (&-> fw size1-large quad)) + (.lvf vf14 (&-> fw size2-large quad)) + (.lvf vf15 (&-> fw size3-large quad)) + (set! q-lo-tmpl (-> fw large-font-lo-tmpl-qw)) + (set! q-hi-tmpl (-> fw large-font-hi-tmpl-qw)) + (label cfg-3) + (let ((in-color (-> arg2 color-s32))) + (set! (-> fw last-color-32) in-color) + (.sll color-array-prod in-color 4) + ) + (let ((fw+col (the-as object (+ color-array-prod (the-as int fw))))) + (let ((q-verts-0p (the-as uint128 (-> (the-as (pointer uint32) fw+col) 496)))) + (let ((q-verts-1p (the-as uint128 (-> (the-as (pointer uint32) fw+col) 497)))) + (.pextlb q-verts-0t r0 q-verts-0p) + (let ((q-verts-2p (the-as uint128 (-> (the-as (pointer uint32) fw+col) 498)))) + (.pextlh q-verts-0 r0 q-verts-0t) + (let ((q-verts-3p (the-as uint128 (-> (the-as (pointer uint32) fw+col) 499)))) + (.pextlb q-verts-1t r0 q-verts-1p) + (set! (-> fw current-verts color 0 quad) (the-as uint128 q-verts-0)) + (.pextlh q-verts-1 r0 q-verts-1t) + (set! (-> fw dest-verts color 0 quad) (the-as uint128 q-verts-0)) + (.pextlb q-verts-2t r0 q-verts-2p) + (set! (-> fw current-verts color 1 quad) (the-as uint128 q-verts-1)) + (.pextlh q-verts-2 r0 q-verts-2t) + (set! (-> fw dest-verts color 1 quad) (the-as uint128 q-verts-1)) + (.pextlb q-verts-3t r0 q-verts-3p) + ) + ) + ) + ) + ) + (set! (-> fw current-verts color 2 quad) (the-as uint128 q-verts-2)) + (.pextlh q-verts-3 r0 q-verts-3t) + (set! (-> fw dest-verts color 2 quad) (the-as uint128 q-verts-2)) + (set! (-> fw current-verts color 3 quad) (the-as uint128 q-verts-3)) + (set! (-> fw dest-verts color 3 quad) (the-as uint128 q-verts-3)) + (let ((fw2 (the-as object fw))) + (label cfg-4) + (let ((str-char (-> (the-as (pointer uint8) str-in) 4))) + (set! str-in (the-as string (&-> (the-as (pointer uint8) str-in) 1))) + (b! (zero? str-char) cfg-67 :delay (set! not-sc-lit1 (+ str-char -1))) + (b! (zero? not-sc-lit1) cfg-54 + :delay (set! not-sc-~ (+ str-char -126)) + ) + (b! (nonzero? not-sc-~) cfg-55) + (set! str-char (-> (the-as (pointer uint8) str-in) 4)) + (set! str-in (the-as string (&-> (the-as (pointer uint8) str-in) 1))) + (let ((t5-5 0) + (t6-2 0) + ) + (b! (zero? str-char) cfg-67 :delay (set! t7-0 (+ str-char -43))) + (.movz t5-6 str-char t7-0 t5-5) + (let ((t7-1 (+ str-char -45))) + (.movz t5-7 str-char t7-1 t5-6) + ) + (b! (nonzero? t5-7) cfg-15 :delay (set! t7-2 (+ str-char -121))) + (b! (zero? t7-2) cfg-52 :delay (set! t6-3 (+ str-char -89))) + (b! (zero? t6-3) cfg-52 :delay (set! t6-4 (+ str-char -122))) + (b! (zero? t6-4) cfg-53 :delay (set! t6-5 (+ str-char -90))) + (b! (zero? t6-5) cfg-53 :delay (set! t6-6 (+ str-char -48))) + (b! (< (the-as int t6-6) 0) + cfg-55 + :delay (set! t6-7 (+ str-char -57)) + ) + (b! (> (the-as int t6-7) 0) + cfg-55 + :delay (set! t6-2 (the-as int (+ str-char -48))) + ) + (label cfg-15) + (set! str-char (-> (the-as (pointer uint8) str-in) 4)) + (set! str-in (the-as string (&-> (the-as (pointer uint8) str-in) 1))) + (b! (zero? str-char) cfg-67 :delay (set! t7-3 (+ str-char -110))) + (b! (zero? t7-3) cfg-33 :delay (set! t7-4 (+ str-char -78))) + (b! (zero? t7-4) cfg-33 :delay (set! t7-5 (+ str-char -108))) + (b! (zero? t7-5) cfg-4 :delay (set! t7-6 (+ str-char -76))) + (b! (zero? t7-6) cfg-4 :delay (set! t7-7 (+ str-char -119))) + (b! (zero? t7-7) cfg-4 :delay (set! t7-8 (+ str-char -87))) + (b! (zero? t7-8) cfg-4 :delay (set! t7-9 (+ str-char -107))) + (b! (zero? t7-9) cfg-36 :delay (set! t7-10 (+ str-char -75))) + (b! (zero? t7-10) cfg-36 :delay (set! t7-11 (+ str-char -106))) + (b! (zero? t7-11) cfg-38 :delay (set! t7-12 (+ str-char -74))) + (b! (zero? t7-12) cfg-38 :delay (set! t7-13 (+ str-char -104))) + (b! (zero? t7-13) cfg-42 :delay (set! t7-14 (+ str-char -72))) + (b! (zero? t7-14) cfg-42 :delay (set! t7-15 (+ str-char -118))) + (b! (zero? t7-15) cfg-47 :delay (set! t7-16 (+ str-char -86))) + (b! (zero? t7-16) cfg-47 :delay (set! t7-17 (+ str-char -48))) + (b! (< (the-as int t7-17) 0) + cfg-55 + :delay (set! t8-0 (+ str-char -57)) + ) + (b! (> (the-as int t8-0) 0) cfg-55 :delay (.sll t8-1 t6-2 2)) + (let ((t4-5 (+ t6-2 t8-1))) + (.sll t4-6 t4-5 1) + ) + (b! #t cfg-15 :delay (set! t6-2 (+ t4-6 t7-17))) + (label cfg-33) + (b! (nonzero? t6-2) cfg-35 :delay (set! t0-1 -33)) + (set! font-table-to-use *font12-table*) + (.lvf vf13 (&-> fw size1-small quad)) + (.lvf vf14 (&-> fw size2-small quad)) + (.lvf vf15 (&-> fw size3-small quad)) + (set! flags (logand flags t0-1)) + (set! q-lo-tmpl (-> fw small-font-lo-tmpl-qw)) + (b! #t cfg-4 :delay (set! q-hi-tmpl (-> fw small-font-hi-tmpl-qw))) + (label cfg-35) + (set! font-table-to-use *font24-table*) + (.lvf vf13 (&-> fw size1-large quad)) + (.lvf vf14 (&-> fw size2-large quad)) + (.lvf vf15 (&-> fw size3-large quad)) + (set! flags (logior flags 32)) + (set! q-lo-tmpl (-> fw large-font-lo-tmpl-qw)) + (b! #t cfg-4 :delay (set! q-hi-tmpl (-> fw large-font-hi-tmpl-qw))) + (label cfg-36) + (let ((t4-7 -3)) + (b! (zero? t6-2) cfg-4 :delay (set! flags (logand flags t4-7))) + ) + (b! #t cfg-4 :delay (set! flags (logior flags 2))) + (label cfg-38) + (let ((t4-8 -21) + (t5-8 (+ t6-2 -2)) + ) + (b! (zero? t6-2) cfg-4 :delay (set! flags (logand flags t4-8))) + (b! (zero? t5-8) cfg-41) + ) + (b! #t cfg-4 :delay (set! flags (logior flags 16))) + (label cfg-41) + (b! #t cfg-4 :delay (set! flags (logior flags 4))) + (label cfg-42) + (.mov vf1 t6-2) + (let ((t4-9 (+ t5-7 -45))) + (b! (zero? t5-7) cfg-46 :delay (.itof.vf vf1 vf1)) + (b! (zero? t4-9) cfg-45) + ) + (b! #t cfg-4 :delay (.add.x.vf vf23 vf23 vf1 :mask #b1)) + (label cfg-45) + (b! #t cfg-4 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b1)) + (label cfg-46) + (b! #t cfg-4 :delay (.add.x.vf vf23 vf0 vf1 :mask #b1)) + (label cfg-47) + (.mov vf1 t6-2) + ) + (let ((t4-10 (+ t5-7 -45))) + (b! (zero? t5-7) cfg-51 :delay (.itof.vf vf1 vf1)) + (b! (zero? t4-10) cfg-50) + ) + (b! #t cfg-4 :delay (.add.x.vf vf23 vf23 vf1 :mask #b10)) + (label cfg-50) + (b! #t cfg-4 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b10)) + (label cfg-51) + (b! #t cfg-4 :delay (.add.x.vf vf23 vf0 vf1 :mask #b10)) + (label cfg-52) + (b! #t cfg-4 :delay (.svf (&-> fw save quad) vf23)) + (label cfg-53) + (b! #t cfg-4 :delay (.lvf vf23 (&-> fw save quad))) + (label cfg-54) + (let ((t4-11 (-> (the-as (pointer uint8) str-in) 4))) + (set! str-in (the-as string (&-> (the-as (pointer uint8) str-in) 1))) + (.add.vf vf4 vf23 vf15 :mask #b111) + (let ((t4-12 (logand t4-11 127))) + (.sub.vf vf1 vf25 vf23) + (let ((t4-13 (+ t4-12 255))) + (b! #t cfg-62 :delay (.sll t5-9 t4-13 4)) + ) + ) + ) + (label cfg-55) + (.add.vf vf4 vf23 vf15 :mask #b111) + (.sll t5-9 str-char 4) + (.sub.vf vf1 vf25 vf23) + (b! (= str-char 10) cfg-57 :delay (set! fc-cr (+ str-char -13))) + ) + (b! (nonzero? fc-cr) cfg-62) + (label cfg-57) + (.sub.vf vf1 vf23 vf24) + (b! (logtest? flags 16) cfg-60 :delay (set! t4-16 (logand flags 4))) + (b! (nonzero? t4-16) cfg-61) + (.add.x.vf vf23 vf0 vf24 :mask #b1) + (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) + (.add.w.vf vf23 vf23 vf15 :mask #b10) + (b! + #t + cfg-4 + :delay + (set! fw2 (-> (the-as font-work fw2) font-tmpl gif)) + ) + (label cfg-60) + (.sub.vf vf23 vf24 vf1 :mask #b1) + (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) + (.add.x.vf vf23 vf0 vf24 :mask #b1) + (.add.w.vf vf23 vf23 vf15 :mask #b10) + (b! + #t + cfg-4 + :delay + (set! fw2 (-> (the-as font-work fw2) font-tmpl gif)) + ) + (label cfg-61) + (.mul.w.vf vf1 vf1 vf16 :mask #b1) + (.sub.vf vf23 vf24 vf1 :mask #b1) + (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) + (.add.x.vf vf23 vf0 vf24 :mask #b1) + (.add.w.vf vf23 vf23 vf15 :mask #b10) + (b! + #t + cfg-4 + :delay + (set! fw2 (-> (the-as font-work fw2) font-tmpl gif)) + ) + (label cfg-62) + (.addu t4-17 t5-9 font-table-to-use) + (.lvf vf5 (+ t4-17 -256)) + (.mov t4-18 vf1) + (b! (< (the-as int t4-18) 0) cfg-67 :delay (.sra t4-19 t4-18 31)) + (.mul.vf vf19 vf5 vf13) + (b! (zero? (logand flags 2)) cfg-65) + (b! #t cfg-66 :delay (.add.w.vf vf23 vf23 vf19 :mask #b1)) + (label cfg-65) + (.add.w.vf vf23 vf23 vf14 :mask #b1) + (label cfg-66) + (b! #t cfg-4) + (label cfg-67) + (.sub.vf vf1 vf23 vf24) + (b! (logtest? flags 16) cfg-70 :delay (set! a0-2 (logand flags 4))) + (b! (nonzero? a0-2) cfg-71) + (.add.x.vf vf23 vf0 vf24 :mask #b1) + (b! + #t + cfg-72 + :delay + (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) + ) + (label cfg-70) + (.sub.vf vf23 vf24 vf1 :mask #b1) + (b! + #t + cfg-72 + :delay + (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) + ) + (label cfg-71) + (.mul.w.vf vf1 vf1 vf16 :mask #b1) + (.sub.vf vf23 vf24 vf1 :mask #b1) + (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) + ) + (label cfg-72) + (let ((a0-3 (-> fw flags-signed))) + (let ((t2-1 (the-as object fw)) + (t3-7 (-> fw str-ptr-signed)) + ) + (.lvf vf23 (&-> (the-as font-work t2-1) justify 0 quad)) + (label cfg-73) + (let ((t4-21 (-> t3-7 4))) + (set! t3-7 (&-> t3-7 1)) + (b! (zero? t4-21) cfg-131 :delay (set! t5-10 (+ t4-21 -1))) + (b! (zero? t5-10) cfg-121 :delay (set! t5-11 (+ t4-21 -126))) + (b! (nonzero? t5-11) cfg-122) + (set! t4-21 (-> t3-7 4)) + (set! t3-7 (&-> t3-7 1)) + (let ((t5-12 0) + (t6-9 0) + ) + (b! (zero? t4-21) cfg-131 :delay (set! t7-18 (+ t4-21 -43))) + (.movz t5-13 t4-21 t7-18 t5-12) + (let ((t7-19 (+ t4-21 -45))) + (.movz t5-14 t4-21 t7-19 t5-13) + ) + (b! (nonzero? t5-14) cfg-84 :delay (set! t7-20 (+ t4-21 -121))) + (b! (zero? t7-20) cfg-119 :delay (set! t6-10 (+ t4-21 -89))) + (b! (zero? t6-10) cfg-119 :delay (set! t6-11 (+ t4-21 -122))) + (b! (zero? t6-11) cfg-120 :delay (set! t6-12 (+ t4-21 -90))) + (b! (zero? t6-12) cfg-120 :delay (set! t6-13 (+ t4-21 -48))) + (b! + (< (the-as int t6-13) 0) + cfg-122 + :delay + (set! t6-14 (+ t4-21 -57)) + ) + (b! + (> (the-as int t6-14) 0) + cfg-122 + :delay + (set! t6-9 (the-as int (+ t4-21 -48))) + ) + (label cfg-84) + (set! t4-21 (-> t3-7 4)) + (set! t3-7 (&-> t3-7 1)) + (b! (zero? t4-21) cfg-131 :delay (set! t7-21 (+ t4-21 -110))) + (b! (zero? t7-21) cfg-102 :delay (set! t7-22 (+ t4-21 -78))) + (b! (zero? t7-22) cfg-102 :delay (set! t7-23 (+ t4-21 -108))) + (b! (zero? t7-23) cfg-73 :delay (set! t7-24 (+ t4-21 -76))) + (b! (zero? t7-24) cfg-73 :delay (set! t7-25 (+ t4-21 -119))) + (b! (zero? t7-25) cfg-105 :delay (set! t7-26 (+ t4-21 -87))) + (b! (zero? t7-26) cfg-105 :delay (set! t7-27 (+ t4-21 -107))) + (b! (zero? t7-27) cfg-107 :delay (set! t7-28 (+ t4-21 -75))) + (b! (zero? t7-28) cfg-107 :delay (set! t7-29 (+ t4-21 -106))) + (b! (zero? t7-29) cfg-73 :delay (set! t7-30 (+ t4-21 -74))) + (b! (zero? t7-30) cfg-73 :delay (set! t7-31 (+ t4-21 -104))) + (b! (zero? t7-31) cfg-109 :delay (set! t7-32 (+ t4-21 -72))) + (b! (zero? t7-32) cfg-109 :delay (set! t7-33 (+ t4-21 -118))) + (b! (zero? t7-33) cfg-114 :delay (set! t7-34 (+ t4-21 -86))) + (b! (zero? t7-34) cfg-114 :delay (set! t7-35 (+ t4-21 -48))) + (b! + (< (the-as int t7-35) 0) + cfg-122 + :delay + (set! t8-2 (+ t4-21 -57)) + ) + (b! (> (the-as int t8-2) 0) cfg-122 :delay (.sll t8-3 t6-9 2)) + (let ((t4-22 (+ t6-9 t8-3))) + (.sll t4-23 t4-22 1) + ) + (b! #t cfg-84 :delay (set! t6-9 (+ t4-23 t7-35))) + (label cfg-102) + (b! (nonzero? t6-9) cfg-104 :delay (set! a3-6 *font12-table*)) + (set! font-table-to-use a3-6) + (let ((t0-2 -33)) + (.lvf vf13 (&-> fw size1-small quad)) + (.lvf vf14 (&-> fw size2-small quad)) + (.lvf vf15 (&-> fw size3-small quad)) + (set! a0-3 (logand a0-3 t0-2)) + ) + (set! q-lo-tmpl (-> fw small-font-lo-tmpl-qw)) + (b! #t cfg-73 :delay (set! q-hi-tmpl (-> fw small-font-hi-tmpl-qw))) + (label cfg-104) + (set! font-table-to-use *font24-table*) + (.lvf vf13 (&-> fw size1-large quad)) + (.lvf vf14 (&-> fw size2-large quad)) + (.lvf vf15 (&-> fw size3-large quad)) + (set! a0-3 (logior a0-3 32)) + (set! q-lo-tmpl (-> fw large-font-lo-tmpl-qw)) + (b! #t cfg-73 :delay (set! q-hi-tmpl (-> fw large-font-hi-tmpl-qw))) + (label cfg-105) + (let ((t4-24 -2)) + (b! (zero? t6-9) cfg-73 :delay (set! a0-3 (logand a0-3 t4-24))) + ) + (b! #t cfg-73 :delay (set! a0-3 (logior a0-3 1))) + (label cfg-107) + (let ((t4-25 -3)) + (b! (zero? t6-9) cfg-73 :delay (set! a0-3 (logand a0-3 t4-25))) + ) + (b! #t cfg-73 :delay (set! a0-3 (logior a0-3 2))) + (label cfg-109) + (.mov vf1 t6-9) + (let ((t4-26 (+ t5-14 -45))) + (b! (zero? t5-14) cfg-113 :delay (.itof.vf vf1 vf1)) + (b! (zero? t4-26) cfg-112) + ) + (b! #t cfg-73 :delay (.add.x.vf vf23 vf23 vf1 :mask #b1)) + (label cfg-112) + (b! #t cfg-73 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b1)) + (label cfg-113) + (b! #t cfg-73 :delay (.add.x.vf vf23 vf0 vf1 :mask #b1)) + (label cfg-114) + (.mov vf1 t6-9) + ) + (let ((t4-27 (+ t5-14 -45))) + (b! (zero? t5-14) cfg-118 :delay (.itof.vf vf1 vf1)) + (b! (zero? t4-27) cfg-117) + ) + (b! #t cfg-73 :delay (.add.x.vf vf23 vf23 vf1 :mask #b10)) + (label cfg-117) + (b! #t cfg-73 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b10)) + (label cfg-118) + (b! #t cfg-73 :delay (.add.x.vf vf23 vf0 vf1 :mask #b10)) + (label cfg-119) + (b! #t cfg-73 :delay (.svf (&-> fw save quad) vf23)) + (label cfg-120) + (b! #t cfg-73 :delay (.lvf vf23 (&-> fw save quad))) + (label cfg-121) + (set! t4-21 (-> t3-7 4)) + (set! t3-7 (&-> t3-7 1)) + (.add.vf vf4 vf23 vf15 :mask #b111) + (let ((t5-15 (logand t4-21 127))) + (.sub.vf vf1 vf25 vf23) + (let ((t5-16 (+ t5-15 255))) + (b! #t cfg-125 :delay (.sll t5-17 t5-16 4)) + ) + ) + (label cfg-122) + (.add.vf vf4 vf23 vf15 :mask #b111) + (.sll t5-17 t4-21 4) + (.sub.vf vf1 vf25 vf23) + (b! (= t4-21 10) cfg-124 :delay (set! t6-16 (+ t4-21 -13))) + (b! (nonzero? t6-16) cfg-125 :delay (logand a0-3 1)) + (label cfg-124) + (set! t2-1 (&-> (the-as (pointer uint64) t2-1) 2)) + (b! + #t + cfg-73 + :delay + (.lvf vf23 (+ (the-as int t2-1) 944)) + ) + (label cfg-125) + (.addu t5-18 t5-17 font-table-to-use) + (.lvf vf5 (+ t5-18 -256)) + (.mov t5-19 vf1) + (b! + (< (the-as int t5-19) 0) + cfg-131 + :delay + (.add.vf vf6 vf5 vf16 :mask #b111) + ) + (.sra t5-20 t5-19 31) + (.add.vf vf7 vf5 vf17 :mask #b111) + (b! (< t5-20 0) cfg-73 :delay (.add.vf vf8 vf5 vf18 :mask #b111)) + (.add.vf vf1 vf23 vf0 :mask #b111) + (.add.vf vf2 vf23 vf13 :mask #b111) + (.svf (&-> fw current-verts tex-st 0 quad) vf5) + (.add.vf vf3 vf23 vf14 :mask #b111) + (.svf (&-> fw current-verts tex-st 1 quad) vf6) + (.mul.vf vf19 vf5 vf13) + (.svf (&-> fw current-verts tex-st 2 quad) vf7) + (.svf (&-> fw current-verts tex-st 3 quad) vf8) + (.svf (&-> fw current-verts pos 0 quad) vf1) + (.svf (&-> fw current-verts pos 1 quad) vf2) + (.svf (&-> fw current-verts pos 2 quad) vf3) + (.svf (&-> fw current-verts pos 3 quad) vf4) + (.lvf vf1 (&-> fw current-verts pos 0 quad)) + (.lvf vf2 (&-> fw current-verts pos 1 quad)) + (.mul.w.vf acc vf31 vf0) + (.lvf vf3 (&-> fw current-verts pos 2 quad)) + (.add.mul.x.vf acc vf28 vf1 acc) + (.lvf vf4 (&-> fw current-verts pos 3 quad)) + (.add.mul.y.vf acc vf29 vf1 acc) + (.add.mul.z.vf vf1 vf30 vf1 acc) + (.mul.w.vf acc vf31 vf0) + (.add.mul.x.vf acc vf28 vf2 acc) + (.add.mul.y.vf acc vf29 vf2 acc) + (.add.mul.z.vf vf2 vf30 vf2 acc) + (.mul.w.vf acc vf31 vf0) + (.add.mul.x.vf acc vf28 vf3 acc) + (.add.mul.y.vf acc vf29 vf3 acc) + (.add.mul.z.vf vf3 vf30 vf3 acc) + (.mul.w.vf acc vf31 vf0) + (.add.mul.x.vf acc vf28 vf4 acc) + (.add.mul.y.vf acc vf29 vf4 acc) + (.add.mul.z.vf vf4 vf30 vf4 acc) + (.div.vf Q vf25 vf1 :fsf #b10 :ftf #b11) + (let ((t5-21 (-> fw char-tmpl dma-vif quad))) + (let ((t6-18 (-> fw char-tmpl quad 1))) + (set! (-> (the-as (pointer uint128) dma-out) 0) t5-21) + (set! (-> (the-as (pointer uint128) dma-out) 1) t6-18) + ) + ) + (.lvf vf5 (&-> fw current-verts tex-st 0 quad)) + (let ((t5-22 q-lo-tmpl)) + (.lvf vf6 (&-> fw current-verts tex-st 1 quad)) + (let ((t4-28 (logand t4-21 128))) + (.lvf vf7 (&-> fw current-verts tex-st 2 quad)) + ;; note: this relies on (somewhat) undefined behavior that the upper 64-bits of a + ;; gpr aren't changed during movn. + (.movn-128 t5-23 q-hi-tmpl t4-28 t5-22) + ) + ) + ) + ) + (.mul.vf vf1 vf1 Q :mask #b111) + (set! (-> (the-as (pointer uint128) dma-out) 2) (the-as uint128 t5-23)) + (.mul.vf vf5 vf5 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.div.vf Q vf25 vf2 :fsf #b10 :ftf #b11) + (.lvf vf8 (&-> fw current-verts tex-st 3 quad)) + (.add.vf vf1 vf1 vf26) + (.lvf vf9 (&-> fw color-shadow quad)) + (vftoi4.xyzw vf1 vf1) + (.mul.vf vf2 vf2 Q :mask #b111) + (.mul.vf vf6 vf6 Q :mask #b111) + (.svf (&-> (the-as (pointer uint128) dma-out) 3) vf5) + (.nop.vf) + (.nop.vf) + (.div.vf Q vf25 vf3 :fsf #b10 :ftf #b11) + (.svf (&-> (the-as (pointer uint128) dma-out) 4) vf9) + (.svf (&-> (the-as (pointer uint128) dma-out) 5) vf1) + (.add.vf vf2 vf2 vf26) + (vftoi4.xyzw vf2 vf2) + (.mul.vf vf3 vf3 Q :mask #b111) + (.mul.vf vf7 vf7 Q :mask #b111) + (.svf (&-> (the-as (pointer uint128) dma-out) 6) vf6) + (.nop.vf) + (.nop.vf) + (.div.vf Q vf25 vf4 :fsf #b10 :ftf #b11) + (.svf (&-> (the-as (pointer uint128) dma-out) 7) vf9) + (.svf (&-> (the-as (pointer uint128) dma-out) 8) vf2) + (.add.vf vf3 vf3 vf26) + (vftoi4.xyzw vf3 vf3) + (.mul.vf vf4 vf4 Q :mask #b111) + (.mul.vf vf8 vf8 Q :mask #b111) + (.svf (&-> (the-as (pointer uint128) dma-out) 9) vf7) + (.svf (&-> (the-as (pointer uint128) dma-out) 10) vf9) + (.add.vf vf4 vf4 vf26) + (.svf (&-> (the-as (pointer uint128) dma-out) 11) vf3) + (let ((t4-29 (logand a0-3 2))) + (b! (zero? t4-29) cfg-129) + ) + ) + (b! #t cfg-130 :delay (.add.w.vf vf23 vf23 vf19 :mask #b1)) + (label cfg-129) + (.add.w.vf vf23 vf23 vf14 :mask #b1) + (label cfg-130) + (vftoi4.xyzw vf4 vf4) + (.svf (&-> (the-as (pointer uint128) dma-out) 12) vf8) + (.svf (&-> (the-as (pointer uint128) dma-out) 13) vf9) + (.svf (&-> (the-as (pointer uint128) dma-out) 14) vf4) + (b! + #t + cfg-73 + :delay + (set! dma-out (&-> (the-as (pointer uint128) dma-out) 15)) + ) + (label cfg-131) + (let ((a0-4 (-> fw flags-signed))) + (let ((t2-2 (the-as object fw)) + (t3-8 (-> fw str-ptr-signed)) + ) + (.lvf vf23 (&-> (the-as font-work t2-2) justify 0 quad)) + (label cfg-132) + (let ((t4-30 (-> t3-8 4))) + (set! t3-8 (&-> t3-8 1)) + (b! (zero? t4-30) cfg-189 :delay (set! t5-24 (+ t4-30 -1))) + (b! (zero? t5-24) cfg-179 :delay (set! t5-25 (+ t4-30 -126))) + (b! (nonzero? t5-25) cfg-180) + (set! t4-30 (-> t3-8 4)) + (set! t3-8 (&-> t3-8 1)) + (let ((t5-26 0) + (t6-19 0) + ) + (b! (zero? t4-30) cfg-189 :delay (set! t7-36 (+ t4-30 -43))) + (.movz t5-27 t4-30 t7-36 t5-26) + (let ((t7-37 (+ t4-30 -45))) + (.movz t5-28 t4-30 t7-37 t5-27) + ) + (b! (nonzero? t5-28) cfg-143 :delay (set! t7-38 (+ t4-30 -121))) + (b! (zero? t7-38) cfg-177 :delay (set! t6-20 (+ t4-30 -89))) + (b! (zero? t6-20) cfg-177 :delay (set! t6-21 (+ t4-30 -122))) + (b! (zero? t6-21) cfg-178 :delay (set! t6-22 (+ t4-30 -90))) + (b! (zero? t6-22) cfg-178 :delay (set! t6-23 (+ t4-30 -48))) + (b! + (< (the-as int t6-23) 0) + cfg-180 + :delay + (set! t6-24 (+ t4-30 -57)) + ) + (b! + (> (the-as int t6-24) 0) + cfg-180 + :delay + (set! t6-19 (the-as int (+ t4-30 -48))) + ) + (label cfg-143) + (set! t4-30 (-> t3-8 4)) + (set! t3-8 (&-> t3-8 1)) + (b! (zero? t4-30) cfg-189 :delay (set! t7-39 (+ t4-30 -110))) + (b! (zero? t7-39) cfg-161 :delay (set! t7-40 (+ t4-30 -78))) + (b! (zero? t7-40) cfg-161 :delay (set! t7-41 (+ t4-30 -108))) + (b! (zero? t7-41) cfg-164 :delay (set! t7-42 (+ t4-30 -76))) + (b! (zero? t7-42) cfg-164 :delay (set! t7-43 (+ t4-30 -119))) + (b! (zero? t7-43) cfg-132 :delay (set! t7-44 (+ t4-30 -87))) + (b! (zero? t7-44) cfg-132 :delay (set! t7-45 (+ t4-30 -107))) + (b! (zero? t7-45) cfg-165 :delay (set! t7-46 (+ t4-30 -75))) + (b! (zero? t7-46) cfg-165 :delay (set! t7-47 (+ t4-30 -106))) + (b! (zero? t7-47) cfg-132 :delay (set! t7-48 (+ t4-30 -74))) + (b! (zero? t7-48) cfg-132 :delay (set! t7-49 (+ t4-30 -104))) + (b! (zero? t7-49) cfg-167 :delay (set! t7-50 (+ t4-30 -72))) + (b! (zero? t7-50) cfg-167 :delay (set! t7-51 (+ t4-30 -118))) + (b! (zero? t7-51) cfg-172 :delay (set! t7-52 (+ t4-30 -86))) + (b! (zero? t7-52) cfg-172 :delay (set! t7-53 (+ t4-30 -48))) + (b! + (< (the-as int t7-53) 0) + cfg-180 + :delay + (set! t8-4 (+ t4-30 -57)) + ) + (b! (> (the-as int t8-4) 0) cfg-180 :delay (.sll t8-5 t6-19 2)) + (let ((t4-31 (+ t6-19 t8-5))) + (.sll t4-32 t4-31 1) + ) + (b! #t cfg-143 :delay (set! t6-19 (+ t4-32 t7-53))) + (label cfg-161) + (b! (nonzero? t6-19) cfg-163 :delay (set! a3-8 *font12-table*)) + (set! font-table-to-use a3-8) + (let ((t0-3 -33)) + (.lvf vf13 (&-> fw size1-small quad)) + (.lvf vf14 (&-> fw size2-small quad)) + (.lvf vf15 (&-> fw size3-small quad)) + (set! a0-4 (logand a0-4 t0-3)) + ) + (set! q-lo-tmpl (-> fw small-font-lo-tmpl-qw)) + (b! + #t + cfg-132 + :delay + (set! q-hi-tmpl (-> fw small-font-hi-tmpl-qw)) + ) + (label cfg-163) + (set! font-table-to-use *font24-table*) + (.lvf vf13 (&-> fw size1-large quad)) + (.lvf vf14 (&-> fw size2-large quad)) + (.lvf vf15 (&-> fw size3-large quad)) + (set! a0-4 (logior a0-4 32)) + (set! q-lo-tmpl (-> fw large-font-lo-tmpl-qw)) + (b! + #t + cfg-132 + :delay + (set! q-hi-tmpl (-> fw large-font-hi-tmpl-qw)) + ) + (label cfg-164) + (set! (-> fw last-color-32) t6-19) + (.sll t4-33 t6-19 4) + (let ((t5-29 (-> fw current-verts color 0 quad)) + (t4-34 (the-as object (+ t4-33 (the-as int fw)))) + ) + (let ((t6-25 (-> fw current-verts color 1 quad))) + (set! (-> fw src-verts color 0 quad) t5-29) + (set! (-> fw src-verts color 1 quad) t6-25) + ) + (let ((t5-30 (-> fw current-verts color 2 quad))) + (let ((t6-26 (-> fw current-verts color 3 quad))) + (set! (-> fw src-verts color 2 quad) t5-30) + (set! (-> fw src-verts color 3 quad) t6-26) + ) + ) + (let ((t6-27 (the-as uint128 (deref uint32 (+ (the-as int t4-34) 1984))))) + (let + ((t5-31 + (the-as + uint128 + (-> (the-as font-work t4-34) color-table 0 color 1) + ) + ) + ) + (.pextlb t6-28 r0 t6-27) + (.pextlh t6-29 r0 t6-28) + (.pextlb t5-32 r0 t5-31) + ) + ) + (set! (-> fw current-verts color 0 quad) (the-as uint128 t6-29)) + (.pextlh t5-33 r0 t5-32) + (set! (-> fw dest-verts color 0 quad) (the-as uint128 t6-29)) + (set! (-> fw current-verts color 1 quad) (the-as uint128 t5-33)) + (set! (-> fw dest-verts color 1 quad) (the-as uint128 t5-33)) + (let + ((t5-34 + (the-as + uint128 + (-> (the-as font-work t4-34) color-table 0 color 2) + ) + ) + ) + (let + ((t4-35 + (the-as + uint128 + (-> (the-as font-work t4-34) color-table 0 color 3) + ) + ) + ) + (.pextlb t5-35 r0 t5-34) + (.pextlh t5-36 r0 t5-35) + (.pextlb t4-36 r0 t4-35) + ) + ) + ) + (set! (-> fw current-verts color 2 quad) (the-as uint128 t5-36)) + (.pextlh t4-37 r0 t4-36) + (set! (-> fw dest-verts color 2 quad) (the-as uint128 t5-36)) + (set! (-> fw current-verts color 3 quad) (the-as uint128 t4-37)) + (b! + #t + cfg-132 + :delay + (set! + (-> fw dest-verts color 3 quad) + (the-as uint128 (the-as int t4-37)) + ) + ) + (label cfg-165) + (let ((t4-38 -3)) + (b! (zero? t6-19) cfg-132 :delay (set! a0-4 (logand a0-4 t4-38))) + ) + (b! #t cfg-132 :delay (set! a0-4 (logior a0-4 2))) + (label cfg-167) + (.mov vf1 t6-19) + (let ((t4-39 (+ t5-28 -45))) + (b! (zero? t5-28) cfg-171 :delay (.itof.vf vf1 vf1)) + (b! (zero? t4-39) cfg-170) + ) + (b! #t cfg-132 :delay (.add.x.vf vf23 vf23 vf1 :mask #b1)) + (label cfg-170) + (b! #t cfg-132 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b1)) + (label cfg-171) + (b! #t cfg-132 :delay (.add.x.vf vf23 vf0 vf1 :mask #b1)) + (label cfg-172) + (.mov vf1 t6-19) + ) + (let ((t4-40 (+ t5-28 -45))) + (b! (zero? t5-28) cfg-176 :delay (.itof.vf vf1 vf1)) + (b! (zero? t4-40) cfg-175) + ) + (b! #t cfg-132 :delay (.add.x.vf vf23 vf23 vf1 :mask #b10)) + (label cfg-175) + (b! #t cfg-132 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b10)) + (label cfg-176) + (b! #t cfg-132 :delay (.add.x.vf vf23 vf0 vf1 :mask #b10)) + (label cfg-177) + (let ((t4-41 (-> fw last-color-32))) + (.lvf vf9 (&-> fw current-verts color 0 quad)) + (.lvf vf10 (&-> fw current-verts color 1 quad)) + (.lvf vf11 (&-> fw current-verts color 2 quad)) + (.lvf vf12 (&-> fw current-verts color 3 quad)) + (set! (-> fw save-last-color-32) t4-41) + ) + (.svf (&-> fw save-color 0 quad) vf9) + (.svf (&-> fw save-color 1 quad) vf10) + (.svf (&-> fw save-color 2 quad) vf11) + (.svf (&-> fw save-color 3 quad) vf12) + (b! #t cfg-132 :delay (.svf (&-> fw save quad) vf23)) + (label cfg-178) + (let ((t4-42 (-> fw save-last-color-32))) + (.lvf vf9 (&-> fw save-color 0 quad)) + (.lvf vf10 (&-> fw save-color 1 quad)) + (.lvf vf11 (&-> fw save-color 2 quad)) + (.lvf vf12 (&-> fw save-color 3 quad)) + (set! (-> fw last-color-32) t4-42) + ) + (.svf (&-> fw current-verts color 0 quad) vf9) + (.svf (&-> fw dest-verts color 0 quad) vf9) + (.svf (&-> fw current-verts color 1 quad) vf10) + (.svf (&-> fw dest-verts color 1 quad) vf10) + (.svf (&-> fw current-verts color 2 quad) vf11) + (.svf (&-> fw dest-verts color 2 quad) vf11) + (.svf (&-> fw current-verts color 3 quad) vf12) + (.svf (&-> fw dest-verts color 3 quad) vf12) + (b! #t cfg-132 :delay (.lvf vf23 (&-> fw save quad))) + (label cfg-179) + (set! t4-30 (-> t3-8 4)) + (set! t3-8 (&-> t3-8 1)) + (.add.vf vf4 vf23 vf15 :mask #b111) + (let ((t5-37 (logand t4-30 127))) + (.sub.vf vf1 vf25 vf23) + (let ((t5-38 (+ t5-37 255))) + (b! #t cfg-183 :delay (.sll t5-39 t5-38 4)) + ) + ) + (label cfg-180) + (.add.vf vf4 vf23 vf15 :mask #b111) + (.sll t5-39 t4-30 4) + (.sub.vf vf1 vf25 vf23) + (b! (= t4-30 10) cfg-182 :delay (set! t6-31 (+ t4-30 -13))) + (b! (nonzero? t6-31) cfg-183) + (label cfg-182) + (set! t2-2 (&-> (the-as (pointer uint64) t2-2) 2)) + (b! + #t + cfg-132 + :delay + (.lvf vf23 (+ (the-as int t2-2) 944)) + ) + (label cfg-183) + (.addu t5-40 t5-39 font-table-to-use) + (.lvf vf5 (+ t5-40 -256)) + (.mov t5-41 vf1) + (b! + (< (the-as int t5-41) 0) + cfg-189 + :delay + (.add.vf vf6 vf5 vf16 :mask #b111) + ) + (.sra t5-42 t5-41 31) + (.add.vf vf7 vf5 vf17 :mask #b111) + (b! (< t5-42 0) cfg-132 :delay (.add.vf vf8 vf5 vf18 :mask #b111)) + (.add.vf vf1 vf23 vf0 :mask #b111) + (.add.vf vf2 vf23 vf13 :mask #b111) + (.add.vf vf3 vf23 vf14 :mask #b111) + (.svf (&-> fw current-verts tex-st 0 quad) vf5) + (.add.vf vf4 vf23 vf15 :mask #b111) + (.svf (&-> fw current-verts tex-st 1 quad) vf6) + (.mul.vf vf19 vf5 vf13) + (.svf (&-> fw current-verts tex-st 2 quad) vf7) + (.svf (&-> fw current-verts tex-st 3 quad) vf8) + (.svf (&-> fw current-verts pos 0 quad) vf1) + (.svf (&-> fw current-verts pos 1 quad) vf2) + (.svf (&-> fw current-verts pos 2 quad) vf3) + (.svf (&-> fw current-verts pos 3 quad) vf4) + (.lvf vf1 (&-> fw current-verts pos 0 quad)) + (.lvf vf2 (&-> fw current-verts pos 1 quad)) + (.mul.w.vf acc vf31 vf0) + (.lvf vf3 (&-> fw current-verts pos 2 quad)) + (.add.mul.x.vf acc vf28 vf1 acc) + (.lvf vf4 (&-> fw current-verts pos 3 quad)) + (.add.mul.y.vf acc vf29 vf1 acc) + (.add.mul.z.vf vf1 vf30 vf1 acc) + (.mul.w.vf acc vf31 vf0) + (.add.mul.x.vf acc vf28 vf2 acc) + (.add.mul.y.vf acc vf29 vf2 acc) + (.add.mul.z.vf vf2 vf30 vf2 acc) + (.mul.w.vf acc vf31 vf0) + (.add.mul.x.vf acc vf28 vf3 acc) + (.add.mul.y.vf acc vf29 vf3 acc) + (.add.mul.z.vf vf3 vf30 vf3 acc) + (.mul.w.vf acc vf31 vf0) + (.add.mul.x.vf acc vf28 vf4 acc) + (.add.mul.y.vf acc vf29 vf4 acc) + (.add.mul.z.vf vf4 vf30 vf4 acc) + (.div.vf Q vf25 vf1 :fsf #b10 :ftf #b11) + (let ((t5-43 (-> fw char-tmpl dma-vif quad))) + (let ((t6-32 (-> fw char-tmpl quad 1))) + (set! (-> (the-as (pointer uint128) dma-out) 0) t5-43) + (set! (-> (the-as (pointer uint128) dma-out) 1) t6-32) + ) + ) + (.lvf vf5 (&-> fw current-verts tex-st 0 quad)) + (let ((t5-44 q-lo-tmpl)) + (.lvf vf6 (&-> fw current-verts tex-st 1 quad)) + (let ((t4-43 (logand t4-30 128))) + (.lvf vf7 (&-> fw current-verts tex-st 2 quad)) + (.movn-128 t5-45 q-hi-tmpl t4-43 t5-44) + ) + ) + ) + ) + (.mul.vf vf1 vf1 Q :mask #b111) + (set! (-> (the-as (pointer uint128) dma-out) 2) (the uint128 t5-45)) + (.mul.vf vf5 vf5 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.div.vf Q vf25 vf2 :fsf #b10 :ftf #b11) + (.lvf vf8 (&-> fw current-verts tex-st 3 quad)) + (.add.vf vf1 vf1 vf27) + (.lvf vf9 (&-> fw current-verts color 0 quad)) + (.lvf vf10 (&-> fw current-verts color 1 quad)) + (.lvf vf11 (&-> fw current-verts color 2 quad)) + (vftoi4.xyzw vf1 vf1) + (.mul.vf vf2 vf2 Q :mask #b111) + (.mul.vf vf6 vf6 Q :mask #b111) + (.svf (&-> (the-as (pointer uint128) dma-out) 3) vf5) + (.nop.vf) + (.nop.vf) + (.div.vf Q vf25 vf3 :fsf #b10 :ftf #b11) + (.svf (&-> (the-as (pointer uint128) dma-out) 4) vf9) + (.lvf vf12 (&-> fw current-verts color 3 quad)) + (.svf (&-> (the-as (pointer uint128) dma-out) 5) vf1) + (.add.vf vf2 vf2 vf27) + (vftoi4.xyzw vf2 vf2) + (.mul.vf vf3 vf3 Q :mask #b111) + (.mul.vf vf7 vf7 Q :mask #b111) + (.svf (&-> (the-as (pointer uint128) dma-out) 6) vf6) + (.nop.vf) + (.nop.vf) + (.div.vf Q vf25 vf4 :fsf #b10 :ftf #b11) + (.svf (&-> (the-as (pointer uint128) dma-out) 7) vf10) + (.svf (&-> (the-as (pointer uint128) dma-out) 8) vf2) + (.add.vf vf3 vf3 vf27) + (vftoi4.xyzw vf3 vf3) + (.mul.vf vf4 vf4 Q :mask #b111) + (.mul.vf vf8 vf8 Q :mask #b111) + (.svf (&-> (the-as (pointer uint128) dma-out) 9) vf7) + (.svf (&-> (the-as (pointer uint128) dma-out) 10) vf11) + (.add.vf vf4 vf4 vf27) + ;;(s.vf! (+ dma-out 176) vf3) + (.svf (+ (the-as int dma-out) 176) vf3) + (let ((t4-44 (logand a0-4 2))) + (b! (zero? t4-44) cfg-187) + ) + ) + ) + ) + ) + (b! #t cfg-188 :delay (.add.w.vf vf23 vf23 vf19 :mask #b1)) + (label cfg-187) + (.add.w.vf vf23 vf23 vf14 :mask #b1) + (label cfg-188) + (vftoi4.xyzw vf4 vf4) + ;;(s.vf! (+ dma-out 192) vf8) + (.svf (+ (the-as int dma-out) 192) vf8) + ;;(s.vf! (+ dma-out 208) vf12) + (.svf (+ (the-as int dma-out) 208) vf12) + ;;(s.vf! (+ dma-out 224) vf4) + (.svf (+ (the-as int dma-out) 224) vf4) + (b! #t cfg-132 :delay (set! dma-out (&+ dma-out 240))) + (label cfg-189) + (let ((v1-6 (-> fw buf))) + ;;(s.w! (+ v1-6 4) dma-out) + (set! (-> (the-as (pointer pointer) v1-6) 1) dma-out) + ) + ) + ) + (.lvf vf24 (&-> arg2 origin quad)) + (.sub.vf vf23 vf23 vf24) + (.mov v0-0 vf23) + v0-0 ) - ) - (let ((font-table-to-use font-table-12)) - (nop!) - (.lvf vf13 (&-> fw size1-small quad)) - (nop!) - (.lvf vf14 (&-> fw size2-small quad)) - (nop!) - (.lvf vf15 (&-> fw size3-small quad)) - (nop!) - (let ((q-lo-tmpl (-> fw small-font-lo-tmpl-qw))) - (b! #t cfg-3 :delay (set! q-hi-tmpl (-> fw small-font-hi-tmpl-qw))) - (label cfg-2) - (nop!) - (set! font-table-to-use *font24-table*) - (nop!) - (.lvf vf13 (&-> fw size1-large quad)) - (nop!) - (.lvf vf14 (&-> fw size2-large quad)) - (nop!) - (.lvf vf15 (&-> fw size3-large quad)) - (nop!) - (set! q-lo-tmpl (-> fw large-font-lo-tmpl-qw)) - (nop!) - (set! q-hi-tmpl (-> fw large-font-hi-tmpl-qw)) - (label cfg-3) - (let ((in-color (-> arg2 color-s32))) - (nop!) - (set! (-> fw last-color-32) in-color) - (nop!) - (.sll color-array-prod in-color 4) - ) - (nop!) - (let ((fw+col (the-as object (+ color-array-prod (the-as int fw))))) - (nop!) - (nop!) - (let - ((q-verts-0p - (the-as uint128 (-> (the-as (pointer uint32) fw+col) 496)) - ) - ) - (nop!) - (let - ((q-verts-1p - (the-as uint128 (-> (the-as (pointer uint32) fw+col) 497)) - ) - ) - (.pextlb q-verts-0t r0 q-verts-0p) - (let - ((q-verts-2p - (the-as uint128 (-> (the-as (pointer uint32) fw+col) 498)) - ) - ) - (.pextlh q-verts-0 r0 q-verts-0t) - (let - ((q-verts-3p - (the-as uint128 (-> (the-as (pointer uint32) fw+col) 499)) - ) - ) - (.pextlb q-verts-1t r0 q-verts-1p) - (set! - (-> fw current-verts color 0 quad) - (the-as uint128 q-verts-0) - ) - (.pextlh q-verts-1 r0 q-verts-1t) - (set! (-> fw dest-verts color 0 quad) (the-as uint128 q-verts-0)) - (.pextlb q-verts-2t r0 q-verts-2p) - (set! - (-> fw current-verts color 1 quad) - (the-as uint128 q-verts-1) - ) - (.pextlh q-verts-2 r0 q-verts-2t) - (set! (-> fw dest-verts color 1 quad) (the-as uint128 q-verts-1)) - (.pextlb q-verts-3t r0 q-verts-3p) - ) - ) - ) - ) - ) - (set! (-> fw current-verts color 2 quad) (the-as uint128 q-verts-2)) - (.pextlh q-verts-3 r0 q-verts-3t) - (set! (-> fw dest-verts color 2 quad) (the-as uint128 q-verts-2)) - (nop!) - (set! (-> fw current-verts color 3 quad) (the-as uint128 q-verts-3)) - (nop!) - (set! (-> fw dest-verts color 3 quad) (the-as uint128 q-verts-3)) - (let ((fw2 (the-as object fw))) - (nop!) - (label cfg-4) - (let ((str-char (-> (the-as (pointer uint8) str-in) 4))) - (set! str-in (the-as string (&-> (the-as (pointer uint8) str-in) 1))) - (b! (zero? str-char) cfg-67 :delay (set! not-sc-lit1 (+ str-char -1))) - (b! - (zero? not-sc-lit1) - cfg-54 - :delay - (set! not-sc-~ (+ str-char -126)) - ) - (b! (nonzero? not-sc-~) cfg-55) - (set! str-char (-> (the-as (pointer uint8) str-in) 4)) - (set! str-in (the-as string (&-> (the-as (pointer uint8) str-in) 1))) - (let ((t5-5 0) - (t6-2 0) - ) - (b! (zero? str-char) cfg-67 :delay (set! t7-0 (+ str-char -43))) - (.movz t5-6 str-char t7-0 t5-5) - (let ((t7-1 (+ str-char -45))) - (.movz t5-7 str-char t7-1 t5-6) - ) - (nop!) - (b! (nonzero? t5-7) cfg-15 :delay (set! t7-2 (+ str-char -121))) - (b! (zero? t7-2) cfg-52 :delay (set! t6-3 (+ str-char -89))) - (b! (zero? t6-3) cfg-52 :delay (set! t6-4 (+ str-char -122))) - (b! (zero? t6-4) cfg-53 :delay (set! t6-5 (+ str-char -90))) - (b! (zero? t6-5) cfg-53 :delay (set! t6-6 (+ str-char -48))) - (b! - (< (the-as int t6-6) 0) - cfg-55 - :delay - (set! t6-7 (+ str-char -57)) - ) - (b! - (> (the-as int t6-7) 0) - cfg-55 - :delay - (set! t6-2 (the-as int (+ str-char -48))) - ) - (label cfg-15) - (set! str-char (-> (the-as (pointer uint8) str-in) 4)) - (set! str-in (the-as string (&-> (the-as (pointer uint8) str-in) 1))) - (b! (zero? str-char) cfg-67 :delay (set! t7-3 (+ str-char -110))) - (b! (zero? t7-3) cfg-33 :delay (set! t7-4 (+ str-char -78))) - (b! (zero? t7-4) cfg-33 :delay (set! t7-5 (+ str-char -108))) - (b! (zero? t7-5) cfg-4 :delay (set! t7-6 (+ str-char -76))) - (b! (zero? t7-6) cfg-4 :delay (set! t7-7 (+ str-char -119))) - (b! (zero? t7-7) cfg-4 :delay (set! t7-8 (+ str-char -87))) - (b! (zero? t7-8) cfg-4 :delay (set! t7-9 (+ str-char -107))) - (b! (zero? t7-9) cfg-36 :delay (set! t7-10 (+ str-char -75))) - (b! (zero? t7-10) cfg-36 :delay (set! t7-11 (+ str-char -106))) - (b! (zero? t7-11) cfg-38 :delay (set! t7-12 (+ str-char -74))) - (b! (zero? t7-12) cfg-38 :delay (set! t7-13 (+ str-char -104))) - (b! (zero? t7-13) cfg-42 :delay (set! t7-14 (+ str-char -72))) - (b! (zero? t7-14) cfg-42 :delay (set! t7-15 (+ str-char -118))) - (b! (zero? t7-15) cfg-47 :delay (set! t7-16 (+ str-char -86))) - (b! (zero? t7-16) cfg-47 :delay (set! t7-17 (+ str-char -48))) - (b! - (< (the-as int t7-17) 0) - cfg-55 - :delay - (set! t8-0 (+ str-char -57)) - ) - (b! (> (the-as int t8-0) 0) cfg-55 :delay (.sll t8-1 t6-2 2)) - (let ((t4-5 (+ t6-2 t8-1))) - (nop!) - (.sll t4-6 t4-5 1) - ) - (nop!) - (b! #t cfg-15 :delay (set! t6-2 (+ t4-6 t7-17))) - (label cfg-33) - (b! (nonzero? t6-2) cfg-35 :delay (set! t0-1 -33)) - (set! font-table-to-use *font12-table*) - (.lvf vf13 (&-> fw size1-small quad)) - (nop!) - (.lvf vf14 (&-> fw size2-small quad)) - (nop!) - (.lvf vf15 (&-> fw size3-small quad)) - (set! flags (logand flags t0-1)) - (set! q-lo-tmpl (-> fw small-font-lo-tmpl-qw)) - (b! #t cfg-4 :delay (set! q-hi-tmpl (-> fw small-font-hi-tmpl-qw))) - (label cfg-35) - (nop!) - (set! font-table-to-use *font24-table*) - (nop!) - (.lvf vf13 (&-> fw size1-large quad)) - (nop!) - (.lvf vf14 (&-> fw size2-large quad)) - (nop!) - (.lvf vf15 (&-> fw size3-large quad)) - (set! flags (logior flags 32)) - (set! q-lo-tmpl (-> fw large-font-lo-tmpl-qw)) - (b! #t cfg-4 :delay (set! q-hi-tmpl (-> fw large-font-hi-tmpl-qw))) - (label cfg-36) - (let ((t4-7 -3)) - (nop!) - (b! (zero? t6-2) cfg-4 :delay (set! flags (logand flags t4-7))) - ) - (b! #t cfg-4 :delay (set! flags (logior flags 2))) - (label cfg-38) - (let ((t4-8 -21) - (t5-8 (+ t6-2 -2)) - ) - (b! (zero? t6-2) cfg-4 :delay (set! flags (logand flags t4-8))) - (b! (zero? t5-8) cfg-41) - ) - (b! #t cfg-4 :delay (set! flags (logior flags 16))) - (label cfg-41) - (b! #t cfg-4 :delay (set! flags (logior flags 4))) - (label cfg-42) - (.mov vf1 t6-2) - (let ((t4-9 (+ t5-7 -45))) - (b! (zero? t5-7) cfg-46 :delay (.itof.vf vf1 vf1)) - (b! (zero? t4-9) cfg-45) - ) - (b! #t cfg-4 :delay (.add.x.vf vf23 vf23 vf1 :mask #b1)) - (label cfg-45) - (b! #t cfg-4 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b1)) - (label cfg-46) - (b! #t cfg-4 :delay (.add.x.vf vf23 vf0 vf1 :mask #b1)) - (label cfg-47) - (.mov vf1 t6-2) - ) - (let ((t4-10 (+ t5-7 -45))) - (b! (zero? t5-7) cfg-51 :delay (.itof.vf vf1 vf1)) - (b! (zero? t4-10) cfg-50) - ) - (b! #t cfg-4 :delay (.add.x.vf vf23 vf23 vf1 :mask #b10)) - (label cfg-50) - (b! #t cfg-4 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b10)) - (label cfg-51) - (b! #t cfg-4 :delay (.add.x.vf vf23 vf0 vf1 :mask #b10)) - (label cfg-52) - (b! #t cfg-4 :delay (.svf (&-> fw save quad) vf23)) - (label cfg-53) - (b! #t cfg-4 :delay (.lvf vf23 (&-> fw save quad))) - (label cfg-54) - (let ((t4-11 (-> (the-as (pointer uint8) str-in) 4))) - (set! str-in (the-as string (&-> (the-as (pointer uint8) str-in) 1))) - (.add.vf vf4 vf23 vf15 :mask #b111) - (let ((t4-12 (logand t4-11 127))) - (.sub.vf vf1 vf25 vf23) - (let ((t4-13 (+ t4-12 255))) - (b! #t cfg-62 :delay (.sll t5-9 t4-13 4)) - ) - ) - ) - (label cfg-55) - (.add.vf vf4 vf23 vf15 :mask #b111) - (.sll t5-9 str-char 4) - (.sub.vf vf1 vf25 vf23) - (b! (= str-char 10) cfg-57 :delay (set! fc-cr (+ str-char -13))) - ) - (b! (nonzero? fc-cr) cfg-62) - (label cfg-57) - (.sub.vf vf1 vf23 vf24) - (b! (logtest? flags 16) cfg-60 :delay (set! t4-16 (logand flags 4))) - (b! (nonzero? t4-16) cfg-61) - (.add.x.vf vf23 vf0 vf24 :mask #b1) - (nop!) - (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) - (.add.w.vf vf23 vf23 vf15 :mask #b10) - (b! - #t - cfg-4 - :delay - (set! fw2 (-> (the-as font-work fw2) font-tmpl gif)) - ) - (label cfg-60) - (.sub.vf vf23 vf24 vf1 :mask #b1) - (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) - (.add.x.vf vf23 vf0 vf24 :mask #b1) - (.add.w.vf vf23 vf23 vf15 :mask #b10) - (b! - #t - cfg-4 - :delay - (set! fw2 (-> (the-as font-work fw2) font-tmpl gif)) - ) - (label cfg-61) - (.mul.w.vf vf1 vf1 vf16 :mask #b1) - (nop!) - (.sub.vf vf23 vf24 vf1 :mask #b1) - (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) - (.add.x.vf vf23 vf0 vf24 :mask #b1) - (.add.w.vf vf23 vf23 vf15 :mask #b10) - (b! - #t - cfg-4 - :delay - (set! fw2 (-> (the-as font-work fw2) font-tmpl gif)) - ) - (label cfg-62) - (.addu t4-17 t5-9 font-table-to-use) - (nop!) - (.lvf vf5 (+ t4-17 -256)) - (.mov t4-18 vf1) - (b! (< (the-as int t4-18) 0) cfg-67 :delay (.sra t4-19 t4-18 31)) - (.mul.vf vf19 vf5 vf13) - (b! (zero? (logand flags 2)) cfg-65) - (b! #t cfg-66 :delay (.add.w.vf vf23 vf23 vf19 :mask #b1)) - (label cfg-65) - (nop!) - (.add.w.vf vf23 vf23 vf14 :mask #b1) - (label cfg-66) - (b! #t cfg-4) - (label cfg-67) - (.sub.vf vf1 vf23 vf24) - (b! (logtest? flags 16) cfg-70 :delay (set! a0-2 (logand flags 4))) - (b! (nonzero? a0-2) cfg-71) - (.add.x.vf vf23 vf0 vf24 :mask #b1) - (nop!) - (b! - #t - cfg-72 - :delay - (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) - ) - (label cfg-70) - (.sub.vf vf23 vf24 vf1 :mask #b1) - (nop!) - (b! - #t - cfg-72 - :delay - (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) - ) - (label cfg-71) - (.mul.w.vf vf1 vf1 vf16 :mask #b1) - (nop!) - (.sub.vf vf23 vf24 vf1 :mask #b1) - (.svf (&-> (the-as font-work fw2) justify 0 quad) vf23) - ) - (label cfg-72) - (let ((a0-3 (-> fw flags-signed))) - (let ((t2-1 (the-as object fw)) - (t3-7 (-> fw str-ptr-signed)) - ) - (.lvf vf23 (&-> (the-as font-work t2-1) justify 0 quad)) - (label cfg-73) - (let ((t4-21 (-> t3-7 4))) - (set! t3-7 (&-> t3-7 1)) - (b! (zero? t4-21) cfg-131 :delay (set! t5-10 (+ t4-21 -1))) - (b! (zero? t5-10) cfg-121 :delay (set! t5-11 (+ t4-21 -126))) - (b! (nonzero? t5-11) cfg-122) - (set! t4-21 (-> t3-7 4)) - (set! t3-7 (&-> t3-7 1)) - (let ((t5-12 0) - (t6-9 0) - ) - (b! (zero? t4-21) cfg-131 :delay (set! t7-18 (+ t4-21 -43))) - (.movz t5-13 t4-21 t7-18 t5-12) - (let ((t7-19 (+ t4-21 -45))) - (.movz t5-14 t4-21 t7-19 t5-13) - ) - (nop!) - (b! (nonzero? t5-14) cfg-84 :delay (set! t7-20 (+ t4-21 -121))) - (b! (zero? t7-20) cfg-119 :delay (set! t6-10 (+ t4-21 -89))) - (b! (zero? t6-10) cfg-119 :delay (set! t6-11 (+ t4-21 -122))) - (b! (zero? t6-11) cfg-120 :delay (set! t6-12 (+ t4-21 -90))) - (b! (zero? t6-12) cfg-120 :delay (set! t6-13 (+ t4-21 -48))) - (b! - (< (the-as int t6-13) 0) - cfg-122 - :delay - (set! t6-14 (+ t4-21 -57)) - ) - (b! - (> (the-as int t6-14) 0) - cfg-122 - :delay - (set! t6-9 (the-as int (+ t4-21 -48))) - ) - (label cfg-84) - (set! t4-21 (-> t3-7 4)) - (set! t3-7 (&-> t3-7 1)) - (b! (zero? t4-21) cfg-131 :delay (set! t7-21 (+ t4-21 -110))) - (b! (zero? t7-21) cfg-102 :delay (set! t7-22 (+ t4-21 -78))) - (b! (zero? t7-22) cfg-102 :delay (set! t7-23 (+ t4-21 -108))) - (b! (zero? t7-23) cfg-73 :delay (set! t7-24 (+ t4-21 -76))) - (b! (zero? t7-24) cfg-73 :delay (set! t7-25 (+ t4-21 -119))) - (b! (zero? t7-25) cfg-105 :delay (set! t7-26 (+ t4-21 -87))) - (b! (zero? t7-26) cfg-105 :delay (set! t7-27 (+ t4-21 -107))) - (b! (zero? t7-27) cfg-107 :delay (set! t7-28 (+ t4-21 -75))) - (b! (zero? t7-28) cfg-107 :delay (set! t7-29 (+ t4-21 -106))) - (b! (zero? t7-29) cfg-73 :delay (set! t7-30 (+ t4-21 -74))) - (b! (zero? t7-30) cfg-73 :delay (set! t7-31 (+ t4-21 -104))) - (b! (zero? t7-31) cfg-109 :delay (set! t7-32 (+ t4-21 -72))) - (b! (zero? t7-32) cfg-109 :delay (set! t7-33 (+ t4-21 -118))) - (b! (zero? t7-33) cfg-114 :delay (set! t7-34 (+ t4-21 -86))) - (b! (zero? t7-34) cfg-114 :delay (set! t7-35 (+ t4-21 -48))) - (b! - (< (the-as int t7-35) 0) - cfg-122 - :delay - (set! t8-2 (+ t4-21 -57)) - ) - (b! (> (the-as int t8-2) 0) cfg-122 :delay (.sll t8-3 t6-9 2)) - (let ((t4-22 (+ t6-9 t8-3))) - (nop!) - (.sll t4-23 t4-22 1) - ) - (nop!) - (b! #t cfg-84 :delay (set! t6-9 (+ t4-23 t7-35))) - (label cfg-102) - (b! (nonzero? t6-9) cfg-104 :delay (set! a3-6 *font12-table*)) - (set! font-table-to-use a3-6) - (let ((t0-2 -33)) - (.lvf vf13 (&-> fw size1-small quad)) - (nop!) - (.lvf vf14 (&-> fw size2-small quad)) - (nop!) - (.lvf vf15 (&-> fw size3-small quad)) - (set! a0-3 (logand a0-3 t0-2)) - ) - (set! q-lo-tmpl (-> fw small-font-lo-tmpl-qw)) - (b! #t cfg-73 :delay (set! q-hi-tmpl (-> fw small-font-hi-tmpl-qw))) - (label cfg-104) - (nop!) - (set! font-table-to-use *font24-table*) - (nop!) - (.lvf vf13 (&-> fw size1-large quad)) - (nop!) - (.lvf vf14 (&-> fw size2-large quad)) - (nop!) - (.lvf vf15 (&-> fw size3-large quad)) - (set! a0-3 (logior a0-3 32)) - (set! q-lo-tmpl (-> fw large-font-lo-tmpl-qw)) - (b! #t cfg-73 :delay (set! q-hi-tmpl (-> fw large-font-hi-tmpl-qw))) - (label cfg-105) - (let ((t4-24 -2)) - (nop!) - (b! (zero? t6-9) cfg-73 :delay (set! a0-3 (logand a0-3 t4-24))) - ) - (b! #t cfg-73 :delay (set! a0-3 (logior a0-3 1))) - (label cfg-107) - (let ((t4-25 -3)) - (nop!) - (b! (zero? t6-9) cfg-73 :delay (set! a0-3 (logand a0-3 t4-25))) - ) - (b! #t cfg-73 :delay (set! a0-3 (logior a0-3 2))) - (label cfg-109) - (.mov vf1 t6-9) - (let ((t4-26 (+ t5-14 -45))) - (b! (zero? t5-14) cfg-113 :delay (.itof.vf vf1 vf1)) - (b! (zero? t4-26) cfg-112) - ) - (b! #t cfg-73 :delay (.add.x.vf vf23 vf23 vf1 :mask #b1)) - (label cfg-112) - (b! #t cfg-73 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b1)) - (label cfg-113) - (b! #t cfg-73 :delay (.add.x.vf vf23 vf0 vf1 :mask #b1)) - (label cfg-114) - (.mov vf1 t6-9) - ) - (let ((t4-27 (+ t5-14 -45))) - (b! (zero? t5-14) cfg-118 :delay (.itof.vf vf1 vf1)) - (b! (zero? t4-27) cfg-117) - ) - (b! #t cfg-73 :delay (.add.x.vf vf23 vf23 vf1 :mask #b10)) - (label cfg-117) - (b! #t cfg-73 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b10)) - (label cfg-118) - (b! #t cfg-73 :delay (.add.x.vf vf23 vf0 vf1 :mask #b10)) - (label cfg-119) - (b! #t cfg-73 :delay (.svf (&-> fw save quad) vf23)) - (label cfg-120) - (b! #t cfg-73 :delay (.lvf vf23 (&-> fw save quad))) - (label cfg-121) - (set! t4-21 (-> t3-7 4)) - (set! t3-7 (&-> t3-7 1)) - (.add.vf vf4 vf23 vf15 :mask #b111) - (let ((t5-15 (logand t4-21 127))) - (.sub.vf vf1 vf25 vf23) - (let ((t5-16 (+ t5-15 255))) - (b! #t cfg-125 :delay (.sll t5-17 t5-16 4)) - ) - ) - (label cfg-122) - (.add.vf vf4 vf23 vf15 :mask #b111) - (.sll t5-17 t4-21 4) - (.sub.vf vf1 vf25 vf23) - (b! (= t4-21 10) cfg-124 :delay (set! t6-16 (+ t4-21 -13))) - (b! (nonzero? t6-16) cfg-125 :delay (logand a0-3 1)) - (label cfg-124) - (set! t2-1 (&-> (the-as (pointer uint64) t2-1) 2)) - (nop!) - (b! - #t - cfg-73 - :delay - (.lvf vf23 (+ (the-as int t2-1) 944)) - ) - (label cfg-125) - (.addu t5-18 t5-17 font-table-to-use) - (nop!) - (.lvf vf5 (+ t5-18 -256)) - (.mov t5-19 vf1) - (b! - (< (the-as int t5-19) 0) - cfg-131 - :delay - (.add.vf vf6 vf5 vf16 :mask #b111) - ) - (.sra t5-20 t5-19 31) - (.add.vf vf7 vf5 vf17 :mask #b111) - (b! (< t5-20 0) cfg-73 :delay (.add.vf vf8 vf5 vf18 :mask #b111)) - (.add.vf vf1 vf23 vf0 :mask #b111) - (nop!) - (.add.vf vf2 vf23 vf13 :mask #b111) - (.svf (&-> fw current-verts tex-st 0 quad) vf5) - (.add.vf vf3 vf23 vf14 :mask #b111) - (.svf (&-> fw current-verts tex-st 1 quad) vf6) - (.mul.vf vf19 vf5 vf13) - (.svf (&-> fw current-verts tex-st 2 quad) vf7) - (nop!) - (.svf (&-> fw current-verts tex-st 3 quad) vf8) - (nop!) - (.svf (&-> fw current-verts pos 0 quad) vf1) - (nop!) - (.svf (&-> fw current-verts pos 1 quad) vf2) - (nop!) - (.svf (&-> fw current-verts pos 2 quad) vf3) - (nop!) - (.svf (&-> fw current-verts pos 3 quad) vf4) - (.lvf vf1 (&-> fw current-verts pos 0 quad)) - (nop!) - (.lvf vf2 (&-> fw current-verts pos 1 quad)) - (.mul.w.vf acc vf31 vf0) - (.lvf vf3 (&-> fw current-verts pos 2 quad)) - (.add.mul.x.vf acc vf28 vf1 acc) - (.lvf vf4 (&-> fw current-verts pos 3 quad)) - (.add.mul.y.vf acc vf29 vf1 acc) - (nop!) - (.add.mul.z.vf vf1 vf30 vf1 acc) - (nop!) - (.mul.w.vf acc vf31 vf0) - (nop!) - (.add.mul.x.vf acc vf28 vf2 acc) - (nop!) - (.add.mul.y.vf acc vf29 vf2 acc) - (nop!) - (.add.mul.z.vf vf2 vf30 vf2 acc) - (nop!) - (.mul.w.vf acc vf31 vf0) - (nop!) - (.add.mul.x.vf acc vf28 vf3 acc) - (nop!) - (.add.mul.y.vf acc vf29 vf3 acc) - (nop!) - (.add.mul.z.vf vf3 vf30 vf3 acc) - (nop!) - (.mul.w.vf acc vf31 vf0) - (nop!) - (.add.mul.x.vf acc vf28 vf4 acc) - (nop!) - (.add.mul.y.vf acc vf29 vf4 acc) - (nop!) - (.add.mul.z.vf vf4 vf30 vf4 acc) - (.div.vf Q vf25 vf1 :fsf #b10 :ftf #b11) - (let ((t5-21 (-> fw char-tmpl dma-vif quad))) - (nop!) - (let ((t6-18 (-> fw char-tmpl quad 1))) - (nop!) - (set! (-> (the-as (pointer uint128) dma-out) 0) t5-21) - (nop!) - (set! (-> (the-as (pointer uint128) dma-out) 1) t6-18) - ) - ) - (.lvf vf5 (&-> fw current-verts tex-st 0 quad)) - (let ((t5-22 q-lo-tmpl)) - (.lvf vf6 (&-> fw current-verts tex-st 1 quad)) - (let ((t4-28 (logand t4-21 128))) - (.lvf vf7 (&-> fw current-verts tex-st 2 quad)) - ;; note: this relies on (somewhat) undefined behavior that the upper 64-bits of a - ;; gpr aren't changed during movn. - (.movn-128 t5-23 q-hi-tmpl t4-28 t5-22) - ) - ) - ) - ) - (.mul.vf vf1 vf1 Q :mask #b111) - (set! (-> (the-as (pointer uint128) dma-out) 2) (the-as uint128 t5-23)) - (.mul.vf vf5 vf5 Q :mask #b111) - (nop!) - (.nop.vf) - (nop!) - (.nop.vf) - (nop!) - (.div.vf Q vf25 vf2 :fsf #b10 :ftf #b11) - (nop!) - (.lvf vf8 (&-> fw current-verts tex-st 3 quad)) - (nop!) - (.add.vf vf1 vf1 vf26) - (nop!) - (.lvf vf9 (&-> fw color-shadow quad)) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (vftoi4.xyzw vf1 vf1) - (nop!) - (.mul.vf vf2 vf2 Q :mask #b111) - (nop!) - (.mul.vf vf6 vf6 Q :mask #b111) - (.svf (&-> (the-as (pointer uint128) dma-out) 3) vf5) - (.nop.vf) - (nop!) - (.nop.vf) - (nop!) - (.div.vf Q vf25 vf3 :fsf #b10 :ftf #b11) - (.svf (&-> (the-as (pointer uint128) dma-out) 4) vf9) - (nop!) - (.svf (&-> (the-as (pointer uint128) dma-out) 5) vf1) - (.add.vf vf2 vf2 vf26) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (vftoi4.xyzw vf2 vf2) - (nop!) - (.mul.vf vf3 vf3 Q :mask #b111) - (nop!) - (.mul.vf vf7 vf7 Q :mask #b111) - (.svf (&-> (the-as (pointer uint128) dma-out) 6) vf6) - (.nop.vf) - (nop!) - (.nop.vf) - (nop!) - (.div.vf Q vf25 vf4 :fsf #b10 :ftf #b11) - (.svf (&-> (the-as (pointer uint128) dma-out) 7) vf9) - (nop!) - (.svf (&-> (the-as (pointer uint128) dma-out) 8) vf2) - (.add.vf vf3 vf3 vf26) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (vftoi4.xyzw vf3 vf3) - (nop!) - (.mul.vf vf4 vf4 Q :mask #b111) - (nop!) - (.mul.vf vf8 vf8 Q :mask #b111) - (.svf (&-> (the-as (pointer uint128) dma-out) 9) vf7) - (nop!) - (.svf (&-> (the-as (pointer uint128) dma-out) 10) vf9) - (.add.vf vf4 vf4 vf26) - (.svf (&-> (the-as (pointer uint128) dma-out) 11) vf3) - (let ((t4-29 (logand a0-3 2))) - (nop!) - (b! (zero? t4-29) cfg-129) - ) - ) - (b! #t cfg-130 :delay (.add.w.vf vf23 vf23 vf19 :mask #b1)) - (label cfg-129) - (nop!) - (.add.w.vf vf23 vf23 vf14 :mask #b1) - (label cfg-130) - (vftoi4.xyzw vf4 vf4) - (nop!) - (nop!) - (nop!) - (nop!) - (.svf (&-> (the-as (pointer uint128) dma-out) 12) vf8) - (nop!) - (.svf (&-> (the-as (pointer uint128) dma-out) 13) vf9) - (nop!) - (.svf (&-> (the-as (pointer uint128) dma-out) 14) vf4) - (b! - #t - cfg-73 - :delay - (set! dma-out (&-> (the-as (pointer uint128) dma-out) 15)) - ) - (label cfg-131) - (let ((a0-4 (-> fw flags-signed))) - (let ((t2-2 (the-as object fw)) - (t3-8 (-> fw str-ptr-signed)) - ) - (.lvf vf23 (&-> (the-as font-work t2-2) justify 0 quad)) - (label cfg-132) - (let ((t4-30 (-> t3-8 4))) - (set! t3-8 (&-> t3-8 1)) - (b! (zero? t4-30) cfg-189 :delay (set! t5-24 (+ t4-30 -1))) - (b! (zero? t5-24) cfg-179 :delay (set! t5-25 (+ t4-30 -126))) - (b! (nonzero? t5-25) cfg-180) - (set! t4-30 (-> t3-8 4)) - (set! t3-8 (&-> t3-8 1)) - (let ((t5-26 0) - (t6-19 0) - ) - (b! (zero? t4-30) cfg-189 :delay (set! t7-36 (+ t4-30 -43))) - (.movz t5-27 t4-30 t7-36 t5-26) - (let ((t7-37 (+ t4-30 -45))) - (.movz t5-28 t4-30 t7-37 t5-27) - ) - (nop!) - (b! (nonzero? t5-28) cfg-143 :delay (set! t7-38 (+ t4-30 -121))) - (b! (zero? t7-38) cfg-177 :delay (set! t6-20 (+ t4-30 -89))) - (b! (zero? t6-20) cfg-177 :delay (set! t6-21 (+ t4-30 -122))) - (b! (zero? t6-21) cfg-178 :delay (set! t6-22 (+ t4-30 -90))) - (b! (zero? t6-22) cfg-178 :delay (set! t6-23 (+ t4-30 -48))) - (b! - (< (the-as int t6-23) 0) - cfg-180 - :delay - (set! t6-24 (+ t4-30 -57)) - ) - (b! - (> (the-as int t6-24) 0) - cfg-180 - :delay - (set! t6-19 (the-as int (+ t4-30 -48))) - ) - (label cfg-143) - (set! t4-30 (-> t3-8 4)) - (set! t3-8 (&-> t3-8 1)) - (b! (zero? t4-30) cfg-189 :delay (set! t7-39 (+ t4-30 -110))) - (b! (zero? t7-39) cfg-161 :delay (set! t7-40 (+ t4-30 -78))) - (b! (zero? t7-40) cfg-161 :delay (set! t7-41 (+ t4-30 -108))) - (b! (zero? t7-41) cfg-164 :delay (set! t7-42 (+ t4-30 -76))) - (b! (zero? t7-42) cfg-164 :delay (set! t7-43 (+ t4-30 -119))) - (b! (zero? t7-43) cfg-132 :delay (set! t7-44 (+ t4-30 -87))) - (b! (zero? t7-44) cfg-132 :delay (set! t7-45 (+ t4-30 -107))) - (b! (zero? t7-45) cfg-165 :delay (set! t7-46 (+ t4-30 -75))) - (b! (zero? t7-46) cfg-165 :delay (set! t7-47 (+ t4-30 -106))) - (b! (zero? t7-47) cfg-132 :delay (set! t7-48 (+ t4-30 -74))) - (b! (zero? t7-48) cfg-132 :delay (set! t7-49 (+ t4-30 -104))) - (b! (zero? t7-49) cfg-167 :delay (set! t7-50 (+ t4-30 -72))) - (b! (zero? t7-50) cfg-167 :delay (set! t7-51 (+ t4-30 -118))) - (b! (zero? t7-51) cfg-172 :delay (set! t7-52 (+ t4-30 -86))) - (b! (zero? t7-52) cfg-172 :delay (set! t7-53 (+ t4-30 -48))) - (b! - (< (the-as int t7-53) 0) - cfg-180 - :delay - (set! t8-4 (+ t4-30 -57)) - ) - (b! (> (the-as int t8-4) 0) cfg-180 :delay (.sll t8-5 t6-19 2)) - (let ((t4-31 (+ t6-19 t8-5))) - (nop!) - (.sll t4-32 t4-31 1) - ) - (nop!) - (b! #t cfg-143 :delay (set! t6-19 (+ t4-32 t7-53))) - (label cfg-161) - (b! (nonzero? t6-19) cfg-163 :delay (set! a3-8 *font12-table*)) - (set! font-table-to-use a3-8) - (let ((t0-3 -33)) - (.lvf vf13 (&-> fw size1-small quad)) - (nop!) - (.lvf vf14 (&-> fw size2-small quad)) - (nop!) - (.lvf vf15 (&-> fw size3-small quad)) - (set! a0-4 (logand a0-4 t0-3)) - ) - (set! q-lo-tmpl (-> fw small-font-lo-tmpl-qw)) - (b! - #t - cfg-132 - :delay - (set! q-hi-tmpl (-> fw small-font-hi-tmpl-qw)) - ) - (label cfg-163) - (nop!) - (set! font-table-to-use *font24-table*) - (nop!) - (.lvf vf13 (&-> fw size1-large quad)) - (nop!) - (.lvf vf14 (&-> fw size2-large quad)) - (nop!) - (.lvf vf15 (&-> fw size3-large quad)) - (set! a0-4 (logior a0-4 32)) - (set! q-lo-tmpl (-> fw large-font-lo-tmpl-qw)) - (b! - #t - cfg-132 - :delay - (set! q-hi-tmpl (-> fw large-font-hi-tmpl-qw)) - ) - (label cfg-164) - (nop!) - (set! (-> fw last-color-32) t6-19) - (.sll t4-33 t6-19 4) - (let ((t5-29 (-> fw current-verts color 0 quad)) - (t4-34 (the-as object (+ t4-33 (the-as int fw)))) - ) - (let ((t6-25 (-> fw current-verts color 1 quad))) - (nop!) - (set! (-> fw src-verts color 0 quad) t5-29) - (nop!) - (set! (-> fw src-verts color 1 quad) t6-25) - ) - (nop!) - (let ((t5-30 (-> fw current-verts color 2 quad))) - (nop!) - (let ((t6-26 (-> fw current-verts color 3 quad))) - (nop!) - (set! (-> fw src-verts color 2 quad) t5-30) - (nop!) - (set! (-> fw src-verts color 3 quad) t6-26) - ) - ) - (nop!) - (let ((t6-27 (the-as uint128 (deref uint32 (+ (the-as int t4-34) 1984))))) - (nop!) - (let - ((t5-31 - (the-as - uint128 - (-> (the-as font-work t4-34) color-table 0 color 1) - ) - ) - ) - (.pextlb t6-28 r0 t6-27) - (.mov r0 f31-0) - (.pextlh t6-29 r0 t6-28) - (.mov r0 f31-0) - (.pextlb t5-32 r0 t5-31) - ) - ) - (set! (-> fw current-verts color 0 quad) (the-as uint128 t6-29)) - (.pextlh t5-33 r0 t5-32) - (set! (-> fw dest-verts color 0 quad) (the-as uint128 t6-29)) - (nop!) - (set! (-> fw current-verts color 1 quad) (the-as uint128 t5-33)) - (nop!) - (set! (-> fw dest-verts color 1 quad) (the-as uint128 t5-33)) - (nop!) - (let - ((t5-34 - (the-as - uint128 - (-> (the-as font-work t4-34) color-table 0 color 2) - ) - ) - ) - (nop!) - (let - ((t4-35 - (the-as - uint128 - (-> (the-as font-work t4-34) color-table 0 color 3) - ) - ) - ) - (.pextlb t5-35 r0 t5-34) - (.mov r0 f31-0) - (.pextlh t5-36 r0 t5-35) - (.mov r0 f31-0) - (.pextlb t4-36 r0 t4-35) - ) - ) - ) - (set! (-> fw current-verts color 2 quad) (the-as uint128 t5-36)) - (.pextlh t4-37 r0 t4-36) - (set! (-> fw dest-verts color 2 quad) (the-as uint128 t5-36)) - (nop!) - (set! (-> fw current-verts color 3 quad) (the-as uint128 t4-37)) - (b! - #t - cfg-132 - :delay - (set! - (-> fw dest-verts color 3 quad) - (the-as uint128 (the-as int t4-37)) - ) - ) - (label cfg-165) - (let ((t4-38 -3)) - (nop!) - (b! (zero? t6-19) cfg-132 :delay (set! a0-4 (logand a0-4 t4-38))) - ) - (b! #t cfg-132 :delay (set! a0-4 (logior a0-4 2))) - (label cfg-167) - (.mov vf1 t6-19) - (let ((t4-39 (+ t5-28 -45))) - (b! (zero? t5-28) cfg-171 :delay (.itof.vf vf1 vf1)) - (b! (zero? t4-39) cfg-170) - ) - (b! #t cfg-132 :delay (.add.x.vf vf23 vf23 vf1 :mask #b1)) - (label cfg-170) - (b! #t cfg-132 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b1)) - (label cfg-171) - (b! #t cfg-132 :delay (.add.x.vf vf23 vf0 vf1 :mask #b1)) - (label cfg-172) - (.mov vf1 t6-19) - ) - (let ((t4-40 (+ t5-28 -45))) - (b! (zero? t5-28) cfg-176 :delay (.itof.vf vf1 vf1)) - (b! (zero? t4-40) cfg-175) - ) - (b! #t cfg-132 :delay (.add.x.vf vf23 vf23 vf1 :mask #b10)) - (label cfg-175) - (b! #t cfg-132 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b10)) - (label cfg-176) - (b! #t cfg-132 :delay (.add.x.vf vf23 vf0 vf1 :mask #b10)) - (label cfg-177) - (nop!) - (let ((t4-41 (-> fw last-color-32))) - (nop!) - (.lvf vf9 (&-> fw current-verts color 0 quad)) - (nop!) - (.lvf vf10 (&-> fw current-verts color 1 quad)) - (nop!) - (.lvf vf11 (&-> fw current-verts color 2 quad)) - (nop!) - (.lvf vf12 (&-> fw current-verts color 3 quad)) - (nop!) - (set! (-> fw save-last-color-32) t4-41) - ) - (nop!) - (.svf (&-> fw save-color 0 quad) vf9) - (nop!) - (.svf (&-> fw save-color 1 quad) vf10) - (nop!) - (.svf (&-> fw save-color 2 quad) vf11) - (nop!) - (.svf (&-> fw save-color 3 quad) vf12) - (b! #t cfg-132 :delay (.svf (&-> fw save quad) vf23)) - (label cfg-178) - (nop!) - (let ((t4-42 (-> fw save-last-color-32))) - (nop!) - (.lvf vf9 (&-> fw save-color 0 quad)) - (nop!) - (.lvf vf10 (&-> fw save-color 1 quad)) - (nop!) - (.lvf vf11 (&-> fw save-color 2 quad)) - (nop!) - (.lvf vf12 (&-> fw save-color 3 quad)) - (nop!) - (set! (-> fw last-color-32) t4-42) - ) - (nop!) - (.svf (&-> fw current-verts color 0 quad) vf9) - (nop!) - (.svf (&-> fw dest-verts color 0 quad) vf9) - (nop!) - (.svf (&-> fw current-verts color 1 quad) vf10) - (nop!) - (.svf (&-> fw dest-verts color 1 quad) vf10) - (nop!) - (.svf (&-> fw current-verts color 2 quad) vf11) - (nop!) - (.svf (&-> fw dest-verts color 2 quad) vf11) - (nop!) - (.svf (&-> fw current-verts color 3 quad) vf12) - (nop!) - (.svf (&-> fw dest-verts color 3 quad) vf12) - (b! #t cfg-132 :delay (.lvf vf23 (&-> fw save quad))) - (label cfg-179) - (set! t4-30 (-> t3-8 4)) - (set! t3-8 (&-> t3-8 1)) - (.add.vf vf4 vf23 vf15 :mask #b111) - (let ((t5-37 (logand t4-30 127))) - (.sub.vf vf1 vf25 vf23) - (let ((t5-38 (+ t5-37 255))) - (b! #t cfg-183 :delay (.sll t5-39 t5-38 4)) - ) - ) - (label cfg-180) - (.add.vf vf4 vf23 vf15 :mask #b111) - (.sll t5-39 t4-30 4) - (.sub.vf vf1 vf25 vf23) - (b! (= t4-30 10) cfg-182 :delay (set! t6-31 (+ t4-30 -13))) - (b! (nonzero? t6-31) cfg-183) - (label cfg-182) - (set! t2-2 (&-> (the-as (pointer uint64) t2-2) 2)) - (nop!) - (b! - #t - cfg-132 - :delay - (.lvf vf23 (+ (the-as int t2-2) 944)) - ) - (label cfg-183) - (.addu t5-40 t5-39 font-table-to-use) - (nop!) - (.lvf vf5 (+ t5-40 -256)) - (.mov t5-41 vf1) - (b! - (< (the-as int t5-41) 0) - cfg-189 - :delay - (.add.vf vf6 vf5 vf16 :mask #b111) - ) - (.sra t5-42 t5-41 31) - (.add.vf vf7 vf5 vf17 :mask #b111) - (b! (< t5-42 0) cfg-132 :delay (.add.vf vf8 vf5 vf18 :mask #b111)) - (.add.vf vf1 vf23 vf0 :mask #b111) - (nop!) - (.add.vf vf2 vf23 vf13 :mask #b111) - (nop!) - (.add.vf vf3 vf23 vf14 :mask #b111) - (.svf (&-> fw current-verts tex-st 0 quad) vf5) - (.add.vf vf4 vf23 vf15 :mask #b111) - (.svf (&-> fw current-verts tex-st 1 quad) vf6) - (.mul.vf vf19 vf5 vf13) - (.svf (&-> fw current-verts tex-st 2 quad) vf7) - (nop!) - (.svf (&-> fw current-verts tex-st 3 quad) vf8) - (nop!) - (.svf (&-> fw current-verts pos 0 quad) vf1) - (nop!) - (.svf (&-> fw current-verts pos 1 quad) vf2) - (nop!) - (.svf (&-> fw current-verts pos 2 quad) vf3) - (nop!) - (.svf (&-> fw current-verts pos 3 quad) vf4) - (.lvf vf1 (&-> fw current-verts pos 0 quad)) - (nop!) - (.lvf vf2 (&-> fw current-verts pos 1 quad)) - (.mul.w.vf acc vf31 vf0) - (.lvf vf3 (&-> fw current-verts pos 2 quad)) - (.add.mul.x.vf acc vf28 vf1 acc) - (.lvf vf4 (&-> fw current-verts pos 3 quad)) - (.add.mul.y.vf acc vf29 vf1 acc) - (nop!) - (.add.mul.z.vf vf1 vf30 vf1 acc) - (nop!) - (.mul.w.vf acc vf31 vf0) - (nop!) - (.add.mul.x.vf acc vf28 vf2 acc) - (nop!) - (.add.mul.y.vf acc vf29 vf2 acc) - (nop!) - (.add.mul.z.vf vf2 vf30 vf2 acc) - (nop!) - (.mul.w.vf acc vf31 vf0) - (nop!) - (.add.mul.x.vf acc vf28 vf3 acc) - (nop!) - (.add.mul.y.vf acc vf29 vf3 acc) - (nop!) - (.add.mul.z.vf vf3 vf30 vf3 acc) - (nop!) - (.mul.w.vf acc vf31 vf0) - (nop!) - (.add.mul.x.vf acc vf28 vf4 acc) - (nop!) - (.add.mul.y.vf acc vf29 vf4 acc) - (nop!) - (.add.mul.z.vf vf4 vf30 vf4 acc) - (.div.vf Q vf25 vf1 :fsf #b10 :ftf #b11) - (let ((t5-43 (-> fw char-tmpl dma-vif quad))) - (nop!) - (let ((t6-32 (-> fw char-tmpl quad 1))) - (nop!) - (set! (-> (the-as (pointer uint128) dma-out) 0) t5-43) - (nop!) - (set! (-> (the-as (pointer uint128) dma-out) 1) t6-32) - ) - ) - (.lvf vf5 (&-> fw current-verts tex-st 0 quad)) - (let ((t5-44 q-lo-tmpl)) - (.lvf vf6 (&-> fw current-verts tex-st 1 quad)) - (let ((t4-43 (logand t4-30 128))) - (.lvf vf7 (&-> fw current-verts tex-st 2 quad)) - (.movn-128 t5-45 q-hi-tmpl t4-43 t5-44) - ) - ) - ) - ) - (.mul.vf vf1 vf1 Q :mask #b111) - (set! (-> (the-as (pointer uint128) dma-out) 2) (the uint128 t5-45)) - (.mul.vf vf5 vf5 Q :mask #b111) - (nop!) - (.nop.vf) - (nop!) - (.nop.vf) - (nop!) - (.div.vf Q vf25 vf2 :fsf #b10 :ftf #b11) - (nop!) - (.lvf vf8 (&-> fw current-verts tex-st 3 quad)) - (nop!) - (.add.vf vf1 vf1 vf27) - (nop!) - (.lvf vf9 (&-> fw current-verts color 0 quad)) - (nop!) - (.lvf vf10 (&-> fw current-verts color 1 quad)) - (nop!) - (.lvf vf11 (&-> fw current-verts color 2 quad)) - (nop!) - (vftoi4.xyzw vf1 vf1) - (nop!) - (.mul.vf vf2 vf2 Q :mask #b111) - (nop!) - (.mul.vf vf6 vf6 Q :mask #b111) - (.svf (&-> (the-as (pointer uint128) dma-out) 3) vf5) - (.nop.vf) - (nop!) - (.nop.vf) - (nop!) - (.div.vf Q vf25 vf3 :fsf #b10 :ftf #b11) - (.svf (&-> (the-as (pointer uint128) dma-out) 4) vf9) - (.lvf vf12 (&-> fw current-verts color 3 quad)) - (.svf (&-> (the-as (pointer uint128) dma-out) 5) vf1) - (.add.vf vf2 vf2 vf27) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (vftoi4.xyzw vf2 vf2) - (nop!) - (.mul.vf vf3 vf3 Q :mask #b111) - (nop!) - (.mul.vf vf7 vf7 Q :mask #b111) - (.svf (&-> (the-as (pointer uint128) dma-out) 6) vf6) - (.nop.vf) - (nop!) - (.nop.vf) - (nop!) - (.div.vf Q vf25 vf4 :fsf #b10 :ftf #b11) - (.svf (&-> (the-as (pointer uint128) dma-out) 7) vf10) - (nop!) - (.svf (&-> (the-as (pointer uint128) dma-out) 8) vf2) - (.add.vf vf3 vf3 vf27) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (vftoi4.xyzw vf3 vf3) - (nop!) - (.mul.vf vf4 vf4 Q :mask #b111) - (nop!) - (.mul.vf vf8 vf8 Q :mask #b111) - (.svf (&-> (the-as (pointer uint128) dma-out) 9) vf7) - (nop!) - (.svf (&-> (the-as (pointer uint128) dma-out) 10) vf11) - (.add.vf vf4 vf4 vf27) - ;;(s.vf! (+ dma-out 176) vf3) - (.svf (+ (the-as int dma-out) 176) vf3) - (let ((t4-44 (logand a0-4 2))) - (nop!) - (b! (zero? t4-44) cfg-187) - ) - ) - ) - ) - ) - (b! #t cfg-188 :delay (.add.w.vf vf23 vf23 vf19 :mask #b1)) - (label cfg-187) - (nop!) - (.add.w.vf vf23 vf23 vf14 :mask #b1) - (label cfg-188) - (vftoi4.xyzw vf4 vf4) - (nop!) - (nop!) - (nop!) - (nop!) - ;;(s.vf! (+ dma-out 192) vf8) - (.svf (+ (the-as int dma-out) 192) vf8) - (nop!) - ;;(s.vf! (+ dma-out 208) vf12) - (.svf (+ (the-as int dma-out) 208) vf12) - (nop!) - ;;(s.vf! (+ dma-out 224) vf4) - (.svf (+ (the-as int dma-out) 224) vf4) - (b! #t cfg-132 :delay (set! dma-out (&+ dma-out 240))) - (label cfg-189) - (let ((v1-6 (-> fw buf))) - ;;(s.w! (+ v1-6 4) dma-out) - (set! (-> (the-as (pointer pointer) v1-6) 1) dma-out) - ) - ) - ) - (.lvf vf24 (&-> arg2 origin quad)) - (.sub.vf vf23 vf23 vf24) - (.mov v0-0 vf23) - v0-0 - ) ) -;; definition for function draw-string-adv -;; INFO: Return type mismatch float vs none. -(defun draw-string-adv ((arg0 string) (arg1 dma-buffer) (arg2 font-context)) - (+! (-> arg2 origin x) (draw-string arg0 arg1 arg2)) +(defun draw-string-adv ((str string) (buf dma-buffer) (ctxt font-context)) + "Draw a string and advance the position of the context." + (+! (-> ctxt origin x) (draw-string str buf ctxt)) (none) ) (defun get-string-length ((arg0 string) (arg1 font-context)) + "Get the length of a string, in pixels" (local-vars - (v0-0 float) - (a2-1 (inline-array vector)) - (a2-4 (inline-array vector)) - (a3-2 int) - (a3-9 uint) - (a3-10 int) - (t0-0 uint) - (t0-1 uint) - (t0-3 int) - (t0-4 int) - (t0-5 int) - (t1-1 uint) - (t1-2 uint) - (t1-3 uint) - (t1-4 uint) - (t1-5 uint) - (t2-0 uint) - (t2-2 uint) - (t2-3 uint) - (t2-4 uint) - (t2-5 uint) - (t2-6 uint) - (t2-7 uint) - (t2-8 uint) - (t2-9 uint) - (t2-10 uint) - (t2-11 uint) - (t2-12 uint) - (t2-13 uint) - (t2-14 uint) - (t2-15 uint) - (t2-16 uint) - (t2-17 uint) - (t3-0 uint) - (t3-1 int) - ) + (v0-0 float) (a2-1 (inline-array vector)) (a2-4 (inline-array vector)) (a3-2 int) (a3-9 uint) + (a3-10 int) (t0-0 uint) (t0-1 uint) (t0-3 int) (t0-4 int) (t0-5 int) (t1-1 uint) (t1-2 uint) + (t1-3 uint) (t1-4 uint) (t1-5 uint) (t2-0 uint) (t2-2 uint) (t2-3 uint) (t2-4 uint) (t2-5 uint) + (t2-6 uint) (t2-7 uint) (t2-8 uint) (t2-9 uint) (t2-10 uint) (t2-11 uint) (t2-12 uint) (t2-13 uint) + (t2-14 uint) (t2-15 uint) (t2-16 uint) (t2-17 uint) (t3-0 uint) (t3-1 int) + ) (rlet ((vf0 :class vf) (vf1 :class vf) (vf13 :class vf) @@ -2068,183 +1639,163 @@ (vf25 :class vf) (vf5 :class vf) ) - (init-vf0-vector) - (.lvf vf25 (&-> arg1 context-vec quad)) - (.lvf vf23 (&-> arg1 origin quad)) - (.lvf vf24 (&-> arg1 origin quad)) - (let ((v1-0 (-> arg1 flags-signed))) - (let ((a1-2 *video-parms*)) - (.lvf vf1 (+ (the-as int a1-2) 64)) - ) - (.mul.vf vf25 vf25 vf1 :mask #b11) - (.mul.vf vf23 vf23 vf1 :mask #b11) - (.mul.vf vf24 vf24 vf1 :mask #b11) - (let ((a1-4 *font-work*)) - (set! (-> a1-4 str-ptr) (the-as uint arg0)) - (set! (-> a1-4 flags) (the-as uint v1-0)) - (.mov.vf vf1 vf0) - (let ((a2-0 (logand v1-0 32))) - (nop!) - (b! (nonzero? a2-0) cfg-2 :delay (set! a2-1 *font12-table*)) - ) - (let ((a2-2 a2-1)) - (nop!) - (.lvf vf13 (&-> a1-4 size1-small quad)) - (b! #t cfg-3 :delay (.lvf vf14 (&-> a1-4 size2-small quad))) - (label cfg-2) - (nop!) - (set! a2-2 *font24-table*) - (nop!) - (.lvf vf13 (&-> a1-4 size1-large quad)) - (nop!) - (.lvf vf14 (&-> a1-4 size2-large quad)) - (label cfg-3) - (let ((a3-0 (-> (the-as (pointer uint8) arg0) 4))) - (set! arg0 (the-as string (&-> (the-as (pointer uint8) arg0) 1))) - (b! (zero? a3-0) cfg-51 :delay (set! t0-0 (+ a3-0 -1))) - (b! (zero? t0-0) cfg-44 :delay (set! t0-1 (+ a3-0 -126))) - (b! (nonzero? t0-1) cfg-45) - (set! a3-0 (-> (the-as (pointer uint8) arg0) 4)) - (set! arg0 (the-as string (&-> (the-as (pointer uint8) arg0) 1))) - 0 - (let ((t1-0 0)) - (b! (zero? a3-0) cfg-51 :delay (set! t2-0 (+ a3-0 -43))) - (.movz t0-3 a3-0 t2-0 0) ;; TODO Wrong - (let ((t2-1 (+ a3-0 -45))) - (.movz t0-4 a3-0 t2-1 0 );; TODO wrong - ) - (nop!) - (b! (nonzero? t0-4) cfg-14 :delay (set! t2-2 (+ a3-0 -121))) - (b! (zero? t2-2) cfg-42 :delay (set! t1-1 (+ a3-0 -89))) - (b! (zero? t1-1) cfg-42 :delay (set! t1-2 (+ a3-0 -122))) - (b! (zero? t1-2) cfg-43 :delay (set! t1-3 (+ a3-0 -90))) - (b! (zero? t1-3) cfg-43 :delay (set! t1-4 (+ a3-0 -48))) - (b! (< (the-as int t1-4) 0) cfg-45 :delay (set! t1-5 (+ a3-0 -57))) - (b! - (> (the-as int t1-5) 0) - cfg-45 - :delay - (set! t1-0 (the-as int (+ a3-0 -48))) - ) - (label cfg-14) - (set! a3-0 (-> (the-as (pointer uint8) arg0) 4)) - (set! arg0 (the-as string (&-> (the-as (pointer uint8) arg0) 1))) - (b! (zero? a3-0) cfg-51 :delay (set! t2-3 (+ a3-0 -110))) - (b! (zero? t2-3) cfg-32 :delay (set! t2-4 (+ a3-0 -78))) - (b! (zero? t2-4) cfg-32 :delay (set! t2-5 (+ a3-0 -108))) - (b! (zero? t2-5) cfg-3 :delay (set! t2-6 (+ a3-0 -76))) - (b! (zero? t2-6) cfg-3 :delay (set! t2-7 (+ a3-0 -119))) - (b! (zero? t2-7) cfg-3 :delay (set! t2-8 (+ a3-0 -87))) - (b! (zero? t2-8) cfg-3 :delay (set! t2-9 (+ a3-0 -107))) - (b! (zero? t2-9) cfg-35 :delay (set! t2-10 (+ a3-0 -75))) - (b! (zero? t2-10) cfg-35 :delay (set! t2-11 (+ a3-0 -106))) - (b! (zero? t2-11) cfg-3 :delay (set! t2-12 (+ a3-0 -74))) - (b! (zero? t2-12) cfg-3 :delay (set! t2-13 (+ a3-0 -104))) - (b! (zero? t2-13) cfg-37 :delay (set! t2-14 (+ a3-0 -72))) - (b! (zero? t2-14) cfg-37 :delay (set! t2-15 (+ a3-0 -118))) - (b! (zero? t2-15) cfg-3 :delay (set! t2-16 (+ a3-0 -86))) - (b! (zero? t2-16) cfg-3 :delay (set! t2-17 (+ a3-0 -48))) - (b! (< (the-as int t2-17) 0) cfg-45 :delay (set! t3-0 (+ a3-0 -57))) - (b! (> (the-as int t3-0) 0) cfg-45 :delay (.sll t3-1 t1-0 2)) - (let ((a3-1 (+ t1-0 t3-1))) - (nop!) - (.sll a3-2 a3-1 1) - ) - (nop!) - (b! #t cfg-14 :delay (set! t1-0 (+ a3-2 t2-17))) - (label cfg-32) - (b! (nonzero? t1-0) cfg-34 :delay (set! a2-4 *font12-table*)) - (set! a2-2 a2-4) - (let ((a3-3 -33)) - (.lvf vf13 (&-> a1-4 size1-small quad)) - (nop!) - (.lvf vf14 (&-> a1-4 size2-small quad)) - (b! #t cfg-3 :delay (set! v1-0 (logand v1-0 a3-3))) - ) - (label cfg-34) - (nop!) - (set! a2-2 *font24-table*) - (nop!) - (.lvf vf13 (&-> a1-4 size1-large quad)) - (nop!) - (.lvf vf14 (&-> a1-4 size2-large quad)) - (b! #t cfg-3 :delay (set! v1-0 (logior v1-0 32))) - (label cfg-35) - (let ((a3-4 -3)) - (nop!) - (b! (zero? t1-0) cfg-3 :delay (set! v1-0 (logand v1-0 a3-4))) - ) - (b! #t cfg-3 :delay (set! v1-0 (logior v1-0 2))) - (label cfg-37) - (.mov vf1 t1-0) - ) - (let ((a3-5 (+ t0-4 -45))) - (b! (zero? t0-4) cfg-41 :delay (.itof.vf vf1 vf1)) - (b! (zero? a3-5) cfg-40) - ) - (b! #t cfg-3 :delay (.add.x.vf vf23 vf23 vf1 :mask #b1)) - (label cfg-40) - (b! #t cfg-3 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b1)) - (label cfg-41) - (b! #t cfg-3 :delay (.add.x.vf vf23 vf0 vf1 :mask #b1)) - (label cfg-42) - (b! #t cfg-3 :delay (.svf (&-> a1-4 save quad) vf23)) - (label cfg-43) - (b! #t cfg-3 :delay (.lvf vf23 (&-> a1-4 save quad))) - (label cfg-44) - (let ((a3-6 (-> (the-as (pointer uint8) arg0) 4))) - (set! arg0 (the-as string (&-> (the-as (pointer uint8) arg0) 1))) - (nop!) - (let ((a3-7 (logand a3-6 127))) - (nop!) - (let ((a3-8 (+ a3-7 255))) - (b! #t cfg-48 :delay (.sll t0-5 a3-8 4)) + (init-vf0-vector) + (.lvf vf25 (&-> arg1 context-vec quad)) + (.lvf vf23 (&-> arg1 origin quad)) + (.lvf vf24 (&-> arg1 origin quad)) + (let ((v1-0 (-> arg1 flags-signed))) + (let ((a1-2 *video-parms*)) + (.lvf vf1 (+ (the-as int a1-2) 64)) + ) + (.mul.vf vf25 vf25 vf1 :mask #b11) + (.mul.vf vf23 vf23 vf1 :mask #b11) + (.mul.vf vf24 vf24 vf1 :mask #b11) + (let ((a1-4 *font-work*)) + (set! (-> a1-4 str-ptr) (the-as uint arg0)) + (set! (-> a1-4 flags) (the-as uint v1-0)) + (.mov.vf vf1 vf0) + (let ((a2-0 (logand v1-0 32))) + (b! (nonzero? a2-0) cfg-2 :delay (set! a2-1 *font12-table*)) + ) + (let ((a2-2 a2-1)) + (.lvf vf13 (&-> a1-4 size1-small quad)) + (b! #t cfg-3 :delay (.lvf vf14 (&-> a1-4 size2-small quad))) + (label cfg-2) + (set! a2-2 *font24-table*) + (.lvf vf13 (&-> a1-4 size1-large quad)) + (.lvf vf14 (&-> a1-4 size2-large quad)) + (label cfg-3) + (let ((a3-0 (-> (the-as (pointer uint8) arg0) 4))) + (set! arg0 (the-as string (&-> (the-as (pointer uint8) arg0) 1))) + (b! (zero? a3-0) cfg-51 :delay (set! t0-0 (+ a3-0 -1))) + (b! (zero? t0-0) cfg-44 :delay (set! t0-1 (+ a3-0 -126))) + (b! (nonzero? t0-1) cfg-45) + (set! a3-0 (-> (the-as (pointer uint8) arg0) 4)) + (set! arg0 (the-as string (&-> (the-as (pointer uint8) arg0) 1))) + 0 + (let ((t1-0 0)) + (b! (zero? a3-0) cfg-51 :delay (set! t2-0 (+ a3-0 -43))) + (.movz t0-3 a3-0 t2-0 0) ;; TODO Wrong + (let ((t2-1 (+ a3-0 -45))) + (.movz t0-4 a3-0 t2-1 0 );; TODO wrong + ) + (b! (nonzero? t0-4) cfg-14 :delay (set! t2-2 (+ a3-0 -121))) + (b! (zero? t2-2) cfg-42 :delay (set! t1-1 (+ a3-0 -89))) + (b! (zero? t1-1) cfg-42 :delay (set! t1-2 (+ a3-0 -122))) + (b! (zero? t1-2) cfg-43 :delay (set! t1-3 (+ a3-0 -90))) + (b! (zero? t1-3) cfg-43 :delay (set! t1-4 (+ a3-0 -48))) + (b! (< (the-as int t1-4) 0) cfg-45 :delay (set! t1-5 (+ a3-0 -57))) + (b! + (> (the-as int t1-5) 0) + cfg-45 + :delay + (set! t1-0 (the-as int (+ a3-0 -48))) + ) + (label cfg-14) + (set! a3-0 (-> (the-as (pointer uint8) arg0) 4)) + (set! arg0 (the-as string (&-> (the-as (pointer uint8) arg0) 1))) + (b! (zero? a3-0) cfg-51 :delay (set! t2-3 (+ a3-0 -110))) + (b! (zero? t2-3) cfg-32 :delay (set! t2-4 (+ a3-0 -78))) + (b! (zero? t2-4) cfg-32 :delay (set! t2-5 (+ a3-0 -108))) + (b! (zero? t2-5) cfg-3 :delay (set! t2-6 (+ a3-0 -76))) + (b! (zero? t2-6) cfg-3 :delay (set! t2-7 (+ a3-0 -119))) + (b! (zero? t2-7) cfg-3 :delay (set! t2-8 (+ a3-0 -87))) + (b! (zero? t2-8) cfg-3 :delay (set! t2-9 (+ a3-0 -107))) + (b! (zero? t2-9) cfg-35 :delay (set! t2-10 (+ a3-0 -75))) + (b! (zero? t2-10) cfg-35 :delay (set! t2-11 (+ a3-0 -106))) + (b! (zero? t2-11) cfg-3 :delay (set! t2-12 (+ a3-0 -74))) + (b! (zero? t2-12) cfg-3 :delay (set! t2-13 (+ a3-0 -104))) + (b! (zero? t2-13) cfg-37 :delay (set! t2-14 (+ a3-0 -72))) + (b! (zero? t2-14) cfg-37 :delay (set! t2-15 (+ a3-0 -118))) + (b! (zero? t2-15) cfg-3 :delay (set! t2-16 (+ a3-0 -86))) + (b! (zero? t2-16) cfg-3 :delay (set! t2-17 (+ a3-0 -48))) + (b! (< (the-as int t2-17) 0) cfg-45 :delay (set! t3-0 (+ a3-0 -57))) + (b! (> (the-as int t3-0) 0) cfg-45 :delay (.sll t3-1 t1-0 2)) + (let ((a3-1 (+ t1-0 t3-1))) + (.sll a3-2 a3-1 1) + ) + (b! #t cfg-14 :delay (set! t1-0 (+ a3-2 t2-17))) + (label cfg-32) + (b! (nonzero? t1-0) cfg-34 :delay (set! a2-4 *font12-table*)) + (set! a2-2 a2-4) + (let ((a3-3 -33)) + (.lvf vf13 (&-> a1-4 size1-small quad)) + (.lvf vf14 (&-> a1-4 size2-small quad)) + (b! #t cfg-3 :delay (set! v1-0 (logand v1-0 a3-3))) + ) + (label cfg-34) + (set! a2-2 *font24-table*) + (.lvf vf13 (&-> a1-4 size1-large quad)) + (.lvf vf14 (&-> a1-4 size2-large quad)) + (b! #t cfg-3 :delay (set! v1-0 (logior v1-0 32))) + (label cfg-35) + (let ((a3-4 -3)) + (b! (zero? t1-0) cfg-3 :delay (set! v1-0 (logand v1-0 a3-4))) + ) + (b! #t cfg-3 :delay (set! v1-0 (logior v1-0 2))) + (label cfg-37) + (.mov vf1 t1-0) + ) + (let ((a3-5 (+ t0-4 -45))) + (b! (zero? t0-4) cfg-41 :delay (.itof.vf vf1 vf1)) + (b! (zero? a3-5) cfg-40) + ) + (b! #t cfg-3 :delay (.add.x.vf vf23 vf23 vf1 :mask #b1)) + (label cfg-40) + (b! #t cfg-3 :delay (.sub.x.vf vf23 vf23 vf1 :mask #b1)) + (label cfg-41) + (b! #t cfg-3 :delay (.add.x.vf vf23 vf0 vf1 :mask #b1)) + (label cfg-42) + (b! #t cfg-3 :delay (.svf (&-> a1-4 save quad) vf23)) + (label cfg-43) + (b! #t cfg-3 :delay (.lvf vf23 (&-> a1-4 save quad))) + (label cfg-44) + (let ((a3-6 (-> (the-as (pointer uint8) arg0) 4))) + (set! arg0 (the-as string (&-> (the-as (pointer uint8) arg0) 1))) + (let ((a3-7 (logand a3-6 127))) + (let ((a3-8 (+ a3-7 255))) + (b! #t cfg-48 :delay (.sll t0-5 a3-8 4)) + ) + ) + ) + (label cfg-45) + (.sll t0-5 a3-0 4) + (b! (= a3-0 10) cfg-47 :delay (set! a3-9 (+ a3-0 -13))) + ) + (b! (nonzero? a3-9) cfg-48) + (label cfg-47) + (b! #t cfg-3 :delay (.add.x.vf vf23 vf0 vf24 :mask #b1)) + (label cfg-48) + (.addu a3-10 t0-5 a2-2) + ) + ) + (.lvf vf5 (+ a3-10 -256)) + (.mul.vf vf19 vf5 vf13) + (b! (zero? (logand v1-0 2)) cfg-50) ) - ) + (b! #t cfg-3 :delay (.add.w.vf vf23 vf23 vf19 :mask #b1)) + (label cfg-50) + (b! #t cfg-3 :delay (.add.w.vf vf23 vf23 vf14 :mask #b1)) + (label cfg-51) + (.sub.vf vf23 vf23 vf24) + (.mov v0-0 vf23) + v0-0 ) - (label cfg-45) - (nop!) - (.sll t0-5 a3-0 4) - (nop!) - (b! (= a3-0 10) cfg-47 :delay (set! a3-9 (+ a3-0 -13))) - ) - (b! (nonzero? a3-9) cfg-48) - (label cfg-47) - (b! #t cfg-3 :delay (.add.x.vf vf23 vf0 vf24 :mask #b1)) - (label cfg-48) - (.addu a3-10 t0-5 a2-2) - ) - ) - (nop!) - (.lvf vf5 (+ a3-10 -256)) - (nop!) - (.mul.vf vf19 vf5 vf13) - (b! (zero? (logand v1-0 2)) cfg-50) - ) - (b! #t cfg-3 :delay (.add.w.vf vf23 vf23 vf19 :mask #b1)) - (label cfg-50) - (b! #t cfg-3 :delay (.add.w.vf vf23 vf23 vf14 :mask #b1)) - (label cfg-51) - (.sub.vf vf23 vf23 vf24) - (.mov v0-0 vf23) - v0-0 - ) ) -(defun draw-string-xy ((arg0 string) (arg1 dma-buffer) (arg2 int) (arg3 int) (arg4 font-color) (arg5 int)) - ;(format #t "call to ds: ~A~%" arg0) - (let ((a2-2 (new 'stack 'font-context - *font-default-matrix* - arg2 - arg3 - 0.0 - arg4 - (the-as uint arg5) - ) - ) +(defun draw-string-xy ((str string) (buf dma-buffer) (x int) (y int) (color font-color) (flags int)) + "Draw a string at the given xy location." + (let ((context (new 'stack 'font-context + *font-default-matrix* + x + y + 0.0 + color + (the-as uint flags) + ) + ) ) - ;;(format 0 "len is ~f~%" (get-string-length arg0 a2-2)) - (draw-string arg0 arg1 a2-2) + (draw-string str buf context) ) (none) ) diff --git a/goal_src/engine/level/level-h.gc b/goal_src/engine/level/level-h.gc index 07b58e332b..847e5fb8de 100644 --- a/goal_src/engine/level/level-h.gc +++ b/goal_src/engine/level/level-h.gc @@ -9,6 +9,12 @@ (defconstant LEVEL_COUNT 2) ;; there are two levels in memory! +(defenum vis-info-flag + :bitfield #t + :type uint32 + (waiting-for-load 30) + ) + ;; Information related to visibility data for a level. ;; Unclear why there are 8 of these per level. ;; Perhaps there are up to 8 "chunks" of the visibility loaded at a single time? @@ -27,7 +33,7 @@ (ramdisk uint32 :offset-assert 40) (vis-bits pointer :offset-assert 44) (current-vis-string uint32 :offset-assert 48) - (vis-string uint8 :dynamic :offset-assert 52) + (vis-string uint32 :dynamic :offset-assert 52) ) :method-count-assert 9 :size-assert #x34 @@ -152,7 +158,7 @@ (bsp-name (_type_) symbol 13) (dummy-14 (_type_ object) memory-usage-block 14) (dummy-15 (_type_ vector) symbol 15) - (dummy-16 (_type_ uint uint) none 16) + (update-vis! (_type_ level-vis-info uint uint) symbol 16) (load-continue (_type_) _type_ 17) (load-begin (_type_) _type_ 18) (login (_type_) _type_ 19) diff --git a/goal_src/engine/load/decomp.gc b/goal_src/engine/load/decomp.gc index 9858672255..72e359bbae 100644 --- a/goal_src/engine/load/decomp.gc +++ b/goal_src/engine/load/decomp.gc @@ -5,3 +5,309 @@ ;; name in dgo: decomp ;; dgos: GAME, ENGINE +;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; decompression functions +;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(defun unpack-comp-rle ((out (pointer int8)) (in (pointer int8))) + "Unpack run-length-encoded data. Has sections of repeated values, then normally copied." + (local-vars (current-input int) (copy-length int)) + (nop!) + (while #t + (while #t + + ;; read the input and see what kind it is, based on number. + (set! current-input (-> in 0)) + (set! in (&-> in 1)) + (b! (<= current-input 0) cfg-5 :delay (nop!)) + + ;; it's a repated value, loop to copy it. + (let ((repeated-value (-> in 0))) + (set! in (&-> in 1)) + (label cfg-3) + (set! (-> out 0) repeated-value) + ) + (set! out (&-> out 1)) + (b! (> current-input 0) cfg-3 :delay (set! current-input (+ current-input -1))) + ) + + (label cfg-5) + ;; check for end + (b! (zero? current-input) cfg-8 :delay (set! copy-length (- current-input))) + + ;; copy + (label cfg-6) + (let ((src-val (-> in 0))) + (set! in (&-> in 1)) + (set! (-> out 0) src-val) + ) + (+! copy-length -1) + (b! (> copy-length 0) cfg-6 :delay (set! out (&-> out 1))) + ) + (label cfg-8) + 0 + (none) + ) + + +(deftype huf-dictionary-node (structure) + ((zero uint16 :offset-assert 0) + (one uint16 :offset-assert 2) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +(defun unpack-comp-huf ((dst (pointer uint8)) (src (pointer uint8)) (arg2 uint) (dict huf-dictionary-node)) + "Unpack data compressed with huffman encoding." + (local-vars (t1-1 uint) (t3-2 object)) + (let ((t1-0 (-> dict zero)) + (a2-1 (+ arg2 -1028)) + (t2-0 (-> dict one)) + ) + (nop!) + (label cfg-1) + (let ((v1-4 128)) + (nop!) + (let ((t0-0 (-> src 0))) + (set! src (&-> src 1)) + (label cfg-2) + (let ((t3-0 (logand t0-0 v1-4))) + (.sra v1-4 v1-4 1) + (b! (zero? t3-0) cfg-4 :delay (set! t1-1 t1-0)) + ) + ) + (nop!) + (set! t1-1 t2-0) + (label cfg-4) + (let ((t2-1 (+ t1-1 -256))) + (let ((t3-1 (* t1-1 4))) + (b! (< (the-as int t2-1) 0) cfg-8 :delay (set! t3-2 (+ t3-1 a2-1))) + ) + (b! (zero? t2-1) cfg-10 + :delay (set! t1-0 (-> (the-as (pointer uint16) t3-2) 0)) + ) + ) + (b! (nonzero? v1-4) cfg-2 + :delay (set! t2-0 (-> (the-as (pointer uint16) t3-2) 1)) + ) + (b! #t cfg-1 :delay (nop!)) + (label cfg-8) + (set! (-> dst 0) t1-1) + (set! dst (&-> dst 1)) + (nop!) + (set! t1-0 (-> dict zero)) + (b! (nonzero? v1-4) cfg-2 :delay (set! t2-0 (-> dict one))) + ) + ) + (b! #t cfg-1 :delay (nop!)) + (label cfg-10) + (nop!) + (nop!) + 0 + (none) + ) + +(defmethod update-vis! level ((obj level) (vis-info level-vis-info) (arg1 uint) (arg2 uint)) + (local-vars (t0-3 uint128) (vis-buffer object)) + + (let* ((cam-leaf-idx (-> vis-info from-bsp current-leaf-idx)) ;; current bsp leaf of camera + (curr-vis-str (-> vis-info current-vis-string)) ;; currently loaded vis-string. + (desired-vis-str (-> vis-info vis-string cam-leaf-idx)) ;; vis-string ptr for what we want. + ) + ;; oops + 0 + (+ 16 #x70000000) + (+ 2064 #x70000000) + + ;; wait on ramdisk load, or do nothing because we already have the right stuff. + (when (= curr-vis-str desired-vis-str) + ;; we match. but are we loading? + (cond + ((logtest? (vis-info-flag waiting-for-load) (-> vis-info flags)) + (if (check-busy *ramdisk-rpc*) + ;; loading, and ramdisk not done, return #f, we don't have vis. + (return #f) + ) + ;; we are done loading. Jump to code that sets it up. + (logclear! (-> vis-info flags) (vis-info-flag waiting-for-load)) + (set! vis-buffer (-> obj vis-buffer)) + (b! #t cfg-27 :delay (nop!)) + ) + (else + ;; matched, and loaded! + (return #t) + ) + ) + ) + + ;; wait for any pending load to finish. + (when (logtest? (vis-info-flag waiting-for-load) (-> vis-info flags)) + (if (check-busy *ramdisk-rpc*) + (return #f) + ) + (logclear! (-> vis-info flags) (vis-info-flag waiting-for-load)) + ) + + ;; not sure what this does yet. + (set! (-> vis-info current-vis-string) desired-vis-str) + (b! (logtest? #x20000000 (-> vis-info flags)) cfg-15) + (set! vis-buffer (the-as (pointer uint8) (+ arg2 desired-vis-str))) + (b! #t cfg-27 :delay (nop!)) + (label cfg-15) + + ;; start a ramdisk load. + (let ((vis-load-result (vis-load obj))) + (b! (nonzero? vis-load-result) cfg-21) + (let* ((dest-bits (-> vis-info vis-bits)) + (len (-> obj bsp visible-list-length)) + (bsp-bits (the-as (pointer uinteger) (-> obj bsp all-visible-list))) + (len-qw (/ (+ len 15) 16)) + ) + (dotimes (a2-1 len-qw) + (set! + (-> (the-as (pointer uint128) dest-bits) 0) + (-> (the-as (pointer uint128) bsp-bits) 0) + ) + (&+! dest-bits 16) + (set! bsp-bits (&-> (the-as (pointer uint16) bsp-bits) 8)) + ) + ) + (let ((result #f)) + (b! #t cfg-55 :delay (nop!)) + (the-as none 0) + (label cfg-21) + (when (check-busy *ramdisk-rpc*) + (set! (-> vis-info current-vis-string) (the-as uint -1)) + (set! (-> obj all-visible?) 'loading) + (if (= *cheat-mode* 'debug) + (format *stdcon* "Ramdisk loading~%") + ) + (return #f) + ) + (set! (-> vis-info flags) (logior (-> vis-info flags) #x40000000)) + (ramdisk-load + (the-as int vis-load-result) + desired-vis-str + (the-as uint 2048) + (-> obj vis-buffer) + ) + (set! result #f) + (b! #t cfg-55 :delay (nop!)) + + + ;; setup loaded + (label cfg-27) + (let ((lower-flag-bits (the-as int (logand #x1fffffff (-> vis-info flags)))) + (spad-start (the-as object (+ 16 #x70000000))) + (spad-end (+ 2064 #x70000000)) + (list-len (-> obj bsp visible-list-length)) + ) + (when (zero? (the-as vis-info-flag lower-flag-bits)) + (let ((list-qwc (/ (+ list-len 15) 16))) + (dotimes (a0-28 list-qwc) + (set! + (-> (the-as (pointer uint128) spad-start) a0-28) + (the-as uint128 0) + ) + ) + ) + (mem-copy! + (the-as pointer spad-start) + (the-as pointer vis-buffer) + list-len + ) + ) + (while (nonzero? lower-flag-bits) + (case (logand lower-flag-bits 7) + ((1) + (let ((v1-55 (/ (+ list-len 15) 16))) + (dotimes (a0-32 v1-55) + (set! (-> (the-as (pointer uint128) spad-start) a0-32) (the-as uint128 0)) + ) + ) + (dummy-16 + (-> obj bsp drawable-trees) + (the-as int spad-start) + (the-as object vis-buffer) + ) + ) + ((2) + (unpack-comp-rle + (the-as (pointer int8) spad-start) + (the-as (pointer int8) vis-buffer) + ) + ) + ((3) + (unpack-comp-huf + (the-as (pointer uint8) spad-start) + (the-as (pointer uint8) vis-buffer) + (-> vis-info dictionary) + (the-as huf-dictionary-node + (+ (-> vis-info dictionary) (-> vis-info dictionary-length) -4) + ) + ) + ) + ) + (set! vis-buffer (the-as (pointer uint8) (the-as int spad-start))) + (set! spad-start spad-end) + (set! spad-end (the-as int vis-buffer)) + (.sra lower-flag-bits lower-flag-bits 3) + ) + (let ((s2-1 (the-as object vis-buffer)) + (s1-1 (the-as (pointer uinteger) (-> obj bsp all-visible-list))) + (v1-67 #f) + ) + (dotimes (s0-1 list-len) + (when (!= (logand (-> (the-as (pointer uint8) s2-1) 0) + (-> (the-as (pointer uint8) s1-1) 0) + ) + (-> (the-as (pointer uint8) s2-1) 0) + ) + (format #t "ERROR: illegal vis bits set [byte ~X] ~X -> ~X~%" + s0-1 + (-> (the-as (pointer uint8) s2-1) 0) + (-> (the-as (pointer uint8) s1-1) 0) + ) + (set! v1-67 #t) + ) + (set! s2-1 (&-> (the-as (pointer uint8) s2-1) 1)) + (set! s1-1 (&+ (the-as (pointer uint16) s1-1) 1)) + ) + (when v1-67 + (format #t "src = #x~x dest = #x~x ~s ~s~%" + (the-as object vis-buffer) + (-> vis-info vis-bits) + (-> vis-info level) + (-> vis-info from-level) + ) + (format #t "leaf-index = ~d~%" (-> vis-info from-bsp current-leaf-idx)) + 0 + ) + ) + (let ((v1-71 (the-as object vis-buffer)) + (a0-47 (-> vis-info vis-bits)) + (a1-22 (the-as (pointer uinteger) (-> obj bsp all-visible-list))) + (a2-11 (/ (+ list-len 15) 16)) + ) + (dotimes (a3-8 a2-11) + (let ((t0-2 (-> (the-as (pointer uint128) v1-71) 0)) + (t1-1 (-> (the-as (pointer uint128) a1-22) 0)) + ) + (.pand t0-3 t0-2 t1-1) + ) + (set! (-> (the-as (pointer uint128) a0-47) 0) t0-3) + (&+! a0-47 16) + (set! v1-71 (&-> (the-as (pointer uint16) v1-71) 8)) + (set! a1-22 (&-> (the-as (pointer uint16) a1-22) 8)) + ) + ) + ) + (set! result #t) + (label cfg-55) + result + ) + ) + ) + ) \ No newline at end of file diff --git a/test/decompiler/reference/decompiler-macros.gc b/test/decompiler/reference/decompiler-macros.gc index c9c60c8d6a..13c91d1b6c 100644 --- a/test/decompiler/reference/decompiler-macros.gc +++ b/test/decompiler/reference/decompiler-macros.gc @@ -330,3 +330,11 @@ ) ) ) + +(defmacro sext32 (in) + `(sar (shl ,in 32) 32) + ) + +(defmacro .sra (result in sa) + `(set! ,result (sext32 (sar (logand #xffffffff (the-as int ,in)) ,sa))) + ) diff --git a/test/decompiler/reference/engine/camera/cam-update_REF.gc b/test/decompiler/reference/engine/camera/cam-update_REF.gc index 09dfbc149d..2a32604ffa 100644 --- a/test/decompiler/reference/engine/camera/cam-update_REF.gc +++ b/test/decompiler/reference/engine/camera/cam-update_REF.gc @@ -183,48 +183,36 @@ (if (!= (-> s5-1 all-visible?) 'loading) (set! (-> s5-1 all-visible?) #f) ) - (let* ((a0-19 s5-1) - (t9-2 (method-of-object a0-19 dummy-16)) - (a1-17 s4-0) - (a2-1 (-> s4-0 ramdisk)) - ) - (-> s4-0 string-block) - (when (t9-2 a0-19 (the-as uint a1-17) a2-1) - (countdown (v1-40 8) - (let ((a0-22 (-> s5-1 vis-info v1-40))) - (when a0-22 - (if (!= a0-22 s4-0) - (set! (-> a0-22 current-vis-string) (the-as uint -1)) - ) + (when + (update-vis! s5-1 s4-0 (-> s4-0 ramdisk) (-> s4-0 string-block)) + (countdown (v1-40 8) + (let ((a0-22 (-> s5-1 vis-info v1-40))) + (when a0-22 + (if (!= a0-22 s4-0) + (set! (-> a0-22 current-vis-string) (the-as uint -1)) ) ) ) - (set! (-> s5-1 all-visible?) #f) ) + (set! (-> s5-1 all-visible?) #f) ) ) (a0-16 (if (!= (-> s5-1 all-visible?) 'loading) (set! (-> s5-1 all-visible?) #f) ) - (let* ((a0-24 s5-1) - (t9-3 (method-of-object a0-24 dummy-16)) - (a1-21 s3-0) - (a2-2 (-> s3-0 ramdisk)) - ) - (-> s3-0 string-block) - (when (t9-3 a0-24 (the-as uint a1-21) a2-2) - (countdown (v1-50 8) - (let ((a0-27 (-> s5-1 vis-info v1-50))) - (when a0-27 - (if (!= a0-27 s3-0) - (set! (-> a0-27 current-vis-string) (the-as uint -1)) - ) + (when + (update-vis! s5-1 s3-0 (-> s3-0 ramdisk) (-> s3-0 string-block)) + (countdown (v1-50 8) + (let ((a0-27 (-> s5-1 vis-info v1-50))) + (when a0-27 + (if (!= a0-27 s3-0) + (set! (-> a0-27 current-vis-string) (the-as uint -1)) ) ) ) - (set! (-> s5-1 all-visible?) #f) ) + (set! (-> s5-1 all-visible?) #f) ) ) ((and (= (-> s5-1 all-visible?) 'loading) (-> *level* play?)) diff --git a/test/decompiler/reference/engine/debug/stats-h_REF.gc b/test/decompiler/reference/engine/debug/stats-h_REF.gc index 69674b773a..8e73699ff6 100644 --- a/test/decompiler/reference/engine/debug/stats-h_REF.gc +++ b/test/decompiler/reference/engine/debug/stats-h_REF.gc @@ -130,7 +130,7 @@ (local-vars (r0-0 none)) (let ((v1-0 (-> obj ctrl))) (+! (-> obj count) 1) - (b! (zero? v1-0) cfg-2) + (b! (zero? v1-0) cfg-2 :delay (nop!)) (.mtc0 Perf r0-0) (.sync.l) (.sync.p) @@ -156,7 +156,7 @@ ;; WARN: Unsupported inline assembly instruction kind - [mfpc v1, pcr1] (defmethod read! perf-stat ((obj perf-stat)) (local-vars (r0-0 none) (v1-1 int) (v1-3 int)) - (b! (zero? (-> obj ctrl)) cfg-2) + (b! (zero? (-> obj ctrl)) cfg-2 :delay (nop!)) (.mtc0 Perf r0-0) (.sync.l) (.sync.p) diff --git a/test/decompiler/reference/engine/geometry/geometry_REF.gc b/test/decompiler/reference/engine/geometry/geometry_REF.gc index b519658710..aea1ef8e0e 100644 --- a/test/decompiler/reference/engine/geometry/geometry_REF.gc +++ b/test/decompiler/reference/engine/geometry/geometry_REF.gc @@ -823,7 +823,7 @@ ) (goto cfg-24) (label cfg-17) - (b! (nonzero? v1-10) cfg-22) + (b! (nonzero? v1-10) cfg-22 :delay (nop!)) (let ((f30-1 (vector-segment-distance-point! @@ -1117,7 +1117,7 @@ (b! (> f1-2 arg2) cfg-4) (b! (>= arg2 f2-0) cfg-4 :delay (set! v0-0 a2-1)) ) - (b! #t cfg-11) + (b! #t cfg-11 :delay (nop!)) (label cfg-4) (let ((a1-1 arg1) (a0-1 (+ arg0 1)) @@ -1135,7 +1135,7 @@ (set! v0-0 a2-3) ) ) - (b! (= v0-0 v1-3) cfg-11) + (b! (= v0-0 v1-3) cfg-11 :delay (nop!)) ) (nop!) (nop!) @@ -1255,7 +1255,7 @@ (b! (> f1-4 f0-3) cfg-4) (b! (>= f0-3 f2-3) cfg-4 :delay (set! s3-0 t1-1)) ) - (b! #t cfg-11) + (b! #t cfg-11 :delay (nop!)) (label cfg-4) (let ((a3-2 a3-1) (a1-2 (+ a1-1 1)) @@ -1273,7 +1273,7 @@ (set! s3-0 t1-3) ) ) - (b! (= s3-0 a0-4) cfg-11) + (b! (= s3-0 a0-4) cfg-11 :delay (nop!)) ) ) (nop!) diff --git a/test/decompiler/reference/engine/gfx/sprite/sprite-distort_REF.gc b/test/decompiler/reference/engine/gfx/sprite/sprite-distort_REF.gc index de12a512f3..321f7d810c 100644 --- a/test/decompiler/reference/engine/gfx/sprite/sprite-distort_REF.gc +++ b/test/decompiler/reference/engine/gfx/sprite/sprite-distort_REF.gc @@ -304,7 +304,7 @@ (.mul.vf vf10 vf1 vf8) (.div.vf Q vf0 vf10 :fsf #b11 :ftf #b11) (TODO.VCLIP vf10 vf10) - (b! (zero? (-> sv-16 flag)) cfg-21) + (b! (zero? (-> sv-16 flag)) cfg-21 :delay (nop!)) (.wait.vf) (.mul.vf vf1 vf1 Q :mask #b111) (.mul.vf vf2 vf2 Q :mask #b111) @@ -510,7 +510,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/engine/gfx/texture_REF.gc b/test/decompiler/reference/engine/gfx/texture_REF.gc index 2973fb802d..45e920a202 100644 --- a/test/decompiler/reference/engine/gfx/texture_REF.gc +++ b/test/decompiler/reference/engine/gfx/texture_REF.gc @@ -3227,7 +3227,7 @@ (.subu a3-10 t0-0 (the-as int a3-9)) (let ((t0-2 (+ (-> arg1 mip-shift) -1))) (nop!) - (b! (zero? t0-2) cfg-2) + (b! (zero? t0-2) cfg-2 :delay (nop!)) ) (let* ((t0-3 (+ a3-10 -4)) (a3-11 (* a3-10 16)) diff --git a/test/decompiler/reference/engine/gfx/tfrag/subdivide_REF.gc b/test/decompiler/reference/engine/gfx/tfrag/subdivide_REF.gc index 36689ee293..1bd3915b80 100644 --- a/test/decompiler/reference/engine/gfx/tfrag/subdivide_REF.gc +++ b/test/decompiler/reference/engine/gfx/tfrag/subdivide_REF.gc @@ -456,7 +456,7 @@ (a0-76 (-> v1-31 0 ctrl)) ) (+! (-> v1-31 0 count) 1) - (b! (zero? a0-76) cfg-28) + (b! (zero? a0-76) cfg-28 :delay (nop!)) (.mtc0 Perf r0-0) (.sync.l) (.sync.p) @@ -484,7 +484,7 @@ (defun-debug end-perf-stat-collection () (local-vars (r0-0 none) (a0-1 int) (a0-3 int)) (let ((v1-1 (-> *perf-stats* data))) - (b! (zero? (-> v1-1 0 ctrl)) cfg-2) + (b! (zero? (-> v1-1 0 ctrl)) cfg-2 :delay (nop!)) (.mtc0 Perf r0-0) (.sync.l) (.sync.p) diff --git a/test/decompiler/reference/engine/gfx/vis/bsp_REF.gc b/test/decompiler/reference/engine/gfx/vis/bsp_REF.gc index 61677279e3..f7c1c88de0 100644 --- a/test/decompiler/reference/engine/gfx/vis/bsp_REF.gc +++ b/test/decompiler/reference/engine/gfx/vis/bsp_REF.gc @@ -593,7 +593,12 @@ (table-data-end (&+ table-data-ptr (* table-size 8))) ) (label cfg-2) - (b! (= (the-as object table-data-start) table-data-end) cfg-8) + (b! + (= (the-as object table-data-start) table-data-end) + cfg-8 + :delay + (nop!) + ) (let ((midpoint (the-as @@ -616,17 +621,14 @@ (- (-> (the-as (pointer int32) midpoint) 0) (the-as int masked-tex-id)) ) ) - (b! (zero? diff) cfg-7) + (b! (zero? diff) cfg-7 :delay (nop!)) (b! (< diff 0) cfg-6 :delay (nop!)) ) (b! #t cfg-2 :delay - (set! - table-data-end - (the-as (pointer uint64) (the-as (pointer uint64) midpoint)) - ) + (set! table-data-end (the-as (pointer uint64) midpoint)) ) (label cfg-6) (b! diff --git a/test/decompiler/reference/engine/level/level-h_REF.gc b/test/decompiler/reference/engine/level/level-h_REF.gc index e1444e95bf..f552b591c1 100644 --- a/test/decompiler/reference/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/engine/level/level-h_REF.gc @@ -15,7 +15,7 @@ (ramdisk uint32 :offset-assert 40) (vis-bits pointer :offset-assert 44) (current-vis-string uint32 :offset-assert 48) - (vis-string uint8 :dynamic :offset-assert 52) + (vis-string uint32 :dynamic :offset-assert 52) ) :method-count-assert 9 :size-assert #x34 @@ -192,7 +192,7 @@ (bsp-name (_type_) symbol 13) (dummy-14 (_type_ object) memory-usage-block 14) (dummy-15 (_type_ vector) symbol 15) - (dummy-16 (_type_ uint uint) none 16) + (update-vis! (_type_ level-vis-info uint uint) symbol 16) (load-continue (_type_) _type_ 17) (load-begin (_type_) _type_ 18) (login (_type_) _type_ 19)