View unanswered posts | View active topics It is currently Fri Oct 31, 2014 9:28 pm



Reply to topic  [ 1 post ] 
 Small library bug 
Author Message

Joined: Mon Sep 28, 2009 1:14 am
Posts: 3
I noticed a small bug in maxmod 1.06. There's code in source/mm_mas.s that looks something like this:

Code:
mpp_Update_ACHN_notest:
        ...
        push {lr}
        ...
        ldrb    r0, [r6, #MCA_SAMPLE]
        sub     r0, #1
        bcc     .mppt_achn_nostart @ no sample!!
        ...
.mppt_achn_noinst:
       
        push    {r4}
        ...
.mppt_achn_nostart:
        ...
.mpp_achn_updated:
        pop     {r4}
        pop     {r0}
        bx      r0


Ie, there's a bit of code that might skip pushing r4, resulting in lr being popped into r4 and junk into r0 which is then jumped to. So, I made a simple diff to fix this:

Code:
diff -ur maxmod_1.06src-org/source/mm_mas.s maxmod_1.06src/source/mm_mas.s
--- maxmod_1.06src-org/source/mm_mas.s  2008-12-23 12:51:50.000000000 -0500
+++ maxmod_1.06src/source/mm_mas.s      2010-05-05 07:18:08.000000000 -0400
@@ -2002,7 +2002,7 @@

        ldrb    r0, [r6, #MCA_SAMPLE]
        sub     r0, #1
-       bcc     .mppt_achn_nostart      @ no sample!!
+       bcc     .mppt_achn_nostart_push @ no sample!!

        @bl     mpp_SamplePointer
        mpp_SamplePointer
@@ -2040,6 +2040,9 @@
        bl      mpph_PitchSlide_Up              @ pitch slide
 #endif
        b       .mppt_av_finished               @
+.mppt_achn_nostart_push:       @ push r4 before jump
+       push {r4}
+       b .mppt_achn_nostart
 .mppt_av_minus:                                        @ --slide down
        neg     r1, r2                          @ r1 = slide value
        mov     r0, r5                          @ r0 = frequency


I'm pretty sure this is the correct behavior. Anyways, I hope this is useful.


Wed May 05, 2010 2:32 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
  Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.
Get devkitPro at SourceForge.net. Fast, secure and Free Open Source software downloads