-
Notifications
You must be signed in to change notification settings - Fork 0
/
RSI_timer1.s
executable file
·116 lines (81 loc) · 1.43 KB
/
RSI_timer1.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
@;
@; Author: Aleix Mariné-Tena
@;
RSI_timer1:
push {r0 - r5, lr}
@; Generar pulsos, invertir estado del bit 7 par control M1
ldr r2, =REG_TEL
ldrb r3, [r2]
and r4, r3, #0x80 @; 0b1000 0000
cmp r4, #0x80
moveq r5, #0
movne r5, #0x80
strb r5, [r2]
@; Comparar RA actual RA destino con circ_sub
ldr r0, =ra_objetivo
ldr r0, [r0]
ldr r1, =ra_actual
ldr r1, [r1]
bl circ_sub
@; Usar R0 para saber direccion
cmp r0, #0
movlt r2, #-1
movgt r2, #1
ldr r0, =seek_ra
ldrb r3, [r0]
cmp r3, #1
bne .NotSeeking
@; Estamos en modo busqueda
cmp r1, #120
blo .LessThan120
@; r1 => 120
mov r0, #1
ldr r1, =divfreq_vmax
ldrh r1, [r1]
bl activar_timer
ldr r2, =REG_TEL
ldrb r3, [r2]
@; r3 = 0b XX1X XXXX
@; 0x20 =0010 0000 = 1101 1111
bic r3, #0x20 @; 0b0010 0000
strb r3, [r2]
b .End
.LessThan120:
cmp r1, #0
beq .Difference0
@; Menor de 120
mov r0, #1
ldr r1, =divfreq_vmax
ldrh r1, [r1]
bl activar_timer
ldr r2, =REG_TEL
ldrb r3, [r2]
orr r3, #0x20 @; 0b0010 0000
strb r3, [r2]
b .End
.Difference0:
ldr r3, =track
mov r4, #1
strb r4, [r3]
mov r0, #1
ldr r1, =divfreq_vmin
ldrh r1, [r1]
bl activar_timer
b .End
.NotSeeking:
mov r0, #1
ldr r1, =divfreq_vmin
ldrh r1, [r1]
bl activar_timer
ldr r2, =REG_TEL
ldrb r3, [r2]
orr r3, #0x20 @; 0b0010 0000
strb r3, [r2]
.End:
ldr r3, =ra_actual
ldr r4, [r4]
@; circ_sub r1 = 1 o bvien r1 = -1
@; depende de giro grueso o fino o r3 120 o 1
@; mul r5, r1, r3
@; add r4, r5
pop {r0 - r5, pc}