diff --git a/Partie son/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/GestionSon.s b/Partie son/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/GestionSon.s index eaef61c..5faddeb 100644 --- a/Partie son/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/GestionSon.s +++ b/Partie son/PjtKEIL_StepSon/PjtKEIL_StepSon/Src/GestionSon.s @@ -3,10 +3,11 @@ include ./Driver/DriverJeuLaser.inc -; ====================== zone de réservation de données, ====================================== +; ====================== zone de r�servation de donn�es, ====================================== ;Section RAM (read only) : area mesdata,data,readonly extern Son + extern LongueurSon ;Section RAM (read write): area maram,data,readwrite @@ -24,14 +25,25 @@ index dcd 0 ;Section ROM code (read only) : area moncode,code,readonly -; écrire le code ici +; �crire le code ici export CallbackSon CallbackSon proc + push {lr} + push {r5} + ldr r0, =Son ;r0=&Son ldr r2, =index ; r2=&index ldr r1, [r2] ; r1 = index + + ldr r5, = LongueurSon ; r5 = &LongueurSon + ldr r5, [r5] ; r5 = LongueurSon ; r5 = LongueurSon + asl r5, #1; r5 = 2 x LongueurSon + + cmp r1, r5 ; compare index et length + bgt done + ldrsh r3, [r0, r1] ;r3=son[index] ; on aurait pu faire ldrsh r3, [r0, r1, lsl #1] et incrementer de 1 add r1, #2 ; index +=2 @@ -46,7 +58,7 @@ CallbackSon proc asr r3, #16 ;r3/=65536 pop {r4} - ;On met la valeur modifiée dans SortieSon + ;On met la valeur modifiee dans SortieSon ldr r0, =SortieSon ;r0=&SortieSon str r3, [r0] @@ -55,6 +67,9 @@ CallbackSon proc bl PWM_Set_Value_TIM3_Ch3 pop {r0-r3} +done + + pop {r5} pop {pc} endp @@ -63,6 +78,7 @@ CallbackSon proc + END \ No newline at end of file