_setcompare.c 435 Bytes
#include <ultra64.h>
#ifdef BBPLAYER
#include "osint.h"
extern u32 __osBbLastVCount;
extern u32 __osBbVCountWraps;
void
__osSetCompare(u32 v) {
    if (v) {
        u32 mask = __osDisableInt();
        u32 wraps = v < __osBbLastVCount ? __osBbVCountWraps + 1: __osBbVCountWraps;
        v = ((((u64)wraps) << 32) | v) * 192ULL/125ULL;
        __osRestoreInt(mask);
    }
    __asm__ (
    "mtc0\t%0,$11\n\t"
    : : "r" (v));
}
#endif