• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

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

変更サマリ

差分

--- a/fig-forth6801_exorsim.68c
+++ b/fig-forth6801_exorsim.68c
@@ -361,7 +361,7 @@ PUSHBA PSH B 8 cycles until 'NEXT'
361361 * = = = = = = = t h e v i r t u a l m a c h i n e = = = = =
362362 * =
363363 NEXT LDX IP
364- INX pre-increment mode
364+NEXTWI INX pre-increment mode
365365 INX
366366 STX IP
367367 NEXT2 LDX 0,X get W which points to CFA of word to be done
@@ -1019,7 +1019,7 @@ SEMIS FDB *+2
10191019 INX
10201020 STX RP
10211021 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
10231023 *
10241024 * ######>> screen 27 <<
10251025 * ======>> 27 <<
@@ -1088,7 +1088,7 @@ ZEQUT LDD #1 Make it stealable.
10881088 ZLESS FDB *+2
10891089 TSX
10901090 LDD 0,X
1091- BMI ZEQUT
1091+ZLESSQ BMI ZEQUT
10921092 ZLESSF CLR A
10931093 CLR B
10941094 JMP STABX
@@ -1274,11 +1274,7 @@ STORE FDB *+2
12741274 FCB $A1
12751275 FDB STORE-4
12761276 CSTORE FDB *+2
1277-
1278- TSX
1279- LDX 0,X get address
1280- INS
1281- INS
1277+ PULX get address
12821278 INS
12831279 PUL B
12841280 STA B 0,X
@@ -1299,16 +1295,14 @@ COLON FDB DOCOL,QEXEC,SCSP,CURENT,AT,CONTXT,STORE
12991295 * nested words in the virtual machine:
13001296 * ( ;S is the equivalent un-nester )
13011297
1302-DOCOL LDX RP make room in the stack
1298+DOCOL LDX RP make room in the return stack
13031299 DEX
13041300 DEX
13051301 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.
13101304 LDX W Get first sub-word of that definition
1311- JMP NEXT+2 and execute it
1305+ JMP NEXTWI and execute it.
13121306 *
13131307 * ======>> 48 <<
13141308 FCB $C1 ; imnediate code
@@ -1325,8 +1319,7 @@ SEMI FDB DOCOL,QCSP,COMPIL,SEMIS,SMUDGE,LBRAK
13251319 FDB SEMI-4
13261320 CON FDB DOCOL,CREATE,SMUDGE,COMMA,PSCODE
13271321 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
13301323 JMP PUSHBA
13311324 *
13321325 * ======>> 50 <<
@@ -1335,10 +1328,8 @@ DOCON LDX W
13351328 FCB $C5
13361329 FDB CON-11
13371330 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
13421333 JMP PUSHBA
13431334 *
13441335 * ======>> 51 <<
@@ -1348,10 +1339,8 @@ DOVAR LDA A W
13481339 FDB VAR-11
13491340 USER FDB DOCOL,CON,PSCODE
13501341 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
13551344 JMP PUSHBA push address of user's variable
13561345 *
13571346 * ######>> screen 35 <<
@@ -1368,6 +1357,9 @@ ZERO FDB DOCON
13681357 FDB ZERO-4
13691358 ONE FDB DOCON
13701359 FDB 1
1360+* FDB *+2
1361+* LDD #1
1362+* JMP PUSHBA 7 bytes vs. 4, faster, semantic tag as constant altered to machine code
13711363 *
13721364 * ======>> 54 <<
13731365 FCB $81
@@ -1626,6 +1618,16 @@ COLUMS FDB DOUSER
16261618 FDB COLUMS-10
16271619 ONEP FDB DOCOL,ONE,PLUS
16281620 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
16291631 *
16301632 * ======>> 84 <<
16311633 FCB $82
@@ -1642,6 +1644,10 @@ TWOP FDB DOCOL,TWO,PLUS
16421644 FDB TWOP-5
16431645 HERE FDB DOCOL,DP,AT
16441646 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
16451651 *
16461652 * ======>> 86 <<
16471653 FCB $85
@@ -1650,6 +1656,13 @@ HERE FDB DOCOL,DP,AT
16501656 FDB HERE-7
16511657 ALLOT FDB DOCOL,DP,PSTORE
16521658 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.
16531666 *
16541667 * ======>> 87 <<
16551668 FCB $81 ; , (COMMA)
@@ -1670,14 +1683,22 @@ CCOMM FDB DOCOL,HERE,CSTORE,ONE,ALLOT
16701683 FCB $81 ; -
16711684 FCB $AD
16721685 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
16751696 *
16761697 * ======>> 90 <<
16771698 FCB $81 =
16781699 FCB $BD
16791700 FDB SUB-4
1680-EQUAL FDB DOCOL,SUB,ZEQU
1701+EQUAL FDB DOCOL,SUB,ZEQU and we can use the speedier SUB here.
16811702 FDB SEMIS
16821703 *
16831704 * ======>> 91 <<
@@ -1685,21 +1706,13 @@ EQUAL FDB DOCOL,SUB,ZEQU
16851706 FCB $BC
16861707 FDB EQUAL-4
16871708 LESS FDB *+2
1688- PUL A
1689- PUL B
16901709 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
17031716 *
17041717 * ======>> 92 <<
17051718 FCB $81 >
@@ -1978,24 +1991,20 @@ BUILDS FDB DOCOL,ZERO,CON
19781991 FDB BUILDS-10
19791992 DOES FDB DOCOL,FROMR,TWOP,LATEST,PFA,STORE
19801993 FDB PSCODE
1981-DODOES LDA A IP
1982- LDA B IP+1
1994+DODOES LDD IP
19831995 LDX RP make room on return stack
19841996 DEX
19851997 DEX
19861998 STX RP
1987- STA A 2,X push return address
1988- STA B 3,X
1999+ STD 2,X push return address
19892000 LDX W get addr of pointer to run-time code
19902001 INX
19912002 INX
19922003 STX N stash it in scratch area
19932004 LDX 0,X get new IP
19942005 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
19992008 PSH B and push it on data stack
20002009 PSH A
20012010 JMP NEXT2
@@ -3319,7 +3328,7 @@ ZZZZ FDB 0,0,0,0,0,0,0,0 end of rom program
33193328 *
33203329 ORG MEMEND simulating disc on-line
33213330 * SCREEN 0
3322- FCC "0) Index to BIF HI-LEVEL disk "
3331+ FCC "0) Index to HI-LEVEL disk "
33233332 FCC "1) "
33243333 FCC "2) Title page, Copr. notice "
33253334 FCC "3) MONITOR CALL TO DEBUG "
--- a/forthtests.fs
+++ b/forthtests.fs
@@ -33,6 +33,10 @@ SP@ .
3333
3434 SP@ .
3535
36+FORTH
37+
38+
39+
3640 45AA 10 SWAP . .
3741
3842 SP@ .