📄 main.lst
字号:
;Disable COP
264
E0C0 [05] CDE040 265 JSR Init_Vars
;Initialize RAM variables
E0C3 [04] ADCB 266 BSR Init_Ports
;Initialize I/O
E0C5 [04] ADC0 267 BSR Init_ICG
;Initialize external crystal
E0C7 [04] ADB5 268 BSR Init_KBD
;Initialize keyboard interrupts
E0C9 [04] ADE2 269 BSR Init_Timer
;Initialize the timer
E0CB [04] ADCF 270 BSR Init_SCI
;Initialize the SCI
E0CD [04] ADD7 271 BSR Init_TBM
;Initialize timebase module
272
E0CF [01] 4F 273 CLRA
E0D0 [01] 8C 274 CLRH
E0D1 [01] 5F 275 CLRX
E0D2 [04] 81 276 RTS
E0D3 277 $Include 'LEDCont.asm'
278 * LEDCont.asm
279
280 ****************************************************
******************
281 * Contains the controls for all the LEDs.
*
282 * PTA[0] = RX
*
283 * PTB[0] = LF
*
284 * PTB[1] = LR
Main.asm Assembled with CASM08Z 3/12/2003 10:12:03 AM PAGE 8
*
285 * PTB[2] = RR
*
286 * PTB[3] = RF
*
287 ****************************************************
******************
288
E0D3 [03] B601 289 BlinkLEDs: LDA PTB
;Flash the LEDs to indicate to the user
E0D5 [02] AA0F 290 ORA #%00001111
;that the module is on, and the Romeo2 is
E0D7 [03] B701 291 STA PTB
;configured properly.
E0D9 [04] 1000 292 BSET 0,PTA
E0DB [02] AEFF 293 LDX #$FF
E0DD [05] CDE2B4 294 JSR Delay
295
E0E0 [03] B601 296 LDA PTB
E0E2 [02] A4F0 297 AND #%11110000
E0E4 [03] B701 298 STA PTB
E0E6 [04] 1100 299 BCLR 0,PTA
E0E8 [04] 81 300 RTS
301
E0E9 [03] B601 302 TurnOnLEDs: LDA PTB
;Turn on all LEDs to indicate to the user
E0EB [02] AA0F 303 ORA #%00001111
;that there's a problem with the module.
E0ED [03] B701 304 STA PTB
;Code is still running to try to recover,
E0EF [04] 1000 305 BSET 0,PTA
;but if the LEDs stay on persistently then
E0F1 [04] 81 306 RTS
;there's probably a bad connection to Romeo.
307
E0F2 [02] AE10 308 LED_Flicker: LDX #$10
E0F4 [01] 4F 309 L0: CLRA
;The Rx LED will flicker to indicate that
310
;something was received, but the checksum
E0F5 [04] 1000 311 BSET 0,PTA
;did not match so the data is not processed.
E0F7 [03] 4BFE 312 DBNZA *
E0F9 [04] 1100 313 BCLR 0,PTA
E0FB [03] 4BFE 314 DBNZA *
E0FD [03] 5BF5 315 DBNZX L0
E0FF [03] B65B 316 LDA FAST_MODE
E101 [03] 2702 317 BEQ Flick_Done
E103 [04] 1000 318 BSET 0,PTA
E105 [04] 81 319 Flick_Done: RTS
320
E106 [03] B65B 321 Blink_Rx: LDA FAST_MODE
E108 [03] 2704 322 BEQ Blink
E10A [04] 1000 323 BSET 0,PTA
E10C [03] 2009 324 BRA DoneBlink
325
E10E [02] AE20 326 Blink: LDX #$20
;The Rx LED will blink once to indicate that
Main.asm Assembled with CASM08Z 3/12/2003 10:12:03 AM PAGE 9
E110 [04] 1000 327 BSET 0,PTA
;good data was received.
E112 [05] CDE2B4 328 JSR Delay
E115 [04] 1100 329 BCLR 0,PTA
E117 [04] 81 330 DoneBlink: RTS
331
332 ****************************************************
******************
333 * ProcessData
*
334 * Process the (already confirmed valid) data frame,
and send tire *
335 * status, position and data to the user.
*
336 * DATA + 7: ID1
*
337 * DATA + 6: ID2
*
338 * DATA + 5: ID3
*
339 * DATA + 4: ID4
*
340 * DATA + 3: PRESSURE
*
341 * DATA + 2: TEMPERATURE
*
342 * DATA + 1: STATUS (bit 7=LVIOUT, bit 6=LOWV, bit
4=FastTx) *
343 * DATA + 0: CHECKSUM
*
344 * PTB[0] = LF
*
345 * PTB[1] = LR
*
346 * PTB[2] = RR
*
347 * PTB[3] = RF
*
348 *
*
349 * Position is stored in the STATUS byte (DATA + 1)
for the device *
350 * receiving the serial data.
*
351 * STATUS[3] high -> LF
*
352 * STATUS[2] high -> RF
*
353 * STATUS[1] high -> LR
*
354 * STATUS[0] high -> RR
*
355 ****************************************************
******************
E118 [03] B64A 356 ProcessData: LDA DATA+1
E11A [03] 2702 357 BEQ FindPos
E11C [04] 1E5B 358 BSET 7,FAST_MODE
;Flag that this tire is in fast mode.
Main.asm Assembled with CASM08Z 3/12/2003 10:12:03 AM PAGE 10
359
E11E [03] B650 360 FindPos: LDA DATA+7
;Check all tire ID bytes.
E120 [03] B163 361 CMP LFID
E122 [03] 2634 362 BNE L1
E124 [03] B64F 363 LDA DATA+6
E126 [03] B164 364 CMP LFID+1
E128 [03] 262E 365 BNE L1
E12A [03] B64E 366 LDA DATA+5
E12C [03] B165 367 CMP LFID+2
E12E [03] 2628 368 BNE L1
E130 [03] B64D 369 LDA DATA+4
E132 [03] B166 370 CMP LFID+3
E134 [03] 2622 371 BNE L1
372
E136 [03] 3F52 373 LF_Match: CLR LFCNTL
E138 [03] 3F51 374 CLR LFCNTH
E13A [04] 164A 375 BSET 3,DATA+1
;Indicate which tire in STATUS
E13C [05] CDE106 376 JSR Blink_Rx
;Blink the Rx LED.
E13F [05] 0F5B04 377 BRCLR 7,FAST_MODE,LF
E142 [04] 105B 378 BSET 0,FAST_MODE
;Flag that the LF tire is in fast mode.
E144 [03] 2002 379 BRA LF1
380
E146 [04] 115B 381 LF: BCLR 0,FAST_MODE
E148 [03] B64C 382 LF1: LDA DATA+3
;Check the pressure
E14A [03] B162 383 CMP THRESHOLD
E14C [03] 2205 384 BHI LF_OK
E14E [04] 1001 385 BSET 0,PTB
;Pressure low: light LED.
E150 [03] CCE1FE 386 JMP EXIT
E153 [04] 1101 387 LF_OK: BCLR 0,PTB
;Pressure okay: clear LED.
E155 [03] CCE1FE 388 JMP EXIT
389
E158 [03] B650 390 L1: LDA DATA+7
;Check all tire ID bytes.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -