📄 function.s
字号:
.module Function.c
.area text
.dbfile Function.c
.dbfunc e DownBtn _DownBtn fV
; i -> 0,X
; CurrentRow -> 3,X
_DownBtn::
.dbline -1
ais #-1
tsx
.dbline 9
; #include "Function.h"
; #include "SCI.h"
; //UpBtn:向移按钮功能函数--------------------------------------------------*
; //功 能:将LCD屏幕中的光标向下移一行 *
; //参 数:当前光标所在行号CurrentRow(取值1/2/3) *
; //返 回:无 *
; //------------------------------------------------------------------------*
; void DownBtn(INT8U *CurrentRow)
; {
.dbline 11
; INT8U i;
; i=(*CurrentRow-1)*16;
lda 3,X
ldx 4,X
psha
pulh
lda ,x
tsx
sub #1
nsa
and #-16
sta ,X
.dbline 12
; LcdShowBuff[i]=' ';
clr *__r0
add #<_LcdShowBuff
sta *__r1
lda *__r0
adc #>_LcdShowBuff
sta *__r0
lda #32
ldhx *__r0
sta ,x
tsx
.dbline 13
; (*CurrentRow)++;
lda 3,X
ldx 4,X
psha
pulh
lda ,x
tsx
add #1
sta *__r1
lda 4,X
sta *__r3
lda 3,X
sta *__r2
lda *__r1
ldhx *__r2
sta ,x
tsx
.dbline 14
; if(*CurrentRow>=3) *CurrentRow=3;
lda 3,X
ldx 4,X
psha
pulh
lda ,x
tsx
cmp #3
blo L2
.dbline 14
lda 4,X
sta *__r1
lda 3,X
sta *__r0
lda #3
ldhx *__r0
sta ,x
tsx
L2:
.dbline 15
; Print(*CurrentRow,1,">",1);//在当前行显示选中标志'>>'
lda #1
psha
ldhx #L4
pshx
pshh
tsx
aix #3
psha
lda 3,X
ldx 4,X
psha
pulh
lda ,x
psha
jsr _Print
ais #5
.dbline 16
; LcdShCh(LcdShowBuff);
ldhx #_LcdShowBuff
pshx
pshh
jsr _LcdShCh
ais #2
tsx
.dbline -2
L1:
ais #1
.dbline 0 ; func end
rts
.dbsym l i 0 c
.dbsym l CurrentRow 3 pc
.dbend
.dbfunc e UpBtn _UpBtn fV
; i -> 0,X
; CurrentRow -> 3,X
_UpBtn::
.dbline -1
ais #-1
tsx
.dbline 24
; }
; //DownBtn:向上移按钮功能函数----------------------------------------------*
; //功 能:将LCD屏幕中的光标向上移一行 *
; //参 数:当前光标所在行号CurrentRow(取值1/2/3) *
; //返 回: 无 *
; //------------------------------------------------------------------------*
; void UpBtn(INT8U *CurrentRow)
; {
.dbline 26
; INT8U i;
; i=(*CurrentRow-1)*16;
lda 3,X
ldx 4,X
psha
pulh
lda ,x
tsx
sub #1
nsa
and #-16
sta ,X
.dbline 27
; LcdShowBuff[i]=' ';
clr *__r0
add #<_LcdShowBuff
sta *__r1
lda *__r0
adc #>_LcdShowBuff
sta *__r0
lda #32
ldhx *__r0
sta ,x
tsx
.dbline 28
; (*CurrentRow)--;
lda 3,X
ldx 4,X
psha
pulh
lda ,x
tsx
sub #1
sta *__r1
lda 4,X
sta *__r3
lda 3,X
sta *__r2
lda *__r1
ldhx *__r2
sta ,x
tsx
.dbline 29
; if(*CurrentRow<=0) *CurrentRow=1;
lda 3,X
ldx 4,X
psha
pulh
lda ,x
tsx
cmp #0
bhi L6
.dbline 29
lda 4,X
sta *__r1
lda 3,X
sta *__r0
lda #1
ldhx *__r0
sta ,x
tsx
L6:
.dbline 30
; Print(*CurrentRow,1,">",1);//在当前行显示选中标志'>>'
lda #1
psha
ldhx #L4
pshx
pshh
tsx
aix #3
psha
lda 3,X
ldx 4,X
psha
pulh
lda ,x
psha
jsr _Print
ais #5
.dbline 31
; LcdShCh(LcdShowBuff);
ldhx #_LcdShowBuff
pshx
pshh
jsr _LcdShCh
ais #2
tsx
.dbline -2
L5:
ais #1
.dbline 0 ; func end
rts
.dbsym l i 0 c
.dbsym l CurrentRow 3 pc
.dbend
.dbfunc e AddBtn _AddBtn fV
; i -> 2,X
; CurrentRow -> 5,X
_AddBtn::
.dbline -1
ais #-3
tsx
.dbline 39
; }
; //AddBtn:增加待调节的值---------------------------------------------------*
; //功 能:将待调节的值增加0.1 *
; //参 数:当前光标所在行号CurrentRow(取值1/2/3) *
; //返 回: 无 *
; //------------------------------------------------------------------------*
; void AddBtn(INT8U CurrentRow)
; {
.dbline 41
; INT8U i;
; i=(CurrentRow-1)*16;
lda 5,X
sub #1
nsa
and #-16
sta 2,X
.dbline 42
; switch (CurrentRow)
clr ,X
lda 5,X
sta 1,X
lda ,X
bne X0
lda 1,X
cmp #1
beq L12
X0:
lda ,X
bne X1
lda 1,X
cmp #2
beq L23
X1:
lda ,X
bne X2
lda 1,X
cmp #3
beq L26
X2:
bra L9
X3:
.dbline 43
; {
L12:
.dbline 45
; case 1://温度加1
; if(SignBT=='+')//正数
lda *_SignBT
cmp #43
bne L13
.dbline 46
; {if(BasicT<1400) BasicT=BasicT+10;
.dbline 46
ldhx *_BasicT
cphx #1400
tsx
bhs L10
.dbline 46
lda *_BasicT+1
add #10
sta *_BasicT+1
lda *_BasicT
adc #0
sta *_BasicT
.dbline 47
L16:
.dbline 47
; else break;}
L13:
.dbline 48
; if(SignBT=='-')//负数
lda *_SignBT
cmp #45
bne L10
.dbline 49
; {if(BasicT<=400)
.dbline 49
ldhx *_BasicT
cphx #400
tsx
bhi L10
.dbline 50
; {BasicT=BasicT-10;
.dbline 50
lda *_BasicT+1
sub #10
sta *_BasicT+1
lda *_BasicT
sbc #0
sta *_BasicT
.dbline 51
; if(BasicT==0) SignBT='+';}
ldhx *_BasicT
cphx #0
tsx
bne L10
.dbline 51
lda #43
sta *_SignBT
.dbline 51
.dbline 52
; else break;
.dbline 53
; }
.dbline 54
; break;
bra L10
L23:
.dbline 56
; case 2://湿度加1
; SCISend1('B');
lda #66
psha
jsr _SCISend1
ais #1
.dbline 57
; if(BasicH<1000) BasicH=BasicH+10;
ldhx *_BasicH
cphx #1000
tsx
bhs L10
.dbline 57
lda *_BasicH+1
add #10
sta *_BasicH+1
lda *_BasicH
adc #0
sta *_BasicH
.dbline 58
; break;
bra L10
L26:
.dbline 60
; case 3:
; ColdHotFlag=(ColdHotFlag+1)%3;
lda *_ColdHotFlag
add #1
ldx #3
clrh
div
pshh
pula
tsx
sta *_ColdHotFlag
.dbline 61
; }
L9:
L10:
.dbline 63
; //在LCD上显示
; PackShowBuf(LcdShowBuff);
ldhx #_LcdShowBuff
pshx
pshh
jsr _PackShowBuf
ais #2
.dbline 64
; LcdShCh(LcdShowBuff);
ldhx #_LcdShowBuff
pshx
pshh
jsr _LcdShCh
ais #2
tsx
.dbline -2
L8:
ais #3
.dbline 0 ; func end
rts
.dbsym l i 2 c
.dbsym l CurrentRow 5 c
.dbend
.dbfunc e SubBtn _SubBtn fV
; j -> 2,X
; i -> 3,X
; CurrentRow -> 6,X
_SubBtn::
.dbline -1
ais #-4
tsx
.dbline 72
; }
; //SubBtn:减少待调节的值---------------------------------------------------*
; //功 能:将待调节的值减少0.1 *
; //参 数:当前光标所在行号CurrentRow(取值1/2/3) *
; //返 回: 无 *
; //------------------------------------------------------------------------*
; void SubBtn(INT8U CurrentRow)
; {
.dbline 74
; INT8U i,j;
; i=(CurrentRow-1)*16;
lda 6,X
sub #1
nsa
and #-16
sta 3,X
.dbline 75
; switch (CurrentRow)
clr ,X
lda 6,X
sta 1,X
lda ,X
bne X4
lda 1,X
cmp #1
beq L31
X4:
lda ,X
bne X5
lda 1,X
cmp #2
beq L42
X5:
lda ,X
bne X6
lda 1,X
cmp #3
beq L45
X6:
jmp L28
X7:
.dbline 76
; {
L31:
.dbline 78
; case 1://温度减1
; if(SignBT=='+')
lda *_SignBT
cmp #43
bne L32
.dbline 79
; {
.dbline 80
; if(BasicT==0)
ldhx *_BasicT
cphx #0
tsx
bne L34
.dbline 81
; {BasicT=10,SignBT='-';break;}
.dbline 81
mov #0,*_BasicT
mov #10,*_BasicT+1
lda #45
sta *_SignBT
.dbline 81
bra L29
L34:
.dbline 82
ldhx *_BasicT
cphx #1400
tsx
bhi L36
.dbline 82
lda *_BasicT+1
sub #10
sta *_BasicT+1
lda *_BasicT
sbc #0
sta *_BasicT
L36:
.dbline 82
; if(BasicT<=1400) BasicT=BasicT-10;}
L32:
.dbline 83
; if(SignBT=='-')
lda *_SignBT
cmp #45
bne L29
.dbline 84
; {if(BasicT<400) BasicT=BasicT+10;}
.dbline 84
ldhx *_BasicT
cphx #400
tsx
bhs L29
.dbline 84
lda *_BasicT+1
add #10
sta *_BasicT+1
lda *_BasicT
adc #0
sta *_BasicT
.dbline 84
.dbline 85
; break;
bra L29
L42:
.dbline 87
; case 2://湿度减1
; if((BasicH>0)&&(BasicH<=1000)) BasicH=BasicH-10;
ldhx *_BasicH
cphx #0
tsx
beq L29
ldhx *_BasicH
cphx #1000
tsx
bhi L29
.dbline 87
lda *_BasicH+1
sub #10
sta *_BasicH+1
lda *_BasicH
sbc #0
sta *_BasicH
.dbline 88
; break;
bra L29
L45:
.dbline 90
; case 3:
; ColdHotFlag=(ColdHotFlag+1)%3;
lda *_ColdHotFlag
add #1
ldx #3
clrh
div
pshh
pula
tsx
sta *_ColdHotFlag
.dbline 91
; }
L28:
L29:
.dbline 93
; //在LCD上显示
; PackShowBuf(LcdShowBuff);
ldhx #_LcdShowBuff
pshx
pshh
jsr _PackShowBuf
ais #2
.dbline 94
; LcdShCh(LcdShowBuff);
ldhx #_LcdShowBuff
pshx
pshh
jsr _LcdShCh
ais #2
tsx
.dbline -2
L27:
ais #4
.dbline 0 ; func end
rts
.dbsym l j 2 c
.dbsym l i 3 c
.dbsym l CurrentRow 6 c
.dbend
.area lit
L4:
.byte 62,0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -