forked from acco/chti23
66 lines
No EOL
989 B
ArmAsm
66 lines
No EOL
989 B
ArmAsm
PRESERVE8
|
|
THUMB
|
|
|
|
export CallbackSon
|
|
export index
|
|
export SortieSon
|
|
import LongueurSon
|
|
import Son
|
|
|
|
; ====================== 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 dcd 0
|
|
|
|
|
|
; ===============================================================================================
|
|
|
|
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
area moncode,code,readonly
|
|
; écrire le code ici
|
|
|
|
CallbackSon proc
|
|
push {r4,lr,r5,r6,r7}
|
|
ldr r4,=LongueurSon
|
|
ldr r4,[r4]
|
|
ldr r2,=index
|
|
ldr r7,[r2]
|
|
cmp r4,r7
|
|
|
|
bne alors
|
|
|
|
sinon
|
|
b finsi
|
|
|
|
alors
|
|
ldr r3,=SortieSon
|
|
ldr r1,=Son
|
|
|
|
ldrsh r0,[r1,r2,lsl#1] ; R0 = *(R1+2*R2 ) R0 = R1[R2]
|
|
|
|
mov r5,#719
|
|
mul r3,r5
|
|
asr r3,#16
|
|
|
|
ldr r6,=23560192 ;719*32768
|
|
add r3,r6
|
|
asr r3,#16
|
|
|
|
add r7,#1 ;index=index+1
|
|
str r7,[r2] ; *R2 = R7
|
|
|
|
|
|
finsi
|
|
pop {r4,lr,r5,r6,r7}
|
|
bx lr
|
|
endp
|
|
|
|
END
|