105 lines
No EOL
1.7 KiB
ArmAsm
105 lines
No EOL
1.7 KiB
ArmAsm
PRESERVE8
|
|
THUMB
|
|
|
|
import LongueurSon
|
|
import PeriodeSonMicroSec
|
|
import Son
|
|
|
|
include Driver/DriverJeuLaser.inc
|
|
|
|
; ====================== 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
|
|
|
|
Offset equ 32768
|
|
Intervalle equ 360
|
|
Index equ 0
|
|
|
|
EXPORT CallbackSon
|
|
|
|
; ===============================================================================================
|
|
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
area moncode,code,readonly
|
|
; écrire le code ici
|
|
|
|
;short int SortieSon;
|
|
;int LongueurSon 5512
|
|
;int i;
|
|
;if not i == LongueurSon
|
|
;lire[i] str
|
|
;i++
|
|
;
|
|
;360*(SortieSon+32768)/32768
|
|
|
|
import son
|
|
import LongueurSon
|
|
|
|
CallbackSon proc
|
|
push {lr}
|
|
|
|
ldr r0,=son ; tableau de données
|
|
ldr r1,=SortieSon ; resultat
|
|
|
|
ldr r2,[r1,#LongueurSon] ; point fini
|
|
ldr r3,[r1,#Index] ; position actuelle
|
|
|
|
add r3,#1
|
|
cmp r2,r3 ;if on n'arrive pas la fin de tableau, on continue
|
|
beq FIN ; if oui on quitte le prog
|
|
|
|
; ldr r4,
|
|
; ldrsh []
|
|
|
|
|
|
|
|
|
|
FIN
|
|
mov r3,#0
|
|
|
|
ENDP
|
|
|
|
END
|
|
|
|
EXPORT GestionSon
|
|
EXPORT StartSon
|
|
StartSon proc
|
|
eor r0, r0
|
|
ldr r1, =Son_index
|
|
str r0, [r1]
|
|
bx lr
|
|
endp
|
|
|
|
GestionSon proc
|
|
ldr r2, =LongueurSon
|
|
ldr r0, [r2]
|
|
ldr r2, =Son_index
|
|
ldr r1, [r2]
|
|
cmp r0, r1
|
|
bls EndOfSound ; if (LongeurSon <= Son_index) goto ResetGestionSon;
|
|
ldr r3, =Son
|
|
ldrsh r0, [r3, r1, lsl #1]
|
|
; r0 = Son[Son_index]
|
|
add r0, #32768
|
|
mov r3, #720
|
|
mul r0, r3
|
|
lsr r0, #16 ;x in [-32768; 32767] -> x in [0; 719]
|
|
ldr r3, =Sortie_son
|
|
str r0, [r3] ; Sortie_son = x
|
|
add r1, r1, #1
|
|
str r1, [r2] ; Son_index++;
|
|
b PWM_Set_Value_TIM3_Ch3
|
|
EndOfSound
|
|
bx lr
|
|
endp
|
|
END |