.include "macros.inc"
.section .text, "ax"
.global __VIRetraceHandler
__VIRetraceHandler:
mflr r0
lis r3, 0xCC002000@ha
stw r0, 4(r1)
addi r5, r3, 0xCC002000@l
lis r3, regs@ha
stwu r1, -0x2f8(r1)
li r7, 0
stmw r27, 0x2e4(r1)
addi r30, r4, 0
addi r31, r3, regs@l
lhzu r6, 0x30(r5)
rlwinm. r0, r6, 0, 0x10, 0x10
beq lbl_80099678
rlwinm r0, r6, 0, 0x11, 0xf
sth r0, 0(r5)
ori r7, r7, 1
lbl_80099678:
lis r3, 0xCC002034@ha
lhzu r4, 0xCC002034@l(r3)
rlwinm. r0, r4, 0, 0x10, 0x10
beq lbl_80099694
rlwinm r0, r4, 0, 0x11, 0xf
sth r0, 0(r3)
ori r7, r7, 2
lbl_80099694:
lis r3, 0xCC002038@ha
lhzu r4, 0xCC002038@l(r3)
rlwinm. r0, r4, 0, 0x10, 0x10
beq lbl_800996B0
rlwinm r0, r4, 0, 0x11, 0xf
sth r0, 0(r3)
ori r7, r7, 4
lbl_800996B0:
lis r3, 0xCC00203C@ha
lhzu r4, 0xCC00203C@l(r3)
rlwinm. r0, r4, 0, 0x10, 0x10
beq lbl_800996CC
rlwinm r0, r4, 0, 0x11, 0xf
sth r0, 0(r3)
ori r7, r7, 8
lbl_800996CC:
rlwinm. r0, r7, 0, 0x1d, 0x1d
bne lbl_800996DC
rlwinm. r0, r7, 0, 0x1c, 0x1c
beq lbl_800996E8
lbl_800996DC:
mr r3, r30
bl OSSetCurrentContext
b lbl_8009984C
lbl_800996E8:
lwz r4, retraceCount@sda21(r13)
addi r3, r1, 0x18
addi r0, r4, 1
stw r0, retraceCount@sda21(r13)
bl OSClearContext
addi r3, r1, 0x18
bl OSSetCurrentContext
lwz r12, PreCB@sda21(r13)
cmplwi r12, 0
beq lbl_8009971C
lwz r3, retraceCount@sda21(r13)
mtlr r12
blrl
lbl_8009971C:
lwz r0, flushFlag@sda21(r13)
cmplwi r0, 0
beq lbl_80099810
lwz r0, shdwChangeMode@sda21(r13)
cmplwi r0, 1
bne lbl_80099740
bl getCurrentFieldEvenOdd
cmplwi r3, 0
beq lbl_800997F8
lbl_80099740:
lis r3, 0xCC002000@ha
addi r29, r3, 0xCC002000@l
b lbl_800997C0
lbl_8009974C:
lwz r3, shdwChanged@sda21(r13)
li r5, 0x20
lwz r27, lbl_80409F3C@sda21(r13)
addi r4, r27, 0
bl __shr2u
cntlzw r4, r4
cmpwi r4, 0x20
li r0, -1
and r0, r27, r0
bge lbl_80099778
b lbl_80099780
lbl_80099778:
cntlzw r3, r0
addi r4, r3, 0x20
lbl_80099780:
slwi r6, r4, 1
add r3, r31, r6
lhz r0, 0x78(r3)
subfic r5, r4, 0x3f
li r3, 0
sthx r0, r29, r6
li r4, 1
bl __shl2i
lwz r0, shdwChanged@sda21(r13)
nor r5, r3, r3
nor r4, r4, r4
lwz r3, lbl_80409F3C@sda21(r13)
and r0, r0, r5
and r3, r3, r4
stw r3, lbl_80409F3C@sda21(r13)
stw r0, shdwChanged@sda21(r13)
lbl_800997C0:
lwz r0, shdwChanged@sda21(r13)
li r4, 0
lwz r3, lbl_80409F3C@sda21(r13)
xor r0, r0, r4
xor r3, r3, r4
or. r0, r3, r0
bne lbl_8009974C
stw r4, shdwChangeMode@sda21(r13)
li r3, 1
lwz r0, 0x144(r31)
stw r0, CurrTiming@sda21(r13)
lwz r0, 0x118(r31)
stw r0, CurrTvMode@sda21(r13)
b lbl_800997FC
lbl_800997F8:
li r3, 0
lbl_800997FC:
cmpwi r3, 0
beq lbl_80099810
li r0, 0
stw r0, flushFlag@sda21(r13)
bl SIRefreshSamplingRate
lbl_80099810:
lwz r0, PostCB@sda21(r13)
cmplwi r0, 0
beq lbl_80099834
addi r3, r1, 0x18
bl OSClearContext
lwz r12, PostCB@sda21(r13)
lwz r3, retraceCount@sda21(r13)
mtlr r12
blrl
lbl_80099834:
addi r3, r13, retraceQueue@sda21
bl OSWakeupThread
addi r3, r1, 0x18
bl OSClearContext
mr r3, r30
bl OSSetCurrentContext
lbl_8009984C:
lmw r27, 0x2e4(r1)
lwz r0, 0x2fc(r1)
addi r1, r1, 0x2f8
mtlr r0
blr
.global VISetPostRetraceCallback
VISetPostRetraceCallback:
mflr r0
stw r0, 4(r1)
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
stw r30, 0x10(r1)
mr r30, r3
lwz r31, PostCB@sda21(r13)
bl OSDisableInterrupts
stw r30, PostCB@sda21(r13)
bl OSRestoreInterrupts
mr r3, r31
lwz r0, 0x1c(r1)
lwz r31, 0x14(r1)
lwz r30, 0x10(r1)
addi r1, r1, 0x18
mtlr r0
blr
.global getTiming
getTiming:
cmplwi r3, 0x15
lis r4, timing@ha
addi r5, r4, timing@l
bgt lbl_8009992C
lis r4, "@92"@ha
addi r4, r4, "@92"@l
slwi r0, r3, 2
lwzx r0, r4, r0
mtctr r0
bctr
lbl_800998CC:
mr r3, r5
blr
lbl_800998D4:
addi r3, r5, 0x26
blr
lbl_800998DC:
addi r3, r5, 0x4c
blr
lbl_800998E4:
addi r3, r5, 0x72
blr
lbl_800998EC:
mr r3, r5
blr
lbl_800998F4:
addi r3, r5, 0x26
blr
lbl_800998FC:
addi r3, r5, 0x98
blr
lbl_80099904:
addi r3, r5, 0xbe
blr
lbl_8009990C:
addi r3, r5, 0xe4
blr
lbl_80099914:
addi r3, r5, 0x10a
blr
lbl_8009991C:
addi r3, r5, 0x4c
blr
lbl_80099924:
addi r3, r5, 0x72
blr
lbl_8009992C:
li r3, 0
blr
.global __VIInit
__VIInit:
mflr r0
stw r0, 4(r1)
stwu r1, -0x30(r1)
stw r31, 0x2c(r1)
srwi r31, r3, 2
stw r30, 0x28(r1)
stw r29, 0x24(r1)
addi r29, r3, 0
lis r3, 0x800000CC@ha
stw r31, 0x800000CC@l(r3)
addi r3, r29, 0
rlwinm r30, r29, 0, 0x1e, 0x1e
bl getTiming
lis r4, 0xCC002000@ha
li r0, 2
addi r5, r4, 0xCC002000@l
sthu r0, 2(r5)
li r0, 0
stw r0, 0x1c(r1)
lwz r0, 0x1c(r1)
cmplwi r0, 0x3e8
bge lbl_800999A8
b lbl_8009999C
lbl_80099990:
lwz r4, 0x1c(r1)
addi r0, r4, 8
stw r0, 0x1c(r1)
lbl_8009999C:
lwz r0, 0x1c(r1)
cmplwi r0, 0x3e8
blt lbl_80099990
lbl_800999A8:
li r0, 0
sth r0, 0(r5)
lis r12, 0xCC002006@ha
li r8, 0x2828
lhz r6, 0x1a(r3)
li r7, 1
cmpwi r29, 2
sth r6, 0xCC002006@l(r12)
li r6, 0x1001
addi r4, r12, 0x2000
lbz r9, 0x1d(r3)
lbz r10, 0x1e(r3)
rlwimi r10, r9, 8, 0x10, 0x17
sth r10, 0x2004(r12)
lbz r9, 0x1f(r3)
lbz r10, 0x1c(r3)
slwi r9, r9, 7
or r9, r10, r9
sth r9, 0x200a(r12)
lhz r9, 0x20(r3)
rlwinm r9, r9, 1, 0x10, 0x1e
sth r9, 0x2008(r12)
lhz r9, 2(r3)
lbz r11, 0(r3)
slwi r9, r9, 1
lhz r10, 4(r3)
addi r9, r9, -2
sth r11, 0x2000(r12)
add r9, r10, r9
sth r9, 0x200e(r12)
lhz r9, 8(r3)
addi r9, r9, 2
sth r9, 0x200c(r12)
lhz r9, 2(r3)
lhz r10, 6(r3)
slwi r9, r9, 1
addi r9, r9, -2
add r9, r10, r9
sth r9, 0x2012(r12)
lhz r9, 0xa(r3)
addi r9, r9, 2
sth r9, 0x2010(r12)
lhz r9, 0x10(r3)
lbz r10, 0xc(r3)
slwi r9, r9, 5
or r9, r10, r9
sth r9, 0x2016(r12)
lhz r9, 0x14(r3)
lbz r10, 0xe(r3)
slwi r9, r9, 5
or r9, r10, r9
sth r9, 0x2014(r12)
lhz r9, 0x12(r3)
lbz r10, 0xd(r3)
slwi r9, r9, 5
or r9, r10, r9
sth r9, 0x201a(r12)
lhz r9, 0x16(r3)
lbz r10, 0xf(r3)
slwi r9, r9, 5
or r9, r10, r9
sth r9, 0x2018(r12)
sth r8, 0x2048(r12)
sth r7, 0x2036(r12)
sth r6, 0x2034(r12)
lhz r6, 0x18(r3)
lhz r3, 0x1a(r3)
srawi r6, r6, 1
addi r3, r3, 1
addze r6, r6
sth r3, 0x2032(r12)
addi r6, r6, 1
ori r3, r6, 0x1000
sth r3, 0x2030(r12)
beq lbl_80099AF8
cmpwi r29, 3
beq lbl_80099AF8
slwi r3, r30, 2
ori r6, r3, 1
slwi r3, r31, 8
or r3, r6, r3
sth r3, 0(r5)
sth r0, 0x6c(r4)
b lbl_80099B10
lbl_80099AF8:
slwi r0, r31, 8
ori r0, r0, 5
sth r0, 0(r5)
lis r3, 0xCC00206C@ha
li r0, 1
sth r0, 0xCC00206C@l(r3)
lbl_80099B10:
lwz r0, 0x34(r1)
lwz r31, 0x2c(r1)
lwz r30, 0x28(r1)
lwz r29, 0x24(r1)
addi r1, r1, 0x30
mtlr r0
blr
.global VIInit
VIInit:
mflr r0
lis r3, 0xCC002000@ha
stw r0, 4(r1)
li r0, 1
lis r4, timing@ha
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
stw r30, 0x10(r1)
addi r30, r4, timing@l
stw r29, 0xc(r1)
stw r28, 8(r1)
addi r28, r3, 0xCC002000@l
lis r3, regs@ha
stw r0, encoderType@sda21(r13)
addi r31, r3, regs@l
lhzu r0, 2(r28)
clrlwi. r0, r0, 0x1f
bne lbl_80099B7C
li r3, 0
bl __VIInit
lbl_80099B7C:
li r29, 0
stw r29, retraceCount@sda21(r13)
lis r3, 0xCC002000@ha
addi r3, r3, 0xCC002000@l
stw r29, lbl_80409F2C@sda21(r13)
li r0, 0x280
stw r29, changed@sda21(r13)
stw r29, lbl_80409F3C@sda21(r13)
stw r29, shdwChanged@sda21(r13)
stw r29, changeMode@sda21(r13)
stw r29, shdwChangeMode@sda21(r13)
stw r29, flushFlag@sda21(r13)
lhz r5, 0x132(r30)
lhz r6, 0x130(r30)
rlwinm r5, r5, 0xa, 0x10, 0x15
or r5, r6, r5
sth r5, 0x4e(r3)
lhz r6, 0x132(r30)
lhz r5, 0x134(r30)
srawi r6, r6, 6
slwi r5, r5, 4
or r5, r6, r5
sth r5, 0x4c(r3)
lhz r5, 0x138(r30)
lhz r6, 0x136(r30)
rlwinm r5, r5, 0xa, 0x10, 0x15
or r5, r6, r5
sth r5, 0x52(r3)
lhz r6, 0x138(r30)
lhz r5, 0x13a(r30)
srawi r6, r6, 6
slwi r5, r5, 4
or r5, r6, r5
sth r5, 0x50(r3)
lhz r5, 0x13e(r30)
lhz r6, 0x13c(r30)
rlwinm r5, r5, 0xa, 0x10, 0x15
or r5, r6, r5
sth r5, 0x56(r3)
lhz r5, 0x13e(r30)
lhz r4, 0x140(r30)
srawi r5, r5, 6
slwi r4, r4, 4
or r4, r5, r4
sth r4, 0x54(r3)
lhz r4, 0x144(r30)
lhz r5, 0x142(r30)
slwi r4, r4, 8
or r4, r5, r4
sth r4, 0x5a(r3)
lhz r4, 0x148(r30)
lhz r5, 0x146(r30)
slwi r4, r4, 8
or r4, r5, r4
sth r4, 0x58(r3)
lhz r4, 0x14c(r30)
lhz r5, 0x14a(r30)
slwi r4, r4, 8
or r4, r5, r4
sth r4, 0x5e(r3)
lhz r4, 0x150(r30)
lhz r5, 0x14e(r30)
slwi r4, r4, 8
or r4, r5, r4
sth r4, 0x5c(r3)
lhz r4, 0x154(r30)
lhz r5, 0x152(r30)
slwi r4, r4, 8
or r4, r5, r4
sth r4, 0x62(r3)
lhz r4, 0x158(r30)
lhz r5, 0x156(r30)
slwi r4, r4, 8
or r4, r5, r4
sth r4, 0x60(r3)
lhz r4, 0x15c(r30)
lhz r5, 0x15a(r30)
slwi r4, r4, 8
or r4, r5, r4
sth r4, 0x66(r3)
lhz r4, 0x160(r30)
lhz r5, 0x15e(r30)
slwi r4, r4, 8
or r4, r5, r4
sth r4, 0x64(r3)
sth r0, 0x70(r3)
bl __OSLockSram
lbz r0, 0x10(r3)
li r3, 0
extsb r0, r0
sth r29, displayOffsetV@sda21(r13)
sth r0, displayOffsetH@sda21(r13)
bl __OSUnlockSram
lhz r30, 0(r28)
addi r3, r31, 0x114
addi r28, r31, 0x118
rlwinm r0, r30, 0x1e, 0x1f, 0x1f
stw r0, 0x114(r31)
rlwinm r0, r30, 0x18, 0x1e, 0x1f
stw r0, 0x118(r31)
lwz r0, 0x118(r31)
cmplwi r0, 3
bne lbl_80099D1C
b lbl_80099D20
lbl_80099D1C:
mr r29, r0
lbl_80099D20:
lwz r0, 0(r3)
slwi r3, r29, 2
add r3, r3, r0
bl getTiming
stw r3, 0x144(r31)
addi r4, r31, 0x144
li r0, 0x280
sth r30, 2(r31)
li r8, 0
addi r6, r31, 0xf6
lwz r4, 0(r4)
addi r3, r31, 0xf2
stw r4, CurrTiming@sda21(r13)
lwz r4, 0(r28)
stw r4, CurrTvMode@sda21(r13)
sth r0, 0xf4(r31)
lwz r4, CurrTiming@sda21(r13)
lhzu r0, 2(r4)
rlwinm r0, r0, 1, 0x10, 0x1e
sth r0, 0xf6(r31)
lhz r0, 0xf4(r31)
subfic r0, r0, 0x2d0
srawi r0, r0, 1
addze r0, r0
sth r0, 0xf0(r31)
sth r8, 0xf2(r31)
lhz r0, 0xf4(r31)
lha r7, 0xf0(r31)
lha r5, displayOffsetH@sda21(r13)
subfic r0, r0, 0x2d0
lhz r9, 0(r4)
add r5, r7, r5
cmpw r5, r0
ble lbl_80099DAC
b lbl_80099DC0
lbl_80099DAC:
cmpwi r5, 0
bge lbl_80099DB8
b lbl_80099DBC
lbl_80099DB8:
mr r8, r5
lbl_80099DBC:
mr r0, r8
lbl_80099DC0:
sth r0, 0xf8(r31)
addi r8, r31, 0x110
lwz r0, 0x110(r31)
cmpwi r0, 0
bne lbl_80099DDC
li r11, 2
b lbl_80099DE0
lbl_80099DDC:
li r11, 1
lbl_80099DE0:
lhz r0, 0(r3)
lha r5, displayOffsetV@sda21(r13)
extsh r7, r0
clrlwi r0, r0, 0x1f
add r7, r7, r5
cmpw r7, r0
ble lbl_80099E00
b lbl_80099E04
lbl_80099E00:
mr r7, r0
lbl_80099E04:
sth r7, 0xfa(r31)
extsh r7, r9
slwi r7, r7, 1
lhz r28, 0(r6)
subf r12, r0, r7
lha r10, 0(r3)
extsh r7, r28
add r9, r7, r5
add r9, r10, r9
subf. r7, r12, r9
ble lbl_80099E38
subf r9, r12, r9
b lbl_80099E3C
lbl_80099E38:
li r9, 0
lbl_80099E3C:
add r10, r10, r5
subf. r7, r0, r10
bge lbl_80099E50
subf r7, r0, r10
b lbl_80099E54
lbl_80099E50:
li r7, 0
lbl_80099E54:
add r7, r28, r7
subf r7, r9, r7
sth r7, 0xfc(r31)
lha r7, 0(r3)
add r9, r7, r5
subf. r7, r0, r9
bge lbl_80099E78
subf r7, r0, r9
b lbl_80099E7C
lbl_80099E78:
li r7, 0
lbl_80099E7C:
divw r10, r7, r11
addi r7, r31, 0x108
lhz r9, 0x108(r31)
subf r9, r10, r9
sth r9, 0xfe(r31)
lha r6, 0(r6)
lha r9, 0(r3)
add r6, r6, r5
add r6, r9, r6
subf. r3, r12, r6
ble lbl_80099EB0
subf r6, r12, r6
b lbl_80099EB4
lbl_80099EB0:
li r6, 0
lbl_80099EB4:
add r5, r9, r5
subf. r3, r0, r5
bge lbl_80099EC8
subf r0, r0, r5
b lbl_80099ECC
lbl_80099EC8:
li r0, 0
lbl_80099ECC:
divw r0, r0, r11
lhz r3, 0x10c(r31)
add r0, r3, r0
divw r5, r6, r11
subf r0, r5, r0
sth r0, 0x100(r31)
li r9, 0x280
li r28, 0
sth r9, 0x102(r31)
li r5, 0x28
li r0, 1
lhz r6, 0(r4)
addi r3, r13, retraceQueue@sda21
rlwinm r6, r6, 1, 0x10, 0x1e
sth r6, 0x104(r31)
sth r28, 0x106(r31)
sth r28, 0(r7)
sth r9, 0x10a(r31)
lhz r4, 0(r4)
rlwinm r4, r4, 1, 0x10, 0x1e
sth r4, 0x10c(r31)
stw r28, 0(r8)
stb r5, 0x11c(r31)
stb r5, 0x11d(r31)
stb r5, 0x11e(r31)
stb r28, 0x12c(r31)
stw r0, 0x130(r31)
stw r28, 0x134(r31)
bl OSInitThreadQueue
lis r3, 0xCC002030@ha
lhz r0, 0xCC002030@l(r3)
addi r4, r3, 0x2000
addi r5, r3, 0x2000
clrlwi r0, r0, 0x11
sth r0, 0x30(r4)
lis r3, __VIRetraceHandler@ha
addi r4, r3, __VIRetraceHandler@l
lhz r0, 0x34(r5)
li r3, 0x18
clrlwi r0, r0, 0x11
sth r0, 0x34(r5)
stw r28, PreCB@sda21(r13)
stw r28, PostCB@sda21(r13)
bl __OSSetInterruptHandler
li r3, 0x80
bl __OSUnmaskInterrupts
lwz r0, 0x1c(r1)
lwz r31, 0x14(r1)
lwz r30, 0x10(r1)
lwz r29, 0xc(r1)
lwz r28, 8(r1)
addi r1, r1, 0x18
mtlr r0
blr
.global VIWaitForRetrace
VIWaitForRetrace:
mflr r0
stw r0, 4(r1)
stwu r1, -0x10(r1)
stw r31, 0xc(r1)
stw r30, 8(r1)
bl OSDisableInterrupts
lwz r30, retraceCount@sda21(r13)
mr r31, r3
lbl_80099FC4:
addi r3, r13, retraceQueue@sda21
bl OSSleepThread
lwz r0, retraceCount@sda21(r13)
cmplw r30, r0
beq lbl_80099FC4
mr r3, r31
bl OSRestoreInterrupts
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
addi r1, r1, 0x10
mtlr r0
blr
.global setFbbRegs
setFbbRegs:
stwu r1, -0x48(r1)
lis r9, regs@ha
addi r9, r9, regs@l
stw r31, 0x44(r1)
lbz r8, 0x2c(r3)
lhz r0, 0xe(r3)
slwi r31, r8, 5
lhz r8, 0x16(r3)
mullw r0, r31, r0
lwz r11, 0x20(r3)
lwz r10, 0x30(r3)
lhz r12, 0xa(r3)
rlwinm r8, r8, 1, 0, 0x1a
add r0, r8, r0
add r0, r10, r0
cmpwi r11, 0
stw r0, 0(r4)
bne lbl_8009A048
lwz r8, 0(r4)
b lbl_8009A050
lbl_8009A048:
lwz r0, 0(r4)
add r8, r0, r31
lbl_8009A050:
srawi r0, r12, 1
stw r8, 0(r5)
addze r0, r0
slwi r0, r0, 1
subfc r0, r0, r12
cmpwi r0, 1
bne lbl_8009A07C
lwz r8, 0(r4)
lwz r0, 0(r5)
stw r0, 0(r4)
stw r8, 0(r5)
lbl_8009A07C:
lwz r0, 0(r4)
clrlwi r0, r0, 2
stw r0, 0(r4)
lwz r0, 0(r5)
clrlwi r0, r0, 2
stw r0, 0(r5)
lwz r0, 0x44(r3)
cmpwi r0, 0
beq lbl_8009A12C
lbz r8, 0x2c(r3)
lhz r0, 0xe(r3)
slwi r31, r8, 5
lhz r8, 0x16(r3)
mullw r0, r31, r0
lwz r11, 0x20(r3)
lwz r10, 0x48(r3)
lhz r12, 0xa(r3)
rlwinm r8, r8, 1, 0, 0x1a
add r0, r8, r0
add r0, r10, r0
cmpwi r11, 0
stw r0, 0(r6)
bne lbl_8009A0E0
lwz r8, 0(r6)
b lbl_8009A0E8
lbl_8009A0E0:
lwz r0, 0(r6)
add r8, r0, r31
lbl_8009A0E8:
srawi r0, r12, 1
stw r8, 0(r7)
addze r0, r0
slwi r0, r0, 1
subfc r0, r0, r12
cmpwi r0, 1
bne lbl_8009A114
lwz r8, 0(r6)
lwz r0, 0(r7)
stw r0, 0(r6)
stw r8, 0(r7)
lbl_8009A114:
lwz r0, 0(r6)
clrlwi r0, r0, 2
stw r0, 0(r6)
lwz r0, 0(r7)
clrlwi r0, r0, 2
stw r0, 0(r7)
lbl_8009A12C:
lwz r0, 0(r4)
lis r8, 0x100
cmplw r0, r8
bge lbl_8009A168
lwz r0, 0(r5)
cmplw r0, r8
bge lbl_8009A168
lwz r0, 0(r6)
cmplw r0, r8
bge lbl_8009A168
lwz r0, 0(r7)
cmplw r0, r8
bge lbl_8009A168
li r10, 0
b lbl_8009A16C
lbl_8009A168:
li r10, 1
lbl_8009A16C:
cmplwi r10, 0
beq lbl_8009A1A4
lwz r0, 0(r4)
srwi r0, r0, 5
stw r0, 0(r4)
lwz r0, 0(r5)
srwi r0, r0, 5
stw r0, 0(r5)
lwz r0, 0(r6)
srwi r0, r0, 5
stw r0, 0(r6)
lwz r0, 0(r7)
srwi r0, r0, 5
stw r0, 0(r7)
lbl_8009A1A4:
lwz r0, 0(r4)
slwi r11, r10, 0xc
lis r8, 1
sth r0, 0x1e(r9)
lis r0, 2
lwz r10, changed@sda21(r13)
lwz r12, lbl_80409F2C@sda21(r13)
or r10, r10, r8
stw r12, lbl_80409F2C@sda21(r13)
stw r10, changed@sda21(r13)
lwz r10, 0(r4)
lbz r4, 0x3c(r3)
srwi r10, r10, 0x10
slwi r4, r4, 8
or r4, r10, r4
or r4, r11, r4
sth r4, 0x1c(r9)
lwz r4, changed@sda21(r13)
lwz r10, lbl_80409F2C@sda21(r13)
or r0, r4, r0
stw r10, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lwz r0, 0(r5)
sth r0, 0x26(r9)
lwz r0, changed@sda21(r13)
lwz r4, lbl_80409F2C@sda21(r13)
ori r0, r0, 0x1000
stw r4, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lwz r0, 0(r5)
srwi r0, r0, 0x10
sth r0, 0x24(r9)
lwz r0, changed@sda21(r13)
lwz r4, lbl_80409F2C@sda21(r13)
ori r0, r0, 0x2000
stw r4, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lwz r0, 0x44(r3)
cmpwi r0, 0
beq lbl_8009A2C0
lwz r3, 0(r6)
addi r0, r8, -32768
sth r3, 0x22(r9)
lwz r3, changed@sda21(r13)
lwz r4, lbl_80409F2C@sda21(r13)
ori r3, r3, 0x4000
stw r4, lbl_80409F2C@sda21(r13)
stw r3, changed@sda21(r13)
lwz r3, 0(r6)
srwi r3, r3, 0x10
sth r3, 0x20(r9)
lwz r3, changed@sda21(r13)
lwz r4, lbl_80409F2C@sda21(r13)
or r0, r3, r0
stw r4, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lwz r0, 0(r7)
sth r0, 0x2a(r9)
lwz r0, changed@sda21(r13)
lwz r3, lbl_80409F2C@sda21(r13)
ori r0, r0, 0x400
stw r3, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lwz r0, 0(r7)
srwi r0, r0, 0x10
sth r0, 0x28(r9)
lwz r0, changed@sda21(r13)
lwz r3, lbl_80409F2C@sda21(r13)
ori r0, r0, 0x800
stw r3, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lbl_8009A2C0:
lwz r31, 0x44(r1)
addi r1, r1, 0x48
blr
.global setVerticalRegs
setVerticalRegs:
stwu r1, -0x28(r1)
clrlwi r0, r5, 0x18
lis r11, regs@ha
stw r31, 0x24(r1)
cmplwi r0, 0xa
lwz r31, 0x30(r1)
addi r11, r11, regs@l
stw r30, 0x20(r1)
stw r29, 0x1c(r1)
blt lbl_8009A300
li r12, 1
li r29, 2
b lbl_8009A308
lbl_8009A300:
li r12, 2
li r29, 1
lbl_8009A308:
clrlwi r30, r3, 0x10
srawi r0, r30, 1
addze r0, r0
slwi r0, r0, 1
subfc. r0, r0, r30
bne lbl_8009A358
clrlwi r3, r12, 0x10
clrlwi r0, r6, 0x10
mullw r0, r3, r0
clrlwi r3, r4, 0x10
subf r0, r3, r0
clrlwi r3, r29, 0x10
mullw r29, r3, r30
subf r0, r30, r0
mullw r30, r3, r0
add r0, r7, r29
add r6, r9, r30
add r3, r8, r29
add r7, r10, r30
b lbl_8009A38C
lbl_8009A358:
clrlwi r3, r12, 0x10
clrlwi r0, r6, 0x10
mullw r0, r3, r0
clrlwi r3, r4, 0x10
subf r0, r3, r0
clrlwi r3, r29, 0x10
mullw r29, r3, r30
subf r0, r30, r0
mullw r30, r3, r0
add r0, r8, r29
add r6, r10, r30
add r3, r7, r29
add r7, r9, r30
lbl_8009A38C:
clrlwi r8, r4, 0x10
clrlwi r4, r12, 0x10
divw r4, r8, r4
cmpwi r31, 0
clrlwi r4, r4, 0x10
beq lbl_8009A3C0
slwi r4, r4, 1
addi r4, r4, -2
add r0, r0, r4
add r3, r3, r4
li r4, 0
addi r6, r6, 2
addi r7, r7, 2
lbl_8009A3C0:
clrlwi r5, r5, 0x18
rlwinm r4, r4, 4, 0xc, 0x1b
or r4, r5, r4
sth r4, 0(r11)
lis r4, 0x8000
lis r9, 0x100
lwz r5, changed@sda21(r13)
lis r8, 0x200
lwz r10, lbl_80409F2C@sda21(r13)
or r4, r5, r4
lis r5, 0x40
stw r10, lbl_80409F2C@sda21(r13)
stw r4, changed@sda21(r13)
lis r4, 0x80
sth r0, 0xe(r11)
lwz r0, changed@sda21(r13)
lwz r10, lbl_80409F2C@sda21(r13)
or r0, r0, r9
stw r10, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
sth r6, 0xc(r11)
lwz r0, changed@sda21(r13)
lwz r6, lbl_80409F2C@sda21(r13)
or r0, r0, r8
stw r6, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
sth r3, 0x12(r11)
lwz r0, changed@sda21(r13)
lwz r3, lbl_80409F2C@sda21(r13)
or r0, r0, r5
stw r3, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
sth r7, 0x10(r11)
lwz r0, changed@sda21(r13)
lwz r3, lbl_80409F2C@sda21(r13)
or r0, r0, r4
stw r3, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lwz r31, 0x24(r1)
lwz r30, 0x20(r1)
lwz r29, 0x1c(r1)
addi r1, r1, 0x28
blr
.global VIConfigure
VIConfigure:
mflr r0
lis r5, timing@ha
stw r0, 4(r1)
lis r4, regs@ha
stwu r1, -0x78(r1)
stmw r14, 0x30(r1)
addi r31, r3, 0
addi r15, r5, timing@l
addi r29, r4, regs@l
bl OSDisableInterrupts
lwz r4, 0(r31)
addi r28, r29, 0x114
lwz r0, 0x114(r29)
addi r14, r3, 0
clrlwi r4, r4, 0x1e
cmplw r0, r4
beq lbl_8009A4BC
li r0, 1
stw r0, changeMode@sda21(r13)
stw r4, 0(r28)
lbl_8009A4BC:
lwz r0, 0(r31)
lis r3, 0x800000CC@ha
lwz r17, 0x800000CC@l(r3)
srwi r16, r0, 2
cmplwi r16, 4
bne lbl_8009A53C
lwz r0, message$332@sda21(r13)
cmplwi r0, 0
bne lbl_8009A53C
li r0, 1
crclr 6
stw r0, message$332@sda21(r13)
addi r3, r15, 0x1bc
bl OSReport
addi r3, r15, 0x1e8
crclr 6
bl OSReport
addi r3, r15, 0x214
crclr 6
bl OSReport
addi r3, r15, 0x240
crclr 6
bl OSReport
addi r3, r15, 0x26c
crclr 6
bl OSReport
addi r3, r15, 0x298
crclr 6
bl OSReport
addi r3, r15, 0x1bc
crclr 6
bl OSReport
lbl_8009A53C:
cmplwi r16, 0
beq lbl_8009A54C
cmplwi r16, 2
bne lbl_8009A554
lbl_8009A54C:
stw r17, 0x118(r29)
b lbl_8009A558
lbl_8009A554:
stw r16, 0x118(r29)
lbl_8009A558:
lhz r0, 0xa(r31)
sth r0, 0xf0(r29)
lwz r0, 0(r28)
cmplwi r0, 1
bne lbl_8009A578
lhz r0, 0xc(r31)
rlwinm r0, r0, 1, 0x10, 0x1e
b lbl_8009A57C
lbl_8009A578:
lhz r0, 0xc(r31)
lbl_8009A57C:
sth r0, 0xf2(r29)
addi r23, r29, 0xf2
addi r24, r29, 0xf4
lhz r0, 0xe(r31)
addi r27, r29, 0x102
addi r25, r29, 0x110
sth r0, 0xf4(r29)
li r0, 0
addi r16, r29, 0x10a
lhz r3, 4(r31)
addi r26, r29, 0x10c
addi r15, r29, 0x106
sth r3, 0x102(r29)
addi r17, r29, 0x108
lhz r3, 8(r31)
sth r3, 0x104(r29)
lwz r3, 0x14(r31)
stw r3, 0x110(r29)
lhz r3, 0x102(r29)
sth r3, 0x10a(r29)
lhz r3, 0x104(r29)
sth r3, 0x10c(r29)
sth r0, 0x106(r29)
sth r0, 0x108(r29)
lwz r0, 0(r28)
cmplwi r0, 2
bne lbl_8009A5F0
lhz r0, 0(r26)
b lbl_8009A61C
lbl_8009A5F0:
cmplwi r0, 3
bne lbl_8009A600
lhz r0, 0(r26)
b lbl_8009A61C
lbl_8009A600:
lwz r0, 0(r25)
cmpwi r0, 0
bne lbl_8009A618
lhz r0, 0(r26)
rlwinm r0, r0, 1, 0x10, 0x1e
b lbl_8009A61C
lbl_8009A618:
lhz r0, 0(r26)
lbl_8009A61C:
addi r22, r29, 0xf6
sth r0, 0xf6(r29)
lwz r0, 0(r28)
cmplwi r0, 3
bne lbl_8009A638
li r0, 1
b lbl_8009A63C
lbl_8009A638:
li r0, 0
lbl_8009A63C:
addi r18, r29, 0x134
stw r0, 0x134(r29)
addi r21, r29, 0x118
lwz r3, 0x118(r29)
lwz r0, 0(r28)
slwi r3, r3, 2
add r3, r3, r0
bl getTiming
mr r30, r3
stw r30, 0x144(r29)
lhz r0, 0(r24)
lha r4, 0xf0(r29)
lha r3, displayOffsetH@sda21(r13)
subfic r5, r0, 0x2d0
lhz r0, 2(r30)
add r3, r4, r3
cmpw r3, r5
ble lbl_8009A688
b lbl_8009A698
lbl_8009A688:
cmpwi r3, 0
bge lbl_8009A694
li r3, 0
lbl_8009A694:
mr r5, r3
lbl_8009A698:
sth r5, 0xf8(r29)
addi r3, r29, 0xf8
lwz r4, 0(r25)
cmpwi r4, 0
bne lbl_8009A6B4
li r4, 2
b lbl_8009A6B8
lbl_8009A6B4:
li r4, 1
lbl_8009A6B8:
lhz r5, 0(r23)
lha r6, displayOffsetV@sda21(r13)
extsh r7, r5
clrlwi r5, r5, 0x1f
add r7, r7, r6
cmpw r7, r5
ble lbl_8009A6D8
b lbl_8009A6DC
lbl_8009A6D8:
mr r7, r5
lbl_8009A6DC:
sth r7, 0xfa(r29)
extsh r0, r0
slwi r0, r0, 1
lhz r8, 0(r22)
subf r0, r5, r0
lha r7, 0(r23)
addi r19, r29, 0xfa
extsh r9, r8
add r10, r9, r6
add r10, r7, r10
subf. r9, r0, r10
ble lbl_8009A714
subf r9, r0, r10
b lbl_8009A718
lbl_8009A714:
li r9, 0
lbl_8009A718:
add r10, r7, r6
subf. r7, r5, r10
bge lbl_8009A72C
subf r7, r5, r10
b lbl_8009A730
lbl_8009A72C:
li r7, 0
lbl_8009A730:
add r7, r8, r7
subf r7, r9, r7
addi r20, r29, 0xfc
sth r7, 0xfc(r29)
lha r7, 0(r23)
add r8, r7, r6
subf. r7, r5, r8
bge lbl_8009A758
subf r7, r5, r8
b lbl_8009A75C
lbl_8009A758:
li r7, 0
lbl_8009A75C:
divw r8, r7, r4
lhz r7, 0(r17)
subf r7, r8, r7
sth r7, 0xfe(r29)
lha r7, 0(r22)
lha r9, 0(r23)
add r8, r7, r6
add r8, r9, r8
subf. r7, r0, r8
ble lbl_8009A78C
subf r7, r0, r8
b lbl_8009A790
lbl_8009A78C:
li r7, 0
lbl_8009A790:
add r6, r9, r6
subf. r0, r5, r6
bge lbl_8009A7A4
subf r0, r5, r6
b lbl_8009A7A8
lbl_8009A7A4:
li r0, 0
lbl_8009A7A8:
divw r0, r0, r4
lhz r5, 0(r26)
divw r4, r7, r4
add r0, r5, r0
subf r0, r4, r0
sth r0, 0x100(r29)
lwz r0, encoderType@sda21(r13)
cmplwi r0, 0
bne lbl_8009A7D4
li r0, 3
stw r0, 0(r21)
lbl_8009A7D4:
lhz r5, 0x18(r30)
srawi r4, r5, 1
addze r4, r4
srawi r0, r5, 1
addze r0, r0
slwi r0, r0, 1
subfc r0, r0, r5
clrlwi. r0, r0, 0x10
clrlwi r4, r4, 0x10
beq lbl_8009A804
lhz r5, 0x1a(r30)
b lbl_8009A808
lbl_8009A804:
li r5, 0
lbl_8009A808:
addi r0, r5, 1
sth r0, 0x32(r29)
addi r0, r4, 1
ori r0, r0, 0x1000
lwz r5, changed@sda21(r13)
addi r4, r29, 2
lwz r6, lbl_80409F2C@sda21(r13)
ori r5, r5, 0x40
stw r6, lbl_80409F2C@sda21(r13)
stw r5, changed@sda21(r13)
sth r0, 0x30(r29)
lwz r0, changed@sda21(r13)
lwz r5, lbl_80409F2C@sda21(r13)
ori r0, r0, 0x80
stw r5, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lwz r0, 0(r28)
lhz r5, 2(r29)
cmplwi r0, 2
beq lbl_8009A860
cmplwi r0, 3
bne lbl_8009A86C
lbl_8009A860:
rlwinm r0, r5, 0, 0x1e, 0x1c
ori r5, r0, 4
b lbl_8009A874
lbl_8009A86C:
rlwinm r5, r5, 0, 0x1e, 0x1c
rlwimi r5, r0, 2, 0x1d, 0x1d
lbl_8009A874:
lwz r6, 0(r21)
rlwinm r5, r5, 0, 0x1d, 0x1b
lwz r7, 0(r18)
cmplwi r6, 4
slwi r0, r7, 3
or r0, r5, r0
beq lbl_8009A898
cmplwi r6, 5
bne lbl_8009A8A0
lbl_8009A898:
rlwinm r0, r0, 0, 0x18, 0x15
b lbl_8009A8AC
lbl_8009A8A0:
rlwinm r5, r0, 0, 0x18, 0x15
slwi r0, r6, 8
or r0, r5, r0
lbl_8009A8AC:
sth r0, 0(r4)
lis r0, 0x4000
addi r6, r29, 0x6c
lwz r4, changed@sda21(r13)
lwz r5, lbl_80409F2C@sda21(r13)
or r0, r4, r0
stw r5, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lwz r0, 0(r31)
lhz r4, 0x6c(r29)
cmpwi r0, 2
beq lbl_8009A8E4
cmpwi r0, 3
bne lbl_8009A8F0
lbl_8009A8E4:
rlwinm r0, r4, 0, 0, 0x1e
ori r0, r0, 1
b lbl_8009A8F4
lbl_8009A8F0:
rlwinm r0, r4, 0, 0, 0x1e
lbl_8009A8F4:
sth r0, 0(r6)
cmpwi r7, 0
lwz r4, changed@sda21(r13)
lwz r0, lbl_80409F2C@sda21(r13)
ori r0, r0, 0x200
stw r0, lbl_80409F2C@sda21(r13)
stw r4, changed@sda21(r13)
lhz r4, 0(r24)
lhz r5, 0(r16)
beq lbl_8009A924
slwi r0, r5, 1
b lbl_8009A928
lbl_8009A924:
mr r0, r5
lbl_8009A928:
clrlwi r8, r0, 0x10
cmplw r8, r4
bge lbl_8009A980
slwi r6, r8, 8
addi r0, r6, -1
add r0, r4, r0
divwu r0, r0, r4
ori r0, r0, 0x1000
sth r0, 0x4a(r29)
lis r0, 0x400
lwz r6, changed@sda21(r13)
lwz r7, lbl_80409F2C@sda21(r13)
or r0, r7, r0
stw r0, lbl_80409F2C@sda21(r13)
stw r6, changed@sda21(r13)
sth r8, 0x70(r29)
lwz r6, changed@sda21(r13)
lwz r0, lbl_80409F2C@sda21(r13)
ori r0, r0, 0x80
stw r0, lbl_80409F2C@sda21(r13)
stw r6, changed@sda21(r13)
b lbl_8009A9A0
lbl_8009A980:
li r0, 0x100
sth r0, 0x4a(r29)
lis r0, 0x400
lwz r6, changed@sda21(r13)
lwz r7, lbl_80409F2C@sda21(r13)
or r0, r7, r0
stw r0, lbl_80409F2C@sda21(r13)
stw r6, changed@sda21(r13)
lbl_8009A9A0:
lhz r0, 0(r3)
subfic r12, r4, 0x2d0
lhz r6, 0x1a(r30)
lis r3, 0x1000
lis r8, 0x2000
sth r6, 6(r29)
lis r9, 0x400
lis r7, 0x800
lwz r10, changed@sda21(r13)
lis r6, 0x10
lis r4, 0x20
lwz r11, lbl_80409F2C@sda21(r13)
or r10, r10, r3
lis r3, 4
stw r11, lbl_80409F2C@sda21(r13)
stw r10, changed@sda21(r13)
lbz r10, 0x1d(r30)
lbz r11, 0x1e(r30)
rlwimi r11, r10, 8, 0x10, 0x17
sth r11, 4(r29)
lwz r10, changed@sda21(r13)
lwz r11, lbl_80409F2C@sda21(r13)
or r8, r10, r8
stw r11, lbl_80409F2C@sda21(r13)
stw r8, changed@sda21(r13)
lbz r8, 0x1f(r30)
lbz r10, 0x1c(r30)
add r16, r8, r0
lhz r11, 0x20(r30)
addi r16, r16, -40
rlwinm r8, r16, 7, 0x10, 0x18
or r8, r10, r8
sth r8, 0xa(r29)
add r8, r11, r0
addi r0, r8, 0x28
lwz r10, changed@sda21(r13)
subf r0, r12, r0
srwi r8, r16, 9
lwz r11, lbl_80409F2C@sda21(r13)
slwi r0, r0, 1
or r9, r10, r9
stw r11, lbl_80409F2C@sda21(r13)
or r0, r8, r0
stw r9, changed@sda21(r13)
sth r0, 8(r29)
lwz r0, changed@sda21(r13)
lwz r8, lbl_80409F2C@sda21(r13)
or r0, r0, r7
stw r8, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lhz r0, 0x10(r30)
lbz r7, 0xc(r30)
slwi r0, r0, 5
or r0, r7, r0
sth r0, 0x16(r29)
lwz r0, changed@sda21(r13)
lwz r7, lbl_80409F2C@sda21(r13)
or r0, r0, r6
stw r7, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lhz r0, 0x14(r30)
lbz r6, 0xe(r30)
slwi r0, r0, 5
or r0, r6, r0
sth r0, 0x14(r29)
lwz r0, changed@sda21(r13)
lwz r6, lbl_80409F2C@sda21(r13)
or r0, r0, r4
stw r6, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lhz r0, 0x12(r30)
lbz r4, 0xd(r30)
slwi r0, r0, 5
or r0, r4, r0
sth r0, 0x1a(r29)
lwz r0, changed@sda21(r13)
lwz r4, lbl_80409F2C@sda21(r13)
or r0, r0, r3
stw r4, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lhz r0, 0x16(r30)
lbz r3, 0xf(r30)
slwi r0, r0, 5
or r0, r3, r0
sth r0, 0x18(r29)
lwz r3, changed@sda21(r13)
lis r0, 8
addi r6, r29, 0x11c
lwz r4, lbl_80409F2C@sda21(r13)
or r0, r3, r0
stw r4, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lhz r3, 0(r27)
lwz r4, 0(r25)
addi r0, r3, 0xf
lhz r3, 0(r15)
srawi r0, r0, 4
addze r0, r0
cmpwi r4, 0
stb r0, 0x11c(r29)
bne lbl_8009AB3C
lbz r4, 0(r6)
b lbl_8009AB44
lbl_8009AB3C:
lbz r0, 0(r6)
rlwinm r4, r0, 1, 0x18, 0x1e
lbl_8009AB44:
srawi r0, r3, 4
stb r4, 0x11d(r29)
addze r0, r0
slwi r0, r0, 4
subfc r0, r0, r3
stb r0, 0x12c(r29)
addi r0, r5, 0xf
lis r3, 0x800
lbz r4, 0x12c(r29)
add r0, r4, r0
srawi r0, r0, 4
addze r0, r0
stb r0, 0x11e(r29)
lbz r0, 0x11e(r29)
lbz r4, 0x11d(r29)
rlwimi r4, r0, 8, 0x10, 0x17
sth r4, 0x48(r29)
lwz r4, changed@sda21(r13)
lwz r0, FBSet@sda21(r13)
lwz r5, lbl_80409F2C@sda21(r13)
cmplwi r0, 0
or r0, r5, r3
stw r0, lbl_80409F2C@sda21(r13)
stw r4, changed@sda21(r13)
beq lbl_8009ABC0
addi r3, r29, 0xf0
addi r4, r29, 0x124
addi r5, r29, 0x128
addi r6, r29, 0x13c
addi r7, r29, 0x140
bl setFbbRegs
lbl_8009ABC0:
lwz r0, 0x130(r29)
stw r0, 8(r1)
lhz r3, 0(r19)
lhz r4, 0(r20)
lbz r5, 0(r30)
lhz r6, 2(r30)
lhz r7, 4(r30)
lhz r8, 6(r30)
lhz r9, 8(r30)
lhz r10, 0xa(r30)
bl setVerticalRegs
mr r3, r14
bl OSRestoreInterrupts
lmw r14, 0x30(r1)
lwz r0, 0x7c(r1)
addi r1, r1, 0x78
mtlr r0
blr
.global VIFlush
VIFlush:
mflr r0
stw r0, 4(r1)
stwu r1, -0x28(r1)
stmw r27, 0x14(r1)
bl OSDisableInterrupts
lwz r7, shdwChangeMode@sda21(r13)
lis r4, shdwRegs@ha
lis r5, regs@ha
lwz r6, changeMode@sda21(r13)
li r0, 0
addi r29, r4, shdwRegs@l
or r6, r7, r6
stw r6, shdwChangeMode@sda21(r13)
addi r31, r5, regs@l
addi r30, r3, 0
stw r0, changeMode@sda21(r13)
lwz r4, shdwChanged@sda21(r13)
lwz r5, lbl_80409F3C@sda21(r13)
lwz r0, changed@sda21(r13)
lwz r3, lbl_80409F2C@sda21(r13)
or r0, r4, r0
or r3, r5, r3
stw r3, lbl_80409F3C@sda21(r13)
stw r0, shdwChanged@sda21(r13)
b lbl_8009ACE4
lbl_8009AC6C:
lwz r3, changed@sda21(r13)
li r5, 0x20
lwz r27, lbl_80409F2C@sda21(r13)
addi r4, r27, 0
bl __shr2u
cntlzw r4, r4
cmpwi r4, 0x20
li r0, -1
and r0, r27, r0
bge lbl_8009AC98
b lbl_8009ACA0
lbl_8009AC98:
cntlzw r3, r0
addi r4, r3, 0x20
lbl_8009ACA0:
slwi r5, r4, 1
add r3, r31, r5
lhz r0, 0(r3)
add r3, r29, r5
subfic r5, r4, 0x3f
sth r0, 0(r3)
li r3, 0
li r4, 1
bl __shl2i
lwz r0, changed@sda21(r13)
nor r5, r3, r3
nor r4, r4, r4
lwz r3, lbl_80409F2C@sda21(r13)
and r0, r0, r5
and r3, r3, r4
stw r3, lbl_80409F2C@sda21(r13)
stw r0, changed@sda21(r13)
lbl_8009ACE4:
lwz r0, changed@sda21(r13)
li r3, 0
lwz r4, lbl_80409F2C@sda21(r13)
xor r0, r0, r3
xor r3, r4, r3
or. r0, r3, r0
bne lbl_8009AC6C
li r0, 1
stw r0, flushFlag@sda21(r13)
mr r3, r30
bl OSRestoreInterrupts
lmw r27, 0x14(r1)
lwz r0, 0x2c(r1)
addi r1, r1, 0x28
mtlr r0
blr
.global VISetNextFrameBuffer
VISetNextFrameBuffer:
mflr r0
lis r4, regs@ha
stw r0, 4(r1)
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
addi r31, r4, regs@l
stw r30, 0x10(r1)
addi r30, r3, 0
bl OSDisableInterrupts
stw r30, 0x120(r31)
li r0, 1
addi r30, r3, 0
stw r0, FBSet@sda21(r13)
addi r3, r31, 0xf0
addi r4, r31, 0x124
addi r5, r31, 0x128
addi r6, r31, 0x13c
addi r7, r31, 0x140
bl setFbbRegs
mr r3, r30
bl OSRestoreInterrupts
lwz r0, 0x1c(r1)
lwz r31, 0x14(r1)
lwz r30, 0x10(r1)
addi r1, r1, 0x18
mtlr r0
blr
.global VISetBlack
VISetBlack:
mflr r0
lis r4, regs@ha
stw r0, 4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1c(r1)
addi r31, r4, regs@l
stw r30, 0x18(r1)
addi r30, r3, 0
bl OSDisableInterrupts
stw r30, 0x130(r31)
mr r30, r3
lwz r10, 0x144(r31)
lwz r0, 0x130(r31)
stw r0, 8(r1)
lhz r3, 0xfa(r31)
lhz r4, 0xf6(r31)
lbz r5, 0(r10)
lhz r6, 2(r10)
lhz r7, 4(r10)
lhz r8, 6(r10)
lhz r9, 8(r10)
lhz r10, 0xa(r10)
bl setVerticalRegs
mr r3, r30
bl OSRestoreInterrupts
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
lwz r30, 0x18(r1)
addi r1, r1, 0x20
mtlr r0
blr
.global VIGetRetraceCount
VIGetRetraceCount:
lwz r3, retraceCount@sda21(r13)
blr
.global getCurrentFieldEvenOdd
getCurrentFieldEvenOdd:
lis r3, 0xCC002000@ha
addi r7, r3, 0xCC002000@l
lhzu r0, 0x2c(r7)
addi r4, r3, 0x2000
clrlwi r5, r0, 0x15
lbl_8009AE28:
lhz r0, 0(r7)
mr r6, r5
lhz r3, 0x2e(r4)
clrlwi r5, r0, 0x15
cmplw r6, r5
clrlwi r3, r3, 0x15
bne lbl_8009AE28
lwz r6, CurrTiming@sda21(r13)
addi r0, r5, -1
addi r4, r3, -1
lhz r3, 0x1a(r6)
slwi r5, r0, 1
lhz r0, 0x18(r6)
divwu r3, r4, r3
add r3, r5, r3
cmplw r3, r0
bge lbl_8009AE74
li r3, 1
blr
lbl_8009AE74:
li r3, 0
blr
.global VIGetNextField
VIGetNextField:
mflr r0
stw r0, 4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1c(r1)
bl OSDisableInterrupts
lis r4, 0xCC002000@ha
addi r8, r4, 0xCC002000@l
lhzu r0, 0x2c(r8)
addi r5, r4, 0x2000
clrlwi r6, r0, 0x15
lbl_8009AEA4:
lhz r0, 0(r8)
mr r7, r6
lhz r4, 0x2e(r5)
clrlwi r6, r0, 0x15
cmplw r7, r6
clrlwi r4, r4, 0x15
bne lbl_8009AEA4
lwz r7, CurrTiming@sda21(r13)
addi r0, r6, -1
addi r5, r4, -1
lhz r4, 0x1a(r7)
slwi r6, r0, 1
lhz r0, 0x18(r7)
divwu r4, r5, r4
add r4, r6, r4
cmplw r4, r0
bge lbl_8009AEF0
li r31, 1
b lbl_8009AEF4
lbl_8009AEF0:
li r31, 0
lbl_8009AEF4:
bl OSRestoreInterrupts
lis r3, HorVer@ha
addi r3, r3, HorVer@l
lhz r0, 0xa(r3)
xori r3, r31, 1
clrlwi r0, r0, 0x1f
xor r3, r3, r0
lwz r0, 0x24(r1)
lwz r31, 0x1c(r1)
addi r1, r1, 0x20
mtlr r0
blr
.global VIGetCurrentLine
VIGetCurrentLine:
mflr r0
stw r0, 4(r1)
stwu r1, -0x10(r1)
stw r31, 0xc(r1)
stw r30, 8(r1)
lwz r31, CurrTiming@sda21(r13)
bl OSDisableInterrupts
lis r4, 0xCC002000@ha
addi r8, r4, 0xCC002000@l
lhzu r0, 0x2c(r8)
addi r5, r4, 0x2000
clrlwi r6, r0, 0x15
lbl_8009AF54:
lhz r0, 0(r8)
mr r7, r6
lhz r4, 0x2e(r5)
clrlwi r6, r0, 0x15
cmplw r7, r6
clrlwi r7, r4, 0x15
bne lbl_8009AF54
lwz r4, CurrTiming@sda21(r13)
addi r5, r7, -1
addi r6, r6, -1
lhz r0, 0x1a(r4)
slwi r4, r6, 1
divwu r0, r5, r0
add r30, r4, r0
bl OSRestoreInterrupts
lhz r0, 0x18(r31)
cmplw r30, r0
blt lbl_8009AFA0
subf r30, r0, r30
lbl_8009AFA0:
srwi r3, r30, 1
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
lwz r30, 8(r1)
addi r1, r1, 0x10
mtlr r0
blr
.global VIGetTvFormat
VIGetTvFormat:
mflr r0
stw r0, 4(r1)
stwu r1, -0x10(r1)
stw r31, 0xc(r1)
bl OSDisableInterrupts
lwz r0, CurrTvMode@sda21(r13)
cmpwi r0, 3
beq lbl_8009B008
bge lbl_8009AFF8
cmpwi r0, 1
beq lbl_8009B010
bge lbl_8009B018
cmpwi r0, 0
bge lbl_8009B008
b lbl_8009B01C
lbl_8009AFF8:
cmpwi r0, 5
beq lbl_8009B018
bge lbl_8009B01C
b lbl_8009B010
lbl_8009B008:
li r31, 0
b lbl_8009B01C
lbl_8009B010:
li r31, 1
b lbl_8009B01C
lbl_8009B018:
mr r31, r0
lbl_8009B01C:
bl OSRestoreInterrupts
mr r3, r31
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
addi r1, r1, 0x10
mtlr r0
blr
.global VIGetDTVStatus
VIGetDTVStatus:
mflr r0
stw r0, 4(r1)
stwu r1, -0x10(r1)
stw r31, 0xc(r1)
bl OSDisableInterrupts
lis r4, 0xCC00206E@ha
lhz r0, 0xCC00206E@l(r4)
clrlwi r31, r0, 0x1e
bl OSRestoreInterrupts
clrlwi r3, r31, 0x1f
lwz r0, 0x14(r1)
lwz r31, 0xc(r1)
addi r1, r1, 0x10
mtlr r0
blr
.section .data, "wa"
timing:
.4byte 0x060000F0
.4byte 0x00180019
.4byte 0x00030002
.4byte 0x0C0D0C0D
.4byte 0x02080207
.4byte 0x02080207
.4byte 0x020D01AD
.4byte 0x404769A2
.4byte 0x01757A00
.4byte 0x019C0600
.4byte 0x00F00018
.4byte 0x00180004
.4byte 0x00040C0C
.4byte 0x0C0C0208
.4byte 0x02080208
.4byte 0x0208020E
.4byte 0x01AD4047
.4byte 0x69A20175
.4byte 0x7A00019C
.4byte 0x0500011F
.4byte 0x00230024
.4byte 0x00010000
.4byte 0x0D0C0B0A
.4byte 0x026B026A
.4byte 0x0269026C
.4byte 0x027101B0
.4byte 0x404B6AAC
.4byte 0x017C8500
.4byte 0x01A40500
.4byte 0x011F0021
.4byte 0x00210002
.4byte 0x00020D0B
.4byte 0x0D0B026B
.4byte 0x026D026B
.4byte 0x026D0270
.4byte 0x01B0404B
.4byte 0x6AAC017C
.4byte 0x850001A4
.4byte 0x060000F0
.4byte 0x00180019
.4byte 0x00030002
.4byte 0x100F0E0D
.4byte 0x02060205
.4byte 0x02040207
.4byte 0x020D01AD
.4byte 0x404E70A2
.4byte 0x01757A00
.4byte 0x019C0600
.4byte 0x00F00018
.4byte 0x00180004
.4byte 0x0004100E
.4byte 0x100E0206
.4byte 0x02080206
.4byte 0x0208020E
.4byte 0x01AD404E
.4byte 0x70A20175
.4byte 0x7A00019C
.4byte 0x0C0001E0
.4byte 0x00300030
.4byte 0x00060006
.4byte 0x18181818
.4byte 0x040E040E
.4byte 0x040E040E
.4byte 0x041A01AD
.4byte 0x404769A2
.4byte 0x01757A00
.4byte 0x019C0C00
.4byte 0x01E0002C
.4byte 0x002C000A
.4byte 0x000A1818
.4byte 0x1818040E
.4byte 0x040E040E
.4byte 0x040E041A
.4byte 0x01AD4047
.4byte 0x69A8017B
.4byte 0x7A00019C
taps:
.4byte 0x01F001DC
.4byte 0x01AE0174
.4byte 0x012900DB
.4byte 0x008E0046
.4byte 0x000C00E2
.4byte 0x00CB00C0
.4byte 0x00C400CF
.4byte 0x00DE00EC
.4byte 0x00FC0008
.4byte 0x000F0013
.4byte 0x0013000F
.4byte 0x000C0008
.4byte 0x00010000
"@92":
.4byte lbl_800998CC
.4byte lbl_800998D4
.4byte lbl_8009990C
.4byte lbl_80099914
.4byte lbl_800998DC
.4byte lbl_800998E4
.4byte lbl_8009992C
.4byte lbl_8009992C
.4byte lbl_800998FC
.4byte lbl_80099904
.4byte lbl_8009992C
.4byte lbl_8009992C
.4byte lbl_8009992C
.4byte lbl_8009992C
.4byte lbl_8009992C
.4byte lbl_8009992C
.4byte lbl_8009991C
.4byte lbl_80099924
.4byte lbl_8009992C
.4byte lbl_8009992C
.4byte lbl_800998EC
.4byte lbl_800998F4
"@336":
.asciz "***************************************\n"
.balign 4
"@337":
.asciz " ! ! ! C A U T I O N ! ! ! \n"
.balign 4
"@338":
.asciz "This TV format \"DEBUG_PAL\" is only for \n"
.balign 4
"@339":
.asciz "temporary solution until PAL DAC board \n"
.balign 4
"@340":
.asciz "is available. Please do NOT use this \n"
.balign 4
"@341":
.asciz "mode in real games!!! \n"
.balign 4
.4byte 0
.section .bss, "wa"
regs:
.skip 0x78
shdwRegs:
.skip 0x78
HorVer:
.skip 0x58
.section .sbss, "wa"
retraceCount:
.skip 0x4
flushFlag:
.skip 0x4
retraceQueue:
.skip 0x8
PreCB:
.skip 0x4
PostCB:
.skip 0x4
encoderType:
.skip 0x4
displayOffsetH:
.skip 0x2
displayOffsetV:
.skip 0x2
changeMode:
.skip 0x8
changed:
.skip 0x4
lbl_80409F2C:
.skip 0x4
shdwChangeMode:
.skip 0x8
shdwChanged:
.skip 0x4
lbl_80409F3C:
.skip 0x4
CurrTiming:
.skip 0x4
CurrTvMode:
.skip 0x4
FBSet:
.skip 0x4
message$332:
.skip 0x4