📄 ecp_userinput.lst
字号:
; Save Regs
214 000154 0512 push R5
215 000156 0612 push R6
216 000158 5440.... mov.b ButtonIndex, R4
; Get
the
index
217 00015C 3540.... mov #ButtonData, R5
; Get
the
array
218 000160 0554 add R4,R5
; Address
array[index]
219 000162 D54234000000 mov.b &P6IN,0(R5)
; Get the
port 6 state
220 000168 2492 cmp #0x04,R4
; Index = 4?
221 00016A 0324 jeq RstButtonIndex
; Yep, go back to 0
222 00016C D053.... add.b #0x01,ButtonIndex
; Increment Index
223 000170 023C jmp ButtonContinue
; Keep going
224 000172 C043.... RstButtonIndex mov.b #0x00,ButtonIndex
; Reset Index to 0
225 000176 7643 ButtonContinue mov.b #0xFF, R6
; R6 = j
226 000178 0443 mov #0x00, R4
; Get the index
227 00017A 3540.... mov #ButtonData, R5
; Get
the
array
228 00017E 66F5 DebounceLoop and.b 0(R5),R6
; AND
array[index]
229 000180 1553 add #0x01,R5
; Increment the index
230 000182 5453 add.b #0x01,R4
; Count loops
231 000184 74900500 cmp.b #0x05,R4
; 5 loops?
232 000188 0124 jeq ButtonContinue2
; Done?
233 00018A F93F jmp DebounceLoop
234 00018C 76F0F800 ButtonContinue2 and.b #SW10+SW11+SW12+SW13+SW1
4,R6 ; Mask switches
235 000190 C046.... mov.b R6, DebouncedButtonState
; Save the
switch state
236 000194 7690F800 cmp.b #SW10+SW11+SW12+SW13+SW1
4,R6 ; Any switch pushed?
237 000198 1824 jeq ButtonExit2
238 00019A 4446 mov.b R6,R4
; Prepare to
send code
239 00019C 34F0FF00 and #0x00FF,R4
; Upper bits are zero
240 0001A0 C093.... cmp.b #0x00,ButtonRepeatCnt
; Time to send code?
241 0001A4 0520 jne CountButtonRepeat
; No
242 0001A6 D053.... inc.b ButtonRepeatCnt
; Increment count
243 0001AA B012.... call #PushInputEvent
; Push onto event stack
244 0001AE 093C jmp ButtonExit1
245 0001B0 D053.... CountButtonRepeat inc.b ButtonRepeatCnt
; Increment count
246 0001B4 F0901400.... cmp.b #20,ButtonRepeatCnt
; 20 counts?
247 0001BA 0124 jeq ClearRepeatCnt
; yes
248 0001BC 023C jmp ButtonExit1
249 0001BE C043.... ClearRepeatCnt mov.b #0x00,ButtonRepeatCnt
; Clear the counter
250 0001C2 3641 ButtonExit1 pop R6
; Restore Regs
251 0001C4 3541 pop R5
252 0001C6 3441 pop R4
253 0001C8 0013 reti
254 0001CA C043.... ButtonExit2 mov.b #0x00,ButtonRepeatCnt
; Reset button repeat
255 0001CE
; count
256 0001CE 3641 pop R6
; Restore regs
257 0001D0 3541 pop R5
258 0001D2 3441 pop R4
259 0001D4 0013 reti
260 0001D6
261 0001D6 ; **********************************************
******************************
262 0001D6 ; Function: PushInputEvent
263 0001D6 ;
264 0001D6 ; Purpose: Pushes an input event into the user
event cue.
265 0001D6 ;
266 0001D6 ; Inputs: R4 - Input event code, 16 bit
267 0001D6 ;
268 0001D6 ; Returns: None
269 0001D6 ; **********************************************
******************************
270 0001D6 0512 PushInputEvent push R5
; Save Regs
271 0001D8 0612 push R6
272 0001DA 1540.... mov IRReadIndex,R5
; Get
the read
index
273 0001DE 1640.... mov IRWriteIndex,R6
; Get
the write
index
274 0001E2 2653 add #0x0002,R6
; Add 2 to write index
275 0001E4 36F03F00 and #0x003F,R6
; Indexes are 6 bits
276 0001E8 0695 cmp R5,R6
; Compare read
and next
277 0001EA
; write index
278 0001EA 1624 jeq IRBUFFOVERRUN
; Out of buffer space,
279 0001EC
; IR overrun
280 0001EC 3540.... mov #IRBuffer,R5
;
Pointer in
R5
281 0001F0 1550.... add IRWriteIndex,R5
; Add
the write
index
282 0001F4 85440000 mov R4,0(R5)
; Store to
buffer
283 0001F8 1540.... mov IRWriteIndex,R5
; Get
the write
index
284 0001FC 2553 add #0x0002,R5
; Increment the index
285 0001FE 35F03F00 and #0x003F,R5
; Index is 6 bits
286 000202 8045.... mov R5,IRWriteIndex
; Save the
index
287 000206 55423000 mov.b &P5IN,R5
; Read in
port 5
288 00020A 75C02000 bic.b #MSP430_INT,R5
; Set the IR Event Flag
289 00020E C2453100 mov.b R5,&P5OUT
; Write out
port 5
290 000212 3641 pop R6
; Restore Regs
291 000214 3541 pop R5
292 000216 3041 ret
293 000218 F0D2.... IRBUFFOVERRUN bis.b #ECP_IR_OVERRUN,ECPStatu
s ; Indicate overrun
294 00021C 3641 pop R6
; Restore Regs
295 00021E 3541 pop R5
296 000220 3041 ret
297 000222
298 000222 END
##############################
# CRC:C78F #
# Errors: 0 #
# Warnings: 0 #
# Bytes: 552 #
##############################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -