View unanswered posts | View active topics It is currently Fri Nov 24, 2017 7:32 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:

        push {lr}
        ldrb    r0, [r6, #MCA_SAMPLE]
        sub     r0, #1
        bcc     .mppt_achn_nostart @ no sample!!
        push    {r4}
        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:

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
@@ -2040,6 +2040,9 @@
        bl      mpph_PitchSlide_Up              @ pitch slide
        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
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:  
  Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.
Get devkitPro at Fast, secure and Free Open Source software downloads