CHTI/soft/PjtKEIL_StepSon/Src/GestionSon.s
Clement Mauperon dbe899586d fin séance
2023-03-21 18:18:30 +01:00

66 lines
No EOL
1.3 KiB
ArmAsm

PRESERVE8
THUMB
; ====================== 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
Index dcb 0
ResolutionEntree equ 32768
ResolutionSortie equ 720
; ===============================================================================================
IMPORT Son
IMPORT LongueurSon
EXPORT SortieSon
EXPORT CallbackSon
EXPORT Index
;Section ROM code (read only) :
area moncode,code,readonly
CallbackSon proc
; int* indexAdress = &Index
ldr r5,=Index
; int index = *indexAdress
ldr r6,[r5]
; if (index < LongueurSon) return;
ldr r7,=LongueurSon
ldr r7,[r7]
cmp r6,r7
blt LireEchantillon
bx lr
LireEchantillon
; long* son = &Son
ldr r7,=Son
; long echantillon = son[index]
ldr r7,[r6]
; index += 1
add r6,r6,#1
; *indexAdresse = index
str r6,[r5]
; int resolutionEntree = ResolutionEntree
ldr r5,=ResolutionEntree
; son = son + ResolutionEntree
adds r7,r7,r5
; int resolutionSortie = ResolutionSortie
ldr r5,=ResolutionSortie
; son = son / resolutionSortie
sdiv r7,r7,r5
; long* sortieSon = &SortieSon
ldr r5,=SortieSon
; *sortieSon = son
str r7,[r5]
bx lr
endp
END