OPEN.BIN MDEC in

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
00073818: 27bdffe0 addiu r29,r29,0xffe0
0007381c: afb10014 sw r17,0x0014(r29)
00073820: 00808821 addu r17,r4,r0                # MDEC instruction + parameters
00073824: afb00010 sw r16,0x0010(r29)
00073828: afbf0018 sw r31,0x0018(r29)
0007382c: 0c01ce4f jal 0x0007393c
00073830: 00a08021 addu r16,r5,r0                # number of blocks / image/video size?
00073834: 3c038007 lui r3,0x8007
00073838: 8c6341b8 lw r3,0x41b8(r3)
0007383c: 00108142 srl r16,r16,0x05              # 
00073840: 8c620000 lw r2,0x0000(r3)
00073844: 00108400 sll r16,r16,0x10              # get final number of blocks (p2 >> 5)
00073848: 34420088 ori r2,r2,0x0088
0007384c: ac620000 sw r2,0x0000(r3)
00073850: 3c038007 lui r3,0x8007
00073854: 8c634180 lw r3,0x4180(r3)              # DMA0 base address
00073858: 26220004 addiu r2,r17,0x0004
0007385c: ac620000 sw r2,0x0000(r3)              # transfer from p1 + 4
00073860: 3c028007 lui r2,0x8007
00073864: 8c424184 lw r2,0x4184(r2)              # DMA0 block control
00073868: 36100020 ori r16,r16,0x0020            # block size 0x20
0007386c: ac500000 sw r16,0x0000(r2)             # issue p2 >> 5 blocks, 0x20 big to block control
00073870: 3c038007 lui r3,0x8007
00073874: 8c6341b0 lw r3,0x41b0(r3)              # MDEC0
00073878: 8e220000 lw r2,0x0000(r17)             # command to issue to MDEC
0007387c: 3c040100 lui r4,0x0100                
00073880: ac620000 sw r2,0x0000(r3)              # issue command 
00073884: 3c028007 lui r2,0x8007
00073888: 8c424188 lw r2,0x4188(r2)              # DMA0 channel control
0007388c: 34840201 ori r4,r4,0x0201              # 0x0100 0201
00073890: ac440000 sw r4,0x0000(r2)              # issue to DMA0: start transfer, RAM to device, transfer mode slice
00073894: 8fbf0018 lw r31,0x0018(r29)
00073898: 8fb10014 lw r17,0x0014(r29)
0007389c: 8fb00010 lw r16,0x0010(r29)
000738a0: 27bd0020 addiu r29,r29,0x0020
000738a4: 03e00008 jr r31
000738a8: 00000000 nop