S0 = @0x800484b4 = LastTick = 1 constant S1 = @0x800484b0 = LastCount 0x800484A4 = TickTock where Tick = 1 tock = 0 0x800484AC = OldLastCount 0x803b3700 = Ticks 0x80048498 = Ticks 0x80048494 = Count 0x80048490 = tmpCount 0x800484A0 = LastHalfCount 0x8004849C = HalfCount 0x800484A8 = DiffInHalfCount void WaitforTick(/*LastTick,*/ *LastCount) //7f0c0b4c { do{ CurrentCount = osGetCount() DiffInCount = CurrentCount - LastCount // D0FE6 856038 1tick = 781372 1sec = 46882325 HalfTickDelayCount = 387937 //5EB61 (+ half a tick) CountsPerTick = 775875 //BD6C3 (781372 is number want) /***This is auto-generated by compiler** if (CountsPerTick = 0) Break 7 */ Ticks = Int((HalfTickDelayCount + DiffInCount)/CountsPerTick) //= 1 //ignore remainder (lo=quotient hi=remainder) }while (Ticks != 0) LastTick = 1 //7f0c0bc4 GetCounterStatus(*LastCount, Ticks) } extern u32 osGetCount(void); extern u32 IsOddCount; extern u32 Count; extern u32 HalfCount; extern u32 lastHalfCount; extern u32 DiffInHalfCount; u32 GetCounterStatus(u32 *LastCount, u32 *Ticks) { *LastCount = osGetCount(); //get fresh Count Count++; IsOddCount = Count && 1; HalfCount = Count >> 1; DiffInHalfCount = HalfCount - LastHalfCount; } GetCounterStatus(LastCount, /* 0F55D0 7F0C0AA0 3C0E8005 */ lui $t6, 0x8005 // /* 0F55D4 7F0C0AA4 8DCE84B0 */ lw $t6, -0x7b50($t6) //LastCount = *LastCount /* 0F55D8 7F0C0AA8 27BDFFE8 */ addiu $sp, $sp, -0x18 // /* 0F55DC 7F0C0AAC AFBF0014 */ sw $ra, 0x14($sp) // /* 0F55E0 7F0C0AB0 3C018005 */ lui $at, 0x8005 // /* 0F55E4 7F0C0AB4 AFA40018 */ sw $a0, 0x18($sp) //0x803b3700 = Ticks /* 0F55E8 7F0C0AB8 0C003638 */ jal osGetCount // /* 0F55EC 7F0C0ABC AC2E84AC */ sw $t6, %lo(0x800484AC)($at) # $t6, -0x7b54($at) 0x800484AC = LastCount /* 0F55F0 7F0C0AC0 3C048005 */ lui $a0, 0x8005 // /* 0F55F4 7F0C0AC4 3C018005 */ lui $at, 0x8005 // /* 0F55F8 7F0C0AC8 AC2284B0 */ sw $v0, %lo(0x800484B0)($at) # $v0, -0x7b50($at) *LastCount = osGetCount get fresh Count /* 0F55FC 7F0C0ACC 24848494 */ addiu $a0, $a0, -0x7b6c //a0 = 0x80048494 /* 0F5600 7F0C0AD0 8C830000 */ lw $v1, ($a0) //v1 = 53c /* 0F5604 7F0C0AD4 8FA70018 */ lw $a3, 0x18($sp) //a3 = 1 @Ticks /* 0F5608 7F0C0AD8 3C018005 */ lui $at, 0x8005 // /* 0F560C 7F0C0ADC AC238490 */ sw $v1, %lo(0x80048490)($at) # $v1, -0x7b70($at) 0x80048490 = 53c tmpCount /* 0F5610 7F0C0AE0 00677821 */ addu $t7, $v1, $a3 //t7 = 53c + 1 /* 0F5614 7F0C0AE4 AC8F0000 */ sw $t7, ($a0) //0x80048494 = 53d /* 0F5618 7F0C0AE8 3C018005 */ lui $at, 0x8005 // /* 0F561C 7F0C0AEC AC278498 */ sw $a3, %lo(0x80048498)($at) # $a3, -0x7b68($at) 0x80048498 = 1 @Ticks /* 0F5620 7F0C0AF0 8C830000 */ lw $v1, ($a0) //v1 = 53d /* 0F5624 7F0C0AF4 3C058005 */ lui $a1, 0x8005 // /* 0F5628 7F0C0AF8 24A584A0 */ addiu $a1, $a1, -0x7b60 // /* 0F562C 7F0C0AFC 8CB80000 */ lw $t8, ($a1) //t8 = 29e @0x800484A0 /* 0F5630 7F0C0B00 3C068005 */ lui $a2, 0x8005 // /* 0F5634 7F0C0B04 24C6849C */ addiu $a2, $a2, -0x7b64 // /* 0F5638 7F0C0B08 30680001 */ andi $t0, $v1, 1 //t0 = v1 and 1 //53d & 1 = 1 //odd /* 0F563C 7F0C0B0C ACD80000 */ sw $t8, ($a2) //0x8004849C = 29e /* 0F5640 7F0C0B10 04610003 */ bgez $v1, .Lproc_7F0C0AA0_80 //if Count >= 0 /* 0F5644 7F0C0B14 0003C843 */ sra $t9, $v1, 1 //t9 = 53d >> 1 = 29e /* 0F5648 7F0C0B18 24610001 */ addiu $at, $v1, 1 /* 0F564C 7F0C0B1C 0001C843 */ sra $t9, $at, 1 .Lproc_7F0C0AA0_80: /* 0F5650 7F0C0B20 ACB90000 */ sw $t9, ($a1) //0x800484A0 = 29e /* 0F5654 7F0C0B24 3C018005 */ lui $at, 0x8005 /* 0F5658 7F0C0B28 AC2884A4 */ sw $t0, %lo(0x800484A4)($at) # $t0, -0x7b5c($at) 0x800484A4 = t0 //odd /* 0F565C 7F0C0B2C 8CCA0000 */ lw $t2, ($a2) //t2 = 29e @0x8004849C /* 0F5660 7F0C0B30 8CA90000 */ lw $t1, ($a1) //t1 = 29e @0x800484A0 /* 0F5664 7F0C0B34 8FBF0014 */ lw $ra, 0x14($sp) // /* 0F5668 7F0C0B38 3C018005 */ lui $at, 0x8005 // /* 0F566C 7F0C0B3C 012A5823 */ subu $t3, $t1, $t2 //t3 = t1 - t2 = 0 /* 0F5670 7F0C0B40 AC2B84A8 */ sw $t3, %lo(0x800484A8)($at) # $t3, -0x7b58($at) 0x800484A8 = 0 /* 0F5674 7F0C0B44 03E00008 */ jr $ra /* 0F5678 7F0C0B48 27BD0018 */ addiu $sp, $sp, 0x18 .global proc_7F0C0B4C .ent proc_7F0C0B4C .type proc_7F0C0B4C, @function proc_7F0C0B4C: /* 0F567C 7F0C0B4C 27BDFFD8 */ addiu $sp, $sp, -0x28 /* 0F5680 7F0C0B50 AFB30020 */ sw $s3, 0x20($sp) /* 0F5684 7F0C0B54 AFB2001C */ sw $s2, 0x1c($sp) /* 0F5688 7F0C0B58 AFB10018 */ sw $s1, 0x18($sp) /* 0F568C 7F0C0B5C AFB00014 */ sw $s0, 0x14($sp) /* 0F5690 7F0C0B60 3C108005 */ lui $s0, 0x8005 /* 0F5694 7F0C0B64 3C118005 */ lui $s1, 0x8005 /* 0F5698 7F0C0B68 3C120005 */ lui $s2, 5 /* 0F569C 7F0C0B6C 3C13000B */ lui $s3, 0xb /* 0F56A0 7F0C0B70 AFBF0024 */ sw $ra, 0x24($sp) /* 0F56A4 7F0C0B74 3673D6C3 */ ori $s3, $s3, 0xd6c3 /* 0F56A8 7F0C0B78 3652EB61 */ ori $s2, $s2, 0xeb61 /* 0F56AC 7F0C0B7C 263184B0 */ addiu $s1, $s1, -0x7b50 /* 0F56B0 7F0C0B80 261084B4 */ addiu $s0, $s0, -0x7b4c .Lproc_7F0C0B4C_38: //Do /* 0F56B4 7F0C0B84 0C003638 */ jal osGetCount /* 0F56B8 7F0C0B88 00000000 */ nop /* 0F56BC 7F0C0B8C 8E2E0000 */ lw $t6, ($s1) // $t6 = osGetCount() /* 0F56C0 7F0C0B90 8E190000 */ lw $t9, ($s0) // $t9 = LastCount /* 0F56C4 7F0C0B94 004E7823 */ subu $t7, $v0, $t6 // $t7 = CurrentCount - LastCount /* 0F56C8 7F0C0B98 01F2C021 */ addu $t8, $t7, $s2 // $t8 = $t7 - HalfCount /* 0F56CC 7F0C0B9C 0313001B */ divu $zero, $t8, $s3 // $t8 / CountsPerTick /* 0F56D0 7F0C0BA0 00002012 */ mflo $a0 // $a0 = (int) result /* 0F56D4 7F0C0BA4 0099082B */ sltu $at, $a0, $t9 // if t9 < a0 then at = 1 else at = 0 /* 0F56D8 7F0C0BA8 16600002 */ bnez $s3, .Lproc_7F0C0B4C_68 // ** Auto Generated /* 0F56DC 7F0C0BAC 00000000 */ nop /* 0F56E0 7F0C0BB0 0007000D */ break 7 // Divide-By-Zero Check ** .Lproc_7F0C0B4C_68: /* 0F56E4 7F0C0BB4 1420FFF3 */ bnez $at, .Lproc_7F0C0B4C_38 //while $at != 0 /* 0F56E8 7F0C0BB8 00000000 */ nop /* 0F56EC 7F0C0BBC 24080001 */ addiu $t0, $zero, 1 /* 0F56F0 7F0C0BC0 0FC302A8 */ jal proc_7F0C0AA0 // GetCounterStatus (s0 = 1) /* 0F56F4 7F0C0BC4 AE080000 */ sw $t0, ($s0) /* 0F56F8 7F0C0BC8 8FBF0024 */ lw $ra, 0x24($sp) //restore variables from stack and return /* 0F56FC 7F0C0BCC 8FB00014 */ lw $s0, 0x14($sp) /* 0F5700 7F0C0BD0 8FB10018 */ lw $s1, 0x18($sp) /* 0F5704 7F0C0BD4 8FB2001C */ lw $s2, 0x1c($sp) /* 0F5708 7F0C0BD8 8FB30020 */ lw $s3, 0x20($sp) /* 0F570C 7F0C0BDC 03E00008 */ jr $ra /* 0F5710 7F0C0BE0 27BD0028 */ addiu $sp, $sp, 0x28 # end proc_7F0C0B4C .end proc_7F0C0B4C /* ************************************** copied from kholdfuzions new asm dump **************************************/ sub_CODE_7F0C0B4C: # CODE XREF: mainloop+36Cp # mainloop:demo_not_playingp saved_s0 = -0x14 saved_s1 = -0x10 saved_s2 = -0xC saved_s3 = -8 saved_ra = -4 addiu $sp, -0x28 # Add Immediate Unsigned sw $s3, 0x28+saved_s3($sp) # Store Word sw $s2, 0x28+saved_s2($sp) # Store Word sw $s1, 0x28+saved_s1($sp) # Store Word sw $s0, 0x28+saved_s0($sp) # Store Word lui $s0, 0x8005 # Load Upper Immediate lui $s1, 0x8005 # Load Upper Immediate lui $s2, 5 # Load Upper Immediate lui $s3, 0xB # Load Upper Immediate sw $ra, 0x28+saved_ra($sp) # Store Word la $s3, 0xBD6C3 # Load Address la $s2, 0x5EB61 # Load Address la $s1, copy_of_osgetCount_value_1 # Load Address la $s0, dword_D_800484B4 # Load Address loc_CODE_7F0C0B84: # CODE XREF: sub_CODE_7F0C0B4C:loc_CODE_7F0C0BB4j jal osGetCount # Jump And Link nop lw $t6, 0($s1) # Load Word lw $t9, 0($s0) # Load Word subu $t7, $v0, $t6 # Subtract Unsigned addu $t8, $t7, $s2 # Add Unsigned divu $t8, $s3 # Divide Unsigned mflo $a0 # Move From LO sltu $at, $a0, $t9 # Set on Less Than Unsigned bnez $s3, loc_CODE_7F0C0BB4 # Branch on Not Zero nop break 0x1C00 # Break loc_CODE_7F0C0BB4: # CODE XREF: sub_CODE_7F0C0B4C+5Cj bnez $at, loc_CODE_7F0C0B84 # Branch on Not Zero nop li $t0, 1 # Load Immediate jal sub_CODE_7F0C0AA0 # Jump And Link sw $t0, 0($s0) # Store Word lw $ra, 0x28+saved_ra($sp) # Load Word lw $s0, 0x28+saved_s0($sp) # Load Word lw $s1, 0x28+saved_s1($sp) # Load Word lw $s2, 0x28+saved_s2($sp) # Load Word lw $s3, 0x28+saved_s3($sp) # Load Word jr $ra # Jump Register addiu $sp, 0x28 # Add Immediate Unsigned # End of function sub_CODE_7F0C0B4C