forked from acco/chti23
94 lines
No EOL
1.4 KiB
ArmAsm
94 lines
No EOL
1.4 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
|
|
indexTab dcd 0
|
|
|
|
|
|
; ===============================================================================================
|
|
EXPORT CallbackSon;
|
|
EXPORT StartSon;
|
|
EXPORT SortieSon;
|
|
EXTERN LongueurSon;
|
|
EXTERN Son;
|
|
EXTERN PWM_Set_Value_TIM3_Ch3;
|
|
INCLUDE ../Driver/DriverJeuLaser.inc;
|
|
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
area moncode,code,readonly
|
|
; écrire le code ici
|
|
|
|
StartSon proc
|
|
|
|
LDR r0,=indexTab
|
|
MOV r1,#0
|
|
STR r1,[r0]
|
|
BX LR
|
|
endp
|
|
|
|
CallbackSon proc
|
|
LDR r0,=SortieSon
|
|
LDR r1,=Son
|
|
LDR r3,=indexTab
|
|
push {r4}
|
|
push {r5}
|
|
push {r6}
|
|
push {r7}
|
|
push {r8}
|
|
LDR r7,=LongueurSon
|
|
LDR r8,[r7]
|
|
|
|
LDR r6,[r3] ; dans r6 la valeur de indextab
|
|
CMP r8,r6
|
|
BEQ Fin
|
|
|
|
MOV r2, #2
|
|
MUL r2,r6,r2
|
|
LDRSH r4,[r1,r2] ; dans r4 l'adresse de son[r6]
|
|
mov r5,r4 ; dans r5 la valeur de son [r6]
|
|
|
|
ADD r5,r5,#32768
|
|
MOV r2,#720
|
|
MUL r5,r2,r5
|
|
LSR r5,r5,#16
|
|
|
|
STR r5,[r0] ; dans sortieson la valeur de son[index]
|
|
MOV r0,r5
|
|
push {lr}
|
|
BL PWM_Set_Value_TIM3_Ch3
|
|
pop{lr}
|
|
add r6,r6,#1
|
|
STR r6,[r3]
|
|
|
|
pop {r8}
|
|
pop {r7}
|
|
pop {r6}
|
|
pop {r5}
|
|
pop {r4}
|
|
BX lr
|
|
|
|
Fin
|
|
MOV r2,#-1
|
|
STR r2,[r0]
|
|
|
|
pop {r8}
|
|
pop {r7}
|
|
pop {r6}
|
|
pop {r5}
|
|
pop {r4}
|
|
BX lr
|
|
endp
|
|
|
|
END
|