chti23/soft/PjtKEIL_StepSon/Src/GestionSon.s
2023-04-12 15:21:44 +02:00

53 lines
No EOL
1.1 KiB
ArmAsm

PRESERVE8
THUMB
IMPORT LongueurSon
IMPORT PeriodeSonMicroSec
IMPORT Son
EXPORT CallbackSon
; ====================== zone de réservation de données, ======================================
;Section RAM (read only) :
area mesdata,data,readonly
;Section RAM (read write):
area maram,data,readwrite
SortieSon dcw 0
EXPORT SortieSon
; ===============================================================================================
;Section ROM code (read only) :
area moncode,code,readonly
; écrire le code ici
CallbackSon proc
;; 1. Il faut pouvoir utiliser SortieSon comme index d'iteration dans le tableau bruitverre
push {r4,r5,r6}
ldr r1,=SortieSon ;sortie
ldr r2,=LongueurSon ;nb de sons
ldr r3,=Son ;adresse du tableau de sons
mov r4,#0 ;compteur
mov r5,#(1<<15) ;registre pour operations
mov r6,#719 ;sauvegarde de 719
calcul
ldrsh r0, [r3,r4,lsl #1]
;faire +32768, ensuite x719, puis diviser par 2^16
add r0,r5
mul r0,r0,r6
lsr r0,#16
str r0,[r1]
add r4,#1
cmp r2,r4
bne calcul
pop {r4,r5,r6}
endp
END