ericmatteson...@hotmail.com
unread,May 11, 2012, 11:00:06 PM5/11/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
1009 REM This is the FIRST LINE of this program.
1010 REM Permission is granted to copy
1011 REM This lbasm3.bas assembler program.
1012 REM No Warranty.
1018 REM lbasm3.txt from basm3.txt
1020 REM basm3.txt from basm2.txt
1030 REM remember to vote against reinstating
1031 REM the U.S. military draft !
1041 REM based on free assembler program BASM
1042 REM written by Eric Matteson
1078 DIM comchr(0) AS STRING*1
1080 DIM linesymms(0 to 511) AS STRING*1
1081 DIM bigsym(0 to 28671) AS STRING*1
1082 DIM fourbres(0 to 4) AS INTEGER
1083 DIM mdregrtm(0 to 127) AS STRING*1
1084 DIM lensyms(32) AS INTEGER
1085 DIM isthold(0 to 80) AS INTEGER
1086 DIM lenregrtm(8) AS INTEGER
1088 bigsymlim&=28671
1182 topen&=0
1183 tclose&=0
1184 GOTO 4000
1186 REM curchr$ validc& linepat& mdpat&
1187 REM lrepeat& btwofour&
1188 REM 1200 SUBROUTINE GETLINE
1189 REM acline$ aclen& acsub& acsuc&
1190 REM acsud& acsue& brbase& brloc& brsub&
1200 acsub&=0
1201 eoft&=0
1202 linesymms(acsub&)=CHR$(0)
1204 acsub&=acsub&+1
1206 IF acsub&<512 THEN GOTO 1202
1207 lrepeat&=0
1208 acsub&=0
1210 mdregrtm(acsub&)=CHR$(0)
1212 acsub&=acsub&+1
1214 IF acsub&<128 THEN GOTO 1210
1216 acsub&=0
1218 acsub&=acsub&+1
1220 acsuc&=acsub&+8
1222 acsud&=acsub&+16
1224 acsue&=acsub&+24
1226 lensyms(acsub&)=0
1228 lensyms(acsuc&)=0
1230 lensyms(acsud&)=0
1232 lensyms(acsue&)=0
1234 lenregrtm(acsub&)=0
1236 IF acsub&<8 THEN GOTO 1218
1248 IF EOF(1) THEN GOTO 1278
1250 LINE INPUT #1,acline$
1251 sln&=sln&+1
1252 aclen&=LEN(acline$)
1253 IF aclen&<1 THEN GOTO 1248
1254 brbase&=0
1255 acsue&=0
1256 acsub&=0
1262 acsub&=acsub&+1
1264 curchr$=mid$(acline$,acsub&,1)
1266 IF curchr$=";" THEN GOTO 1272
1268 acsue&=acsue&+1
1270 IF acsue&<aclen& THEN GOTO 1262
1272 aclen&=acsue&
1274 IF aclen&<1 THEN GOTO 1248
1276 GOTO 1281
1278 eoft&=1
1279 aclen&=0
1280 REM RETURN aclen& acline$ eoft&=0
1281 acsub&=0
1282 RETURN
1288 REM 1290 get character from acline$
1290 validc&=1
1291 curtype&=0
1292 IF lrepeat&=0 GOTO 1346
1294 REM RETURN validc& curchr$ curtype& acsub&++
1296 IF curchr$<CHR$(48) THEN GOTO 1304
1298 IF curchr$>CHR$(57) THEN GOTO 1304
1300 curtype&=1
1302 GOTO 1340
1303 REM 0-9,A-H |||| I-Z
1304 IF curchr$ < CHR$(65) THEN GOTO 1307
1305 IF curchr$ > CHR$(72) THEN GOTO 1307
1306 GOTO 1300
1307 IF curchr$ > CHR$(104) THEN GOTO 1310
1308 IF curchr$ < CHR$(97) THEN GOTO 1310
1309 GOTO 1300
1310 IF curchr$ = CHR$(95) THEN GOTO 1320
1311 REM add alphabetic characters here
1315 IF curchr$ > CHR$(90) THEN GOTO 1318
1316 IF curchr$ < CHR$(73) THEN GOTO 1318
1317 GOTO 1320
1318 IF curchr$ > CHR$(122) THEN GOTO 1328
1319 IF curchr$ < CHR$(105) THEN GOTO 1328
1320 curtype&=2
1321 REM 105 i 122 z 104 h 97 a
1322 GOTO 1302
1324 curtype&=3
1326 GOTO 1302
1327 REM blank []"+
1328 IF curchr$=CHR$(20) THEN GOTO 1326
1330 IF curchr$=CHR$(91) THEN GOTO 1324
1332 IF curchr$=CHR$(93) THEN GOTO 1324
1334 IF curchr$=CHR$(34) THEN GOTO 1324
1335 IF curchr$=CHR$(42) THEN GOTO 1324
1336 IF curchr$=CHR$(43) THEN GOTO 1324
1338 GOTO 1326
1340 lrepeat&=0
1344 RETURN
1346 curchr$=CHR$(32)
1348 acsub&=acsub&+1
1350 IF acsub&>aclen& THEN GOTO 1354
1352 GOTO 1358
1354 validc&=0
1356 GOTO 1296
1358 curchr$=MID$(acline$,acsub&,1)
1360 GOTO 1296
1368 REM 1370 get next symbol to linesymms
1369 REM symvalid& symbtype&
1370 symvalid&=1
1371 symbtype&=0
1372 GOSUB 1290
1374 IF validc&=0 THEN GOTO 1416
1376 IF curtype&=0 THEN GOTO 1372
1378 IF curtype&=3 THEN GOTO 1418
1380 REM curtype&== 1 or 2
1390 IF acsub& < 2 THEN GOTO 1394
1392 brbase&=brbase&+16
1393 symbtype&=0
1394 brloc&=2
1396 brsub&=brloc&+brbase&
1398 brloc&=brloc&+1
1400 linesymms(brsub&)=curchr$
1401 IF curtype&>symbtype& THEN symbtype&=curtype&
1402 prvchr$=curchr$
1403 GOSUB 1290
1404 IF brloc&<>3 THEN GOTO 1408
1405 IF prvchr$<CHR$(58) THEN GOTO 1408
1406 symbtype&=2
1407 REM first character <= 9 for symbtype&=1
1408 IF curtype&=2 THEN GOTO 1396
1409 IF curtype&=1 THEN GOTO 1396
1410 IF curtype&<3 THEN GOTO 1412
1411 lrepeat&=1
1412 linesymms(brbase&+1)=chr$(brloc&-2)
1414 linesymms(brbase&)=chr$(symbtype&)
1415 GOTO 1446
1416 symvalid&=0
1417 GOTO 1415
1418 brbase&=brbase&+16
1419 IF curchr$=CHR$(34) THEN GOTO 1428
1420 linesymms(brbase&)=CHR$(3)
1422 linesymms(brbase&+1)=CHR$(1)
1424 linesymms(brbase&+2)=curchr$
1426 GOTO 1415
1428 brsub&=brbase&+2
1429 linesymms(brbase&)=chr$(2)
1430 brloc&=0
1432 GOSUB 1290
1434 IF curchr$=CHR$(34) THEN GOTO 1444
1436 linesymms(brsub&)=curchr$
1438 brsub&=brsub&+1
1440 brloc&=brloc&+1
1442 GOTO 1432
1444 linesymms(brbase&+1)=CHR$(brloc&)
1446 RETURN
1458 REM 1460 get group of symbols from
1459 REM already existing line
1460 brbase&=0
1461 regbase&=0
1462 GOSUB 1370
1463 IF symvalid&=1 THEN GOTO 1462
1464 brbase&=0
1465 xrbase&=0
1466 otherop&=0
1467 brbase&=brbase&+16
1469 mrchk$=linesymms(brbase&)
1471 IF mrchk$=CHR$(0) THEN GOTO 1500
1472 IF mrchk$<>CHR$(3) THEN GOTO 1467
1473 mrchk$=linesymms(brbase&+2)
1475 IF mrchk$<>CHR$(91) THEN GOTO 1467
1476 otherop&=brbase&-16
1477 xrbase&=brbase&
1478 brbase&=brbase&+16
1479 mrsub&=0
1483 mrui$=linesymms(brbase&+2)
1484 IF mrui$=CHR$(93) THEN GOTO 1494
1485 mrl&=mrsub&+regbase&
1486 mrr&=brbase&+mrsub&
1487 mrc$=linesymms(mrr&)
1488 mdregrtm(mrl&)=mrc$
1489 mrsub&=mrsub&+1
1490 IF mrsub&<16 THEN GOTO 1485
1491 regbase&=regbase&+16
1493 GOTO 1478
1494 mrc$=linesymms(brbase&+16)
1495 IF xrbase&=0 THEN GOTO 1500
1496 IF mrc$=CHR$(0) THEN GOTO 1500
1497 otherop&=brbase&+16
1500 linepat&=0
1501 brbase&=0
1502 lasttype&=0
1503 lastpos&=0
1505 brbase&=brbase&+16
1506 mrc$=linesymms(brbase&)
1508 IF mrc$=CHR$(0) THEN GOTO 1516
1509 lasttype&=ASC(mrc$)
1510 lastpos&=brbase&
1511 IF brbase&>112 THEN GOTO 1515
1512 IF xrbase&<>0 THEN GOTO 1515
1513 linepat&=linepat&*4
1514 linepat&=linepat&+lasttype&
1515 GOTO 1505
1516 mdpat&=0
1518 regbase&=0
1520 mrc$=mdregrtm(regbase&)
1521 regbase&=regbase&+16
1522 IF mrc$=CHR$(0) THEN GOTO 1532
1524 mdpat&=mdpat&*4
1526 mdpat&=mdpat&+ASC(mrc$)
1527 REM Also returns with lastpos& lasttype&
1528 GOTO 1520
1529 REM returns with xrbase& mdregrtm linesymms
1530 REM mdpat& linepat& otherop&
1532 RETURN
1538 REM 1540 positive integer divide drem&
1539 REM dfrac&=dnumer&/denom&
1540 dfrac&=dnumer&/denom&
1541 IF dfrac&>=cst8m& AND denom&=256 THEN dfrac&=dfrac&-1
1542 IF dnumer& >= 0 THEN dprod&=dfrac&*denom&
1544 drem&=dnumer&-dprod&
1546 IF drem&<0 THEN GOTO 1550
1548 GOTO 1554
1550 dfrac&=dfrac&-1
1552 IF dnumer& >= 0 THEN GOTO 1541
1554 RETURN
1557 REM 1560 get iml&,imh&,ddimed& imhh& imhhh& imzf&
1559 REM USING dnbase&={16,10} incoming dlbase&
1560 dqrneg&=0
1561 dqval&=0
1562 dlptr&=dlbase&+2
1563 ddimed&=0
1564 dnbase&=16
1565 IF dlptr&>1023 THEN GOTO 1568
1566 dlren$=linesymms(dlptr&)
1567 GOTO 1569
1568 dlren$=mdregrtm(dlptr&-1024)
1569 dlptr&=dlptr&+1
1570 wdigit&=ASC(dlren$)
1571 IF wdigit&=72 OR wdigit&=104 THEN GOTO 1606
1572 IF wdigit&=103 OR wdigit&=71 THEN GOTO 1592
1573 IF wdigit&<65 THEN GOTO 1589
1574 IF wdigit&>70 THEN GOTO 1586
1575 ddigit&=(wdigit&-65)+10
1576 dqval&=1
1577 IF ddimed& < cst128m& THEN ddimed&=ddimed&*dnbase&
1578 IF ddimed& < cst128m& OR dqrneg&>=2 THEN goto 1581
1579 dqrneg&=dqrneg&+1
1580 IF dqrneg& >= 2 THEN goto 1561
1581 IF dqrneg& <= 1 THEN ddimed&=ddimed&+ddigit&
1582 IF dqrneg& <= 1 OR ddimed&<>0 THEN GOTO 1584
1583 IF ddigit&=0 AND dqval&=0 THEN GOTO 1585
1584 IF dqrneg&>=2 THEN ddimed&=ddimed&+(dnbase&-1)-ddigit&
1585 GOTO 1565
1586 IF wdigit&<97 OR wdigit&>102 THEN GOTO 1610
1587 ddigit&=(wdigit&-97)+10
1588 GOTO 1576
1589 IF wdigit&<48 OR wdigit&>57 THEN GOTO 1610
1590 ddigit&=wdigit&-48
1591 GOTO 1577
1592 dnbase&=ddimed&
1593 ddimed&=0
1594 IF dlptr&>1023 THEN GOTO 1597
1595 dlren$=linesymms(dlptr&)
1596 GOTO 1598
1597 dlren$=mdregrtm(dlptr&-1024)
1598 dlptr&=dlptr&+1
1599 wdigit&=ASC(dlren$)
1600 IF wdigit&<48 THEN GOTO 1611
1601 IF wdigit&>55 THEN GOTO 1611
1602 ddigit&=wdigit&-48
1603 ddimed&=ddimed&*dnbase&
1604 ddimed&=ddimed&+ddigit&
1605 GOTO 1594
1606 IF dqrneg& >= 2 THEN ddimed&=(0-1)-ddimed&
1607 goto 1611
1610 IF dqval&=0 THEN GOTO 1612
1611 GOTO 1630
1612 dlptr&=dlbase&+2
1613 dnbase&=10
1614 ddimed&=0
1615 IF dlptr&>1023 THEN GOTO 1618
1616 dlren$=linesymms(dlptr&)
1617 GOTO 1619
1618 dlren$=mdregrtm(dlptr&-1024)
1619 dlptr&=dlptr&+1
1620 wdigit&=ASC(dlren$)
1621 IF wdigit&<48 THEN GOTO 1611
1622 IF wdigit&>57 THEN GOTO 1611
1623 ddigit&=wdigit&-48
1624 ddimed&=ddimed&*dnbase&
1625 ddimed&=ddimed&+ddigit&
1626 GOTO 1615
1628 REM 1630 get iml& imh& FROM ddimed&
1630 IF ddimed& < 0 THEN GOTO 1633
1631 dnumer&=ddimed&
1632 GOTO 1634
1633 dnumer&=(0-(ddimed&+1))
1634 aagctr& = 0
1635 IF(aagctr& > 3)THEN GOTO 1644
1636 denom&=256
1637 GOSUB 1540
1638 fourbres[aagctr&]=255-drem&
1639 IF(ddimed& < 0)THEN GOTO 1641
1640 fourbres[aagctr&]=drem&
1641 dnumer& = dfrac&
1642 aagctr& = aagctr& + 1
1643 GOTO 1635
1644 imzf&=0
1645 imhh& = fourbres(2)
1646 imhhh& = fourbres(3)
1647 iml& = fourbres(0)
1648 imh& = fourbres(1)
1649 RETURN
1650 rbase&=16
1651 rtlim&=LEN(rcmpval$)
1652 rtsub&=0
1653 tcmpval&=0
1654 rtsub&=rtsub&+1
1655 REM 1650 GET tcmpval& from rcmpval$
1656 IF rtlim&<rtsub& THEN GOTO 1684
1658 rrcmpc$=MID$(rcmpval$,rtsub&,1)
1659 rrcmp&=ASC(rrcmpc$)
1660 IF rrcmp&=ASC("H") THEN GOTO 1684
1662 IF rrcmp&=ASC("G") THEN GOTO 1680
1665 IF rrcmp&<ASC("A") THEN GOTO 1672
1666 IF rrcmp&>ASC("F") THEN GOTO 1684
1667 tidgit&=rrcmp&-55
1668 tcmpval&=tcmpval&*rbase&
1669 tcmpval&=tcmpval&+tidgit&
1670 GOTO 1654
1672 IF rrcmp&<ASC("0") THEN GOTO 1684
1674 IF rrcmp&>ASC("9") THEN GOTO 1684
1676 tidgit&=rrcmp&-48
1678 GOTO 1668
1680 rbase&=tcmpval&
1682 GOTO 1653
1684 RETURN
1686 REM 1690 GET regindex& regnumber& regtype&
1687 REM FROM regbase&
1690 IF regbase&>1023 THEN GOTO 1696
1692 rreglec$=linesymms(regbase&+1)
1694 GOTO 1698
1696 rreglec$=mdregrtm(regbase&+1-1024)
1698 rreglen&=ASC(rreglec$)
1699 regnumber&=0
1700 regtype&=1777
1701 IF btwofour& <> 4 THEN GOTO 1703
1702 IF rreglen&=3 THEN GOTO 1707
1703 IF rreglen&=2 THEN GOTO 1707
1704 regnumber&=1777
1705 regindex&=1777
1706 GOTO 1756
1707 listreg$="R0R1R2R3R4R5R6R7AXCXDXBXSPBPSIDI"
1710 listreg$=listreg$+"ALCLDLBLAHCHDHBHESCSSSDSRCRDRERF!!"
1713 GOTO 1716
1714 regnumber&=regnumber&+1
1716 lregbase&=regnumber&+regnumber&+1
1718 rilop&=0
1720 IF regbase&>1023 THEN GOTO 1726
1722 cregchr$=linesymms(regbase&+rilop&+rreglen&)
1724 GOTO 1728
1726 cregchr$=mdregrtm(rreglen&+regbase&+rilop&-1024)
1728 rregchr&=ASC(cregchr$)
1730 tregchr$=MID$(listreg$,(lregbase&+rilop&),1)
1732 loregchr&=ASC(tregchr$)
1733 IF loregchr&=ASC("!") THEN GOTO 1704
1734 IF rregchr&<97 THEN GOTO 1740
1736 IF rregchr&>122 THEN GOTO 1740
1738 loregchr&=loregchr&+32
1740 rilop&=rilop&+1
1744 IF loregchr&<>rregchr& THEN GOTO 1714
1746 IF rilop&<2 THEN GOTO 1720
1748 denom&=8
1750 dnumer&=regnumber&
1752 GOSUB 1540
1754 regtype&=dfrac&
1755 regindex&=drem&
1756 RETURN
1758 REM 1760 GET mduuuram&, xxregxxx& emw& emd& emsize&
1759 REM offsetloc& segerror&
1760 mduuuram&=1024
1761 ssdexbas& = 0
1762 xxregxxx&=1024
1764 emw&=1024
1766 emd&=1024
1768 emsize&=0
1769 offsetloc&=2048
1770 segerror&=0
1774 IF xrbase&<>0 THEN GOTO 1819
1776 REM unbracketed cases 1783 reg,imed 1798 reg,reg
1778 IF lasttype&=2 THEN GOTO 1798
1780 IF lasttype&=1 THEN GOTO 1783
1781 REM 1789 1792. 1787. is mduuuram& right register
1782 GOTO 2066
1783 regbase&=lastpos&-16
1784 GOSUB 1690
1785 IF regtype&=1777 THEN GOTO 1782
1786 IF segerror&<>0 THEN GOTO 1794
1787 IF regtype&<3 THEN GOTO 1794
1788 segerror&=2
1789 emd&=0
1790 xxregxxx&=regindex&*8
1791 regindex&=poindex&
1794 mduuuram&=regindex&+192
1795 emw&=2-regtype&
1796 emsize&=1
1797 GOTO 1782
1798 regbase&=lastpos&-16
1799 GOSUB 1690
1800 IF regtype&=1777 THEN GOTO 1782
1801 emd&=1
1802 IF regtype&<3 THEN GOTO 1805
1803 segerror&=1
1804 emd&=1
1805 xxregxxx&=regindex&*8
1806 regbase&=lastpos&
1807 pregtype&=regtype&
1808 poindex&=regindex&
1809 GOSUB 1690
1810 IF regtype&>2 THEN GOTO 1813
1811 IF regindex&=0 THEN GOTO 1813
1812 regtype&=pregtype&
1813 GOTO 1785
1814 REM BRACKETED [MDREGR/M]
1815 REM [],imed lasttype&=1 emw& widthcheck
1816 REM linesymms(xrbase&-16+2)="B" or "b"
1817 REM reg,[] emd&=1 lasttype&=3 [] otherop& not register
1818 REM [],reg emd&=0 lasttype&=2 [] otherop& not register
1819 IF lasttype&<>1 THEN GOTO 1836
1820 xybase&=xrbase&-16
1821 emw&=1
1822 xychr$=linesymms(xybase&+2)
1824 IF xychr$=CHR$(66) THEN GOTO 1830
1826 IF xychr$=CHR$(98) THEN GOTO 1830
1828 GOTO 1834
1830 emw&=0
1834 GOTO 1884
1836 regbase&=otherop&
1838 GOSUB 1690
1840 IF regtype&=1777 THEN GOTO 1858
1842 xxregxxx&=regindex&*8
1844 emd&=1
1846 IF otherop&<xrbase& THEN GOTO 1850
1848 emd&=0
1850 emw&=1
1852 IF regtype&<2 THEN GOTO 1858
1854 IF regtype&=3 THEN GOTO 1860
1856 emw&=0
1858 GOTO 1884
1860 segerror&=emd&+1
1862 GOTO 1856
1864 REM case absolute offset [8888] mdpat&=1
1866 REM case reg+absolute offset [R?+8888] mdpat&=231
1867 REM base four
1868 REM one reg+reg+ absolute offset
1869 REM [R?+R?+8888] mdpat&=23231
1870 REM CASE [nonregister] mdpat&=2
1872 REM case 1872 [reg+nonregister] mdpat&=232 to 231
1874 REM one [reg+reg+nonregister] mdpat&=23232
1876 REM case [register] mdpat&=2
1878 REM case 1878 [register+register] mdpat& stays 232
1884 rcmpval$="4G1"
1886 GOSUB 1650
1888 IF tcmpval&<>mdpat& THEN GOTO 1896
1889 IF btwofour& = 4 THEN GOTO 5136
1890 offsetloc&=0+1024
1892 mduuuram&=6
1893 emsize&=3
1894 GOTO 1782
1896 rcmpval$="4G231"
1898 GOSUB 1650
1900 IF tcmpval&<>mdpat& THEN GOTO 1934
1901 IF btwofour& = 4 THEN GOTO 5095
1903 REM mdpat&=231
1904 regbase&=1024
1906 GOSUB 1690
1908 IF regindex&<>6 THEN GOTO 1916
1910 mduuuram&=128+4
1912 offsetloc&=1024+32
1914 GOTO 1893
1916 IF regindex&<>7 THEN GOTO 1922
1918 mduuuram&=128+5
1920 GOTO 1912
1922 IF regindex&<>5 THEN GOTO 1928
1924 mduuuram&=128+6
1926 GOTO 1912
1928 IF regindex&<>3 THEN GOTO 1782
1930 mduuuram&=128+7
1932 GOTO 1912
1934 rcmpval$="4G23231"
1935 gosub 1650
1936 IF (tcmpval&+1)=mdpat& THEN GOTO 1942
1938 IF tcmpval&<>mdpat& THEN GOTO 1985
1942 regbase&=1024
1943 IF btwofour& = 4 THEN GOTO 5126
1944 GOSUB 1690
1946 pegindex&=regindex&
1948 regbase&=1024+32
1950 GOSUB 1690
1952 IF pegindex&=3 THEN GOTO 1958
1954 IF pegindex&=5 THEN GOTO 1974
1956 GOTO 1782
1958 IF regindex&<>6 THEN GOTO 1966
1960 mduuuram&=128+0
1962 offsetloc&=1024+64
1964 GOTO 1893
1966 IF regindex&<>7 THEN GOTO 1782
1968 mduuuram&=128+1
1972 GOTO 1962
1974 IF regindex&<>6 THEN GOTO 1980
1976 mduuuram&=128+2
1978 GOTO 1962
1980 IF regindex&<>7 THEN GOTO 1782
1981 mduuuram&=128+3
1982 GOTO 1962
1985 rcmpval$="4G232"
1986 GOSUB 1650
1987 IF tcmpval&<>mdpat& THEN GOTO 2034
1988 regbase&=1024
1989 IF btwofour& = 4 THEN GOTO 5095
1990 GOSUB 1690
1992 pegindex&=regindex&
1994 regbase&=1024+32
1996 GOSUB 1690
1997 IF regtype&=1777 THEN GOTO 1904
1998 IF pegindex&=3 THEN GOTO 2004
2000 IF pegindex&=5 THEN GOTO 2020
2002 GOTO 1782
2004 IF regindex&<>6 THEN GOTO 2014
2006 mduuuram&=0
2008 REM no offsetloc& in [reg+reg]
2010 emsize&=1
2012 GOTO 1782
2014 IF regindex&<>7 THEN GOTO 1904
2016 mduuuram&=1
2018 GOTO 2010
2020 IF regindex&<>6 THEN GOTO 2028
2024 mduuuram&=2
2026 GOTO 2010
2028 IF regindex&<>7 THEN GOTO 1904
2030 mduuuram&=3
2032 GOTO 2010
2034 rcmpval$="4G2"
2036 GOSUB 1650
2038 IF tcmpval&<>mdpat& THEN GOTO 5023
2039 IF btwofour& = 4 THEN GOTO 5109
2040 regbase&=1024+0
2042 GOSUB 1690
2044 IF regindex&<>6 THEN GOTO 2054
2046 mduuuram&=4
2048 REM offsetloc& is not used in [reg]
2050 GOTO 2010
2054 IF regindex&<>7 THEN GOTO 2060
2056 mduuuram&=5
2058 GOTO 2050
2060 IF regindex&<>3 THEN GOTO 1890
2062 mduuuram&=7
2064 GOTO 2050
2065 REM 2066 old return without [ ],imed
2066 ddimed&=0
2068 iml&=0
2070 imh&=0
2072 onereg&=1024
2074 IF lasttype&<>1 THEN GOTO 2096
2076 IF xrbase&=0 THEN GOTO 2090
2078 harbase&=xrbase&-16
2080 harbw$=linesymms(harbase&+2)
2082 emw&=1
2084 IF harbw$=CHR$(66) THEN GOTO 2088
2085 IF harbw$=CHR$(98) THEN GOTO 2088
2086 GOTO 2090
2088 emw&=0
2090 dlbase&=lastpos&
2092 GOSUB 1560
2096 IF mduuuram&<256 THEN GOTO 2116
2098 IF lasttype&<>2 THEN GOTO 2116
2100 regbase&=lastpos&
2102 GOSUB 1690
2104 IF regtype&=1777 THEN GOTO 2116
2106 segerror&=0
2107 emw&=0
2108 IF regtype&<3 THEN GOTO 2112
2110 segerror&=8
2111 GOTO 2114
2112 emw&=2-regtype&
2114 onereg&=regindex&
2116 IF lasttype&=1 THEN GOTO 2129
2117 IF xrbase&=0 THEN GOTO 2129
2118 IF xxregxxx&<256 THEN GOTO 2129
2119 IF mduuuram&>255 THEN GOTO 2129
2120 IF harbase&<32 THEN GOTO 2129
2121 emw&=1
2125 harbase&=xrbase&-16
2126 harbw$=linesymms(harbase&+2)
2127 IF harbw$=CHR$(66) THEN GOTO 2130
2128 IF harbw$=CHR$(98) THEN GOTO 2130
2129 GOTO 2131
2130 emw&=0
2131 IF xrbase&<48 THEN GOTO 2141
2132 harbase&=xrbase&-16
2133 hlrbw$=linesymms(harbase&+1)
2134 IF hlrbw$<CHR$(4) OR hlrbw$>CHR$(5) THEN GOTO 2141
2135 harbw$=linesymms(harbase&+2)
2136 IF harbw$=CHR$(119) OR harbw$=CHR$(100) THEN GOTO 2140
2137 REM Word length override for shr word [bp+iuy],cl
2138 IF harbw$=CHR$(87) OR harbw$=CHR$(68) THEN GOTO 2140
2139 GOTO 2141
2140 emw&=1
2141 RETURN
2146 REM 2150 get lslen& FROM stpos&
2150 lslen&=0
2152 IF stpos&>stlen& THEN GOTO 2167
2154 lsptr&=((stpos&-1)*16)+(2+1)
2156 lschra$=bigsym(lsptr&)
2158 lsptr&=lsptr&+1
2160 lschka&=ASC(lschra$)
2162 IF lschka&<33 THEN GOTO 2167
2164 lslen&=lslen&+1
2166 IF lslen&<(14-1) THEN GOTO 2156
2167 RETURN
2168 REM 2170 or 2171 iml&,imh&,ddimed& xor
2169 REM notfound& FROM sybase& OR lc&
2170 overwrt&=0
2171 notfound&=1
2172 IF sybase&>1023 THEN GOTO 2178
2173 REM overwrt nonzero to overwrite existing symbol
2174 lschrb$=linesymms(sybase&+1)
2176 GOTO 2180
2178 lschrb$=mdregrtm((sybase&-1024)+1)
2180 sylenb&=ASC(lschrb$)
2182 stpos&=1
2184 GOSUB 2150
2186 IF lslen&=0 THEN GOTO 2239
2188 IF lslen&=sylenb& THEN GOTO 2196
2190 REM 2192 unequal
2192 stpos&=stpos&+1
2194 GOTO 2184
2196 sycpos&=2
2198 syepos&=((stpos&-1)*16)+(2+1)
2200 IF sybase&>1023 THEN GOTO 2206
2202 lschrc$=linesymms(sycpos&+sybase&)
2204 GOTO 2208
2206 lschrc$=mdregrtm(sycpos&+sybase&-1024)
2208 sychrc&=ASC(lschrc$)
2210 sycpos&=sycpos&+1
2214 sychre$=bigsym(syepos&)
2216 syepos&=syepos&+1
2218 sichre&=ASC(sychre$)
2220 IF sichre&<>sychrc& THEN GOTO 2192
2222 IF sycpos&<(lslen&+2) THEN GOTO 2200
2224 syepos&=((stpos&-1)*16)
2225 imlc$=bigsym(syepos&+0)
2226 immc$=bigsym(syepos&+1)
2227 imhc$=bigsym(syepos&+2)
2228 iml&=ASC(imlc$)
2229 imh&=ASC(immc$)
2232 imhh&=ASC(imhc$)
2233 imhhh& = 0
2234 ddimed&=(imh&+(256*imhh&))
2235 ddimed&=ddimed&*256
2236 ddimed&=ddimed&+iml&
2237 notfound&=0
2238 REM FOUND ddimed& iml& imh& notfound&=0
2239 IF overwrt&<>0 THEN GOTO 2242
2240 IF notfound&=0 THEN GOTO 2272
2241 stlen&=stlen&+1
2242 ddimed&=lc&
2244 GOSUB 1630
2246 syepos&=((stpos&-1)*16)
2248 bigsym(syepos&+0)=CHR$(iml&)
2250 bigsym(syepos&+1)=CHR$(imh&)
2251 bigsym(syepos&+2)=CHR$(imhh&)
2252 syepos&=syepos&+(2+1)
2253 syfpos&=2
2256 IF sybase&>1023 THEN GOTO 2262
2258 symg$=linesymms(sybase&+syfpos&)
2260 GOTO 2264
2262 symg$=mdregrtm(sybase&+syfpos&-1024)
2264 syfpos&=syfpos&+1
2266 bigsym(syepos&)=symg$
2268 syepos&=syepos&+1
2270 IF syfpos&<(16-1) THEN GOTO 2256
2272 RETURN
2273 REM 2274 inst length w unknown symbols cpuinlen&
2274 symknown&=0
2275 REM lc&.next-lc&=resblen&+cpuinlen& r isthold(cpuinlen&)
2276 REM 2278 GET instruction qteepvar& == 0 if no sib byte
2277 REM wrdis&=0 to write
2278 istlbase&=16
2279 cpuinlen&=1
2280 isttype&=ASC(linesymms(istlbase&))
2281 resblen&=0
2282 istlen&=ASC(linesymms(istlbase&+1))
2283 IF isttype&=0 THEN GOTO 2494
2284 IF istlen&<2 THEN GOTO 2288
2286 IF isttype&=2 THEN GOTO 2296
2288 errorlin&=2288
2290 crash&=1
2292 REM 2290 error 2293 cpuinlen&=0 exit 2294 goto quit
2293 cpuinlen&=0
2294 GOTO 3998
2296 u$=""
2297 u$=u$+" 0 1 2 3 4 5 DD RESD "
2298 u$=u$+" DB DW RESB RESW ORG STACKEND STACKORG NEGORG "
2300 REM compiler directives two jumps
2302 u$=u$+" ADD OR ADC SBB AND SUB XOR CMP "
2304 REM 2302 imed 100000dw mduuuram& +8*irem8& non imed
2305 REM uses 0+8*erem8&
2306 REM 2308 MOV imed c6+emw& md000r/m,
2307 REM 88+2*emd&+emw& seg, 8c+emd*2
2308 u$=u$+" MOV y y y y y y 31 "
2310 u$=u$+" PUSH y y y y y y 39 "
2312 REM PUSH 1010reg lastpos=32,
2313 REM word ff md 110 r/m segment*8+6
2314 u$=u$+" POP y y y y y y 47 "
2316 REM pop 1011reg lastpos&=32,
2317 REM word 8f md000r/m,7+seg*8 (NOT CS)
2318 u$=u$+" INC DEC y y y y y y y y y y y y y 63 "
2320 REM 2318 irem8&*8+40h+reg
2321 REM lastpos&=32,byte fe+emw& md(emw&*8)R/M
2322 REM 2324 GOTO ON CONDITION USES irem16&
2323 REM instead of irem8&
2324 u$=u$+" JV JNV JB JNB JE JNE JBE JNBE "
2326 u$=u$+" JS JNS JPE JPO JL JNL JNG JNLE "
2328 u$=u$+" JO JNO JNAE JAE JZ JNZ JNA JA "
2330 u$=u$+" JN JNN JP JNP JNGE JGE JLE JG "
2332 REM SEG OVERRIDE =26+8*segreg
2334 u$=u$+" ES CS SS DS y y y 103 "
2336 u$=u$+" RET RETF y y y y y 111 "
2338 REM 2336 c2+8*irem8&,(add 1 if lasttype&<>1 not imed
2340 u$=u$+" ROL ROR RCL RCR SHL SHR 118 SAR "
2342 u$=u$+" ROL ROR RCL RCR SAL SHR 126 SAR "
2344 REM 2340 shifts d0+v*2+emw& MD(8*irem8&)R/M
2345 REM lasttype&=1 for v=0
2346 u$=u$+" LEA y y y y y y 135 "
2348 REM LEA 8D MDREGR/M
2350 REM 2352 single byte instructions 9c+irem8&*1
2352 u$=u$+" PUSHF POPF SAHF LAHF y y y 143 "
2354 REM call 2358 imed linepat&=4G211 call far 9a(5)
2355 REM linepat&=4G22 rel e8(3)
2356 REM mduuuram&<256 (xrbase-16)="F" far
2357 REM or near indirect jmp same rules
2358 u$=u$+" CALL y y y y y y 151 "
2360 u$=u$+" JMP y y y y y y 159 "
2362 REM 2364 TEST IMED f6+emw& md000r/m, 84+emw& MDREGR/M
2364 u$=u$+" TEST y y y y y y 167 "
2366 REM 2368 IN E4 + erem8&*1 + emw&, add 8 IF not imed
2368 u$=u$+" IN y OUT y y y y 175 "
2370 REM 2372 CE + irem8&*1
2372 u$=u$+" INTO IRET y y y y y 183 "
2374 REM 2376 CD+immediate needs immediate number byte
2376 u$=u$+" INT y y y y y y 191 "
2378 REM 2380 single byte character series a4+irem16&
2380 u$=u$+" MOVSB MOVSW CMPSB CMPSW y 197 STOSB STOSW "
2382 u$=u$+" LODSB LODSW SCASB SCASW y y y 207 "
2384 REM 2386 F6 + emw&,C0+irem8&*8 regsingle or
2385 REM irem8&*8+mduuuram&
2386 u$=u$+" y y NOT NEG y y y 215 "
2388 REM 2390 NOP 90
2390 u$=u$+" NOP y y y y y y 223 "
2392 REM 2394 loopne series realative jump E0+erem8&*1
2394 u$=u$+" LOOPNE LOOPE LOOP JCXZ y y y 231 "
2396 REM 2398 LES C4+irem8&*1, mduuuram&+xxregxxx&
2398 u$=u$+" LES LDS y y y y y 239 "
2400 REM 2402 lock series F0+irem8&*1 single byte
2402 u$=u$+" LOCK y REPNZ REPZ HALT CMC y 247 "
2404 REM 2406 duplicate lock series for REP
2406 u$=u$+" LOCK y REPNZ REP HALT CMC y 255 "
2408 REM 2410 CLC SERIES F8+irem8&*1 single byte
2409 REM instructions
2410 u$=u$+" CLC STC CLI STI CLD STD y 263 "
2412 REM 2414 F6+emw&,mduuuram&+irem8&*8
2414 u$=u$+" 264 y y 267 MUL IMUL DIV IDIV "
2416 REM 2418 XCHG 86+emw&,mduuuram&+xxregxxx&
2418 u$=u$+" xchg y y y y y y 279 "
2420 REM 2422 27+irem8&*8 unknown byte group
2422 u$=u$+" DAA DAS AAA AAS y y y 287 "
2426 REM 2428 D4+irem8&*1 unknown immediate8 group
2428 u$=u$+" AAM AAD y y y y y 295 "
2430 REM 2432 xlatb d7
2432 u$=u$+" XLATB y y y y y y 303 "
2433 REM 2434 cbw single byte series 98+irem8&*1
2434 u$=u$+" CBW CWD y WAIT y y y 311 "
2435 u$=u$+" BITS ALIGN SYMDIFF REALSEGDIFF SECTION y y 319 "
2438 REM end of known integer instruction list for 8088
2439 qteepvar& = 0
2440 GOSUB 1760
2441 IF ssdexbas& <> 0 THEN qteepvar& = 1
2442 searlim&=LEN(u$)-3
2444 ibasesub&=1
2445 rchosen&=0
2446 REM first checklength = istlen& blankloop=2448
2448 instchr$=MID$(u$,ibasesub&,1)
2450 IF instchr$<>" " THEN GOTO 2456
2452 ibasesub&=ibasesub&+1
2454 IF ibasesub&<searlim& THEN GOTO 2448
2455 GOTO 2494
2456 tabilen&=0
2458 instchr$=mid$(u$,(ibasesub&+tabilen&),1)
2460 IF instchr$=" " THEN GOTO 2465
2462 tabilen&=tabilen&+1
2464 IF tabilen&<14 THEN GOTO 2458
2465 rchosen&=rchosen&+1
2466 IF tabilen&=istlen& THEN GOTO 2472
2467 REM 2468 unequal
2468 ibasesub&=ibasesub&+tabilen&
2470 GOTO 2448
2472 tabictr&=0
2474 instchr$=MID$(u$,(ibasesub&+tabictr&),1)
2476 rinstchr$=linesymms(istlbase&+2+tabictr&)
2478 IF instchr$=rinstchr$ THEN GOTO 2488
2480 IF instchr$<CHR$(65) THEN GOTO 2486
2482 IF instchr$>CHR$(90) THEN GOTO 2486
2484 IF (ASC(instchr$)+32)=ASC(rinstchr$) THEN GOTO 2488
2486 GOTO 2468
2488 tabictr&=tabictr&+1
2490 IF tabictr&<tabilen& THEN GOTO 2474
2492 REM 2494 equal
2494 IF symknown&<>0 THEN GOTO 2511
2496 labelen&=ASC(linesymms(1))
2498 IF labelen&<1 THEN GOTO 2511
2500 sybase&=0
2502 GOSUB 2170
2504 IF notfound&<>0 THEN GOTO 2511
2505 errorlin&=2505
2506 GOTO 2290
2507 errorlin&=2507
2508 GOTO 2290
2509 errorlin&=2509
2510 GOTO 2290
2511 denom&=8
2513 dnumer&=rchosen&-1
2514 GOSUB 1540
2516 irem8&=drem&
2518 dnumer&=dfrac&
2520 GOSUB 1540
2522 igti&=drem&+1
2524 dnumer&=dfrac&
2526 GOSUB 1540
2528 igto&=drem&+1
2530 denom&=16
2534 dnumer&=rchosen&-1
2535 GOSUB 1540
2536 irem16&=drem&
2537 IF isttype&=0 THEN GOTO 2293
2538 ihctr&=0
2540 ihctr&=ihctr&+1
2542 isthold(ihctr&)=0
2544 IF ihctr&<80 THEN GOTO 2540
2546 GOTO 2568
2550 igtix& = irem8& + 1
2554 ON igtix& GOTO 2507,2507,2507,2507,2507,2507,3273,3326
2566 GOTO 2507
2568 ON igto& GOTO 2570,2573,2574,2576,2578,2507,2507,2507
2570 ON igti& GOTO 2550,2571,2588,2708,2744,2782,2802,2507
2571 igtix&=irem8&+1
2572 ON igtix& GOTO 3166,3218,3276,3290,3332,3340,3350,3366
2573 ON igti& GOTO 2816,2816,2816,2816,2846,2854,2874,2874
2574 ON igti& GOTO 2888,2900,2906,2986,3028,3042,3066,3074
2576 ON igti& GOTO 3080,3080,3086,3096,3102,3108,3114,3114
2578 ON igti& GOTO 3120,3126,3134,3140,3148,3154,3160,2580
2580 igtix&=irem8&+1
2582 ON igtix& GOTO 3372,3388,3424,3428,3476,2507,2507,2507
2586 REM 2588 ADD OR ADC SBB AND SUB XOR CMP series
2588 IF segerror&=0 THEN GOTO 2594
2589 REM 2590 unwanted segment register error
2590 errorlin&=2590
2592 GOTO 2290
2594 IF lasttype&=1 THEN GOTO 2658
2595 isthold(1)=0+(8*irem8&)+(2*emd&)+emw&
2596 IF isthold(1)>255 THEN GOTO 2601
2597 REM 2598 GENRL reg,mdregr/m reg is 8*ist for not immed
2598 isthold(2)=mduuuram&+xxregxxx&
2599 IF isthold(2)<256 THEN GOTO 2604
2601 errorlin&=2601
2602 GOTO 2290
2603 REM 2601 invalid mdregr/m
2604 cpuinlen&=1+emsize&
2606 IF emsize&=(1 + btwofour& + qteepvar&) THEN GOTO 2610
2608 GOTO 2294
2610 IF symknown&<>0 THEN GOTO 2614
2612 GOTO 2294
2614 atype&=ASC(mdregrtm(offsetloc&-1024))
2616 IF atype&=1 THEN GOTO 2624
2618 IF atype&=2 THEN GOTO 2642
2620 errorlin&=2620
2621 REM 2620 late caught invalid mdregr/m
2622 GOTO 2290
2624 dlbase&=offsetloc&
2626 GOSUB 1560
2628 GOSUB 5148
2640 GOTO 2294
2642 sybase&=offsetloc&
2644 GOSUB 2170
2646 IF notfound&=0 THEN GOTO 2652
2647 REM 2648 error undefined symbol
2648 errorlin&=2648
2650 GOTO 2290
2652 GOTO 2628
2653 errorlin&=2653
2654 GOTO 2650
2658 isthold(1)=128+emw&
2659 IF isthold(1)>255 THEN GOTO 2601
2660 isthold(2)=mduuuram&+(8*irem8&)
2661 REM 2660 general mdregr/m,imed
2662 IF isthold(2)>255 THEN GOTO 2601
2664 cpuinlen& = 2 + emsize& + (emw& * (btwofour& - 1))
2665 IF segerror&<>0 THEN GOTO 2590
2666 IF emsize& = (1 + qteepvar&) THEN GOTO 2698
2668 IF symknown&=0 THEN GOTO 2698
2670 atype&=ASC(mdregrtm(offsetloc&-1024))
2672 IF atype&=1 THEN GOTO 2678
2674 IF atype&=2 THEN GOTO 2688
2676 GOTO 2620
2678 dlbase&=offsetloc&
2680 GOSUB 1560
2682 GOSUB 5148
2686 GOTO 2698
2688 sybase&=offsetloc&
2690 gosub 2170
2692 IF notfound&<>0 THEN GOTO 2648
2694 GOSUB 5148
2698 dlbase&=lastpos&
2699 GOSUB 1560
2700 GOSUB 5166
2704 GOTO 2294
2706 REM 2708 MOV
2708 IF lasttype&=1 THEN GOTO 2736
2710 IF segerror&<>0 THEN GOTO 2718
2712 isthold(1)=136+(2*emd&)+emw&
2714 IF isthold(1)>255 THEN GOTO 2601
2716 GOTO 2598
2718 IF xrbase&=0 THEN GOTO 2724
2720 isthold(1)=140+(2*emd&)
2722 GOTO 2714
2724 isthold(1)=140
2726 IF segerror&=1 THEN GOTO 2730
2728 GOTO 2714
2730 isthold(1)=142
2731 IF xxregxxx&=8 THEN GOTO 2601
2732 GOTO 2714
2736 isthold(1)=198+emw&
2738 IF isthold(1)>255 THEN GOTO 2601
2740 GOTO 2660
2742 REM 2744 PUSH
2744 IF xrbase&=0 THEN GOTO 2752
2746 xxregxxx&=48
2748 isthold(1)=255
2750 GOTO 2598
2752 IF segerror&<>0 THEN GOTO 2770
2754 lefnib&=80
2756 REM 2758 single general register operand
2758 isthold(1)=lefnib&+onereg&
2760 IF isthold(1)>255 THEN GOTO 2601
2761 IF segerror&<>0 THEN GOTO 2590
2762 cpuinlen&=1
2764 GOTO 2294
2770 lefnib&=6
2772 REM 2774 single segment register to push or pop
2774 isthold(1)=lefnib&+(8*onereg&)
2776 IF isthold(1)>255 THEN GOTO 2601
2778 GOTO 2762
2780 REM 2782 POP
2782 IF xrbase&=0 THEN GOTO 2790
2784 xxregxxx&=0
2786 isthold(1)=143
2788 GOTO 2598
2790 IF segerror&<>0 THEN GOTO 2796
2792 lefnib&=88
2794 GOTO 2758
2796 lefnib&=7
2797 IF onereg&=1 THEN GOTO 2601
2798 GOTO 2774
2800 REM 2802 INC DEC
2802 IF xrbase&=0 THEN GOTO 2810
2804 xxregxxx&=8*irem8&
2806 isthold(1)=254+emw&
2808 GOTO 2598
2810 lefnib&=64+(8*irem8&)
2812 GOTO 2758
2814 REM 2816 J (cond)
2816 isthold(1)=112+irem16&
2817 REM 2818 shared J (cond) JCXZ
2818 cpuinlen&=2
2819 IF lasttype&=1 THEN GOTO 2838
2820 IF symknown&=0 THEN GOTO 2836
2822 sybase&=lastpos&
2824 GOSUB 2170
2825 IF notfound&<>0 THEN GOTO 2648
2826 ddimed&=(ddimed&-lc&)-2
2828 IF ddimed&<(0-128) THEN GOTO 2842
2830 IF ddimed&>127 THEN GOTO 2842
2832 GOSUB 1630
2834 isthold(2)=iml&
2836 goto 2294
2838 dlbase&=lastpos&
2839 GOSUB 1560
2840 GOTO 2834
2842 errorlin&=2842
2843 REM short conditional jump range exceeded 2842
2844 GOTO 2290
2845 REM 2846 seg override
2846 isthold(1)=38+(8*irem8&)
2848 cpuinlen&=1
2850 GOTO 2294
2852 REM 2854 ret retf c2+(not imed)+8*irem8&
2854 isthold(1)=194+8*(irem8&)
2856 IF lasttype&=1 THEN GOTO 2860
2857 isthold(1)=isthold(1)+1
2858 GOTO 2848
2860 dlbase&=lastpos&
2862 GOSUB 1560
2864 GOSUB 5170
2868 cpuinlen& = btwofour& + 1
2870 GOTO 2294
2872 REM 2874 shifts lasttype&=1 for v=0
2874 vv&=0
2875 IF lasttype&=1 THEN GOTO 2884
2876 IF emsize&=(1+btwofour&+qteepvar&) THEN GOTO 2883
2877 denom&=8
2878 REM IF 2882 fix emw&=word for all shift reg,cl
2879 dnumer&=xxregxxx&
2880 GOSUB 1540
2881 mduuuram&=192+dfrac&
2882 REM emw&=1
2883 vv&=2
2884 isthold(1)=208+vv&+emw&
2885 xxregxxx&=8*irem8&
2886 GOTO 2598
2887 REM 2888 LEA
2888 isthold(1)=141
2890 IF segerror&<>0 THEN GOTO 2588
2891 IF emsize&<>(1+btwofour&+qteepvar&) THEN GOTO 2620
2892 IF emw&<1 THEN GOTO 2601
2894 IF lasttype&<>3 THEN GOTO 2620
2895 IF xrbase&=0 THEN GOTO 2620
2896 GOTO 2598
2898 REM 2900 9c+irem8&*1 single byte pushf popf sahf lahf
2900 isthold(1)=156+irem8&
2902 GOTO 2848
2904 REM 2906 call
2906 IF linepat&=165 THEN GOTO 2916
2907 IF linepat&=166 THEN GOTO 2916
2908 IF mduuuram&<255 THEN GOTO 2940
2909 IF onereg&<255 THEN GOTO 2938
2910 IF linepat&=10 THEN GOTO 2962
2912 IF linepat&=42 THEN GOTO 2962
2914 GOTO 2601
2916 isthold(1)=154
2917 REM 2918 common call jump far constants
2918 dlbase&=lastpos&
2919 IF linepat&=166 THEN GOTO 2922
2920 GOSUB 1560
2921 GOTO 2925
2922 sybase& = lastpos&
2923 GOSUB 2170
2924 IF notfound& <> 0 THEN GOTO 2648
2925 isthold(2)=iml&
2926 isthold(3)=imh&
2927 isthold(4)=imhh&
2928 isthold(5)=imhhh&
2930 dlbase&=lastpos&-16
2931 GOSUB 1560
2932 isthold(2+btwofour&)=iml&
2933 isthold(3+btwofour&)=imh&
2934 cpuinlen&=3+btwofour&
2936 GOTO 2294
2938 mduuuram&=192+onereg&
2940 calpos&=xrbase&-16
2944 cachk$=linesymms(calpos&+2)
2946 IF cachk$=CHR$(70) THEN GOTO 2956
2948 IF cachk$=CHR$(102) THEN GOTO 2956
2950 xxregxxx&=16
2952 GOTO 2958
2956 xxregxxx&=24
2958 isthold(1)=255
2960 GOTO 2598
2962 isthold(1)=232
2963 REM 2964 common call jump realative 16
2964 cpuinlen& = btwofour& + 1
2966 IF symknown&=0 THEN GOTO 2982
2968 sybase&=lastpos&
2970 GOSUB 2170
2972 IF notfound&<>0 THEN GOTO 2648
2974 ddimed&=(ddimed&-lc&)-(btwofour&+1)
2976 GOSUB 1630
2978 GOSUB 5170
2982 GOTO 2294
2984 REM 2986 JMP
2986 IF linepat&=165 THEN GOTO 2998
2987 IF linepat&=166 THEN GOTO 2998
2988 IF mduuuram&<255 THEN GOTO 3004
2990 IF onereg&<255 THEN GOTO 3002
2992 IF linepat&=10 THEN GOTO 3022
2994 IF linepat&=42 THEN GOTO 3022
2996 GOTO 2601
2998 isthold(1)=234
3000 GOTO 2918
3002 mduuuram&=192+onereg&
3004 calpos&=xrbase&-16
3006 cachk$=linesymms(calpos&+2)
3008 IF cachk$=CHR$(70) THEN GOTO 3016
3010 IF cachk$=CHR$(102) THEN GOTO 3016
3012 xxregxxx&=32
3014 GOTO 3018
3016 xxregxxx&=40
3018 isthold(1)=255
3020 GOTO 2598
3022 isthold(1)=233
3024 GOTO 2964
3026 REM 3028 TEST
3028 IF lasttype&=1 THEN GOTO 3034
3030 isthold(1)=132+emw&
3032 GOTO 2598
3034 isthold(1)=246+emw&
3038 GOTO 2660
3040 REM 3042 in
3042 cpuinlen&=1
3043 REM emw&=0
3044 isthold(1)=228+irem8&+emw&
3045 IF isthold(1)>255 THEN GOTO 2601
3046 IF lasttype&<>1 THEN GOTO 3060
3047 REM IF 3043 Width=byte for ALL I/O. DB hex is exception
3048 REM 3050 I/O with immediate byte common with int type
3050 dlbase&=lastpos&
3052 GOSUB 1560
3054 cpuinlen&=2
3056 isthold(2)=iml&
3058 GOTO 2294
3060 isthold(1)=isthold(1)+8
3062 GOTO 2294
3064 REM 3066 into iret series
3066 isthold(1)=206+irem8&
3068 cpuinlen&=1
3070 GOTO 2294
3072 REM 3074 int byte
3074 isthold(1)=205
3076 GOTO 3050
3078 REM 3080 single byte character series a4+irem16&
3080 isthold(1)=164+irem16&
3082 GOTO 3068
3084 REM 3086 not neg
3086 isthold(1)=246+emw&
3087 xxregxxx&=8*irem8&
3088 IF xrbase&<>0 THEN GOTO 3092
3090 mduuuram&=192+onereg&
3092 GOTO 2598
3094 REM 3096 NOP series 90+irem8&*1
3096 isthold(1)=144+irem8&
3098 GOTO 3068
3100 REM 3102 loopne series e0+irem8&*1 JCXZ
3102 isthold(1)=224+irem8&
3104 GOTO 2818
3106 REM 3108 LES c4+irem8&*1 mdregr/m
3108 isthold(1)=196+irem8&
3110 GOTO 2598
3112 REM 3114 lock series two repz rep f0+irem8&*1 one byte
3114 isthold(1)=240+irem8&
3116 GOTO 3068
3118 REM 3120 clc series F8+irem8&*1 single byte
3120 isthold(1)=248+irem8&
3122 GOTO 3068
3124 REM 3126 MUL series
3126 xxregxxx&=8*irem8&
3128 isthold(1)=246+emw&
3130 GOTO 2598
3132 REM 3134 XCHG 86+emw&
3134 isthold(1)=134+emw&
3136 GOTO 2598
3138 REM 3140 2422 unknown group 27+irem8&*8
3140 isthold(1)=39+irem8&*8
3142 cpuinlen&=1
3144 GOTO 2294
3146 REM 3148 2428 unknown immediate 8 group irem8&*1
3148 isthold(1)=216+irem8&
3150 GOTO 3050
3152 REM 3154 XLATB D7
3154 isthold(1)=215
3156 GOTO 3142
3158 REM 3160 CBW single byte series 98+irem8&*1
3160 isthold(1)=152+irem8&
3162 GOTO 3142
3164 REM DB 3166
3166 dacd&=32
3167 cpuinlen&=0
3169 cdtype$=linesymms(dacd&)
3170 cdlen&=ASC(linesymms(dacd&+1))
3172 IF cdtype$=CHR$(0) THEN GOTO 3214
3174 IF cdtype$=CHR$(1) THEN GOTO 3184
3176 IF cdtype$=CHR$(2) THEN GOTO 3196
3178 REM 3180 error in DB statement
3180 errorlin&=3180
3182 GOTO 2290
3184 dlbase&=dacd&
3186 GOSUB 1560
3188 cpuinlen&=cpuinlen&+1
3190 isthold(cpuinlen&)=iml&
3192 dacd&=dacd&+16
3194 GOTO 3169
3196 bucd&=0
3198 bucd&=bucd&+1
3200 IF bucd&>cdlen& THEN GOTO 3210
3202 cdg$=linesymms(dacd&+1+bucd&)
3204 cpuinlen&=cpuinlen&+1
3206 isthold(cpuinlen&)=ASC(cdg$)
3208 GOTO 3198
3210 dacd&=dacd&+16
3212 IF cdlen&<15 THEN GOTO 3169
3214 GOTO 2294
3216 REM 3218 DW
3218 wdarcsel& = 2
3219 cpuinlen&=0
3222 denom&=wdarcsel&
3224 dnumer&=lc&
3226 GOSUB 1540
3227 phasecor& = wdarcsel& - drem&
3228 IF drem&=0 THEN GOTO 3249
3230 dacd&=0
3231 IF drem& <> 0 THEN GOTO 2653
3232 cdtype$=linesymms(dacd&)
3234 IF cdtype$=CHR$(0) THEN GOTO 3246
3236 lc&=lc&+(cpuinlen&+1)
3238 sybase&=0
3240 overwrt&=1
3242 GOSUB 2171
3244 lc&=lc&-(cpuinlen&+1)
3246 cpuinlen&=cpuinlen&+1
3248 isthold(cpuinlen&)=144
3249 dacd&=32
3250 cdtype$=linesymms(dacd&)
3252 IF cdtype$=CHR$(0) THEN GOTO 2294
3254 IF cdtype$=CHR$(1) THEN GOTO 3258
3256 GOTO 3180
3258 dlbase&=dacd&
3260 GOSUB 1560
3261 isthold(cpuinlen&+1)=iml&
3262 isthold(cpuinlen&+2)=imh&
3263 IF(wdarcsel& < 3)THEN GOTO 3266
3264 isthold(cpuinlen&+3)=imhh&
3265 isthold(cpuinlen&+4)=imhhh&
3266 cpuinlen&=cpuinlen&+wdarcsel&
3268 dacd&=dacd&+16
3269 GOTO 3250
3270 REM 3273 DD
3273 wdarcsel& = 4
3274 GOTO 3219
3275 REM 3276 RESB
3276 dlbase&=lastpos&
3277 wrdis&=1
3278 GOSUB 1560
3280 resblen&=ddimed&*incstep&
3282 REM 3284 cpuinlen&=0 EXIT
3284 cpuinlen&=0
3286 GOTO 2294
3288 REM 3290 RESW
3290 wdarcsel& = 2
3291 resblen&=0
3292 wrdis&=1
3294 denom&=wdarcsel&
3296 dnumer&=lc&
3298 GOSUB 1540
3299 phasecor& = wdarcsel& - drem&
3300 IF drem&=0 THEN GOTO 3322
3301 IF drem& <> 0 THEN GOTO 2653
3302 IF incstep&<>1 THEN GOTO 3180
3304 dacd&=0
3306 cdtype$=linesymms(dacd&)
3308 IF cdtype$=CHR$(0) THEN GOTO 3320
3310 lc&=lc&+resblen&+1
3312 sybase&=0
3314 overwrt&=1
3316 GOSUB 2171
3318 lc&=lc&-(resblen&+1)
3320 resblen&=resblen&+1
3322 dlbase&=lastpos&
3323 GOSUB 1560
3324 resblen&=resblen&+(ddimed&*incstep&*wdarcsel&)
3325 GOTO 3284
3326 wdarcsel& = 4
3328 GOTO 3291
3329 REM 3326 RESD
3330 REM 3332 ORG
3332 dlbase&=lastpos&
3334 GOSUB 1560
3336 slc&=ddimed&
3338 REM 3340 stackend
3340 lc&=slc&
3341 wrdis&=0
3342 resblen&=0
3344 incstep&=1
3346 GOTO 3284
3348 REM 3350 stackorg
3350 incstep&=1
3352 slc&=lc&
3354 dlbase&=lastpos&
3356 GOSUB 1560
3358 lc&=ddimed&
3359 wrdis&=1
3360 resblen&=0
3362 GOTO 3284
3364 REM 3366 negorg
3366 incstep&=0-1
3368 GOTO 3352
3370 REM 3372 bits
3372 IF lasttype&<>1 THEN GOTO 3381
3374 dlbase&=lastpos&
3376 GOSUB 1560
3377 btwofour&=2
3378 IF ddimed&=16 THEN GOTO 3382
3379 btwofour&=4
3380 IF ddimed&=32 THEN GOTO 3382
3381 GOTO 3180
3382 resblen&=0
3384 GOTO 3284
3386 REM 3388 align
3388 dlbase&=lastpos&
3390 GOSUB 1560
3392 IF imh&<>0 THEN GOTO 3180
3394 IF iml&=16 THEN GOTO 3400
3396 IF iml&=256 THEN GOTO 3404
3398 GOTO 3180
3400 afill&=144
3402 GOTO 3406
3404 afill&=0
3406 denom&=iml&
3408 cpuinlen&=0
3410 dnumer&=cpuinlen&+lc&
3412 GOSUB 1540
3414 IF drem&=0 THEN GOTO 2294
3416 cpuinlen&=cpuinlen&+1
3418 isthold(cpuinlen&)=afill&
3420 GOTO 3410
3422 REM 3424 SYMDIFF 3428 realsegdiff
3424 diffbot&=1
3426 GOTO 3430
3428 diffbot&=16
3430 IF linepat&=169 THEN GOTO 3434
3432 GOTO 3180
3434 sybase&=32
3436 GOSUB 2170
3438 swbig&=ddimed&
3440 IF notfound&<>0 THEN GOTO 3432
3442 sybase&=48
3444 GOSUB 2170
3446 swtiny&=ddimed&
3448 IF notfound&<>0 THEN GOTO 3432
3450 dlbase&=lastpos&
3452 GOSUB 1560
3454 ddimed&=(ddimed&+swbig&)-swtiny&
3456 dnumer&=ddimed&
3458 denom&=diffbot&
3460 GOSUB 1540
3462 IF drem&<>0 THEN GOTO 3432
3464 GOSUB 1630
3466 isthold(1)=iml&
3468 isthold(2)=imh&
3470 cpuinlen&=2
3472 GOTO 2294
3474 REM 3476 SECTION
3476 cpuinlen&=0
3488 resblen&=0
3498 GOTO 2294
3998 RETURN
3999 REM 4000 main
4000 rsub&=0
4001 cst2048&=2048
4002 bigsym(rsub&)=CHR$(0)
4003 cst4096&=4096
4004 rsub&=rsub&+1
4006 IF rsub&<(bigsymlim&+1) THEN GOTO 4002
4008 slc&=0
4009 sln&=0
4010 lc&=0
4011 cst8m&=cst2048&*cst4096&
4012 incstep&=1
4013 pass&=1
4014 stlen&=0
4015 cst8192&=8192
4016 cst16384&=16384
4017 cst128m&=cst8192&*cst16384&
4018 symknown&=0
4020 PRINT " LBASM3 QBASIC 8086 mode assembler for DOS "
4021 errorlin&=4021
4022 PRINT " Enter name of source *.asm or *.txt file "
4024 line input asmname$
4026 PRINT " enter name of output plain binary file. "
4027 LINE INPUT binname$
4028 IF binname$="" THEN GOTO 4060
4029 crash&=0
4030 OPEN asmname$ FOR INPUT AS #1
4031 eoft&=0
4032 GOTO 4042
4033 PRINT "sln&=";sln&;" pass&=";pass&;
4034 PRINT " errorlin&=";errorlin&;" igto&=";igto&;
4035 PRINT " igti&=";igti&;" acline$=";acline$;" "
4036 PRINT "rchosen&=";rchosen&;
4037 PRINT " mduuuram&=";mduuuram&;" xxregxxx&=";xxregxxx&
4038 PRINT "tcmpval&=";tcmpval&;" mdpat&=";mdpat&;" "
4039 PRINT "phasecor&=";phasecor&;" "
4040 PRINT " *** ERROR *** PROGRAM HALTED "
4041 GOTO 4998
4042 errorlin&=4042
4043 topen&=1
4044 REM 4046 loop pass #1
4046 GOSUB 1200
4048 IF eoft&<>0 THEN GOTO 4062
4050 GOSUB 1460
4052 REM 1760 is in 2274
4054 GOSUB 2274
4055 lc&=(lc&+cpuinlen&)+resblen&
4056 REM making symbol table with first pass
4057 REM sln&=sln&+1
4058 IF crash&=0 THEN GOTO 4046
4060 GOTO 4033
4062 CLOSE #1
4063 topen&=0
4064 compos&=0
4066 eoft&=0
4067 PRINT "sln&=";sln&;" lc&=";lc&;" stlen&=";stlen&;" "
4068 sln&=0
4070 pass&=2
4072 slc&=0
4074 lc&=0
4076 PRINT " LBASM3 NEEDS TWO PASSES "
4078 PRINT " REMEMBER TO VOTE AGAINST RESUMING THE"
4079 PRINT " PEACETIME U.S. MILITARY DRAFT !"
4100 OPEN asmname$ FOR INPUT AS #1
4101 topen&=1
4102 OPEN binname$ FOR BINARY AS #2
4103 tclose&=1
4104 REM 4106 loop pass #2
4106 GOSUB 1200
4108 IF eoft&<>0 THEN GOTO 4146
4110 GOSUB 1460
4111 REM 1760 is in 2274
4112 symknown&=1
4114 GOSUB 2278
4115 REM sln&=sln&+1
4116 IF crash&<>0 THEN GOTO 4060
4118 REM cpuinlen&>0 XOR resblen&>0 or both zero
4120 IF cpuinlen&=0 THEN GOTO 4142
4122 IF resblen&<>0 THEN GOTO 4060
4124 IF wrdis&<>0 THEN GOTO 4060
4126 comctr&=0
4128 comctr&=comctr&+1
4130 comchr(0)=CHR$(isthold(comctr&))
4132 compos&=compos&+1
4134 PUT #2,compos&,comchr(0)
4136 REM compos& starts at 1 in basic binary file
4138 IF comctr&<cpuinlen& THEN GOTO 4128
4140 REM 4142 common cpuinlen& resblen&
4142 lc&=(lc&+cpuinlen&)+resblen&
4144 GOTO 4106
4146 CLOSE #2
4147 tclose&=0
4148 CLOSE #1
4149 topen&=0
4160 PRINT compos&
4998 rsub&=0
4999 IF topen&=0 THEN GOTO 5010
5002 CLOSE #1
5010 IF tclose&=0 THEN GOTO 8021
5012 CLOSE #2
5014 GOTO 8021
5023 rcmpval$="4G2323131"
5024 REM 5023 32-bit [ebp+edi*1+0h]
5025 GOSUB 1650
5026 IF (tcmpval&+1) = mdpat& THEN GOTO 5028
5027 IF tcmpval& <> mdpat& THEN GOTO 1782
5028 IF btwofour& <> 4 THEN GOTO 1782
5030 GOTO 5060
5038 REM 5040 get nonreg& from regbase&
5040 nonreg& = 512
5042 IF regbase& > 1023 THEN GOTO 5048
5044 cregchr$ = linesymms(2+regbase&)
5046 goto 5050
5048 cregchr$ = mdregrtm(2+regbase&-1024)
5050 IF cregchr$ = "1" THEN nonreg& = 0
5051 IF chegchr$ = "2" THEN nonreg& = 64
5052 IF cregchr$ = "4" THEN nonreg& = 128
5054 IF cregchr$ = "8" THEN nonreg& = 192
5056 return
5057 REM 5060 fix 32-bit 2323131
5060 emsize& = 6
5061 mduuuram& = 128+4
5062 offsetloc& = 1024 + 96
5063 regbase& = 1024
5064 GOSUB 1690
5065 pegindex& = regindex&
5066 regbase& = 1024 + 32
5068 GOSUB 1690
5072 ssdexbas& = ( regindex& * 8 ) + pegindex&
5074 regbase& = 1024 + 64
5076 GOSUB 5040
5078 IF nonreg& < 256 THEN GOTO 5086
5079 REM prefix instruction mdregram
5080 REM ssdexbas a0 a1 a2 a3 D0 D1 D2 D3
5081 mduuuram& = 1777
5082 xxregxxx& = 1777
5084 GOTO 1782
5086 ssdexbas& = ssdexbas& + nonreg&
5089 GOTO 1782
5094 REM 5095 fix 32-bit 231 [ecx+0000h]
5095 emsize& = 5
5097 offsetloc& = 1024+32
5099 regbase& = 1024
5101 GOSUB 1690
5103 mduuuram& = 128 + regindex&
5105 GOTO 1782
5107 REM 5109 fix 2 [ecx] 32-bit
5109 emsize& = 1
5112 regbase& = 1024
5114 GOSUB 1690
5116 mduuuram& = regindex&
5118 IF regindex& = 4 THEN GOTO 5081
5120 IF regindex& = 5 THEN GOTO 5081
5122 GOTO 1782
5124 REM 5126 partial fix of 32-bit 23231 [edx+esi*4]
5126 emsize& = 2
5128 mduuuram&=4
5130 GOTO 5063
5134 REM 5136 fix 1 in 32-bit mode [8888]
5136 offsetloc& = 1024
5138 mduuuram& = 5
5140 emsize& = 5
5142 GOTO 1782
5147 REM subroutine 5148 iml& save using z514& = 0
5148 z514& = 0
5149 isthold(3+qteepvar& + z514&)=iml&
5151 isthold(4+qteepvar& + z514&)=imh&
5153 IF btwofour& <> 4 THEN GOTO 5164
5156 isthold(5+qteepvar& + z514&)=imhh&
5158 isthold(6+qteepvar& + z514&)=imhhh&
5160 IF qteepvar& = 0 THEN GOTO 5164
5161 IF z514& <> 0 THEN GOTO 5164
5162 isthold(3)=ssdexbas&
5164 RETURN
5165 REM 5166 iml& save using z514& = emsize& - qteepvar&
5166 z514& = emsize& - (qteepvar& + 1)
5168 GOTO 5149
5169 REM 5170 JMP or CALL difference save
5170 z514& = 0 - (qteepvar& + 1)
5172 GOTO 5149
8021 rsub&=1
8022 SYSTEM
8023 REM This is the LAST LINE of this program.