• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 … 78 79 80 81 82 … 117 Next »

RE on PCM 8 decoder, need a little help
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode
RE on PCM 8 decoder, need a little help
07-07-2010, 04:29 PM
#1
Torin Offline
Member
***
Posts: 65
Threads: 4
Joined: Jun 2010
Hi guys, i was trying to make another RE to the RE decoder, using the other RE made for other users, but modified a little bit:
Code:
//////////////////////////////////////////// 0x08 DECODER
// Hardcoded destination 0x0580.
void Decoder0x08() {
    098f 0092 0004 lri         $CR, #0x0004
    0991 2002      lrs         $AX0.L, @0x0002
    0992 8100      clr         $ACC0
    0993 8900      clr         $ACC1
    0994 2430      lrs         $AC0.L, @0x0030   // CurSampleFrac
    
    $AX0.L = PB.RatioInt;
    $AC0.L = PB.CurSampleFrac;

    // 0995 8d00      set15      
    // 0996 0950      lris        $AX1.L, #0x50
    // 0997 a000      mulx        $AX0.L, $AX1.L
    // 0998 a400      mulxac      $AX0.L, $AX1.L, $ACC0
    // 0999 1404      lsl         $ACC0, #4
    // 099a 8c00      clr15      
    // Compute how much data we need to read, to get 0x50 samples after resampling.
    // AC0.L is cursamplefrace, AX0.L is ratio.
    $ACC0 = PB.CurrentSampleFrac + 0x50 * PB.Ratio;

    099b 1ffe      mrr         $AC1.M, $AC0.M
    099c 0083 0580 lri         $AR3, #0x0580
    // 099e 2201      lrs         $AX0.H, @0x0001
    // 099f 8600      tstaxh      $AX0.H
    // 09a0 0294 09b1 jnz         0x09b1
    
    if (PB.KeyOff)
        goto clear_buffer;
        
    // 09a2 2204      lrs         $AX0.H, @0x0004
    // 09a3 8600      tstaxh      $AX0.H
    // 09a4 02b4 09f9 callne      0x09f9
    
    if (PB.NeedsReset)
    {
        09f9_UpdateSampleCounters8();
    }

    09a6 8100      clr         $ACC0
    
    // 09a7 2605      lrs         $AC0.M, @0x0005
    // 09a8 b100      tst         $ACC0
    // 09a9 0295 09be jz          0x09be
    
    if (PB.ReachedEnd)
    {
        09be_SetupAccelerator
    

reached_end:

    09ab 8100      clr         $ACC0
    09ac 2e05      srs         @0x0005, $AC0.M
    
    PB.ReachedEnd = 0;
    
    09ad 2281      lrs         $AX0.H, @0xff81
    09ae 8600      tstaxh      $AX0.H
    09af 0294 09b8 jnz         0x09b8
    
    if (!RepeatMode)
    {
        
clear_buffer:

    09b1 8100      clr         $ACC0
    
    // 09b2 005f      loop        $AC1.M
    // 09b3 1b7e      srri        @$AR3, $AC0.M
    // 09b4 7400      incm        $AC0.M
    // 09b5 2e01      srs         @0x0001, $AC0.M
    // 09b6 029f 09f2 jmp         0x09f2
    
    for (u32 i = 0; i < rem_samples; i++)
        *_Buffer++ = 0;
    PB.KeyOff = 1;
    return;
    
    }
    else
    {    
    
    // 09b8 2688      lrs         $AC0.M, @0xff88
    // 09b9 2489      lrs         $AC0.L, @0xff89
    // 09ba 2e34      srs         @0x0034, $AC0.M
    // 09bb 2c35      srs         @0x0035, $AC0.L
    // 09bc 02bf 09f9 call        0x09f9
    
    PB.RestartPos = PB.LoopStartPos;
    09f9_UpdateSampleCounters8();
    }
    }
    
    09be 00ff 0360 sr          @0x0360, $AC1.M
    09c0 2638      lrs         $AC0.M, @0x0038
    09c1 2439      lrs         $AC0.L, @0x0039
    09c2 0f05      lris        $AC1.M, #0x05   // Sample format 5, how we can use this?
    // 09c3 02bf 05ad call        0x05ad
    
    void 05ad_SetupAccelerator(_acceleratorH(PB.CurAddr), _accleratorL(0x0039), _format(0x05))
    {
    *SampleFormat = AC1.M
    *ACCAH/ACCAL = PB.CurAddr >> ((0x05 & 3) - 1);
    }  

    09c5 00df 0360 lr          $AC1.M, @0x0360
    09c7 8100      clr         $ACC0
    
    // 09c8 263a      lrs         $AC0.M, @0x003a
    // 09c9 b100      tst         $ACC0
    // 09ca 0294 09d9 jnz         0x09d9
    
    if (!PB.RemLength)
    {
    
        // 09cc 263b      lrs         $AC0.M, @0x003b
        // 09cd 5c00      sub         $ACC0, $ACC1
        // 09ce 0290 09d9 jge         0x09d9
        
        PB.CurAddr = 0x003b
        $ACC0 -= $ACC1
        $AX0.H = PB.RemLength
        09d0 223b      lrs         $AX0.H, @0x003b
        
        // 09d1 02bf 0a0a call        0x0a0a   // Load more samples.
        void 0a0a_ReadFromAccelerator8To16(OutBuffer($AR3), Count($AX0.H))
        {
            for (int i = 0; i < PB.RemLength; i++)
                *_Buffer++ = (s8)(*read_ptr++) << 8;   // ffd3 is the non-adpcm alternative read address for the accelerator.
        }

        // 09d3 5500      subr        $ACC1, $AX0.H
        // 09d4 0a01      lris        $AX0.H, #0x01
        // 09d5 00fa 0405 sr          @0x0405, $AX0.H
        // 09d7 029f 09ab jmp         0x09ab
        
        rem_samples -= PB.RemLength
        PB.ReachedEnd = 1;
        goto reached_end;        
    }
    else
    {
    09d9 1f5f      mrr         $AX0.H, $AC1.M
    $AX0.H = 0x05 = 0x0360
    
    // 09da 02bf 0a0a call        0x0a0a   // Load more samples.
        void 0a0a_ReadFromAccelerator8To16(OutBuffer($AR3), Count($AX0.H))
        {
            for (int i = 0; i < (PB.Format == 5); i++)
                *_Buffer++ = (s8)(*read_ptr++) << 8;
        }    
    
    // Stash AX0.H away, it gets read again at 09ef.
    09dc 00fa 0362 sr          @0x0362, $AX0.H

    09de 8100      clr         $ACC0
    // 09df 263a      lrs         $AC0.M, @0x003a
    // 09e0 243b      lrs         $AC0.L, @0x003b
    // 09e1 1570      lsr         $ACC1, #-16
    
    $AC0.M = PB.RemLength
    $ACC1 = (rem_samples << 16)
    
    // 09e2 0a01      lris        $AX0.H, #0x01
    // 09e3 0081 0405 lri         $AR1, #0x0405
    // 09e5 5c00      sub         $ACC0, $ACC1
    // 09e6 b100      tst         $ACC0
    // 09e7 0275      ifz        
    //     09e8 1a3a      srr         @$AR1, $AX0.H
    
    PB.RemLength -= (rem_samples << 16);
    if(PB.RemLength == 0)
    PB.ReachedEnd = 1;
    }
        
    09e9 2e3a      srs         @0x003a, $AC0.M
    09ea 2c3b      srs         @0x003b, $AC0.L
    09eb 2638      lrs         $AC0.M, @0x0038
    09ec 2439      lrs         $AC0.L, @0x0039
    09ed 00d8 0362 lr          $AX0.L, @0x0362
    
    PB.RemLength = PB.CurAddr
    
    09ef 7000      addaxl      $ACC0, $AX0.L
    09f0 2c39      srs         @0x0039, $AC0.L
    09f1 2e38      srs         @0x0038, $AC0.M
    
    PB.RemLength = PB.CurAddr + PB.Format

    // 09f2 0092 00ff lri         $CR, #0x00ff
    // 09f4 029f 02d0 jmp         0x02d0
    GOTO Resample_From0580To0520:
}

I want to know how exactli work the part of:

Code:
09c2 0f05      lris        $AC1.M, #0x05   // Sample format 5, how

Couse on accelerator setup for dmai need $AC1.M Values, andd i want to kwno if i may use it like PB.Format ==5. Greets
Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma