📄 amy.asm
字号:
bsf flag4,z1_jis
goto process_ok
k714
btfss flag4,z2
goto process_ok
bsf flag4,xcjs_x
movlw T500MS ;wu 6ah
movwf xc_counter1
clrf xc_counter2
goto process_ok
k73
movlw 3
subwf qujian,w
btfss status,z
goto process_ok
bsf flag4,z3
btfss flag3,sx
goto k731
bcf flag3,sx
bcf flag3,xx
bsf flag3,xxhx
goto process_ok
k731 btfsc portb,4
goto k732
bsf flag3,xx
goto process_ok
k732
bsf flag3,sx
bsf flag6,z3_jis
goto process_ok
;---------------------------------
k8 ;quan sheng
movlw 24h
subwf key_buffer,w
btfss status,z
goto k9
btfss flag2,auto
goto k8a
bcf flag2,auto ;wu
movlw 83h
andwf flag7,f ;wu
bcf flag4,qs
k8a
bsf flag2,x_on
bsf fsr,4
bsf fsr,5
bcf fsr,6
clrf 31
clrf 34
clrf 36
movlw T500MS
movwf 30
movwf 33
movwf 35
clrf fsr
bcf flag4,z1
bcf flag4,z2
bcf flag4,z3
bcf flag4,xcjs_s
bcf flag4,xcjs_x
bcf flag4,z1_jis
bcf flag2,z2_ds
bcf flag5,z2_dx
clrf flag6
clrf qujian
btfsc flag2,auto
goto k81 ;auto jie yong
btfss flag4,qs
goto k81
goto xz_stop
;(wu) bcf flag4,qs
; bcf flag3,sx
; bcf flag3,xx
; bcf flag2,x_on;(wu) flag3,x_on
; bcf status,5
; bsf status,6
; goto stop
k81 bsf flag4,qs
;;wu bsf flag1,qd
btfsc flag3,xx
goto k811
btfsc portb,3
goto k812
bsf flag3,sx
goto process_ok
k811 bsf flag3,xshx
bcf flag3,xx
goto process_ok
k812
bsf flag3,xx
bsf flag4,xcjs_x
movlw T500MS ;wu 6ah
movwf xc_counter1
clrf xc_counter2
goto process_ok
;--------------------------------------
k9 ;xiao tui
movlw 18h
subwf key_buffer,w
btfss status,z
goto k10
btfss flag2,xiaotui
goto k91
bcf flag2,xiaotui
goto process_ok
k91 bsf flag2,xiaotui
bsf flag1,qd
movlw d'155' ;0-----50-----155-----205------255
movwf tui_timer ;on/off on/on off/on off/off
bsf porta,2
goto process_ok
;--------------------------------------
k10 ;da tui
movlw 28
subwf key_buffer,w
btfss status,z
goto no_key_down;process_ok
btfss flag2,datui
goto k101
bcf flag2,datui
goto process_ok
k101
bsf flag2,datui
bsf flag1,qd
;0-----50-----155-----205------255
clrf tui_timer ;on/off on/on off/on off/off
bcf porta,2
goto process_ok
;+++++++++++++++++++++++++++++++++++++++
process_ok
bcf status,5
goto auto_mode
;; goto check_end_position
;++++++++++++++++++++++++++++++++++++
org 400
;++++++++++++++++++++++++++++++++++++
;auto_chang
delay_fw ;(wu)
clrf temp1
loop_f1
clrf temp2
loop_f2 nop
nop
incfsz temp2,f
goto loop_f2
clrwdt
incfsz temp1,f
goto loop_f1
retlw 0
;-------------------------------
auto_mode_x
movlw mode_ct
movwf fsr
movf indf,w
addwf indf,f
btfss indf,4
goto ak30
movlw b'00000010'
movwf indf
ak30 movf indf,w
clrf fsr
movwf mode
goto auto_mode_set
auto_mode_c
movlw mode_ct
movwf fsr
movf indf,w
clrf fsr
movwf mode
auto_mode_set
ak31 btfss mode,1 ;mode2/mode3-->mode1
goto ak32
bsf flag3,rzhx
;; bcf flag3,rz
bcf flag3,rf
goto auto_ok
ak32 ;mode1/mode3-->mode2
btfss mode,2
goto ak33
w_change
btfsc flag3,rzhx
goto auto_ok
bsf flag3,rzhx
bcf flag3,rz
bcf flag3,rf
bsf flag7,jcqq1
btfsc flag7,a_pause
goto w_c1
btfsc flag7,a_jingbu
goto auto_ok
w_c1 btfss flag5,kuan ;wu~
goto ak321
bcf flag5,kuan
bsf flag5,zhong
goto auto_ok
ak321 btfss flag5,zhong
goto ak322
bcf flag5,zhong
bsf flag5,zhai
goto auto_ok
ak322 bcf flag5,zhai
bsf flag5,kuan
goto auto_ok ;wu
ak33 ;mode1/mode2-->mode3
btfss mode,3
goto auto_ok
btfss flag3,rf
goto ak34
bcf flag3,rf
goto auto_ok
ak34
bsf flag3,rz
bsf flag7,jcqq
auto_ok
;-------------------------------
check_end_position
clrf fsr
btfss flag2,end_position
goto check_e
btfsc flag5,dwxy
goto e_up
btfss flag1,end_key_time
goto rnyx
bsf flag5,dwxy
btfss flag5,sxw
goto e2
btfss portb,3
goto no_end
bsf flag3,xxhx
bcf flag3,xx
bcf flag3,sx
movlw T500MS ;wu 6ah
movwf xc_counter1
clrf xc_counter2
goto rnyx
e2
btfss flag5,xxw
goto no_end
btfss portb,4
goto no_end
bsf flag3,xshx
bcf flag3,sx
bcf flag3,xx
goto rnyx
check_e
btfss portb,3 ;if portb.3=1,then shang xianwei dao
goto check_e1
bsf flag2,end_position
bcf flag5,xxw
bsf flag5,sxw
goto rnyx
check_e1 btfss portb,4
goto rnyx
bsf flag2,end_position
bcf flag5,sxw
bsf flag5,xxw
goto rnyx
up
no_end
bcf flag2,end_position
bcf flag5,dwxy
bcf flag5,sxw
bcf flag5,xxw
bcf flag1,end_key_time
goto rnyx
e_up
btfss flag5,sxw
goto e_up1
btfss portb,3
goto up
goto rnyx
e_up1
btfss flag5,xxw
goto rnyx
btfss portb,4
goto up
; goto rnyx
;up
; bcf flag2,end_position
; bcf flag5,dwxy
; bcf flag1,end_key_time
; bcf flag5,xxw
; bcf flag5,sxw
;========================================
rnyx ;rou nie dianji yunxing
clrf fsr
btfss flag7,jcqq
goto yx
btfsc flag1,jc_timer
goto w11
btfsc flag5,zhai
goto width1
btfsc flag5,zhong
goto width2
btfss flag5,kuan
goto yx
width3 btfss portb,6
goto w11
goto yx
width1 btfss portb,5
goto w11
goto yx
width2 btfsc portb,7
;; goto w11
goto yx
w11 bcf flag1,jc_timer
bcf flag7,jcqq
btfss mode,2
goto w12
bsf flag3,rfhx
bcf flag3,rz
bcf flag3,rf
goto yx
w12
btfss mode,3
goto yx
bcf flag3,rf
bcf flag3,rz
; goto yx
yx
btfss flag3,rz
goto yx1
bsf portb,1
bcf portb,2
goto xzyx
yx1 btfss flag3,rf
goto yx2
bsf portb,2
bcf portb,1
goto xzyx
yx2 bsf portb,2
bsf portb,1
goto xzyx
;======================================
xzyx
;; btfss flag2,auto ;wu
;; goto yx1
btfsc flag7,a_pause
goto xy3 ;wu
xy1
btfss flag3,sx
goto xy2
bcf portb,0
bsf porta,3 ;zheng zhuan
goto dianjiyx
xy2 btfss flag3,xx
goto xy3
bcf porta,3
bsf portb,0 ;fan zhuan
goto dianjiyx
xy3 bsf porta,3
bsf portb,0 ;ting
;; goto dianjiyx
;===================================
; 0-----50-----155-----205------255
; on/off on/on off/on off/off
dianjiyx
btfss flag2,datui
bcf porta,1
btfss flag2,datui
goto dy1
movlw d'155'
subwf tui_timer,w
btfss status,c
bsf porta,1
btfsc status,c
bcf porta,1
dy1 btfss flag2,xiaotui
bcf porta,2
btfss flag2,xiaotui
goto beiguang
movlw d'50'
xorwf tui_timer,w
btfsc status,z
bsf porta,2
movlw d'205'
xorwf tui_timer,w
btfsc status,z
bcf porta,2
;; goto beiguang
;----------------------------------
beiguang
btfss flag5,beig
goto bei1
btfss flag1,qd ;wu
goto bei1
bcf porta,0
goto qujian_dspl
bei1 bsf porta,0
;*********************************
;display ram update.
;--------------------
qujian_dspl
btfsc flag1,qd
goto quj_ds1
bsf status,5
bsf status,6
goto turn
quj_ds1
clrf fsr
btfsc flag4,z1
goto z1_dspl
btfsc flag4,z2
goto z2_dspl
btfsc flag4,z3
goto z3_dspl
goto nz_dspl
z1_dspl
movlw 79h ;70 danyuan wei qujian zhi shi
movwf fsr
movlw 3 ;`00000011`
movwf indf
goto qujian_dspl1
z2_dspl
movlw 79h
movwf fsr
movlw 5 ;`00000101`
movwf indf
goto qujian_dspl1
z3_dspl
movlw 79h
movwf fsr
movlw 9 ;`00001001`
movwf indf
goto qujian_dspl1
nz_dspl
movlw 79h
movwf fsr
movlw 0
movwf indf
;-----------------------------
qujian_dspl1 ;quansheng qu jian he zhi ding yu qu jian
clrf fsr
btfsc flag4,qs
goto qs_ram
btfsc flag4,self_de
goto self_de_ram
goto no_q_s
qs_ram
movlw 78h
movwf fsr
movlw 1 ;quan shen qu jian
movwf indf
goto width_ram
self_de_ram
movlw 78h
movwf fsr
movlw 2
movwf indf
goto width_ram
no_q_s
movlw 78h
movwf fsr
movlw 0
movwf indf
;----------------------------------
width_ram
movlw 77h
movwf fsr
btfsc flag5,kuan
bsf indf,0
btfss flag5,kuan ;
bcf indf,0
btfsc flag5,zhong
bsf indf,1
btfss flag5,zhong
bcf indf,1
btfsc flag5,zhai
bsf indf,2
btfss flag5,zhai
bcf indf,2
;----------------------------------
mode_ram
clrf fsr
;; movlw 1
;; subwf mode,w
btfsc mode,1 ;status,z
goto mode1_ram
;; movlw 2
;; subwf mode,w
btfsc mode,2 ;status,z
goto mode2_ram
;; movlw 3
;; subwf mode,w
btfsc mode,3 ;status,z
goto mode3_ram
goto no_mode_ram
mode1_ram
movlw 76h
movwf fsr
movlw 1
movwf indf
movlw 77h ;wu
movwf fsr
bcf indf,0
bcf indf,1
bcf indf,2 ;wu
goto sax_ram
mode2_ram
movlw 76h
movwf fsr
movlw 2
movwf indf
goto sax_ram
mode3_ram
movlw 76h
movwf fsr
movlw 4
movwf indf
goto sax_ram
no_mode_ram
movlw 76h
movwf fsr
movlw 0
movwf indf
;-------------------------------
sax_ram ;shang xing he xia xing ram
movlw 75h
movwf fsr
clrf indf
btfsc flag3,sx
bsf indf,0
btfss flag3,sx
bcf indf,0
btfsc flag3,xx
bsf indf,1
btfss flag3,xx
bcf indf,1
;-------------------------------
time_ram
clrf fsr
btfss flag1,qd
goto jindu_ram ;wu no_t
movf ds_counter2,w ;wu f
btfsc status,z
goto t1_ram
movlw 8 ;2
subwf ds_counter2,w
btfsc status,z
goto t15_ram
movlw d'12' ;3
subwf ds_counter2,w
btfsc status,z
goto t2_ram
movlw d'20' ;5
subwf ds_counter2,w
btfsc status,z
goto t25_ram
movlw d'24' ;6
subwf ds_counter2,w
btfsc status,z
goto t3_ram
movlw d'28' ;7
subwf ds_counter2,w
btfsc status,z
goto t35_ram
movlw d'32' ;8 ;wu 9
subwf ds_counter2,w
btfsc status,z
goto t4_ram
goto jindu_ram ;wu no_t
t1_ram
movlw 74h
movwf fsr
movlw 1
movwf indf
goto jindu_ram
t15_ram
movlw 74h
movwf fsr
movlw 3
movwf indf
goto jindu_ram
t2_ram
movlw 74h
movwf fsr
movlw 2
movwf indf
goto jindu_ram
t25_ram
movlw 74h
movwf fsr
movlw 6
movwf indf
goto jindu_ram
t3_ram
movlw 74h
movwf fsr
movlw 4
movwf indf
goto jindu_ram
t35_ram
movlw 74h
movwf fsr
movlw 0c
movwf indf
goto jindu_ram
t4_ram
movlw 74h
movwf fsr
movlw 8
movwf indf
goto jindu_ram
no_t
movlw 74h
movwf fsr
movlw 0
movwf indf
;-----------------------------
jindu_ram
clrf fsr
btfsc flag4,qs
goto jindu_ram_qs
bsf status,6
bsf status,5
btfsc flag4,z1
goto jindu_ram_z1
btfsc flag4,z2
goto jindu_ram_z2
btfsc flag4,z3
goto jindu_ram_z3
goto no_jindu
jindu_ram_qs ;quan cheng wei 27s
btfss flag3,sx
goto qs_x1
bsf status,5
bsf status,6
goto sx_qs1 ;xing zuo shang xing,
qs_x1 btfsc flag3,xx
goto qs_x2
bsf status,5
bsf status,6
goto no_jindu ;xing zuo ting ji.
qs_x2
btfsc flag4,xcjs_x
goto qs_x3
bsf status,5
bsf status,6
goto no_jindu
qs_x3 movlw 1
subwf xc_counter2,w ;xing zuo xia xing,
btfss status,z
goto qs1
movlw 73h ;di yi dian liang
movwf fsr
movlw 1
movwf indf
n1 decf fsr,f ;fsr=72
movlw 0
movwf indf
n2 decf fsr,f ;fsr=71
movlw 0
movwf indf
bsf status,5
bsf status,6
goto dianji_ram
qs1 movlw 6
subwf xc_counter2,w ;0.5s*6=3s
btfss status,z
goto qs2
movlw 73h
movwf fsr
movlw 3
movwf indf
goto n1
qs2 movlw 0ch
subwf xc_counter2,w ;0.5s*12=6s
btfss status,z
goto qs3
movlw 73h
movwf fsr
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -