forked from acco/chti23
82 lines
No EOL
1.3 KiB
ArmAsm
82 lines
No EOL
1.3 KiB
ArmAsm
PRESERVE8
|
|
THUMB
|
|
|
|
INCLUDE DriverJeuLaser.inc
|
|
IMPORT Son
|
|
IMPORT LongueurSon
|
|
EXPORT callbackSon
|
|
EXPORT SortieSon
|
|
EXPORT IndiceCourrant
|
|
|
|
; ====================== 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
|
|
IndiceCourrant dcw 0
|
|
|
|
; ===============================================================================================
|
|
|
|
|
|
|
|
|
|
;Section ROM code (read only) :
|
|
area moncode,code,readonly
|
|
; écrire le code ici
|
|
|
|
|
|
;void callbackSon (void) {
|
|
; if (LongueurSon >= IndiceCourrant) {
|
|
; SortieSon = Son[IndiceCourrant];
|
|
; SortieSon += 32767;
|
|
; SortieSon = SortieSon/(65534/719);
|
|
; IndiceCourrant++;
|
|
; }
|
|
;}
|
|
|
|
|
|
|
|
callbackSon proc
|
|
push{lr}
|
|
ldr r0, =Son
|
|
|
|
ldr r1, =LongueurSon
|
|
ldr r1, [r1]
|
|
|
|
ldr r2, =IndiceCourrant
|
|
ldrh r2, [r2]
|
|
|
|
; if (LongueurSon >= IndiceCourrant) {
|
|
cmp r1,r2
|
|
blt RienFaire
|
|
|
|
; SortieSon = Son[IndiceCourrant];
|
|
ldrsh r0, [r0, r2, lsl #1]
|
|
|
|
; IndiceCourrant++;
|
|
add r2, #1
|
|
ldr r3, =IndiceCourrant
|
|
strh r2, [r3]
|
|
|
|
; SortieSon += 32767;
|
|
mov r2, #32767
|
|
add r0, r2
|
|
|
|
; SortieSon = SortieSon*719/65534;
|
|
mov r1, #719
|
|
mul r0, r1
|
|
asr r0, #16
|
|
|
|
; }
|
|
|
|
RienFaire
|
|
pop {pc}
|
|
|
|
endp
|
|
|
|
|
|
END
|