Motorola M6800 (6800) Exorciser / SWTPC emulator plus 6801 instruction set emulation
リビジョン | 7b9a5a57b99fd4578bce153aac53d44f913a5b20 (tree) |
---|---|
日時 | 2020-11-17 19:51:19 |
作者 | Joel Matthew Rees <joel.rees@gmai...> |
コミッター | Joel Matthew Rees |
forth conversion complete
@@ -361,7 +361,7 @@ PUSHBA PSH B 8 cycles until 'NEXT' | ||
361 | 361 | * = = = = = = = t h e v i r t u a l m a c h i n e = = = = = |
362 | 362 | * = |
363 | 363 | NEXT LDX IP |
364 | - INX pre-increment mode | |
364 | +NEXTWI INX pre-increment mode | |
365 | 365 | INX |
366 | 366 | STX IP |
367 | 367 | NEXT2 LDX 0,X get W which points to CFA of word to be done |
@@ -1019,7 +1019,7 @@ SEMIS FDB *+2 | ||
1019 | 1019 | INX |
1020 | 1020 | STX RP |
1021 | 1021 | LDX 0,X get address we have just finished. |
1022 | - JMP NEXT+2 increment the return address & do next word | |
1022 | + JMP NEXTWI increment the return address & do next word | |
1023 | 1023 | * |
1024 | 1024 | * ######>> screen 27 << |
1025 | 1025 | * ======>> 27 << |
@@ -1088,7 +1088,7 @@ ZEQUT LDD #1 Make it stealable. | ||
1088 | 1088 | ZLESS FDB *+2 |
1089 | 1089 | TSX |
1090 | 1090 | LDD 0,X |
1091 | - BMI ZEQUT | |
1091 | +ZLESSQ BMI ZEQUT | |
1092 | 1092 | ZLESSF CLR A |
1093 | 1093 | CLR B |
1094 | 1094 | JMP STABX |
@@ -1274,11 +1274,7 @@ STORE FDB *+2 | ||
1274 | 1274 | FCB $A1 |
1275 | 1275 | FDB STORE-4 |
1276 | 1276 | CSTORE FDB *+2 |
1277 | - | |
1278 | - TSX | |
1279 | - LDX 0,X get address | |
1280 | - INS | |
1281 | - INS | |
1277 | + PULX get address | |
1282 | 1278 | INS |
1283 | 1279 | PUL B |
1284 | 1280 | STA B 0,X |
@@ -1299,16 +1295,14 @@ COLON FDB DOCOL,QEXEC,SCSP,CURENT,AT,CONTXT,STORE | ||
1299 | 1295 | * nested words in the virtual machine: |
1300 | 1296 | * ( ;S is the equivalent un-nester ) |
1301 | 1297 | |
1302 | -DOCOL LDX RP make room in the stack | |
1298 | +DOCOL LDX RP make room in the return stack | |
1303 | 1299 | DEX |
1304 | 1300 | DEX |
1305 | 1301 | STX RP |
1306 | - LDA A IP | |
1307 | - LDA B IP+1 | |
1308 | - STA A 2,X Store address of the high level word | |
1309 | - STA B 3,X that we are starting to execute | |
1302 | + LDD IP Store address of the high level word | |
1303 | + STD 2,X that we are starting to execute. | |
1310 | 1304 | LDX W Get first sub-word of that definition |
1311 | - JMP NEXT+2 and execute it | |
1305 | + JMP NEXTWI and execute it. | |
1312 | 1306 | * |
1313 | 1307 | * ======>> 48 << |
1314 | 1308 | FCB $C1 ; imnediate code |
@@ -1325,8 +1319,7 @@ SEMI FDB DOCOL,QCSP,COMPIL,SEMIS,SMUDGE,LBRAK | ||
1325 | 1319 | FDB SEMI-4 |
1326 | 1320 | CON FDB DOCOL,CREATE,SMUDGE,COMMA,PSCODE |
1327 | 1321 | DOCON LDX W |
1328 | - LDA A 2,X | |
1329 | - LDA B 3,X A & B now contain the constant | |
1322 | + LDD 2,X A & B now contain the constant | |
1330 | 1323 | JMP PUSHBA |
1331 | 1324 | * |
1332 | 1325 | * ======>> 50 << |
@@ -1335,10 +1328,8 @@ DOCON LDX W | ||
1335 | 1328 | FCB $C5 |
1336 | 1329 | FDB CON-11 |
1337 | 1330 | VAR FDB DOCOL,CON,PSCODE |
1338 | -DOVAR LDA A W | |
1339 | - LDA B W+1 | |
1340 | - ADD B #2 | |
1341 | - ADC A #0 A,B now contain the address of the variable | |
1331 | +DOVAR LDD W | |
1332 | + ADDD #2 A,B now contain the address of the variable | |
1342 | 1333 | JMP PUSHBA |
1343 | 1334 | * |
1344 | 1335 | * ======>> 51 << |
@@ -1348,10 +1339,8 @@ DOVAR LDA A W | ||
1348 | 1339 | FDB VAR-11 |
1349 | 1340 | USER FDB DOCOL,CON,PSCODE |
1350 | 1341 | DOUSER LDX W get offset into user's table |
1351 | - LDA A 2,X | |
1352 | - LDA B 3,X | |
1353 | - ADD B UP+1 add to users base address | |
1354 | - ADC A UP | |
1342 | + LDD 2,X | |
1343 | + ADDD UP add to users base address | |
1355 | 1344 | JMP PUSHBA push address of user's variable |
1356 | 1345 | * |
1357 | 1346 | * ######>> screen 35 << |
@@ -1368,6 +1357,9 @@ ZERO FDB DOCON | ||
1368 | 1357 | FDB ZERO-4 |
1369 | 1358 | ONE FDB DOCON |
1370 | 1359 | FDB 1 |
1360 | +* FDB *+2 | |
1361 | +* LDD #1 | |
1362 | +* JMP PUSHBA 7 bytes vs. 4, faster, semantic tag as constant altered to machine code | |
1371 | 1363 | * |
1372 | 1364 | * ======>> 54 << |
1373 | 1365 | FCB $81 |
@@ -1626,6 +1618,16 @@ COLUMS FDB DOUSER | ||
1626 | 1618 | FDB COLUMS-10 |
1627 | 1619 | ONEP FDB DOCOL,ONE,PLUS |
1628 | 1620 | FDB SEMIS |
1621 | +*ONEP FDB *+2 | |
1622 | +* TSX | |
1623 | +* LDD 0,X | |
1624 | +* ADDD #1 | |
1625 | +* JMP STABX 9 bytes vs. 6, faster, semantic link to constant broken | |
1626 | +* or | |
1627 | +* PULX | |
1628 | +* INX | |
1629 | +* PSHX | |
1630 | +* JMP NEXT 6 bytes vs. 6, faster, semantic link broken | |
1629 | 1631 | * |
1630 | 1632 | * ======>> 84 << |
1631 | 1633 | FCB $82 |
@@ -1642,6 +1644,10 @@ TWOP FDB DOCOL,TWO,PLUS | ||
1642 | 1644 | FDB TWOP-5 |
1643 | 1645 | HERE FDB DOCOL,DP,AT |
1644 | 1646 | FDB SEMIS |
1647 | +*HERE FDB *+2 | |
1648 | +* LDX UP | |
1649 | +* LDD XDP-UORIG,X | |
1650 | +* JMP PUSHBA 7 bytes vs. 6 bytes, faster, semantic tag altered | |
1645 | 1651 | * |
1646 | 1652 | * ======>> 86 << |
1647 | 1653 | FCB $85 |
@@ -1650,6 +1656,13 @@ HERE FDB DOCOL,DP,AT | ||
1650 | 1656 | FDB HERE-7 |
1651 | 1657 | ALLOT FDB DOCOL,DP,PSTORE |
1652 | 1658 | FDB SEMIS |
1659 | +*ALLOT FDB *+2 | |
1660 | +* PUL A | |
1661 | +* PUL B | |
1662 | +* LDX UP | |
1663 | +* ADDD XDP-UORIG,X | |
1664 | +* STD XDP-UORIG,X | |
1665 | +* JMP NEXT 11 bytes vs. 6, etc. | |
1653 | 1666 | * |
1654 | 1667 | * ======>> 87 << |
1655 | 1668 | FCB $81 ; , (COMMA) |
@@ -1670,14 +1683,22 @@ CCOMM FDB DOCOL,HERE,CSTORE,ONE,ALLOT | ||
1670 | 1683 | FCB $81 ; - |
1671 | 1684 | FCB $AD |
1672 | 1685 | FDB CCOMM-5 |
1673 | -SUB FDB DOCOL,MINUS,PLUS | |
1674 | - FDB SEMIS | |
1686 | +SUB FDB *+2 | |
1687 | + TSX | |
1688 | + LDD 2,X Not commutative. | |
1689 | + SUBD 0,X | |
1690 | + STD 2,X TXS would be one byte less, but why jump to a branch? | |
1691 | + INS | |
1692 | + INS | |
1693 | + JMP NEXT 12 bytes vs. 6, but much faster | |
1694 | +*SUB FDB DOCOL,MINUS,PLUS | |
1695 | +* FDB SEMIS | |
1675 | 1696 | * |
1676 | 1697 | * ======>> 90 << |
1677 | 1698 | FCB $81 = |
1678 | 1699 | FCB $BD |
1679 | 1700 | FDB SUB-4 |
1680 | -EQUAL FDB DOCOL,SUB,ZEQU | |
1701 | +EQUAL FDB DOCOL,SUB,ZEQU and we can use the speedier SUB here. | |
1681 | 1702 | FDB SEMIS |
1682 | 1703 | * |
1683 | 1704 | * ======>> 91 << |
@@ -1685,21 +1706,13 @@ EQUAL FDB DOCOL,SUB,ZEQU | ||
1685 | 1706 | FCB $BC |
1686 | 1707 | FDB EQUAL-4 |
1687 | 1708 | LESS FDB *+2 |
1688 | - PUL A | |
1689 | - PUL B | |
1690 | 1709 | TSX |
1691 | - CMP A 0,X | |
1692 | - INS | |
1693 | - BGT LESST | |
1694 | - BNE LESSF | |
1695 | - CMP B 1,X | |
1696 | - BHI LESST | |
1697 | -LESSF CLR B | |
1698 | - BRA LESSX | |
1699 | -LESST LDA B #1 | |
1700 | -LESSX CLR A | |
1701 | - INS | |
1702 | - JMP PUSHBA | |
1710 | + LDD 2,X Not commutative. | |
1711 | + SUBD 0,X | |
1712 | + INX | |
1713 | + INX | |
1714 | + TXS | |
1715 | + JMP ZLESSQ | |
1703 | 1716 | * |
1704 | 1717 | * ======>> 92 << |
1705 | 1718 | FCB $81 > |
@@ -1978,24 +1991,20 @@ BUILDS FDB DOCOL,ZERO,CON | ||
1978 | 1991 | FDB BUILDS-10 |
1979 | 1992 | DOES FDB DOCOL,FROMR,TWOP,LATEST,PFA,STORE |
1980 | 1993 | FDB PSCODE |
1981 | -DODOES LDA A IP | |
1982 | - LDA B IP+1 | |
1994 | +DODOES LDD IP | |
1983 | 1995 | LDX RP make room on return stack |
1984 | 1996 | DEX |
1985 | 1997 | DEX |
1986 | 1998 | STX RP |
1987 | - STA A 2,X push return address | |
1988 | - STA B 3,X | |
1999 | + STD 2,X push return address | |
1989 | 2000 | LDX W get addr of pointer to run-time code |
1990 | 2001 | INX |
1991 | 2002 | INX |
1992 | 2003 | STX N stash it in scratch area |
1993 | 2004 | LDX 0,X get new IP |
1994 | 2005 | STX IP |
1995 | - CLR A get address of parameter | |
1996 | - LDA B #2 | |
1997 | - ADD B N+1 | |
1998 | - ADC A N | |
2006 | + LDD #2 get address of parameter | |
2007 | + ADDD N | |
1999 | 2008 | PSH B and push it on data stack |
2000 | 2009 | PSH A |
2001 | 2010 | JMP NEXT2 |
@@ -3319,7 +3328,7 @@ ZZZZ FDB 0,0,0,0,0,0,0,0 end of rom program | ||
3319 | 3328 | * |
3320 | 3329 | ORG MEMEND simulating disc on-line |
3321 | 3330 | * SCREEN 0 |
3322 | - FCC "0) Index to BIF HI-LEVEL disk " | |
3331 | + FCC "0) Index to HI-LEVEL disk " | |
3323 | 3332 | FCC "1) " |
3324 | 3333 | FCC "2) Title page, Copr. notice " |
3325 | 3334 | FCC "3) MONITOR CALL TO DEBUG " |
@@ -33,6 +33,10 @@ SP@ . | ||
33 | 33 | |
34 | 34 | SP@ . |
35 | 35 | |
36 | +FORTH | |
37 | + | |
38 | + | |
39 | + | |
36 | 40 | 45AA 10 SWAP . . |
37 | 41 | |
38 | 42 | SP@ . |