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 INCLUDE DriverJeuLaser.inc
IMPORT Son IMPORT Son
IMPORT LongueurSon IMPORT LongueurSon
EXPORT callbackSon EXPORT callbackSon
EXPORT SortieSon EXPORT SortieSon
EXPORT IndiceCourrant EXPORT IndiceCourrant
@ -17,7 +18,7 @@
area maram,data,readwrite area maram,data,readwrite
SortieSon dcw 0 SortieSon dcw 0
IndiceCourrant dcw 0 IndiceCourrant dcd 0
; =============================================================================================== ; ===============================================================================================
@ -38,44 +39,45 @@ IndiceCourrant dcw 0
; } ; }
;} ;}
callbackSon proc callbackSon proc
push{lr} push{lr}
push{r4}
push {r5}
ldr r0, =Son ldr r0, =Son
ldr r1, =LongueurSon
ldr r1, [r1]
ldr r2, =IndiceCourrant ldr r2, =IndiceCourrant
ldrh r2, [r2] ldr r1, [r2]
ldr r5, =LongueurSon
ldr r5, [r5]
; if (LongueurSon >= IndiceCourrant) { ; if (LongueurSon >= IndiceCourrant) {
cmp r1,r2 cmp r1,r5
blt RienFaire bgt RienFaire
; SortieSon = Son[IndiceCourrant]; ; SortieSon = Son[IndiceCourrant];
ldrsh r0, [r0, r2, lsl #1] ldrsh r3, [r0, r1, lsl #1]
; IndiceCourrant++; ; IndiceCourrant++;
add r2, #1 add r1, #1
ldr r3, =IndiceCourrant str r1, [r2]
strh r2, [r3]
; SortieSon += 32767; ; SortieSon += 32767;
mov r2, #32767 add r3, #32768
add r0, r2
; SortieSon = SortieSon*719/65534; ; SortieSon = SortieSon*719/65534;
mov r1, #719 mov r4, #719
mul r0, r1 mul r3, r4
asr r0, #16 asr r3, #16
ldr r0, =SortieSon
str r3, [r0] ; valeur de r3 à l'adresse dans r0 = adresse de SortieSon
; } ; }
RienFaire RienFaire
pop {r5}
pop {r4}
pop {pc} pop {pc}
endp endp