SortieSon marche (sans PMW)

Cette révision appartient à :
Maelle Cros 2023-04-07 09:02:22 +02:00
Parent acaa0e00d2
révision c2aa407cec

Voir le fichier

@ -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