From c2aa407cec2e4a5997a01a0748dc8138fd7aa9ac Mon Sep 17 00:00:00 2001 From: MaelleCros Date: Fri, 7 Apr 2023 09:02:22 +0200 Subject: [PATCH] SortieSon marche (sans PMW) --- PjtKEIL_StepSon/Src/GestionSon.s | 42 +++++++++++++++++--------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/PjtKEIL_StepSon/Src/GestionSon.s b/PjtKEIL_StepSon/Src/GestionSon.s index c6e8d16..c4d4ad3 100644 --- a/PjtKEIL_StepSon/Src/GestionSon.s +++ b/PjtKEIL_StepSon/Src/GestionSon.s @@ -4,6 +4,7 @@ INCLUDE DriverJeuLaser.inc IMPORT Son IMPORT LongueurSon + EXPORT callbackSon EXPORT SortieSon EXPORT IndiceCourrant @@ -17,7 +18,7 @@ area maram,data,readwrite SortieSon dcw 0 -IndiceCourrant dcw 0 +IndiceCourrant dcd 0 ; =============================================================================================== @@ -38,44 +39,45 @@ IndiceCourrant dcw 0 ; } ;} - - callbackSon proc push{lr} + push{r4} + push {r5} + ldr r0, =Son - - ldr r1, =LongueurSon - ldr r1, [r1] - ldr r2, =IndiceCourrant - ldrh r2, [r2] + ldr r1, [r2] + + ldr r5, =LongueurSon + ldr r5, [r5] ; if (LongueurSon >= IndiceCourrant) { - cmp r1,r2 - blt RienFaire + cmp r1,r5 + bgt RienFaire ; SortieSon = Son[IndiceCourrant]; - ldrsh r0, [r0, r2, lsl #1] + ldrsh r3, [r0, r1, lsl #1] ; IndiceCourrant++; - add r2, #1 - ldr r3, =IndiceCourrant - strh r2, [r3] + add r1, #1 + str r1, [r2] ; SortieSon += 32767; - mov r2, #32767 - add r0, r2 + add r3, #32768 ; SortieSon = SortieSon*719/65534; - mov r1, #719 - mul r0, r1 - asr r0, #16 + mov r4, #719 + mul r3, r4 + asr r3, #16 + ldr r0, =SortieSon + str r3, [r0] ; valeur de r3 à l'adresse dans r0 = adresse de SortieSon ; } RienFaire + pop {r5} + pop {r4} pop {pc} - endp