📄 mc_stm8s_lcd.ls
字号:
1009 00e2 _LCD_PrintString:
1011 00e2 89 pushw x
1012 00e3 88 push a
1013 00000001 OFST: set 1
1016 ; 408 u8 CharPos = 0;
1018 00e4 0f01 clr (OFST+0,sp)
1019 ; 411 if (Append == DISABLE)
1021 00e6 7b06 ld a,(OFST+5,sp)
1022 00e8 2619 jrne L324
1023 ; 413 LCD_SendByte(COMMAND_TYPE, Line);
1025 00ea 9e ld a,xh
1026 00eb 97 ld xl,a
1027 00ec a6f8 ld a,#248
1028 00ee 95 ld xh,a
1029 00ef cd0036 call _LCD_SendByte
1031 00f2 200f jra L324
1032 00f4 L124:
1033 ; 419 LCD_SendByte(DATA_TYPE, *ptr);
1035 00f4 f6 ld a,(x)
1036 00f5 97 ld xl,a
1037 00f6 a6fa ld a,#250
1038 00f8 95 ld xh,a
1039 00f9 cd0036 call _LCD_SendByte
1041 ; 420 CharPos++;
1043 00fc 0c01 inc (OFST+0,sp)
1044 ; 421 ptr++;
1046 00fe 1e07 ldw x,(OFST+6,sp)
1047 0100 5c incw x
1048 0101 1f07 ldw (OFST+6,sp),x
1049 0103 L324:
1050 ; 417 while ((*ptr != 0) && (CharPos < LCD_LINE_MAX_CHAR))
1052 0103 1e07 ldw x,(OFST+6,sp)
1053 0105 f6 ld a,(x)
1054 0106 2706 jreq L724
1056 0108 7b01 ld a,(OFST+0,sp)
1057 010a a10f cp a,#15
1058 010c 25e6 jrult L124
1059 010e L724:
1060 ; 425 if (AutoComplete == ENABLE)
1062 010e 7b03 ld a,(OFST+2,sp)
1063 0110 4a dec a
1064 0111 2610 jrne L134
1066 0113 2008 jra L534
1067 0115 L334:
1068 ; 429 LCD_SendByte(DATA_TYPE, ' ');
1070 0115 aefa20 ldw x,#64032
1071 0118 cd0036 call _LCD_SendByte
1073 ; 430 CharPos++;
1075 011b 0c01 inc (OFST+0,sp)
1076 011d L534:
1077 ; 427 while (CharPos < LCD_LINE_MAX_CHAR)
1079 011d 7b01 ld a,(OFST+0,sp)
1080 011f a10f cp a,#15
1081 0121 25f2 jrult L334
1082 0123 L134:
1083 ; 434 }
1086 0123 5b03 addw sp,#3
1087 0125 81 ret
1142 ; 451 void LCD_PrintMsg(u8 *ptr)
1142 ; 452 {
1143 switch .text
1144 0126 _LCD_PrintMsg:
1146 0126 89 pushw x
1147 0127 89 pushw x
1148 00000002 OFST: set 2
1151 ; 454 u8 Char = 0;
1153 ; 455 u8 CharPos = 0;
1155 0128 0f02 clr (OFST+0,sp)
1156 ; 457 LCD_Clear(); /* Clear the LCD display */
1158 012a cd0097 call _LCD_Clear
1160 ; 460 LCD_SendByte(COMMAND_TYPE, LCD_LINE1);
1162 012d aef880 ldw x,#63616
1165 0130 2035 jp LC001
1166 0132 L574:
1167 ; 467 if (CharPos == LCD_LINE_MAX_CHAR)
1169 0132 a10f cp a,#15
1170 0134 2608 jrne L305
1171 ; 469 LCD_SendByte(COMMAND_TYPE, LCD_LINE2); /* Select second line */
1173 0136 aef890 ldw x,#63632
1174 0139 cd0036 call _LCD_SendByte
1176 013c 1e03 ldw x,(OFST+1,sp)
1177 013e L305:
1178 ; 472 Char = *ptr;
1180 013e f6 ld a,(x)
1181 013f 6b01 ld (OFST-1,sp),a
1182 ; 474 switch (Char)
1185 ; 492 break;
1186 0141 a00a sub a,#10
1187 0143 271a jreq L344
1188 0145 a003 sub a,#3
1189 0147 2712 jreq L144
1190 ; 487 default:
1190 ; 488 /* Display characters different from (\r, \n) */
1190 ; 489 LCD_SendByte(DATA_TYPE, Char);
1192 0149 7b01 ld a,(OFST-1,sp)
1193 014b 97 ld xl,a
1194 014c a6fa ld a,#250
1195 014e 95 ld xh,a
1196 014f cd0036 call _LCD_SendByte
1198 ; 490 CharPos++;
1200 0152 0c02 inc (OFST+0,sp)
1201 ; 491 ptr++;
1203 0154 1e03 ldw x,(OFST+1,sp)
1204 0156 LC002:
1206 0156 5c incw x
1207 0157 1f03 ldw (OFST+1,sp),x
1208 ; 492 break;
1210 0159 2011 jra L774
1211 015b L144:
1212 ; 476 case ('\r'):
1212 ; 477 /* Carriage return */
1212 ; 478 CharPos++;
1214 015b 0c02 inc (OFST+0,sp)
1215 ; 479 ptr++;
1216 ; 480 break;
1218 015d 20f7 jp LC002
1219 015f L344:
1220 ; 481 case ('\n'):
1220 ; 482 CharPos = 0;
1222 015f 6b02 ld (OFST+0,sp),a
1223 ; 483 ptr++;
1225 0161 5c incw x
1226 0162 1f03 ldw (OFST+1,sp),x
1227 ; 485 LCD_SendByte(COMMAND_TYPE, LCD_LINE2);
1229 0164 aef890 ldw x,#63632
1230 0167 LC001:
1231 0167 cd0036 call _LCD_SendByte
1233 ; 486 break;
1235 016a 1e03 ldw x,(OFST+1,sp)
1236 016c L774:
1237 ; 463 while ((*ptr != 0) && (CharPos < (LCD_LINE_MAX_CHAR * 2)))
1239 016c f6 ld a,(x)
1240 016d 2706 jreq L115
1242 016f 7b02 ld a,(OFST+0,sp)
1243 0171 a11e cp a,#30
1244 0173 25bd jrult L574
1245 0175 L115:
1246 ; 496 }
1249 0175 5b04 addw sp,#4
1250 0177 81 ret
1294 ; 513 void LCD_PrintDec1(u8 Number)
1294 ; 514 {
1295 switch .text
1296 0178 _LCD_PrintDec1:
1298 0178 88 push a
1299 0179 88 push a
1300 00000001 OFST: set 1
1303 ; 518 if (Number < (u8)10)
1305 017a a10a cp a,#10
1306 017c 2416 jruge L535
1307 ; 522 NbreTmp = (u8)(Number / (u8)10);
1309 017e ae000a ldw x,#10
1310 0181 9093 ldw y,x
1311 0183 5f clrw x
1312 0184 97 ld xl,a
1313 0185 65 divw x,y
1314 ; 525 NbreTmp = (u8)(Number - (u8)((u8)10 * NbreTmp));
1316 0186 a60a ld a,#10
1317 0188 42 mul x,a
1318 0189 9f ld a,xl
1319 018a 1002 sub a,(OFST+1,sp)
1320 018c 40 neg a
1321 018d 6b01 ld (OFST+0,sp),a
1322 ; 526 LCD_PrintChar((u8)(NbreTmp + (u8)0x30));
1324 018f ab30 add a,#48
1325 0191 cd00db call _LCD_PrintChar
1327 0194 L535:
1328 ; 530 }
1331 0194 85 popw x
1332 0195 81 ret
1376 ; 547 void LCD_PrintDec2(u8 Number)
1376 ; 548 {
1377 switch .text
1378 0196 _LCD_PrintDec2:
1380 0196 88 push a
1381 0197 88 push a
1382 00000001 OFST: set 1
1385 ; 552 if (Number < (u8)100)
1387 0198 a164 cp a,#100
1388 019a 2421 jruge L165
1389 ; 556 NbreTmp = (u8)(Number / (u8)10);
1391 019c ae000a ldw x,#10
1392 019f 9093 ldw y,x
1393 01a1 5f clrw x
1394 01a2 97 ld xl,a
1395 01a3 65 divw x,y
1396 01a4 9f ld a,xl
1397 01a5 6b01 ld (OFST+0,sp),a
1398 ; 557 LCD_PrintChar((u8)(NbreTmp + (u8)0x30));
1400 01a7 ab30 add a,#48
1401 01a9 cd00db call _LCD_PrintChar
1403 ; 560 NbreTmp = (u8)(Number - (u8)((u8)10 * NbreTmp));
1405 01ac 7b01 ld a,(OFST+0,sp)
1406 01ae 97 ld xl,a
1407 01af a60a ld a,#10
1408 01b1 42 mul x,a
1409 01b2 9f ld a,xl
1410 01b3 1002 sub a,(OFST+1,sp)
1411 01b5 40 neg a
1412 01b6 6b01 ld (OFST+0,sp),a
1413 ; 561 LCD_PrintChar((u8)(NbreTmp + (u8)0x30));
1415 01b8 ab30 add a,#48
1416 01ba cd00db call _LCD_PrintChar
1418 01bd L165:
1419 ; 565 }
1422 01bd 85 popw x
1423 01be 81 ret
1476 ; 582 void LCD_PrintDec3(u16 Number)
1476 ; 583 {
1477 switch .text
1478 01bf _LCD_PrintDec3:
1480 01bf 89 pushw x
1481 01c0 89 pushw x
1482 00000002 OFST: set 2
1485 ; 588 if (Number < (u16)1000)
1487 01c1 a303e8 cpw x,#1000
1488 01c4 243a jruge L116
1489 ; 592 Nbre1Tmp = (u8)(Number / (u8)100);
1491 01c6 90ae0064 ldw y,#100
1492 01ca 65 divw x,y
1493 01cb 9f ld a,xl
1494 01cc 6b02 ld (OFST+0,sp),a
1495 ; 593 LCD_PrintChar((u8)(Nbre1Tmp + (u8)0x30));
1497 01ce ab30 add a,#48
1498 01d0 cd00db call _LCD_PrintChar
1500 ; 596 Nbre1Tmp = (u8)(Number - ((u8)100 * Nbre1Tmp));
1502 01d3 7b02 ld a,(OFST+0,sp)
1503 01d5 97 ld xl,a
1504 01d6 a664 ld a,#100
1505 01d8 42 mul x,a
1506 01d9 9f ld a,xl
1507 01da 1004 sub a,(OFST+2,sp)
1508 01dc 40 neg a
1509 01dd 6b02 ld (OFST+0,sp),a
1510 ; 597 Nbre2Tmp = (u8)(Nbre1Tmp / (u8)10);
1512 01df ae000a ldw x,#10
1513 01e2 9093 ldw y,x
1514 01e4 5f clrw x
1515 01e5 97 ld xl,a
1516 01e6 65 divw x,y
1517 01e7 9f ld a,xl
1518 01e8 6b01 ld (OFST-1,sp),a
1519 ; 598 LCD_PrintChar((u8)(Nbre2Tmp + (u8)0x30));
1521 01ea ab30 add a,#48
1522 01ec cd00db call _LCD_PrintChar
1524 ; 601 Nbre1Tmp = ((u8)(Nbre1Tmp - (u8)((u8)10 * Nbre2Tmp)));
1526 01ef 7b01 ld a,(OFST-1,sp)
1527 01f1 97 ld xl,a
1528 01f2 a60a ld a,#10
1529 01f4 42 mul x,a
1530 01f5 9f ld a,xl
1531 01f6 1002 sub a,(OFST+0,sp)
1532 01f8 40 neg a
1533 01f9 6b02 ld (OFST+0,sp),a
1534 ; 602 LCD_PrintChar((u8)(Nbre1Tmp + (u8)0x30));
1536 01fb ab30 add a,#48
1537 01fd cd00db call _LCD_PrintChar
1539 0200 L116:
1540 ; 605 }
1543 0200 5b04 addw sp,#4
1544 0202 81 ret
1597 ; 622 void LCD_PrintDec4(u16 Number)
1597 ; 623 {
1598 switch .text
1599 0203 _LCD_PrintDec4:
1601 0203 89 pushw x
1602 0204 5206 subw sp,#6
1603 00000006 OFST: set 6
1606 ; 628 if (Number < (u16)10000)
1608 0206 a32710 cpw x,#10000
1609 0209 2467 jruge L146
1610 ; 632 Nbre1Tmp = (u16)(Number / (u16)1000);
1612 020b 90ae03e8 ldw y,#1000
1613 020f 65 divw x,y
1614 0210 1f05 ldw (OFST-1,sp),x
1615 ; 633 LCD_PrintChar((u8)(Nbre1Tmp + (u8)0x30));
1617 0212 7b06 ld a,(OFST+0,sp)
1618 0214 ab30 add a,#48
1619 0216 cd00db call _LCD_PrintChar
1621 ; 636 Nbre1Tmp = (u16)(Number - ((u16)1000 * Nbre1Tmp));
1623 0219 1e05 ldw x,(OFST-1,sp)
1624 021b 90ae03e8 ldw y,#1000
1625 021f cd0000 call c_imul
1627 0222 1f01 ldw (OFST-5,sp),x
1628 0224 1e07 ldw x,(OFST+1,sp)
1629 0226 72f001 subw x,(OFST-5,sp)
1630 0229 1f05 ldw (OFST-1,sp),x
1631 ; 637 Nbre2Tmp = (u16)(Nbre1Tmp / (u8)100);
1633 022b 90ae0064 ldw y,#100
1634 022f 65 divw x,y
1635 0230 1f03 ldw (OFST-3,sp),x
1636 ; 638 LCD_PrintChar((u8)(Nbre2Tmp + (u8)0x30));
1638 0232 7b04 ld a,(OFST-2,sp)
1639 0234 ab30 add a,#48
1640 0236 cd00db call _LCD_PrintChar
1642 ; 641 Nbre1Tmp = (u16)(Nbre1Tmp - ((u16)100 * Nbre2Tmp));
1644 0239 1e03 ldw x,(OFST-3,sp)
1645 023b 90ae0064 ldw y,#100
1646 023f cd0000 call c_imul
1648 0242 1f01 ldw (OFST-5,sp),x
1649 0244 1e05 ldw x,(OFST-1,sp)
1650 0246 72f001 subw x,(OFST-5,sp)
1651 0249 1f05 ldw (OFST-1,sp),x
1652 ; 642 Nbre2Tmp = (u16)(Nbre1Tmp / (u16)10);
1654 024b 90ae000a ldw y,#10
1655 024f 65 divw x,y
1656 0250 1f03 ldw (OFST-3,sp),x
1657 ; 643 LCD_PrintChar((u8)(Nbre2Tmp + (u8)0x30));
1659 0252 7b04 ld a,(OFST-2,sp)
1660 0254 ab30 add a,#48
1661 0256 cd00db call _LCD_PrintChar
1663 ; 646 Nbre1Tmp = ((u16)(Nbre1Tmp - (u16)((u16)10 * Nbre2Tmp)));
1665 0259 1e03 ldw x,(OFST-3,sp)
1666 025b 90ae000a ldw y,#10
1667 025f cd0000 call c_imul
1669 0262 1f01 ldw (OFST-5,sp),x
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -