1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784
|
#!/usr/bin/tclsh
# Part of MCU 8051 IDE ( http://https://sourceforge.net/projects/mcu8051ide/ )
############################################################################
# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 by Martin Ošmera #
# martin.osmera@gmail.com #
# #
# Copyright (C) 2014 by Moravia Microsystems, s.r.o. #
# martin.osmera@gmail.com #
# #
# This program is free software; you can redistribute it and#or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the #
# Free Software Foundation, Inc., #
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #
############################################################################
# >>> File inclusion guard
if { ! [ info exists _INSTRUCTIONDETAILS_TCL ] } {
set _INSTRUCTIONDETAILS_TCL _
# <<< File inclusion guard
# --------------------------------------------------------------------------
# DESCRIPTION
# Implements tab "Instruction details" on the Right Panel
# --------------------------------------------------------------------------
class InstructionDetails {
## COMMON
# Conter of instances
public common instd_count 0
# Font for instruction details
public common instruction_font [font create \
-size [expr {int(-12 * $::font_size_factor)}] \
-family $::DEFAULT_FIXED_FONT \
]
## Highlighting tags for instruction details
# {
# {tag_name foreground_color ?bold_or_italic?}
# ...
# }
public common instruction_tags {
{tag_code8 #00AA00 0}
{tag_code11 #00AA33 0}
{tag_code16 #00AA55 0}
{tag_imm8 #FF0000 0}
{tag_imm16 #FF0055 0}
{tag_data #88DD00 0}
{tag_bit #555588 0}
{tag_DPTR #0000FF 1}
{tag_A #3300DD 1}
{tag_AB #8800FF 1}
{tag_SFR #0000FF 1}
{tag_indr #FF0000 1}
{tag_1 #00DD00}
{tag_2 #AAAA00}
{tag_3 #FF0000}
{tag_4 #8800FF}
{tag_5 #0000FF}
}
## Detail description of each directive
# Format: {
# {directive} {description}
# {directive} {description}
# {directive} {description}
# . .
# . .
# . .
# }
public common HELP_FOR_DIRECTIVES {}
public common HELP_FOR_DIRECTIVES_RAW {
elseif {Conditional assembly\n\nSyntax:\n ELSEIF <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifn {IF Not, conditional assembly\n\nSyntax:\n IFN <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
elseifn {ELSE IF Not\n\nSyntax:\n ELSEIFN <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFN SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifdef {IF DEFined\n\nSyntax:\n IFDEF <symbol>\n\nExample:\n IFDEF CND\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
elseifdef {ELSE IF DEFined\n\nSyntax:\n ELSEIFDEF <symbol>\n\nExample:\n IFDEF(2 * 4 - CND)\n MOV A, #20h\n ELSEIFDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifndef {IF Not DEFined\n\nSyntax:\n IFNDEF <symbol>\n\nExample:\n IFNDEF CND\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
elseifndef {ELSE IF Not DEFined\n\nSyntax:\n ELSEIFNDEF <symbol>\n\nExample:\n IFDEF CND\n MOV A, #20h\n ELSEIFNDEF SOMETHING_ELSE\n MOV A, #40h\n ENDIF\n\n}
ifb {IF Black\n\nSyntax:\n IFB <literal>\n\nExample:\n IFB <CND>\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
elseifb {ELSE IF Black\n\nSyntax:\n ELSEIFB <literal>\n\nExample:\n IFB <CND>\n MOV A, #20h\n ELSEIFB <SOMETHING_ELSE>\n MOV A, #40h\n ENDIF\n\literal:\n Supported by ASEM-51 only}
ifnb {IF Not Black\n\nSyntax:\n IFNB <literal>\n\nExample:\n IFNB <CND>\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
elseifnb {ELSE IF Not Black\n\nSyntax:\n ELSEIFNB <literal>\n\nExample:\n IFB <CND>\n MOV A, #20h\n ELSEIFNB <SOMETHING_ELSE>\n MOV A, #40h\n ENDIF\n\nNote:\n Supported by ASEM-51 only}
rept {REPeaT Macro\n\nSyntax:\n REPT <expr>\n\nExample:\n REPT 5\n NOP\n ENDM\n\n}
times {REPeaT Macro\n\nSyntax:\n TIMES <expr>\n\nExample:\n TIMES 5\n NOP\n ENDM\n\nNote:\n Supported by native assembler only}
name {define module NAME\n\nSyntax:\n NAME <name>\n\nExample:\n NAME my_2nd_program\n\nNote:\n Supported by ASEM-51 only}
if {Conditional assembly\n\nSyntax:\n IF <expr>\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
else {Conditional assembly\n\nSyntax:\n ELSE\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
endif {Conditional assembly\n\nSyntax:\n ENDIF\n\nExample:\n IF(2 * 4 - CND)\n MOV A, #20h\n ELSE\n MOV A, #40h\n ENDIF\n\n}
endm {END of Macro definition\n\nSyntax:\n ENDM\n\nExample:\n ABC MACRO\n MOV B, #12d\n ENDM\n\n}
end {END of the program\n\nSyntax:\n END\n\nExample:\n END\n\n}
exitm {premature end of macro expansion\n\nSyntax:\n EXITM\n\nExample:\n ABC MACRO\n MOV B, #12d\n EXITM\n NOP\n ENDM\n\n}
list {enable code LISTing\n\nSyntax:\n LIST\n\nExample:\n NOP\n NOLIST\n NOP\n NOP\n LIST\n NOP\n\n}
nolist {disabled code listing\n\nSyntax:\n NOLIST\n\nExample:\n NOP\n NOLIST\n NOP\n NOP\n LIST\n NOP\n\n}
dseg {switch to DATA segment \[at address\]\n\nSyntax:\n DSEG \[AT <expr>\]\n\nExample:\n DSEG at 20d\n\n}
iseg {switch to IDATA segment \[at address\]\n\nSyntax:\n ISEG \[AT <expr>\]\n\nExample:\n ISEG at 10d\n\n}
bseg {switch to BIT segment \[at address\]\n\nSyntax:\n BSEG \[AT <expr>\]\n\nExample:\n BSEG at 5d\n\n}
xseg {switch to XDATA segment \[at address\]\n\nSyntax:\n XSEG \[AT <expr>\]\n\nExample:\n XSEG at 30d\n\n}
cseg {switch to CODE segment \[at address\]\n\nSyntax:\n CSEG \[AT <expr>\]\n\nExample:\n CSEG at 40d\n\n}
local {define a local label inside a macro\n\nSyntax:\n LOCAL <symbol>\n\nExample:\n ABC MACRO\n LOCAL xyz\n xyz: MOV B, #12d\n EXITM\n NOP\n ENDM\n\n}
flag {define a FLAG bit\n\nSyntax:\n <symbol> FLAG <expr>\n\nExample:\n F4 FLAG 16h\n\nNote:\n Deprecated directive. Consider directive BIT instead.}
skip {SKIP bytes in the code memory\n\nSyntax:\n SKIP <expr>\n\nExample:\n SKIP 5\n\n}
equ {EQUivalent\n\nSyntax:\n <symbol> EQU <expr>\n\nExample:\n ABC EQU R0\n XYZ EQU 4Eh+12\n\n}
bit {define BIT address\n\nSyntax:\n <symbol> BIT <expr>\n\nExample:\n ABC BIT P4.5\n\n}
set {SET numeric variable or variable register\n\nSyntax:\n <symbol> SET <expr>\n <symbol> SET <register>\n\nExample:\n ALPHA SET R0\n ALPHA SET 42*BETA\n\n}
code {define address in the CODE memory\n\nSyntax:\n <symbol> CODE <expr>\n\nExample:\n TBL CODE 600h\n\n}
data {define address in the DATA memory\n\nSyntax:\n <symbol> DATA <expr>\n\nExample:\n UIV DATA 20h\n\n}
idata {define address in the Internal DATA memory\n\nSyntax:\n <symbol> IDATA <expr>\n\nExample:\n UIV IDATA 20h\n\n}
xdata {define address in the External DATA memory\n\nSyntax:\n <symbol> XDATA <expr>\n\nExample:\n UIV XDATA 400h\n\n}
macro {MACRO definition\n\nSyntax:\n <macro> MACRO \[<arg0> \[,<arg1> ... \]\n\n\nExample:\n ABC MACRO X\n MOV X, #12d\n ENDM\n\n}
ds {Define Space\n\nSyntax:\n DS <expr>\n\nExample:\n DS 2+4\n\n}
dw {Define Words\n\nSyntax:\n DW <expr1> \[,<expr2> ... \]\n\nExample:\n DW 0,02009H,2009,4171\n\n}
db {Define Bytes\n\nSyntax:\n DB <expr1> \[,<expr2> ... \]\n\nExample:\n DB 24,'August',09,(2*8+24)/8\n\n}
dbit {Define BITs\n\nSyntax:\n DBIT <expr>\n\nExample:\n DBIT 4+2\n\n}
include {INCLUDE an external source code\n\nSyntax:\n INCLUDE <filename>\n\nExample:\n INCLUDE 'my file.asm'\n\n}
org {ORiGin of code segment location\n\nSyntax:\n ORG <expr>\n\nExample:\n ORG 0Bh\n\n}
using {USING register banks\n\nSyntax:\n USING <expr>\n\nExample:\n USING 2\n\n}
byte {define BYTE address in the data memory\n\nSyntax:\n <symbol> BYTE <expr>\n\nExample:\n UIV BYTE 20h\n\nNote:\n Deprecated directive. Consider directive DATA instead.}
{$cond} {List full IFxx .. ENDIF\n\nSyntax:\n \$COND\n\nExample:\n \$COND\n\nNote:\n Supported by ASEM-51 only}
{$nocond} {Don't list lines in false branches\n\nSyntax:\n \$NOCOND\n\nExample:\n \$NOCOND\n\nNote:\n Supported by ASEM-51 only}
{$condonly} {List assembled lines only\n\nSyntax:\n \$CONDONLY\n\nExample:\n \$CONDONLY\n\nNote:\n Supported by ASEM-51 only}
{$date} {Inserts date string into page header\n\nSyntax:\n \$DATE(string)\n\nExample:\n \$DATE(1965-12-31)\n\n}
{$da} {Inserts date string into page header\n\nSyntax:\n \$DATE(string)\n\nExample:\n \$DATE(1965-12-31)\n\n}
{$debug} {Include debug information\n\nSyntax:\n \$DEBUG\n\nExample:\n \$DEBUG\n\nNote:\n Supported by ASEM-51 only}
{$db} {Include debug information\n\nSyntax:\n \$DB\n\nExample:\n \$DB\n\nNote:\n Supported by ASEM-51 only}
{$nodebug} {Don't include debug information\n\nSyntax:\n \$NODEBUG\n\nExample:\n \$NODEBUG\n\nNote:\n Supported by ASEM-51 only}
{$nodb} {Don't include debug information\n\nSyntax:\n \$NODB\n\nExample:\n \$NODB\n\nNote:\n Supported by ASEM-51 only}
{$eject} {Start a new page in list file\n\nSyntax:\n \$EJECT\n\nExample:\n \$EJECT\n\n}
{$ej} {Start a new page in list file\n\nSyntax:\n \$EJ\n\nExample:\n \$EJ\n\n}
{$error} {Force a user-defined error\n\nSyntax:\n \$ERROR(string)\n\nExample:\n \$ERROR(Impossible combination ...)\n\nNote:\n Supported by ASEM-51 only}
{$warning} {Force a user-defined warning\n\nSyntax:\n \$WARNING(string)\n\nExample:\n \$WARNING(Testing only !)\n\nNote:\n Supported by ASEM-51 only}
{$ge} {List macro calls and expansion lines\n\nSyntax:\n \$GE\n\nExample:\n \$GE\n\nNote:\n Supported by ASEM-51 only}
{$gen} {List macro calls and expansion lines\n\nSyntax:\n \$GEN\n\nExample:\n \$GEN\n\nNote:\n Supported by ASEM-51 only}
{$noge} {List macro calls only\n\nSyntax:\n \$NOGE\n\nExample:\n \$NOGE\n\nNote:\n Supported by ASEM-51 only}
{$nogen} {List macro calls only\n\nSyntax:\n \$NOGEN\n\nExample:\n \$NOGEN\n\nNote:\n Supported by ASEM-51 only}
{$go} {List expansion lines only\n\nSyntax:\n \$GO\n\nExample:\n \$GO\n\nNote:\n Supported by ASEM-51 only}
{$genonly} {List expansion lines only\n\nSyntax:\n \$GENONLY\n\nExample:\n \$GENONLY\n\nNote:\n Supported by ASEM-51 only}
{$include} {Include a source file\n\nSyntax:\n \$INCLUDE(string)\n\nExample:\n \$INCLUDE(somefile.asm)\n\n}
{$inc} {Include a source file\n\nSyntax:\n \$INC(string)\n\nExample:\n \$INC(somefile.asm)\n\n}
{$list} {List subsequent source lines\n\nSyntax:\n \$LIST\n\nExample:\n \$LIST\n\n}
{$li} {List subsequent source lines\n\nSyntax:\n \$LI\n\nExample:\n \$LI\n\n}
{$noli} {Don't list subsequent source lines\n\nSyntax:\n \$NOLI\n\nExample:\n \$NOLI\n\n}
{$nolist} {Don't list subsequent source lines\n\nSyntax:\n \$NOLIST\n\nExample:\n \$NOLIST\n\n}
{$macro} {Reserve n % of free memory for macros\n\nSyntax:\n \$MACRO(int)\n\nExample:\n \$MACRO(50)\n\nNote:\n Supported by ASEM-51 only}
{$mr} {Reserve n % of free memory for macros\n\nSyntax:\n \$MR(int)\n\nExample:\n \$MR(50)\n\nNote:\n Supported by ASEM-51 only}
{$nomr} {Reserve all for the symbol table\n\nSyntax:\n \$NOMR\n\nExample:\n \$NOMR\n\nNote:\n Supported by ASEM-51 only}
{$nomacro} {Reserve all for the symbol table\n\nSyntax:\n \$NOMACRO\n\nExample:\n \$NOMACRO\n\nNote:\n Supported by ASEM-51 only}
{$mod51} {Enable predefined SFR symbols\n\nSyntax:\n \$MOD51\n\nExample:\n \$MOD51\n\nNote:\n Supported by ASEM-51 only}
{$mo} {Enable predefined SFR symbols\n\nSyntax:\n \$MO\n\nExample:\n \$MO\n\nNote:\n Supported by ASEM-51 only}
{$nomod} {Disable predefined SFR symbols\n\nSyntax:\n \$NOMOD\n\nExample:\n \$NOMOD\n\n}
{$nomo} {Disable predefined SFR symbols\n\nSyntax:\n \$NOMO\n\nExample:\n \$NOMO\n\n}
{$nomod51} {Disable predefined SFR symbols\n\nSyntax:\n \$NOMOD51\n\nExample:\n \$NOMOD51\n\n}
{$nobuiltin} {Don't list predefined symbols\n\nSyntax:\n \$NOBUILTIN\n\nExample:\n \$NOBUILTIN\n\nNote:\n Supported by ASEM-51 only}
{$notabs} {Don't use tabs in list file\n\nSyntax:\n \$NOTABS\n\nExample:\n \$NOTABS\n\nNote:\n Supported by ASEM-51 only}
{$paging} {Enable listing page formatting\n\nSyntax:\n \$LIST\n\nExample:\n \$PAGING\n\n}
{$pi} {Enable listing page formatting\n\nSyntax:\n \$PI\n\nExample:\n \$PI\n\n}
{$nopi} {Disable listing page formatting\n\nSyntax:\n \$NOPI\n\nExample:\n \$NOPI\n\n}
{$nopaging} {Disable listing page formatting\n\nSyntax:\n \$NOPAGING\n\nExample:\n \$NOPAGING\n\n}
{$pagelength} {Set lines per page for listing\n\nSyntax:\n \$PAGELENGTH(int)\n\nExample:\n \$PAGELENGTH(64)\n\n}
{$pl} {Set lines per page for listing\n\nSyntax:\n \$PL(int)\n\nExample:\n \$PL(64)\n\n}
{$pagewidth} {Set columns per line for listing\n\nSyntax:\n \$PAGEWIDTH(int)\n\nExample:\n \$PAGEWIDTH(132)\n\n}
{$pw} {Set columns per line for listing\n\nSyntax:\n \$PW(int)\n\nExample:\n \$PW(132)\n\n}
{$philips} {Switch on 83C75x family support\n\nSyntax:\n \$PHILIPS\n\nExample:\n \$PHILIPS\n\nNote:\n Supported by ASEM-51 only}
{$save} {Save current \$LIST/\$GEN/\$COND\n\nSyntax:\n \$SAVE\n\nExample:\n \$SAVE\n\nNote:\n Supported by ASEM-51 only}
{$sa} {Save current \$LIST/\$GEN/\$COND\n\nSyntax:\n \$SA\n\nExample:\n \$SA\n\nNote:\n Supported by ASEM-51 only}
{$restore} {Restore old \$LIST/\$GEN/\$COND\n\nSyntax:\n \$RESTORE\n\nExample:\n \$RESTORE\n\nNote:\n Supported by ASEM-51 only}
{$rs} {Restore old \$LIST/\$GEN/\$COND\n\nSyntax:\n \$RS\n\nExample:\n \$RS\n\nNote:\n Supported by ASEM-51 only}
{$symbols} {Create symbol table\n\nSyntax:\n \$SYMBOLS\n\nExample:\n \$SYMBOLS\n\n}
{$sb} {Create symbol table\n\nSyntax:\n \$SB\n\nExample:\n \$SB\n\n}
{$nosymbols} {Don't create symbol table\n\nSyntax:\n \$NOSYMBOLS\n\nExample:\n \$NOSYMBOLS\n\n}
{$nosb} {Don't create symbol table\n\nSyntax:\n \$NOSB\n\nExample:\n \$NOSB\n\n}
{$title} {Inserts title string into page header\n\nSyntax:\n \$TITLE(string)\n\nExample:\n \$TITLE(My firts code)\n\n}
{$tt} {Inserts title string into page header\n\nSyntax:\n \$TT(string)\n\nExample:\n \$TT(My firts code)\n\n}
{$xref} {Create cross reference\n\nSyntax:\n \$XREF\n\nExample:\n \$XREF\n\nNote:\n Supported by ASEM-51 only}
{$xr} {Create cross reference\n\nSyntax:\n \$XR\n\nExample:\n \$XR\n\nNote:\n Supported by ASEM-51 only}
{$noxref} {Don't create cross reference\n\nSyntax:\n \$NOXREF\n\nExample:\n \$NOXREF\n\nNote:\n Supported by ASEM-51 only}
{$noxr} {Don't create cross reference\n\nSyntax:\n \$NOXR\n\nExample:\n \$NOXR\n\nNote:\n Supported by ASEM-51 only}
{$noobject} {Do not create Intel HEX file\n\nSyntax:\n \$NOOBJECT\n\nExample:\n \$NOOBJECT\n\nNote:\n Supported by native assembler only}
{$object} {Specify file name for Intel HEX\n\nSyntax:\n \$OBJECT(string)\n\nExample:\n \$OBJECT(my_hex.hex)\n\nNote:\n Supported by native assembler only}
{$print} {Specify file name for list file\n\nSyntax:\n \$PRINT(string)\n\nExample:\n \$PRINT(my_list.lst)\n\nNote:\n Supported by native assembler only}
{$noprint} {Do not create list file at all\n\nSyntax:\n \$NOPRINT\n\nExample:\n \$NOPRINT\n\nNote:\n Supported by native assembler only}
{$nomacrosfirst} {Define and expand macro instruction after! conditional assembly and definitions of constants\n\nSyntax:\n \$NOMACROSFIRTS\n\nExample:\n \$NOMACROSFIRTS\n\nNote:\n Supported by native assembler only}
}
## Detail description of each instruction
# Format: {
# {INSTRUCTION OPR0, OPR1 ...} {
# {description}
# {class}
# {note}
# {affected flags in order: C OV AC, for instance "{0 X 1}"}
# }
# }
public common INSTRUCTION_DESCRIPTION {
{ADD A, Rn} {
{Add register to Accumulator}
{Arithmetic Operations}
{}
{X X X}
}
{ADD A, direct} {
{Add direct byte to Accumulator}
{Arithmetic Operations}
{}
{X X X}
}
{ADD A, @Ri} {
{Add indirect RAM to Accumulator}
{Arithmetic Operations}
{}
{X X X}
}
{ADD A, #data} {
{Add immediate data to Accumulator}
{Arithmetic Operations}
{}
{X X X}
}
{ADDC A, Rn} {
{Add register to Accumulator with Carry}
{Arithmetic Operations}
{}
{X X X}
}
{ADDC A, direct} {
{Add direct byte to Accumulator with Carry}
{Arithmetic Operations}
{}
{X X X}
}
{ADDC A, @Ri} {
{Add indirect RAM to Accumulator with Carry}
{Arithmetic Operations}
{}
{X X X}
}
{ADDC A, #data} {
{Add immediate data to Acc with Carry}
{Arithmetic Operations}
{}
{X X X}
}
{SUBB A, Rn} {
{Subtract Register from Acc with borrow}
{Arithmetic Operations}
{}
{X X X}
}
{SUBB A, direct} {
{Subtract direct byte from Acc with borrow}
{Arithmetic Operations}
{}
{X X X}
}
{SUBB A, @Ri} {
{Subtract indirect RAM from ACC with borrow}
{Arithmetic Operations}
{}
{X X X}
}
{SUBB A, #data} {
{Subtract immediate data from Acc with borrow}
{Arithmetic Operations}
{}
{X X X}
}
{INC A} {
{Increment Accumulator}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{INC Rn} {
{Increment register}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{INC direct} {
{Increment direct byte}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{INC @Ri} {
{Increment direct RAM}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{DEC A} {
{Decrement Accumulator}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{DEC Rn} {
{Decrement Register}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{DEC direct} {
{Decrement direct byte}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{DEC @Ri} {
{Decrement indirect RAM}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{INC DPTR} {
{Increment Data Pointer}
{Arithmetic Operations}
{Read-Modify-Write}
{}
}
{MUL AB} {
{Multiply A & B}
{Arithmetic Operations}
{}
{0 X {}}
}
{DIV AB} {
{Divide A by B}
{Arithmetic Operations}
{}
{0 X {}}
}
{DA A} {
{Decimal Adjust Accumulator}
{Arithmetic Operations}
{}
{X {} {}}
}
{ANL A, Rn} {
{AND Register to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ANL A, direct} {
{AND direct byte to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ANL A, @Ri} {
{AND indirect RAM to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ANL A, #data} {
{AND immediate data to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ANL direct, A} {
{AND Accumulator to direct byte}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ANL direct, #data} {
{AND immediate data to direct byte}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ORL A, Rn} {
{OR register to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ORL A, direct} {
{OR direct byte to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ORL A, @Ri} {
{OR indirect RAM to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ORL A, #data} {
{OR immediate data to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ORL direct, A} {
{OR Accumulator to direct byte}
{Logical Operations}
{Read-Modify-Write}
{}
}
{ORL direct, #data} {
{OR immediate data to direct byte}
{Logical Operations}
{Read-Modify-Write}
{}
}
{XRL A, Rn} {
{Exclusive-OR register to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{XRL A, direct} {
{Exclusive-OR direct byte to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{XRL A, @Ri} {
{Exclusive-OR indirect RAM to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{XRL A, #data} {
{Exclusive-OR immediate data to Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{XRL direct, A} {
{Exclusive-OR Accumulator to direct byte}
{Logical Operations}
{Read-Modify-Write}
{}
}
{XRL direct, #data} {
{Exclusive-OR immediate data to direct byte}
{Logical Operations}
{Read-Modify-Write}
{}
}
{CLR A} {
{Clear Accumulator}
{Logical Operations}
{}
{}
}
{CPL A} {
{Complement Accumulator}
{Logical Operations}
{Read-Modify-Write}
{}
}
{RL A} {
{Rotate Accumulator Left}
{Logical Operations}
{}
{}
}
{RLC A} {
{Rotate Accumulator Left through the Carry}
{Logical Operations}
{}
{X {} {}}
}
{RR A} {
{Rotate Accumulator Right}
{Logical Operations}
{}
{}
}
{RRC A} {
{Rotate Accumulator Right through the Carry}
{Logical Operations}
{}
{X {} {}}
}
{SWAP A} {
{Swap nibbles within the Accumulator}
{Logical Operations}
{}
{}
}
{MOV A, Rn} {
{Move register to Accumulator}
{Data Transfer}
{}
{}
}
{MOV A, direct} {
{Move direct byte to Accumulator}
{Data Transfer}
{}
{}
}
{MOV A, @Ri} {
{Move indirect RAM to Accumulator}
{Data Transfer}
{}
{}
}
{MOV A, #data} {
{Move immediate data to Accumulator}
{Data Transfer}
{}
{}
}
{MOV Rn, A} {
{Move Accumulator to register}
{Data Transfer}
{}
{}
}
{MOV Rn, direct} {
{Move direct byte to register}
{Data Transfer}
{}
{}
}
{MOV Rn, #data} {
{Move immediate data to register}
{Data Transfer}
{}
{}
}
{MOV direct, A} {
{Move Accumulator to direct byte}
{Data Transfer}
{}
{}
}
{MOV direct, Rn} {
{Move register to direct byte}
{Data Transfer}
{}
{}
}
{MOV direct, direct} {
{Move direct byte to direct}
{Data Transfer}
{}
{}
}
{MOV direct, @Ri} {
{Move indirect RAM to direct byte}
{Data Transfer}
{}
{}
}
{MOV direct, #data} {
{Move immediate data to direct byte}
{Data Transfer}
{}
{}
}
{MOV @Ri, A} {
{Move Accumulator to indirect RAM}
{Data Transfer}
{}
{}
}
{MOV @Ri, direct} {
{Move direct byte to indirect RAM}
{Data Transfer}
{}
{}
}
{MOV @Ri, #data} {
{Move immediate data to indirect RAM}
{Data Transfer}
{}
{}
}
{MOV DPTR, #data16} {
{Load Data Pointer with a 16-bit constant}
{Data Transfer}
{}
{}
}
{MOVC A, @A+DPTR} {
{Move Code byte relative to DPTR to Acc}
{Data Transfer}
{}
{}
}
{MOVC A, @A+PC} {
{Move Code byte relative to PC to Acc}
{Data Transfer}
{}
{}
}
{MOVX A, @Ri} {
{Move External RAM (8-bit addr) to Acc}
{Data Transfer}
{}
{}
}
{MOVX A, @DPTR} {
{Move Exernal RAM (16-bit addr) to Acc}
{Data Transfer}
{}
{}
}
{MOVX @Ri, A} {
{Move Acc to External RAM (8-bit addr)}
{Data Transfer}
{}
{}
}
{MOVX @DPTR, A} {
{Move Acc to External RAM (16-bit addr)}
{Data Transfer}
{}
{}
}
{PUSH direct} {
{Push direct byte onto stack}
{Data Transfer}
{}
{}
}
{POP direct} {
{Pop direct byte from stack}
{Data Transfer}
{}
{}
}
{XCH A, Rn} {
{Exchange register with Accumulator}
{Data Transfer}
{}
{}
}
{XCH A, direct} {
{Exchange direct byte with Accumulator}
{Data Transfer}
{}
{}
}
{XCH A, @Ri} {
{Exchange indirect RAM with Accumulator}
{Data Transfer}
{}
{}
}
{XCHD A, @Ri} {
{Exchange low-order Digit indirect RAM with Acc}
{Data Transfer}
{}
{}
}
{CLR C} {
{Clear Carry}
{Boolean Variable Manipulation}
{}
{0 {} {}}
}
{CLR bit} {
{Clear direct bit}
{Boolean Variable Manipulation}
{Read-Modify-Write}
{}
}
{SETB C} {
{Set Carry}
{Boolean Variable Manipulation}
{}
{1 {} {}}
}
{SETB bit} {
{Set direct bit}
{Boolean Variable Manipulation}
{Read-Modify-Write}
{}
}
{CPL C} {
{Complement Carry}
{Boolean Variable Manipulation}
{Read-Modify-Write}
{X {} {}}
}
{CPL bit} {
{Complement direct bit}
{Boolean Variable Manipulation}
{Read-Modify-Write}
{}
}
{ANL C, bit} {
{AND direct bit to CARRY}
{Boolean Variable Manipulation}
{Read-Modify-Write}
{X {} {}}
}
{ANL C, /bit} {
{AND complement of direct bit to Carry}
{Boolean Variable Manipulation}
{Read-Modify-Write}
{X {} {}}
}
{ORL C, bit} {
{OR direct bit to Carry}
{Boolean Variable Manipulation}
{}
{X {} {}}
}
{ORL C, /bit} {
{OR complement of direct bit to Carry}
{Boolean Variable Manipulation}
{}
{X {} {}}
}
{MOV C, bit} {
{Move direct bit to Carry}
{Boolean Variable Manipulation}
{}
{X {} {}}
}
{MOV bit, C} {
{Move Carry to direct bit}
{Boolean Variable Manipulation}
{Read-Modify-Write}
{}
}
{JC rel} {
{Jump if Carry is set}
{Boolean Variable Manipulation}
{}
{}
}
{JNC rel} {
{Jump if Carry not set}
{Boolean Variable Manipulation}
{}
{}
}
{JB bit, rel} {
{Jump if direct Bit is set}
{Boolean Variable Manipulation}
{}
{}
}
{JNB bit, rel} {
{Jump if direct Bit is Not set}
{Boolean Variable Manipulation}
{}
{}
}
{JBC bit, rel} {
{Jump if direct Bit is set & clear bit}
{Boolean Variable Manipulation}
{Read-Modify-Write}
{}
}
{ACALL addr11} {
{Absolute Subroutine Call}
{Program Branching}
{}
{}
}
{LCALL addr16} {
{Long Subroutine Call}
{Program Branching}
{}
{}
}
{RET } {
{Return from Subroutine}
{Program Branching}
{}
{}
}
{RETI } {
{Return from interrupt}
{Program Branching}
{}
{}
}
{AJMP addr11} {
{Absolute Jump}
{Program Branching}
{}
{}
}
{LJMP addr16} {
{Long Jump}
{Program Branching}
{}
{}
}
{SJMP rel} {
{Short Jump (relative addr)}
{Program Branching}
{}
{}
}
{JMP @A+DPTR} {
{Jump indirect relative to the DPTR}
{Program Branching}
{}
{}
}
{JZ rel} {
{Jump if Accumulator is Zero}
{Program Branching}
{}
{}
}
{JNZ rel} {
{Jump if Accumulator is Not Zero}
{Program Branching}
{}
{}
}
{CJNE A, direct, rel} {
{Compare direct byte to Acc and Jump if Not Equal}
{Program Branching}
{}
{X {} {}}
}
{CJNE A, #data, rel} {
{Compare immediate to Acc and Jump if Not Equal}
{Program Branching}
{}
{X {} {}}
}
{CJNE Rn, #data, rel} {
{Compare immediate to register and Jump if Not Equal}
{Program Branching}
{}
{X {} {}}
}
{CJNE @Ri, #data, rel} {
{Compare immediate to indirect and Jump if Not Equal}
{Program Branching}
{}
{X {} {}}
}
{DJNZ Rn, rel} {
{Decrement register and Jump if Not Zero}
{Program Branching}
{Read-Modify-Write}
{}
}
{DJNZ direct, rel} {
{Decrement direct byte and Jump if Not Zero}
{Program Branching}
{Read-Modify-Write}
{}
}
{NOP } {
{No Operation}
{Program Branching}
{}
{}
}
}
## PRIVATE
private variable instruction_text {} ;# Widget: ID of text widget of tab "Instruction details"
private variable instruction_menu ;# Widget: Popup menu for the text widget
private variable instruction_label ;# Widget: ID of label above instruction details
private variable header_text ;# Widget: Text header
private variable instruction_last {} ;# String: Last instruction shown in details window
private variable parent {} ;# Widget: GUI parent
private variable instd_gui_initialized 0 ;# Bool: GUI initialized
private variable gui_preparing 0 ;# Bool: Prearing panel GUI
private variable enabled 0 ;# Bool: enable procedures which are needless while loading project
private variable help_win_index 0 ;# Int: Index of help window object (just some number)
private variable ins_help_win_enabled 1 ;# Bool: Enable instruction help window
private variable ins_help_win_created 0 ;# Bool: Help window widgets are ready to be mapped by geometry manager
private variable ins_help_win_visible 0 ;# Bool: Flag help window visible
private variable ins_help_window {} ;# Widget: Help window itself
private variable help_win_title ;# Widget: Title label (should contain instruction name and operands)
## Array of Widgets: Labels containing certain information
# available keys are: description, length, execution_time, opcode, note and class
private variable help_win_labels
constructor {} {
incr instd_count
}
destructor {
}
## Prepare object for creating its GUI
# @parm Widget _parent - GUI parent widget
# @return void
public method PrepareInstructionDetails {_parent} {
set parent $_parent
set instd_gui_initialized 0
}
## Create GUI of tab "Instruction details"
# @return void
public method CreateInstructionDetailsGUI {} {
if {$instd_gui_initialized || $gui_preparing || ${::Editor::editor_to_use}} {return}
set gui_preparing 1
# Create frames
set body_frame [frame $parent.frm_rightPanel_instruction_body]
set text_frame [frame $body_frame.frm_rightPanel_instruction_txt -bd 1 -relief sunken]
set header_frame [frame $parent.frm_rightPanel_instruction_header]
# Button "Show legend"
set button [ttk::button \
$header_frame.but_rightPanel_instruction_legend \
-image ::ICONS::16::help \
-style Flat.TButton \
-command "$this rightPanel_ins_legend" \
]
DynamicHelp::add $header_frame.but_rightPanel_instruction_legend \
-text [mc "Show legend"]
pack $button -side right -fill none -expand 0
setStatusTip -widget $button -text [mc "Show legend"]
# Tab header (instruction name)
set instruction_label [label $header_frame.lbl_rightPanel_instruction_header \
-fg {#0000FF} \
-anchor w \
-padx {20px} \
-font [font create \
-weight {bold} \
-size [expr {int(-17 * $::font_size_factor)}] \
-family $::DEFAULT_FIXED_FONT \
] \
]
pack $instruction_label -side left -fill x -expand 1
setStatusTip -widget $instruction_label -text [mc "Instruction name"]
# Create popup menu for instruction text and its header
set instruction_menu [menu $text_frame.popup_menu -tearoff 0]
$instruction_menu add command -label "Configure" -compound left \
-command {::configDialogues::rightPanel::mkDialog 1} \
-underline 0 -image ::ICONS::16::configure
# Text header
set header_text [text $text_frame.txt_rightPanel_instruction_hdr \
-cursor left_ptr \
-font $instruction_font \
-bg {#DDDDDD} \
-height 1 \
-bd 0 \
-exportselection 0 \
-wrap none \
]
bind $header_text <ButtonRelease-3> "tk_popup $instruction_menu %X %Y; break"
bind $header_text <Key-Menu> "tk_popup $instruction_menu %X %Y; break"
bindtags $header_text $header_text
# Instruction details text
set instruction_text [text $text_frame.txt_rightPanel_instruction \
-yscrollcommand "$body_frame.src_rightPanel_instruction set" \
-cursor left_ptr -state disabled -wrap none \
-font $instruction_font -bd 0 -exportselection 0 \
]
# Create scrollbar
pack [ttk::scrollbar $body_frame.src_rightPanel_instruction \
-orient vertical -command "$instruction_text yview" \
] -side right -fill y
setStatusTip -widget $instruction_text -text [mc "Instruction operands"]
bind $instruction_text <ButtonRelease-3> "tk_popup $instruction_menu %X %Y; break"
bind $instruction_text <Key-Menu> "tk_popup $instruction_menu %X %Y; break"
bind $instruction_text <<Selection>> {false_selection %W}
bind $instruction_text <Motion> "$this rightPanel_ins_text_motion %x %y %X %Y"
bind $instruction_text <Leave> "+$this rightPanel_ins_hide_ins_help_window"
$instruction_text delete 1.0 end
$instruction_text tag configure tag_sel -background #CCCCFF
$instruction_text tag configure tag_sel0 -background #E0FFE0
rightPanel_refresh_instruction_highlighting
$instruction_text tag configure tag_bold -font [font create \
-size [expr {int(-12 * $::font_size_factor)}] \
-family $::DEFAULT_FIXED_FONT \
-weight {bold} \
]
# Pack parts of text frame (Instruction details text, Text header)
pack $header_text -side top -fill x
pack $instruction_text -side bottom -fill both -expand 1
pack $text_frame -side left -fill both -expand 1
# Pack all remaining frames
pack $header_frame -side top -fill x
pack $body_frame -side bottom -fill both -expand 1
set instd_gui_initialized 1
}
## Invoke legend window for "Instruction details"
# @return void
public method rightPanel_ins_legend {} {
# Destroy legend window
if {[winfo exists .rightPanel_legend]} {
grab release .rightPanel_legend
destroy .rightPanel_legend
return
}
set x [expr {[winfo pointerx .] - 380}]
set y [winfo pointery .]
# Create legend window
set win [toplevel .rightPanel_legend -class {Help} -bg ${::COMMON_BG_COLOR}]
set frame [frame $win.f -bg {#555555} -bd 0 -padx 1 -pady 1]
wm overrideredirect $win 1
# Click to close
bind $win <Button-1> "grab release $win; destroy $win"
# Create header "-- click to close --"
pack [label $frame.lbl_header \
-text [mc "-- click to close --"] \
-bg {#FFFF55} -font $::smallfont\
-fg {#000000} -anchor c \
] -side top -anchor c -fill x
# Create text widget
set text [text $frame.text \
-bg {#FFFFCC} \
-exportselection 0 \
-takefocus 0 \
-cursor left_ptr \
-bd 0 -relief flat \
]
pack $frame -fill both -expand 1
# Create text tags
$this right_panel_create_highlighting_tags $text $instruction_tags 0
$text tag configure tag_sel \
-relief raised \
-borderwidth 1 \
-background #F8F8F8
$text tag configure tag_desc
## Fill text widget
# "code8"
set idx [$text index insert]
$text insert end [mc "code8"]
$text tag add tag_code8 $idx insert
set idx [$text index insert]
$text insert end [mc "\t8 bit offset for relative jump\n"]
$text tag add tag_desc $idx insert
# "code11"
set idx [$text index insert]
$text insert end [mc "code11"]
$text tag add tag_code11 $idx insert
set idx [$text index insert]
$text insert end [mc "\t11 bit program memory address\n"]
$text tag add tag_desc $idx insert
# "code16"
set idx [$text index insert]
$text insert end [mc "code16"]
$text tag add tag_code16 $idx insert
set idx [$text index insert]
$text insert end [mc "\t16 bit program memory address\n"]
$text tag add tag_desc $idx insert
# "imm8"
set idx [$text index insert]
$text insert end [mc "imm8"]
$text tag add tag_imm8 $idx insert
set idx [$text index insert]
$text insert end [mc "\t8 bit constant data\n"]
$text tag add tag_desc $idx insert
# "imm16"
set idx [$text index insert]
$text insert end [mc "imm16"]
$text tag add tag_imm16 $idx insert
set idx [$text index insert]
$text insert end [mc "\t16 bit constant data\n"]
$text tag add tag_desc $idx insert
# "data"
set idx [$text index insert]
$text insert end [mc "data"]
$text tag add tag_data $idx insert
set idx [$text index insert]
$text insert end [mc "\tinternal data memory or SFR direct address\n"]
$text tag add tag_desc $idx insert
# "bit"
set idx [$text index insert]
$text insert end [mc "bit"]
$text tag add tag_bit $idx insert
set idx [$text index insert]
$text insert end [mc "\tbit memory direct address\n"]
$text tag add tag_desc $idx insert
$text insert end "\n"
# "DPTR"
set idx [$text index insert]
$text insert end "DPTR"
$text tag add tag_DPTR $idx insert
set idx [$text index insert]
$text insert end [mc "\tData PoinTeR register (16 bit)\n"]
$text tag add tag_desc $idx insert
# "A"
set idx [$text index insert]
$text insert end "A"
$text tag add tag_A $idx insert
set idx [$text index insert]
$text insert end [mc "\tPrimary work register\n"]
$text tag add tag_desc $idx insert
# "AB"
set idx [$text index insert]
$text insert end "AB"
$text tag add tag_AB $idx insert
set idx [$text index insert]
$text insert end [mc "\tAccumulator\n"]
$text tag add tag_desc $idx insert
$text insert end "\n"
# "R0..R7"
set idx [$text index insert]
$text insert end "R0..R7"
$text tag add tag_SFR $idx insert
set idx [$text index insert]
$text insert end [mc "\tRegisters of active bank\n"]
$text tag add tag_desc $idx insert
# "C"
set idx [$text index insert]
$text insert end "C"
$text tag add tag_SFR $idx insert
set idx [$text index insert]
$text insert end [mc "\tCarry flag\n"]
$text tag add tag_desc $idx insert
# "@R0 ..."
set idx [$text index insert]
$text insert end "@R0 ..."
$text tag add tag_indr $idx insert
set idx [$text index insert]
$text insert end [mc "\tIndirect address"]
$text tag add tag_desc $idx insert
# Show the text
$text configure -state disabled
pack $text -side bottom -fill both -expand 1
# Show the window
wm geometry $win "=380x280+$x+$y"
update
catch {
grab -global $win
}
}
## Clear instruction details window
# @return void
public method rightPanel_ins_clear {} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
if {!$instd_gui_initialized} {CreateInstructionDetailsGUI}
$instruction_text configure -state normal
$instruction_text delete 1.0 end
$instruction_text configure -state disabled
$instruction_label configure -text {}
set instruction_last {}
rightPanel_ins_hide_ins_help_window
set help_win_index 0
}
## Refresh highlighting tags in "Instruction details"
# @return void
public method rightPanel_refresh_instruction_highlighting {} {
if {${::Editor::editor_to_use}} {return}
if {!$instd_gui_initialized && !$gui_preparing} {return}
$this right_panel_create_highlighting_tags \
$instruction_text $instruction_tags 0
}
## Unset current selection in "Instruction details" window
# @return void
public method rightPanel_ins_unselect {} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
if {!$instd_gui_initialized} {return}
$instruction_text tag remove tag_sel 1.0 end
if {$::CONFIG(VALIDATION_LEVEL) == 2} {
$instruction_label configure -fg {#FF0000}
} else {
$instruction_label configure -fg {#0000FF}
}
}
## Change current selection in "Instruction details" window
# @parm Bool perfect_match - Operand matches exactly
# @parm List list_of_indexes - Lines to select (benining from zero) (eg. '0 4 9')
# @return void
public method rightPanel_ins_select {perfect_match list_of_indexes} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
if {!$instd_gui_initialized} {return}
if {[$instruction_label cget -text] == {}} {return}
$instruction_label configure -fg {#0000FF}
if {$perfect_match} {
set tag tag_sel
} else {
set tag tag_sel0
}
foreach line $list_of_indexes {
incr line
$instruction_text tag add $tag $line.0 "$line.0+1l"
}
$instruction_text see $line.0
}
## Change current directive in "Instruction details" window
# @parm Char type - 'C' == Control; 'D' == Directive
# @parm String directive - directive name
# @return void
public method rightPanel_dir_change {type directive} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
if {!$instd_gui_initialized} {return}
regsub {^\.} $directive {} directive
set directive [string tolower $directive]
if {$instruction_last == $directive} {return}
set instruction_last $directive
set ins_help_win_enabled 0
# Change content of tab header
if {$type == {D}} {
set clr {#00AADD}
} else {
set clr {#00AADD}
}
set dir_up [string toupper $directive]
$instruction_label configure -text $dir_up -fg $clr
$header_text delete 1.0 end
# Enable and clear the text widget
$instruction_text configure -state normal
$instruction_text delete 1.0 end
set idx [lsearch -ascii -exact $HELP_FOR_DIRECTIVES $directive]
if {$idx == -1} {
$instruction_text insert end [mc "no help available for this directive"]
} else {
incr idx
$instruction_text insert end [lindex $HELP_FOR_DIRECTIVES $idx]
}
# Create highlight tags
$instruction_text tag add tag_DPTR 1.0 {1.0 lineend}
$instruction_text tag add tag_AB 3.0 {3.0 lineend}
$instruction_text tag add tag_AB 6.0 {6.0 lineend}
$instruction_text tag add tag_indr {end-2l linestart} {end-2l lineend}
# Disable the widget
$instruction_text configure -state disabled
}
## Change current instruction in "Instruction details" window
# @parm String instruction - instruction name
# @return void
public method rightPanel_ins_change {instruction} {
if {!$enabled || ${::Editor::editor_to_use}} {return}
if {!$instd_gui_initialized} {return}
set instruction [string tolower $instruction]
if {$instruction_last == $instruction} {return}
set instruction_last $instruction
set ins_help_win_enabled 0
# Change content of tab header
$instruction_label configure -text [string toupper $instruction] -fg {#0000FF}
$header_text delete 1.0 end
$header_text insert 1.0 "Opr 0\tOpr 1\tOpr 2\tLen Code Time"
# Find given instruction in compilers instruction set definition
if {[lsearch -ascii -exact ${::CompilerConsts::AllInstructions} $instruction] == -1} {return}
# Enable and clear the text widget
$instruction_text configure -state normal
$instruction_text delete 1.0 end
# Display instruction details
set data {}
foreach line [lindex $::CompilerConsts::InstructionDefinition($instruction) 1] {
# Write operands
for {set i 0} {$i < 3} {incr i} {
set startIndex [$instruction_text index insert]
set opr [lindex $line [list 0 $i]]
# Adjust operand
if {[lsearch -ascii -exact {code8 code11 code16 imm8 imm16 data bit} $opr] == -1} {
set opr [string toupper $opr]
}
# Insert operand
$instruction_text insert insert $opr
$instruction_text insert insert "\t"
# Highlight operand
switch -- $opr {
{code8} { ;# 8 bit offset for relative jump
$instruction_text tag add tag_code8 $startIndex insert-1c
}
{code11} { ;# 11 bit program memory address
$instruction_text tag add tag_code11 $startIndex insert-1c
}
{code16} { ;# 16 bit program memory address
$instruction_text tag add tag_code16 $startIndex insert-1c
}
{imm8} { ;# 8 bit constant data
$instruction_text tag add tag_imm8 $startIndex insert-1c
}
{imm16} { ;# 16 bit constant data
$instruction_text tag add tag_imm16 $startIndex insert-1c
}
{data} { ;# internal data memory or SFR direct address
$instruction_text tag add tag_data $startIndex insert-1c
}
{bit} { ;# bit memory direct address
$instruction_text tag add tag_bit $startIndex insert-1c
}
{DPTR} { ;# Data PoinTeR register (16 bit)
$instruction_text tag add tag_DPTR $startIndex insert-1c
}
{A} { ;# Primary work register (Accumulator)
$instruction_text tag add tag_A $startIndex insert-1c
}
{AB} { ;# Accumulator
$instruction_text tag add tag_AB $startIndex insert-1c
}
default { ;# SFR or indirect address
# Indirect address
if {[string index $opr 0] == {@}} {
$instruction_text tag add tag_indr $startIndex insert-1c
# SFR
} else {
$instruction_text tag add tag_SFR $startIndex insert-1c
}
}
}
}
# Write length
$instruction_text insert insert " "
set startIndex [$instruction_text index insert]
set num [lindex $line 1]
$instruction_text insert insert $num
if {$num > 0 && $num < 6} {
$instruction_text tag add "tag_$num" $startIndex insert
}
# Write OP code
$instruction_text insert insert " "
$instruction_text insert insert [string toupper [lindex $line 2]]
# Write time
$instruction_text insert insert " "
set startIndex [$instruction_text index insert]
set num [lindex $line 4]
$instruction_text insert insert $num
if {$num > 0 && $num < 6} {
$instruction_text tag add "tag_$num" $startIndex insert
}
# Set last 9 characters to bold font
$instruction_text tag add tag_bold {insert-9c} insert
$instruction_text insert insert "\n"
}
# Disable the widget
$instruction_text configure -state disabled
# Update help window
if {$ins_help_win_visible} {
set idx $help_win_index
set help_win_index 0
show_ins_help_window $idx
}
set ins_help_win_enabled 1
}
## Set flag enabled
# @parm Bool bool - New value
# @return void
public method right_panel_instruction_details_set_enabled {bool} {
set enabled $bool
}
## Handles Motion event on the text widget
# @param Int x - Relative mouse pointer position
# @param Int y - Relative mouse pointer position
# @param Int X - Absolute mouse pointer position
# @param Int Y - Absolute mouse pointer position
# @return void
public method rightPanel_ins_text_motion {x y X Y} {
if {!$ins_help_win_enabled} {return}
set index [$instruction_text index @$x,$y]
set index [expr {int($index)}]
if {$help_win_index == $index} {
move_ins_help_window $X $Y
return
}
set help_win_index $index
show_ins_help_window $index
}
## Move instruction help window
# @param Int X - Absolute mouse pointer position
# @param Int Y - Absolute mouse pointer position
# @return void
private method move_ins_help_window {X Y} {
if {!$ins_help_win_visible} {
return
}
# Determinate main window geometry
set geometry [split [wm geometry .] {+}]
set limits [split [lindex $geometry 0] {x}]
# Adjust X and Y
set x_coord [expr {$X - 5 - [lindex $geometry 1]}]
set y_coord [expr {$Y - 20 - [lindex $geometry 2]}]
if {$y_coord > ([lindex $limits 1] - 220)} {incr y_coord -240}
# Show the window
catch {
place $ins_help_window -anchor ne -x $x_coord -y $y_coord -width 300
raise $ins_help_window
}
}
## Show instruction help window
# @param Int index - Line number
# @return void
private method show_ins_help_window {index} {
# Create help window widget
if {!$ins_help_win_created} {
create_ins_help_window
}
# Hide window if there is nothing to show
if {[$instruction_text compare $index.0 == end]} {
rightPanel_ins_hide_ins_help_window
return
}
# Set help window visibility flag
set ins_help_win_visible 1
# Determinate instruction name (and possibly abort the process)
incr index -1
set instruction [string tolower [$instruction_label cget -text]]
if {![string length $instruction]} {
rightPanel_ins_hide_ins_help_window
return
}
# Check if the instruction is really an instruction
if {[lsearch -ascii -exact ${::CompilerConsts::AllInstructions} $instruction] == -1} {return}
# Modify instruction name if nessesary
switch -- $instruction {
{jmp} {
switch -- $index {
1 {set instruction {ljmp}}
2 {set instruction {ajmp}}
3 {set instruction {sjmp}}
}
set index 0
}
}
# Obtain detailed informations about the instruction
set operands_tmp [list]
set instruction_def [lindex $::CompilerConsts::InstructionDefinition($instruction) [list 1 $index]]
set operands [lindex $instruction_def 0]
foreach operand $operands {
switch -glob -- $operand {
a -
c -
ab -
@dptr -
@a+dptr -
@a+pc -
dptr {
set operand [string toupper $operand]
}
r? {
set operand {Rn}
}
@r? {
set operand {@Ri}
}
imm8 {
set operand {#data}
}
imm16 {
set operand {#data16}
}
code8 {
set operand {rel}
}
code11 {
set operand {addr11}
}
code16 {
set operand {addr16}
}
bit {
set operand {bit}
}
/bit {
set operand {/bit}
}
data {
set operand {direct}
}
}
lappend operands_tmp $operand
}
set operands [join $operands_tmp {, }]
set instruction [string toupper $instruction]
# Modify detailed informations
set title "$instruction\t$operands"
set ins_length [lindex $instruction_def 1]
set opcode [string toupper [lindex $instruction_def 2]]
if {[string length $ins_length]} {
append opcode [string repeat {-} [expr {($ins_length - 1) * 2}]]
}
set ins_description [lsearch -ascii -exact $INSTRUCTION_DESCRIPTION $title]
if {$ins_description == -1} {
rightPanel_ins_hide_ins_help_window
return
}
incr ins_description
set ins_description [lindex $INSTRUCTION_DESCRIPTION $ins_description]
# Fill in the help window
$help_win_title configure -text $title
$help_win_labels(description) configure -text [mc [lindex $ins_description 0]]
$help_win_labels(length) configure -text $ins_length
$help_win_labels(execution_time) configure -text [lindex $instruction_def 4]
$help_win_labels(opcode) configure -text "0x$opcode"
$help_win_labels(note) configure -text [mc [lindex $ins_description 2]]
$help_win_labels(class) configure -text [mc [lindex $ins_description 1]]
foreach i_0 {0 1 2 } \
i_1 {C OV AC } \
i_2 {C_l OV_l AC_l } \
{
set txt [lindex $ins_description [list 3 $i_0]]
switch -- $txt {
X {set clr {#00AAFF}}
0 {set clr {#DD0000}}
1 {set clr {#00CC00}}
default {set clr {#888888}}
}
$help_win_labels($i_1) configure -text $txt -fg $clr
$help_win_labels($i_2) configure -fg $clr
}
}
## Hide instruction help window
# @return void
public method rightPanel_ins_hide_ins_help_window {} {
if {!$ins_help_win_visible} {
return
}
set help_win_index 0
set ins_help_win_visible 0
catch {
place forget $ins_help_window
}
}
## Create instruciton help window
# @return void
private method create_ins_help_window {} {
if {$ins_help_win_created} {
return
}
set ins_help_win_created 1
# Create main parts of the window
incr instd_count
set ins_help_window [frame .ins_help_window${instd_count} -bd 0 -bg {#BBBBFF} -padx 2 -pady 2]
pack [frame $ins_help_window.top -bg {#BBBBFF}] -fill x -expand 1
pack [label $ins_help_window.top.img -bg {#BBBBFF} -image ::ICONS::16::info] -side left
pack [label $ins_help_window.top.tit -bg {#BBBBFF} -justify left -anchor w] -side left -fill x -expand 1
pack [frame $ins_help_window.msg -bg {#FFFFFF} -padx 10 -pady 5] -fill both -expand 1
set help_win_title "${ins_help_window}.top.tit"
## Create other parts of the window
# Descripton
set i 0
set help_win_labels(description) [ \
label $ins_help_window.msg.r_$i \
-pady 0 -bg {#FFFFFF} \
-highlightthickness 0 \
-wraplength 260 -justify left \
]
grid $help_win_labels(description) -row $i -column 0 -columnspan 2 -sticky w
incr i
# - (separator)
grid [ttk::separator $ins_help_window.msg.sep \
-orient horizontal \
] -row $i -column 0 -columnspan 2 -sticky we
# Class
incr i
grid [label $ins_help_window.msg.l_$i \
-pady 0 -fg {#0000AA} \
-bg {#FFFFFF} \
-highlightthickness 0 \
-text [mc "Class:"] \
] -row $i -column 0 -sticky w
set help_win_labels(class) [ \
label $ins_help_window.msg.r_$i \
-pady 0 -bg {#FFFFFF} \
-highlightthickness 0 \
]
grid $help_win_labels(class) -row $i -column 1 -sticky w
incr i
# Flags
grid [label $ins_help_window.msg.l_$i \
-pady 0 -fg {#0000AA} \
-highlightthickness 0 \
-text [mc "Flags:"] \
-bg {#FFFFFF} \
] -row $i -column 0 -sticky nw
set flags_frm [frame $ins_help_window.msg.flags_frm \
-bg {#888888} \
]
grid $flags_frm -row $i -column 1 -sticky w
incr i
# Length
grid [label $ins_help_window.msg.l_$i \
-pady 0 -fg {#0000AA} \
-highlightthickness 0 \
-text [mc "Length:"] \
-bg {#FFFFFF} \
] -row $i -column 0 -sticky w
set help_win_labels(length) [ \
label $ins_help_window.msg.r_$i \
-pady 0 -bg {#FFFFFF} \
-highlightthickness 0 \
]
grid $help_win_labels(length) -row $i -column 1 -sticky w
incr i
# Time
grid [label $ins_help_window.msg.l_$i \
-pady 0 -fg {#0000AA} \
-highlightthickness 0 \
-text [mc "Time:"] \
-bg {#FFFFFF} \
] -row $i -column 0 -sticky w
set help_win_labels(execution_time) [ \
label $ins_help_window.msg.r_$i \
-pady 0 -bg {#FFFFFF} \
-highlightthickness 0 \
]
grid $help_win_labels(execution_time) -row $i -column 1 -sticky w
incr i
# OPCODE
grid [label $ins_help_window.msg.l_$i \
-pady 0 -fg {#0000AA} \
-highlightthickness 0 \
-text [mc "OPCODE:"] \
-bg {#FFFFFF} \
] -row $i -column 0 -sticky w
set help_win_labels(opcode) [ \
label $ins_help_window.msg.r_$i \
-pady 0 -bg {#FFFFFF} \
-highlightthickness 0 \
]
grid $help_win_labels(opcode) -row $i -column 1 -sticky w
incr i
# Note
grid [label $ins_help_window.msg.l_$i \
-pady 0 -fg {#0000AA} \
-highlightthickness 0 \
-text [mc "Note:"] \
-bg {#FFFFFF} \
] -row $i -column 0 -sticky w
set help_win_labels(note) [ \
label $ins_help_window.msg.r_$i \
-pady 0 -bg {#FFFFFF} \
-highlightthickness 0 \
]
grid $help_win_labels(note) -row $i -column 1 -sticky w
## Table of flags
# Flag C
set help_win_labels(C_l) [ \
label $flags_frm.ll_C \
-bg {#FFFFFF} \
-pady 0 \
-highlightthickness 0 \
-text "C" \
]
grid $help_win_labels(C_l) -row 0 -column 0 -sticky nswe -padx 1 -pady 1
set help_win_labels(C) [ \
label $flags_frm.lr_C \
-bg {#FFFFFF} \
-pady 0 \
-highlightthickness 0 \
]
grid $help_win_labels(C) -row 1 -column 0 -sticky nswe -padx 1 -pady 1
# Flag OV
set help_win_labels(OV_l) [ \
label $flags_frm.ll_OV \
-bg {#FFFFFF} \
-pady 0 \
-highlightthickness 0 \
-text "OV" \
]
grid $help_win_labels(OV_l) -row 0 -column 1 -sticky nswe -padx 1 -pady 1
set help_win_labels(OV) [ \
label $flags_frm.lr_OV \
-bg {#FFFFFF} \
-pady 0 \
-highlightthickness 0 \
]
grid $help_win_labels(OV) -row 1 -column 1 -sticky nswe -padx 1 -pady 1
# Flag AC
set help_win_labels(AC_l) [ \
label $flags_frm.ll_AC \
-bg {#FFFFFF} \
-pady 0 \
-highlightthickness 0 \
-text "AC" \
]
grid $help_win_labels(AC_l) -row 0 -column 2 -sticky nswe -padx 1 -pady 1
set help_win_labels(AC) [ \
label $flags_frm.lr_AC \
-bg {#FFFFFF} -bd 1 \
-pady 0 \
-highlightthickness 0 \
]
grid $help_win_labels(AC) -row 1 -column 2 -sticky nswe -padx 1 -pady 1
# (finalize creation of table of flags)
grid columnconfigure $ins_help_window.msg 0 -minsize 80
grid columnconfigure $ins_help_window.msg 1 -weight 1
}
proc initialize {} {
set l [llength $HELP_FOR_DIRECTIVES_RAW]
for {set i 0; set j 1} {$i < $l} {incr i 2; incr j 2} {
lappend HELP_FOR_DIRECTIVES [lindex $HELP_FOR_DIRECTIVES_RAW $i]
lappend HELP_FOR_DIRECTIVES [mc [subst [lindex $HELP_FOR_DIRECTIVES_RAW $j]]]
}
}
}
# Initialize
::InstructionDetails::initialize
# >>> File inclusion guard
}
# <<< File inclusion guard
|