static void *startIntr();


disassembled listing :
startIntr:
    addiu   sp,sp,-24
    sw      s0,16(sp)
    lui     s0,_hi(data_58)
    addiu   s0,s0,_lo(data_58)
    sw      ra,20(sp)
    lhu     v0,0(s0)
    nop
    bnez    v0,text_25C
    move    v0,zero
    lui     v1,_hi(data_10E4)
    lw      v1,_lo(data_10E4)(v1)
    lui     v0,_hi(data_10E8)
    lw      v0,_lo(data_10E8)(v0)
    lui     a1,$3333
    sh      zero,0(v0)
    lhu     v0,0(v0)
    ori     a1,a1,$3333
    sh      v0,0(v1)
    lui     v0,_hi(data_10EC)
    lw      v0,_lo(data_10EC)(v0)
    move    a0,s0
    sw      a1,0(v0)
    jal     text_69C
    li      a1,1050
    jal     setjmp
    addiu   a0,s0,56
    beqz    v0,text_20C
    nop
    jal     text_26C
    nop
text_20C:
    lui     s0,_hi(data_94)
    addiu   s0,s0,_lo(data_94)
    addiu   a0,s0,-4
    addiu   v0,s0,4060
    jal     HookEntryInt
    sw      v0,0(s0)
    li      v0,1
    jal     startIntrVSync
    sh      v0,-60(s0)
    lui     v1,_hi(data_10E0)
    lw      v1,_lo(data_10E0)(v1)
    jal     startIntrDMA
    sw      v0,20(v1)
    lui     a0,_hi(data_10E0)
    lw      a0,_lo(data_10E0)(a0)
    jal     _96_remove
    sw      v0,4(a0)
    jal     ExitCriticalSection
    addiu   s0,s0,-60
    move    v0,s0
text_25C:
    lw      ra,20(sp)
    lw      s0,16(sp)
    jr      ra
    addiu   sp,sp,24
source code :
static struct
{
    u_short     started;
    u_short     trapped;
    void        (*cbIntr[11])();
    u_short     mask, oldmask;
    u_long      dma;
    jmp_buf     trap;
    u_char      stack[0x1000];
} intrData;

static volatile u_short *int_reg = (void *)0x1f801070;
static volatile u_short *int_mask = (void *)0x1f801074;
static u_long *dpcr = (void *)0x1f8010f0;

static void *startIntr()
{
    if(!intrData.started)
    {
        *int_reg = *int_mask = 0;
        *dpcr = 0x33333333;
        memclr(&intrData, sizeof(intrData) / 4);
        if(setjmp(intrData.trap))
            trapIntr();
        (void *)intrData.trap[JB_SP] = &intrData.stack[0xfb0];
        HookEntryInt(intrData.trap);
        intrData.started = 1;
        intrCB->setIntrVSync = startIntrVSync();
        intrCB->setIntrDMA = startIntrDMA();
        _96_remove();
        ExitCriticalSection();
        return &intrData;
    }
    else return NULL;
}
reversed listing :
startIntr:
    subu    $sp,$sp,24
    sw      $16,16($sp)
    la      $16,intrData
    sw      $31,20($sp)
    lhu     $2,0($16)
    nop
    bne     $2,$0,$L11
    move    $2,$0
    lw      $3,int_reg
    lw      $2,int_mask
    li      $5,0x33330000
    sh      $0,0($2)
    lhu     $2,0($2)
    ori     $5,$5,0x3333
    sh      $2,0($3)
    lw      $2,dpcr
    move    $4,$16
    sw      $5,0($2)
    jal     memclr
    li      $5,0x0000041a
    jal     setjmp
    addu    $4,$16,56
    beq     $2,$0,$L12
    jal     trapIntr
$L12:
    la      $16,intrData+60
    addu    $4,$16,-4
    addu    $2,$16,4060
    jal     HookEntryInt
    sw      $2,0($16)
    li      $2,0x00000001
    jal     startIntrVSync
    sh      $2,-60($16)
    lw      $3,intrCB
    jal     startIntrDMA
    sw      $2,20($3)
    lw      $3,intrCB
    jal     _96_remove
    sw      $2,4($3)
    jal     ExitCriticalSection
    addu    $16,$16,-60
    move    $2,$16
$L11:
    lw      $31,20($sp)
    lw      $16,16($sp)
    j       $31
    addu    $sp,$sp,24
coincidence: 100%

STATUS: COMPLETE
19 Apr 2003
Hosted by uCoz