-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrows.asm
More file actions
319 lines (251 loc) · 6.63 KB
/
arrows.asm
File metadata and controls
319 lines (251 loc) · 6.63 KB
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
;copyright 2004 by Samuel Stearley
;This file has the code that responds to the arrows.
;----See if a unit menu is needed it checks here in this file if the
;----current app is the home app.
ifd ti89
cmp.w #4147,d0
beq DefinitelyUnitMenu
endc
ifd ti92plus
cmp.w #8272,d0
beq DefinitelyUnitMenu
endc
btst.w #11,8(a2)
sne d4 ;will indicate if arrow is auto repeated
;----If the menu is visible then it will respond differently------
move.b menuIndic(pc),d1
bne VisibleSoHandleKeys
;----2nd + up response is the up-directory-----------------------
ifd ti89
cmp.w #4433,d0
endc
ifd ti92plus
cmp.w #4434,d0
endc
bne NotUpDirectory
;----Now set main as the current directory-----------
clr.w -(a7)
pea mainEnd(pc)
move.l 404(a6),a0
jsr (a0) ;set folder call
checkTrashing 'F'
pea main+1(pc)
move.l 912(a6),a0
jsr (a0) ;change status line stuff
checkTrashing 'G'
move.w #$700,(a2)
lea 10(a7),a7
bra PassItOn
;----Maybe an instant menu of current variables------
NotUpDirectory:
ifd ti89
cmp.w #340,d0
endc
ifd ti92plus
cmp.w #344,d0
endc
bne MaybeSystemVariables
;----Check if it is an auto repeated arrow, if it is then do not give a menu-----
move.w #$700,(a2) ;make into cm_idle
tst.b d4
bne PassItOn
;----Make a menu of only variables---------
bsr AllocateMem
move.l ptr(pc),a3
lea title(pc),a0
lea onlyVariablesTitle(pc),a1
move.l a1,(a0) ;title of the menu
lea folderWasCompleted(pc),a0
st.b (a0)
; lea charBuffer(pc),a0
; move.w #$0100,(a0) ;string to search for (let everything in)
moveq #NUMBER_OF_MATCHES,d0
; lea charBufferIndex(pc),a0
; clr.w (a0)
bra SearchAndDisplay
;----Maybe a menu of system variables--------
MaybeSystemVariables:
ifd ti89
cmp.w #4436,d0
endc
ifd ti92plus
cmp.w #4440,d0
endc
bne NotVisibleSoIgnoreRemainingKeys
;----Do menu of only system variables------
move.w #$700,(a2) ;make into cm_idle
lea pageIndic(pc),a0
st.b (a0)
; lea charBuffer(pc),a0
; move.w #$0100,(a0) ;string to search for (let everything in)
; lea charBufferIndex(pc),a0
; clr.w (a0)
bra NewMenu
;----Normall scrolling operations of the menu
;----see if the up or down arrows were pressed
VisibleSoHandleKeys:
moveq #20,d2 ;increment or decrement
move.w #$700,d3 ;idle event
lea listBufferIndex(pc),a0 ;get pointer to the value to be modified
move.w (a0),d1
ifd ti89
cmp.w #337,d0 ;up
beq.s ScrollUp
cmp.w #340,d0 ;down
bne.s NotVerticalArrows
endc
ifd ti92plus
cmp.w #338,d0 ;up
beq.s ScrollUp
cmp.w #344,d0 ;down
bne.s NotVerticalArrows
endc
;----Code to scroll down----------------
move.w d3,(a2)
move.l ptr(pc),a1
tst.l 20(a1,d1) ;is the first adress of the next page a zero?
bne CanScroll
tst.w d1 ;are we already on the first page
beq CanNotScroll
tst.b d4
bne PassItOn
move.w d2,d1
neg.w d1 ;so when it adds it become zero
CanScroll:
add.w d2,d1
move.w d1,(a0)
bra ReDoMenuNoClearing
;----Code to scroll up------------------
ScrollUp:
move.w d3,(a2)
tst.w d1
bne ScrollNormal ;are we on the first page?
move.l ptr(pc),a1
tst.l 0(a1,d2) ;is there a second page?
beq CanNotScroll
;---find lowest page----
tst.b d4
bne PassItOn
KeepGoing
add.w d2,d1
tst.l 0(a1,d1)
bne KeepGoing
ScrollNormal
sub.w d2,d1
move.w d1,(a0)
bra ReDoMenuNoClearing
;----If it is a unit menu, then the right and left keys are enabled to change
;----the types of units that the user wants.
NotVerticalArrows:
move.b shortcutTableInView(pc),d1
bne NothingElseMatters
lea right(pc),a4
lea charBuffer(pc),a1
move.b unitIndic(pc),d1
beq.s NotAUnitMenu
;----right and left arrow code for the units------
moveq #2,d1 ;increment
lea autoUnitScrollDirection(pc),a1
clr.b (a1)
lea offsetTableIndex(pc),a0
move.w (a0),d2
cmp.w 2(a4),d0 ;2nd + right?
beq.s ScrollMuchRight
cmp.w 4(a4),d0 ;left?
beq.s ScrollLeft
cmp.w (a4),d0 ;right?
bne NotHorizontalArrows
;----code to scroll right---------------
move.w d3,(a2) ;make it command idle
cmp.w #NUMBER_OF_UNIT_MENUS,d2
bne.s NoWrapToLeftSide
tst.b d4
bne PassItOn
moveq #-2,d2
NoWrapToLeftSide:
add.w d1,d2
move.w d2,(a0)
bra NewUnitMenu
;----code to scroll left---------------
ScrollLeft:
move.w d3,(a2)
sub.w d1,d2
bcc.s NoWrapToRightSide
tst.b d4
bne PassItOn
moveq #NUMBER_OF_UNIT_MENUS,d2
NoWrapToRightSide:
move.w d2,(a0)
st.b (a1)
bra NewUnitMenu
;----code to scroll much right-----------
ScrollMuchRight:
move.w d3,(a2)
add.w #14,d2
cmp.w #NUMBER_OF_UNIT_MENUS+2,d2
bcs.s SkipWrapping2
sub.w #NUMBER_OF_UNIT_MENUS+2,d2
SkipWrapping2:
move.w d2,(a0)
bra NewUnitMenu
NotAUnitMenu:
;----Handle arrows without units This will cause only the folders and
;----variable names to be depicted
move.b folderWasCompleted(pc),d1
or.b flashAppIndic(pc),d1
cmp.w 4(a4),d0 ;left?
beq.s ScrollLeft2
cmp.w (a4),d0 ;right?
bne NotHorizontalArrows
;---Code to make it display only the variables and folders Right arrow was pressed
move.w d3,(a2)
tst.b d1 ;Deny displaying folders and variables
bne PassItOn ; if already displaying files in an auto
; completed folder.
lea pageIndic(pc),a0
move.b (a0),d0
subq.b #1,d0
beq PassItOn
bcs FoldersAndVariables
addq.b #1,(a0) ;system variables to normal
bra NewMenu
FoldersAndVariables:
addq.b #1,(a0)
lea variableTitle(pc),a0
lea title(pc),a3 ;we get a new title
move.l a0,(a3)
move.b listIsFull(pc),d0
beq OnlyVariables ;reset the pointer list and search only through
;the variable lists
move.b foldersAndVarsIndic(pc),d0
beq OnlyVariables
move.l ptr(pc),a0
move.l a0,a3
moveq #NUMBER_OF_MATCHES,d0
move.l #$40000000,d1
FindFirstVar
cmp.l (a0)+,d1
bcc FindFirstVar
subq.l #4,a0
CopyLower:
move.l (a0)+,(a3)+
dbeq d0,CopyLower
lea listBufferIndex(pc),a0 ;get scrolling variable
clr.w (a0)
bra DoVisuals
;---Code to make it display the commands again Left arrow was pressed----
ScrollLeft2:
move.w d3,(a2)
tst.w d1
bne PassItOn ;are we in an autocompleted folder?
lea pageIndic(pc),a0
tst.b (a0)
bmi PassItOn ;are we on system var page?
subq.b #1,(a0)
lea oneThingAllowed(pc),a0
st.b (a0)
bra IncludeAll
NotHorizontalArrows:
NothingElseMatters:
;---After this file program execution flows into the code for the funtion keys
;---in complete.asm