📄 font5_7.s
字号:
; _X______,
; _X______,
; _X______,
; _X______,
; _X______,
; ________}
;
; /* 0x7d */
; ,{
; X_______,
; _X______,
; _X______,
; __X_____,
; _X______,
; _X______,
; X_______,
; ________}
;
; /* 0x7e */
; ,{
; _XX_X___,
; X__X____,
; ________,
; ________,
; ________,
; ________,
; ________,
; ________}
;
; /* 0x7f */
; ,{
; XXXXX___,
; XXXXX___,
; XXXXX___,
; XXXXX___,
; XXXXX___,
; XXXXX___,
; XXXXX___,
; ________}
;
; };
; /*电池图形定义*/
; const uint8 BAT[40] = {
; _____XXX,XXXXXXXX,XXXXXXXX,XXXXXXXX,XXXXXXXX,
; ___XXX__,________,________,________,______XX,
; __XXX___,________,________,________,______XX,
; _XXX____,________,________,________,______XX,
; _XXX____,________,________,________,______XX,
; __XXX___,________,________,________,______XX,
; ___XXX__,________,________,________,______XX,
; _____XXX,XXXXXXXX,XXXXXXXX,XXXXXXXX,XXXXXXXX,};
; /****************************************************************************
; * 名称:GUI_DrawBat()
; * 功能:显示电池电量,显示值为BAT[40]。
; * 入口参数: x 指定显示位置,x坐标
; * y 指定显示位置,y坐标
; * v 要显示的电池电量等级,共有0,1,2,3,4五个等级。
; * 出口参数:返回值为1时表示操作成功,为0时表示操作失败。
; * 说明:操作失败原因是指定地址超出有效范围。(显示格式为6*8)
; ****************************************************************************/
; uint8 GUI_DrawBat(uint32 x, uint32 y, uint8 v)
; { uint8 font_dat;
.dbline 1091
; uint8 i, j, k, temp;
; TCOLOR bakc;
; /* 参数过滤 */
; if( x>=(GUI_LCM_XMAX-40) ) return(0);
ldd R24,y+13
ldd R25,y+14
cpi R24,200
ldi R30,0
cpc R25,R30
brlo L8
.dbline 1091
clr R16
xjmp L7
L8:
.dbline 1092
; if( y>=(GUI_LCM_YMAX-8) ) return(0);
ldd R24,y+15
ldd R25,y+16
cpi R24,120
ldi R30,0
cpc R25,R30
brlo L10
.dbline 1092
clr R16
xjmp L7
L10:
.dbline 1095
; //if( (ch<0x20) || (ch>0x7f) ) ch = 0x20;
; //ch -= 0x20;
; for(i=0; i<8; i++)
clr R0
std y+2,R0
xjmp L15
L12:
.dbline 1096
; { /* 读取点阵数据 */
.dbline 1097
; for(k=0; k<5; k++)
clr R14
xjmp L19
L16:
.dbline 1098
; {
.dbline 1099
; temp = i*5 + k;
ldi R24,5
ldd R0,y+2
mul R24,R0
mov R12,R0
add R12,R14
.dbline 1100
; font_dat = BAT[temp];
ldi R24,<_BAT
ldi R25,>_BAT
mov R30,R12
clr R31
add R30,R24
adc R31,R25
lpm R10,Z
.dbline 1101
ldd R22,y+17
clr R23
cpi R22,1
ldi R30,0
cpc R23,R30
breq L23
cpi R22,2
ldi R30,0
cpc R23,R30
breq L26
cpi R22,3
ldi R30,0
cpc R23,R30
breq L30
cpi R22,4
ldi R30,0
cpc R23,R30
breq L35
xjmp L21
X0:
.dbline 1101
; switch(v){
L23:
.dbline 1102
; case 1: if(temp%5==4){font_dat |= 0xff;}break;
ldi R17,5
mov R16,R12
xcall mod8u
cpi R16,4
breq X1
xjmp L21
X1:
.dbline 1102
.dbline 1102
mov R24,R10
ori R24,255
mov R10,R24
.dbline 1102
.dbline 1102
xjmp L21
L26:
.dbline 1103
ldi R18,5
ldi R19,0
mov R16,R12
clr R17
xcall mod16s
cpi R16,4
ldi R30,0
cpc R17,R30
breq L29
cpi R16,3
ldi R30,0
cpc R17,R30
brne L21
L29:
.dbline 1103
; case 2: if((temp%5==4)||(temp%5==3)){font_dat |= 0xff;}break;
.dbline 1103
mov R24,R10
ori R24,255
mov R10,R24
.dbline 1103
.dbline 1103
xjmp L21
L30:
.dbline 1104
ldi R18,5
ldi R19,0
mov R16,R12
clr R17
xcall mod16s
cpi R16,4
ldi R30,0
cpc R17,R30
breq L34
cpi R16,3
ldi R30,0
cpc R17,R30
breq L34
cpi R16,2
ldi R30,0
cpc R17,R30
brne L21
L34:
.dbline 1104
; case 3: if((temp%5==4)||(temp%5==3)||(temp%5==2)){font_dat |= 0xff;}break;
.dbline 1104
mov R24,R10
ori R24,255
mov R10,R24
.dbline 1104
.dbline 1104
xjmp L21
L35:
.dbline 1105
ldi R18,5
ldi R19,0
mov R16,R12
clr R17
xcall mod16s
cpi R16,4
ldi R30,0
cpc R17,R30
breq L40
cpi R16,3
ldi R30,0
cpc R17,R30
breq L40
cpi R16,2
ldi R30,0
cpc R17,R30
breq L40
cpi R16,1
ldi R30,0
cpc R17,R30
brne L21
L40:
.dbline 1105
; case 4: if((temp%5==4)||(temp%5==3)||(temp%5==2)||(temp%5==1)){font_dat |= 0xff;}break;
.dbline 1105
mov R24,R10
ori R24,255
mov R10,R24
.dbline 1105
.dbline 1105
.dbline 1106
; default: break;
L21:
.dbline 1108
; }
; for(j=0; j<8; j++)
clr R20
xjmp L44
L41:
.dbline 1109
; { /* 设置相应的点为color或为back_color */
.dbline 1110
; if( (font_dat&DCB2HEX_TAB[j])==0 ) GUI_CopyColor(&bakc, back_color);
ldi R24,<_DCB2HEX_TAB
ldi R25,>_DCB2HEX_TAB
mov R30,R20
clr R31
add R30,R24
adc R31,R25
lpm R30,Z
mov R2,R10
and R2,R30
brne L45
.dbline 1110
lds R2,_back_color
std y+1,R2
xjmp L46
L45:
.dbline 1111
; else GUI_CopyColor(&bakc, disp_color);
lds R2,_disp_color
std y+1,R2
L46:
.dbline 1112
ldd R2,y+1
std y+0,R2
ldd R18,y+15
ldd R19,y+16
ldd R16,y+13
ldd R17,y+14
xcall _GUI_Point
.dbline 1113
ldd R24,y+13
ldd R25,y+14
adiw R24,1
std y+14,R25
std y+13,R24
.dbline 1114
L42:
.dbline 1108
inc R20
L44:
.dbline 1108
cpi R20,8
brlo L41
.dbline 1115
L17:
.dbline 1097
inc R14
L19:
.dbline 1097
mov R24,R14
cpi R24,5
brsh X2
xjmp L16
X2:
.dbline 1116
ldd R24,y+15
ldd R25,y+16
adiw R24,1
std y+16,R25
std y+15,R24
.dbline 1117
ldd R24,y+13
ldd R25,y+14
sbiw R24,40
std y+14,R25
std y+13,R24
.dbline 1118
L13:
.dbline 1095
ldd R0,y+2
inc R0
std y+2,R0
L15:
.dbline 1095
ldd R24,y+2
cpi R24,8
brsh X3
xjmp L12
X3:
.dbline 1119
; GUI_Point(x, y, bakc);
; x++;
; }
; }
; y++; // 指向下一行
; x -= 40; // 恢复x值
; }
; return(1);
ldi R16,1
.dbline -2
L7:
adiw R28,3
xcall pop_gset5
adiw R28,4
.dbline 0 ; func end
ret
.dbsym l i 2 c
.dbsym r temp 12 c
.dbsym r k 14 c
.dbsym r font_dat 10 c
.dbsym l bakc 1 c
.dbsym r j 20 c
.dbsym l v 17 c
.dbsym l y 15 i
.dbsym l x 13 i
.dbend
.dbfunc e GUI_PutChar _GUI_PutChar fc
; i -> R20
; font_dat -> R14
; bakc -> y+1
; j -> R22
; ch -> R10
; y -> R12,R13
; x -> y+12
.even
_GUI_PutChar::
xcall push_arg4
xcall push_gset5
movw R12,R18
sbiw R28,2
ldd R10,y+16
.dbline -1
.dbline 1131
; }
; /****************************************************************************
; * 名称:GUI_PutChar()
; * 功能:显示ASCII码,显示值为20H-7FH(若为其它值,则显示' ')。
; * 入口参数: x 指定显示位置,x坐标
; * y 指定显示位置,y坐标
; * ch 要显示的ASCII码值。
; * 出口参数:返回值为1时表示操作成功,为0时表示操作失败。
; * 说明:操作失败原因是指定地址超出有效范围。(显示格式为6*8)
; ****************************************************************************/
; uint8 GUI_PutChar(uint32 x, uint32 y, uint8 ch)
; { uint8 font_dat;
.dbline 1136
; uint8 i, j;
; TCOLOR bakc;
;
; /* 参数过滤 */
; if( x>=(GUI_LCM_XMAX-8) ) return(0);
ldd R24,y+12
ldd R25,y+13
cpi R24,232
ldi R30,0
cpc R25,R30
brlo L48
.dbline 1136
clr R16
xjmp L47
L48:
.dbline 1137
; if( y>=(GUI_LCM_YMAX-8) ) return(0);
movw R24,R12
cpi R24,120
ldi R30,0
cpc R25,R30
brlo L50
.dbline 1137
clr R16
xjmp L47
L50:
.dbline 1138
mov R24,R10
cpi R24,32
brlo L54
ldi R24,127
cp R24,R10
brsh L52
L54:
.dbline 1138
; if( (ch<0x20) || (ch>0x7f) ) ch = 0x20;
ldi R24,32
mov R10,R24
L52:
.dbline 1140
;
; ch -= 0x20;
mov R24,R10
subi R24,32
mov R10,R24
.dbline 1141
; for(i=0; i<8; i++)
clr R20
xjmp L58
L55:
.dbline 1142
; { /* 读取点阵数据 */
.dbline 1143
; font_dat = FONT5x7ASCII[ch][i];
ldi R24,8
mul R24,R10
movw R2,R0
ldi R24,<_FONT5x7ASCII
ldi R25,>_FONT5x7ASCII
add R2,R24
adc R3,R25
mov R30,R20
clr R31
add R30,R2
adc R31,R3
lpm R14,Z
.dbline 1145
;
; for(j=0; j<6; j++)
clr R22
xjmp L62
L59:
.dbline 1146
; { /* 设置相应的点为color或为back_color */
.dbline 1147
; if( (font_dat&DCB2HEX_TAB[j])==0 ) GUI_CopyColor(&bakc, back_color);
ldi R24,<_DCB2HEX_TAB
ldi R25,>_DCB2HEX_TAB
mov R30,R22
clr R31
add R30,R24
adc R31,R25
lpm R30,Z
mov R2,R14
and R2,R30
brne L63
.dbline 1147
lds R2,_back_color
std y+1,R2
xjmp L64
L63:
.dbline 1148
; else GUI_CopyColor(&bakc, disp_color);
lds R2,_disp_color
std y+1,R2
L64:
.dbline 1149
ldd R2,y+1
std y+0,R2
movw R18,R12
ldd R16,y+12
ldd R17,y+13
xcall _GUI_Point
.dbline 1150
ldd R24,y+12
ldd R25,y+13
adiw R24,1
std y+13,R25
std y+12,R24
.dbline 1151
L60:
.dbline 1145
inc R22
L62:
.dbline 1145
cpi R22,6
brlo L59
.dbline 1153
movw R24,R12
adiw R24,1
movw R12,R24
.dbline 1154
ldd R24,y+12
ldd R25,y+13
sbiw R24,6
std y+13,R25
std y+12,R24
.dbline 1155
L56:
.dbline 1141
inc R20
L58:
.dbline 1141
cpi R20,8
brsh X4
xjmp L55
X4:
.dbline 1157
; GUI_Point(x, y, bakc);
; x++;
; }
;
; y++; // 指向下一行
; x -= 6; // 恢复x值
; }
;
; return(1);
ldi R16,1
.dbline -2
L47:
adiw R28,2
xcall pop_gset5
adiw R28,4
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r font_dat 14 c
.dbsym l bakc 1 c
.dbsym r j 22 c
.dbsym r ch 10 c
.dbsym r y 12 i
.dbsym l x 12 i
.dbend
.dbfunc e GUI_PutString _GUI_PutString fV
; str -> R20,R21
; y -> R22,R23
; x -> R10,R11
.even
_GUI_PutString::
xcall push_gset3
movw R22,R18
movw R10,R16
sbiw R28,1
ldd R20,y+7
ldd R21,y+8
.dbline -1
.dbline 1172
; }
;
;
;
; /****************************************************************************
; * 名称:GUI_PutString()
; * 功能:输出显示字符串(没有自动换行功能)。
; * 入口参数: x 指定显示位置,x坐标
; * y 指定显示位置,y坐标
; * str 要显示的ASCII码字符串
; * 出口参数:无
; * 说明:操作失败原因是指定地址超出有效范围。
; ****************************************************************************/
; void GUI_PutString(uint32 x, uint32 y, char *str)
; { while(1)
xjmp L67
L66:
.dbline 1173
; { if( (*str)=='\0' ) break;
.dbline 1173
movw R30,R20
ldd R2,z+0
tst R2
brne L69
.dbline 1173
xjmp L68
L69:
.dbline 1174
; if( GUI_PutChar(x, y, *str++)==0 ) break;
movw R30,R20
ld R2,Z+
movw R20,R30
std y+0,R2
movw R18,R22
movw R16,R10
xcall _GUI_PutChar
tst R16
brne L71
.dbline 1174
xjmp L68
L71:
.dbline 1175
movw R24,R10
adiw R24,6
movw R10,R24
.dbline 1176
L67:
.dbline 1172
xjmp L66
L68:
.dbline -2
L65:
adiw R28,1
xcall pop_gset3
.dbline 0 ; func end
ret
.dbsym r str 20 pc
.dbsym r y 22 i
.dbsym r x 10 i
.dbend
.dbfunc e GUI_PutNoStr _GUI_PutNoStr fV
; no -> R20
; str -> R22,R23
; y -> R10,R11
; x -> R12,R13
.even
_GUI_PutNoStr::
xcall push_gset4
movw R10,R18
movw R12,R16
sbiw R28,1
ldd R22,y+9
ldd R23,y+10
ldd R20,y+11
.dbline -1
.dbline 1191
; x += 6; // 下一个字符显示位置,y不变(即不换行)
; }
; }
;
;
; /****************************************************************************
; * 名称:GUI_PutNoStr()
; * 功能:输出显示字符串(没有自动换行功能),若显示的字符个数大于指定个数,则直接退出。
; * 入口参数: x 指定显示位置,x坐标
; * y 指定显示位置,y坐标
; * str 要显示的ASCII码字符串。
; * no 最大显示字符的个数
; * 出口参数:无
; * 说明:操作失败原因是指定地址超出有效范围。
; ****************************************************************************/
; void GUI_PutNoStr(uint32 x, uint32 y, char *str, uint8 no)
; { if(no==0) return;
.dbline 1191
tst R20
brne L79
.dbline 1191
xjmp L73
X5:
.dbline 1192
; for(; no>0; no--)
L76:
.dbline 1193
; { if( (*str)=='\0' ) break;
.dbline 1193
movw R30,R22
ldd R2,z+0
tst R2
brne L80
.dbline 1193
xjmp L78
L80:
.dbline 1194
; if( GUI_PutChar(x, y, *str++)==0 ) break;
movw R30,R22
ld R2,Z+
movw R22,R30
std y+0,R2
movw R18,R10
movw R16,R12
xcall _GUI_PutChar
tst R16
brne L82
.dbline 1194
xjmp L78
L82:
.dbline 1195
movw R24,R12
adiw R24,6
movw R12,R24
.dbline 1196
L77:
.dbline 1192
dec R20
L79:
.dbline 1192
clr R2
cp R2,R20
brlo L76
L78:
.dbline -2
L73:
adiw R28,1
xcall pop_gset4
.dbline 0 ; func end
ret
.dbsym r no 20 c
.dbsym r str 22 pc
.dbsym r y 10 i
.dbsym r x 12 i
.dbend
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -