;;==============================================================================
;; Power On Reset Area
;;==============================================================================
Reset:
LDX #FFH
TXS
LDA #%01000000
STA R_IntFlags
%WakeUpBranch L_KeyWakeUp
lda #00
ldx #80H
%ClearAllRAM
%SetAudioMode
%Channel1PowerUpInitial
;%IoPowerUpInitial
%TimerPowerUpInitial
%SentencePowerOnInitial
.IF WaveTableMode
%MelodyPowerUpInitial
.ENDIF
.IF VOL_CTRL ;{
lda #04
jsr F_SetVolCh1
.ENDIF
JMP L_Start
;;==============================================================================
;; Key Wakeup Area
;;==============================================================================
L_KeyWakeUp:
; ldx #00
;L_Lop?:
; dex
; bne L_Lop?
%SetAudioMode
;%IoWakeUpInitial
%Channel1WakeUpInitial
.IF WaveTableMode
%MelodyWakeUpInitial
.ENDIF
L_Start:
LDA #%00000110
STA R_IntFlags ;;;;;;;;暂时变量
STA P_0DH_INT
CLI
;;==============================================================================
;; 变量赋值
;;==============================================================================
LDA#0
STAR_daochealltime
STAR_zhuozhuanalltime
STAR_youzhuanalltime
LDA#0
STAR_qidongover
STA R_IoBuffer
STAR_PressCount
LDA #0
STA R_BufferCount
LDA#1
STAR_Playingjiashu01
STAR_Playingjiashu02
LDA#0
STAR_jiashu01over
STAR_jiashu01alltime
STAR_jiashu02over
STAR_jiashu02alltime
STAR_daoche_Flag
LDA#100
STAR_DownweidengCount
;;==============================================================================
;;设置Point C,D状况
;;I/O_D全为下拉电阻
;;I/O_C 0,1,2,3为输出且为低电平
;;==============================================================================
LDA#%00000000
STAP_03H_IOD_Ctrl
LDA#%00000000
STAP_04H_IOD_Data
LDA#%00010000
STAP_00H_IOBC_Ctrl
LDA #%00000000
STAP_0EH_IOC_Buffer
;;==============================================================================
;;DetectKey_Press 主循环
;;检测触发按键
;;==============================================================================
DetectKey_Press:
LDAP_04H_IOD_Data
STAR_IOD_Buffer
;;发动
LDAR_IOD_Buffer
AND#%10000000
BEQnextA
JSRPlay_qidong
nextA:
;;喇叭
LDAR_IOD_Buffer
AND#%00100000
BNEnextlaba
nextone:
LDA#0
STAR_laba_Flag
JMPnextend
nextlaba:
LDAR_laba_Flag
BNEnextend
LDA#1
STAR_laba_Flag
JSRPlay_laba
nextend:
;;左转
LDAR_IOD_Buffer
AND#%00001000
BEQnextB
JSRFlash_zhuo
nextB:
LDAR_IOD_Buffer
AND#%00001000
BNEnextC
LDA#0
STAR_zhuozhuancount
JSRLed_zhuoDown
nextC:
;;右转
LDAR_IOD_Buffer
AND#%00010000
BEQnextD
JSRFlash_you
nextD:
LDAR_IOD_Buffer
AND#%00010000
BNEnextE
LDA#0
STAR_youzhuancount
JSRLed_youDown
nextE:
;;倒车
LDAR_IOD_Buffer
AND#%00000100
BEQnextF
JSRPlay_daoche
nextF:
LDAR_IOD_Buffer
AND#%00000100
BNEnextG
LDA#0
STAR_daochecount
LDAR_daoche_Flag
BEQnextG
JSRLed_weidengDown
LDA#0
STAR_daoche_Flag
nextG:
;;加快01
LDAR_IOD_Buffer
AND#%00000001
BEQtryB
JSRPlay_jiashu01
LDA#1
STAR_jiashu01over
tryB:
LDAR_jiashu01over
CMP#1
BNEtryx
JSRPlay_jiashu01B
tryx:
LDAR_IOD_Buffer
AND#%00000001
BNEtryZ
LDA#0
STAR_jiashu01alltime
LDAR_jiashu01over
CMP#1
BNEtryZ
JSRPlay_shache
LDA#0
STAR_jiashu01over
tryZ:
LDAR_Downweideng_Flag
CMP#1
BNEDownnext
LDAR_DownweidengCount
BNEDownnext
JSRLed_weidengDown
LDA#0
STAR_Downweideng_Flag
Downnext:
;;加快02
LDAR_IOD_Buffer
AND#%00000010
BEQtryBA
JSRPlay_jiashu02
LDA#1
STAR_jiashu02over
tryBA:
LDAR_jiashu02over
CMP#1
BNEtryBX
JSRPlay_jiashu02B
tryBX:
LDAR_IOD_Buffer
AND#%00000010
BNEtryBZ
LDA#0
STAR_jiashu02alltime
LDAR_jiashu02over
CMP#1
BNEtryBZ
JSRPlay_shache
LDA#0
STAR_jiashu02over
tryBZ:
;;大灯
LDAR_IOD_Buffer
AND#%01000000
BNEelse?
if?:
LDA#0
STAR_PressCount
JMPendif?
else?:
LDAR_PressCount
BNEendif?
LDA#1
STAR_PressCount
JSRLed_dadeng
endif?:
;;空车
LDAR_qidongover
CMP#1
BNEnext?
JSRPlay_kongche
next?:
;;循环延时
LDA#3
STAR_BufferCount
Count:
LDAR_BufferCount
BNECount
JMPDetectKey_Press
;;==============================================================================
;; IRQ Area
;;==============================================================================
Irq:
STA R_IntTempA
STY R_IntTempY
LDA P_0DH_INT
STA R_IntTmp
EOR #%00111111
STA P_0DH_INT
LDA R_IntFlags
STA P_0DH_INT
LDA R_IntTmp
AND #%00100000 ;TimerA interrupt
BNE V_TimerAInt
JMP L_CheckTimerBInt
声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/xinpin/jishu/260223.html