Set Voice Volume Left/Right Scaled
Jump to navigation
Jump to search
p1 = voice half-ID p2 = volume to set * 64
0001920c: 3c028003 lui r2,0x8003 00019210: 8c42ad68 lw r2,-0x5298(r2) 00019214: 00000000 nop 00019218: 10400011 beq r2,r0,0x00019260 0001921c: 00803021 addu r6,r4,r0 00019220: 3c048003 lui r4,0x8003 00019224: 8c84ad70 lw r4,-0x5290(r4) # 8 00019228: 00000000 nop 0001922c: 00a4001b divu r5,r4 # p2 / 8 00019230: 14800002 bne r4,r0,0x0001923c 00019234: 00000000 nop 00019238: 0007000d break 0x00001c00 # divide by 0 break 0001923c: 00001010 mfhi r2 00019240: 00000000 nop 00019244: 10400006 beq r2,r0,0x00019260 # no need to round value if desired volume = 0 00019248: 00000000 nop 0001924c: 3c028003 lui r2,0x8003 00019250: 8c42ad74 lw r2,-0x528c(r2) # 7 00019254: 00a42821 addu r5,r5,r4 00019258: 00021027 nor r2,r0,r2 0001925c: 00a22824 and r5,r5,r2 # volume always rounded to multiple of 8 00019260: 3c028003 lui r2,0x8003 00019264: 8c42ad6c lw r2,-0x5294(r2) # 3 00019268: 00000000 nop 0001926c: 00453806 srlv r7,r5,r2 # volume 00019270: 2402fffe addiu r2,r0,0xfffe 00019274: 10c20005 beq r6,r2,0x0001928c # end return volume * 8 if voice half-ID = -2 00019278: 2402ffff addiu r2,r0,0xffff 0001927c: 14c20005 bne r6,r2,0x00019294 00019280: 00a01021 addu r2,r5,r0 00019284: 080064aa j 0x000192a8 # end return volume if voice half-ID = -1 00019288: 30e2ffff andi r2,r7,0xffff 0001928c: 080064aa j 0x000192a8 00019290: 00a01021 addu r2,r5,r0 00019294: 3c048003 lui r4,0x8003 00019298: 8c84ad44 lw r4,-0x52bc(r4) # voice left IO port 0001929c: 00061840 sll r3,r6,0x01 000192a0: 00641821 addu r3,r3,r4 # voice-half IO port 000192a4: a4670000 sh r7,0x0000(r3) # store volume 000192a8: 03e00008 jr r31 000192ac: 00000000 nop