OPEN.BIN MDEC reset

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search

p1 = instruction type

  0 = set MDEC quant table (luminance, colour, scale)
  1 = reset MDEC & DMA transfer channels
0007371c: 27bdffe8 addiu r29,r29,0xffe8
00073720: 00802821 addu r5,r4,r0
00073724: 10a00006 beq r5,r0,0x00073740        #
00073728: afbf0010 sw r31,0x0010(r29)
0007372c: 34020001 ori r2,r0,0x0001
00073730: 10a2001c beq r5,r2,0x000737a4
00073734: 3c028000 lui r2,0x8000
00073738: 0801cdfe j 0x000737f8
0007373c: 00000000 nop

p1 = 0

00073740: 3c038007 lui r3,0x8007
00073744: 8c6341b4 lw r3,0x41b4(r3)             # MDEC1 stat reg
00073748: 3c028000 lui r2,0x8000
0007374c: ac620000 sw r2,0x0000(r3)             # disable data-in and data-out requests
00073750: 3c028007 lui r2,0x8007
00073754: 8c424188 lw r2,0x4188(r2)             # DMA0 channel control
00073758: 3c048007 lui r4,0x8007
0007375c: 24844078 addiu r4,r4,0x4078           # p1 = set quant tables instr. + parameters (set quant table; luminance & color)
00073760: ac400000 sw r0,0x0000(r2)             # turn everything off for DMA0 chnl ctrl
00073764: 3c028007 lui r2,0x8007
00073768: 8c424194 lw r2,0x4194(r2)             # DMA1 channel control
0007376c: 34050020 ori r5,r0,0x0020             # 0x20 parameters
00073770: ac400000 sw r0,0x0000(r2)             # turn everything off for DMA1 chnl ctrl
00073774: 3c038007 lui r3,0x8007
00073778: 8c6341b4 lw r3,0x41b4(r3)             # MDEC1 stat reg
0007377c: 3c026000 lui r2,0x6000
00073780: ac620000 sw r2,0x0000(r3)             # enable data-in and data-out request
00073784: 0c01ce06 jal 0x00073818               # OPEN.BIN Parse Instruction to MDEC
00073788: 00000000 nop
0007378c: 3c048007 lui r4,0x8007
00073790: 248440fc addiu r4,r4,0x40fc           # p1 = set scale table instr. + parameters (set scale table)
00073794: 0c01ce06 jal 0x00073818               # OPEN.BIN Parse Instruction to MDEC
00073798: 34050020 ori r5,r0,0x0020             # 0x20 param.
0007379c: 0801ce02 j 0x00073808
000737a0: 00000000 nop

p1 = 1

000737a4: 3c038007 lui r3,0x8007
000737a8: 8c6341b4 lw r3,0x41b4(r3)             # MDEC1 stat reg
000737ac: 00000000 nop
000737b0: ac620000 sw r2,0x0000(r3)             # tell reset MDEC
000737b4: 3c028007 lui r2,0x8007
000737b8: 8c424188 lw r2,0x4188(r2)             # DMA0 channel control
000737bc: 00000000 nop
000737c0: ac400000 sw r0,0x0000(r2)             # turn everything off for DMA0 chnl ctrl
000737c4: 3c028007 lui r2,0x8007
000737c8: 8c424194 lw r2,0x4194(r2)             # DMA1 channel control
000737cc: 00000000 nop
000737d0: ac400000 sw r0,0x0000(r2)             # turn everything off for DMA1 chnl ctrl
000737d4: 3c028007 lui r2,0x8007
000737d8: 8c424194 lw r2,0x4194(r2)             # DMA1 channel control
000737dc: 3c038007 lui r3,0x8007
000737e0: 8c6341b4 lw r3,0x41b4(r3)             # MDEC1 stat reg
000737e4: 8c420000 lw r2,0x0000(r2)             # 
000737e8: 3c026000 lui r2,0x6000                # enable bus snooping; persist forced transfer start
000737ec: ac620000 sw r2,0x0000(r3)             # give instructions back to DMA1 channel control
000737f0: 0801ce02 j 0x00073808                 # return
000737f4: 00000000 nop

otherwise

000737f8: 3c048006 lui r4,0x8006
000737fc: 24847044 addiu r4,r4,0x7044           # "MDEC_rest:bad option(%d)" %d = p2
00073800: 0c0088cb jal 0x0002232c               # printf
00073804: 00000000 nop

return:

00073808: 8fbf0010 lw r31,0x0010(r29)
0007380c: 27bd0018 addiu r29,r29,0x0018
00073810: 03e00008 jr r31
00073814: 00000000 nop