From baf725aa38b8e82c157421f1cf51982e642c14e4 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 8 May 2020 20:55:50 -0400 Subject: [PATCH] Move a bunch of words from core to inner core That makes it easier to write drivers that can be xcompiled. --- blk/393 | 2 +- blk/412 | 22 ++++++++-------------- blk/413 | 30 ++++++++++++++---------------- blk/414 | 16 ++++++++++++++++ blk/422 | 5 ----- blk/425 | 4 ---- emul/forth.bin | Bin 5907 -> 5907 bytes 7 files changed, 39 insertions(+), 40 deletions(-) create mode 100644 blk/414 diff --git a/blk/393 b/blk/393 index 0c04a4a..98d16d9 100644 --- a/blk/393 +++ b/blk/393 @@ -12,4 +12,4 @@ 0 0x08 RAM+ ! ( 08 == C<* override ) LIT< INTERPRET (find) DROP EXECUTE ; -1 20 LOADR+ +1 21 LOADR+ diff --git a/blk/412 b/blk/412 index 60f0030..107cf36 100644 --- a/blk/412 +++ b/blk/412 @@ -1,14 +1,8 @@ -( LITN has to be defined after the last immediate usage of - it to avoid bootstrapping issues ) -: LITN 32 , , ( 32 == NUMBER ) ; - -: IMMED? 1- C@ 0x80 AND ; - -( ';' can't have its name right away because, when created, it - is not an IMMEDIATE yet and will not be treated properly by - xcomp. ) -: _ - ['] EXIT , - R> DROP ( exit : ) -; IMMEDIATE - +: H@ HERE @ ; +: IMMEDIATE + CURRENT @ 1- + DUP C@ 128 OR SWAP C! +; +: +! SWAP OVER @ + SWAP ! ; +: -^ SWAP - ; +: ALLOT HERE +! ; diff --git a/blk/413 b/blk/413 index e109431..60f0030 100644 --- a/blk/413 +++ b/blk/413 @@ -1,16 +1,14 @@ -XCURRENT @ ( to PSP ) -: : - (entry) - ( We cannot use LITN as IMMEDIATE because of bootstrapping - issues. Same thing for ",". - 32 == NUMBER 14 == compiledWord ) - [ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] C, - BEGIN - WORD - (find) - ( is word ) - IF DUP IMMED? IF EXECUTE ELSE , THEN - ( maybe number ) - ELSE (parse) LITN THEN - AGAIN ; -( from PSP ) ';' SWAP 4 - C! +( LITN has to be defined after the last immediate usage of + it to avoid bootstrapping issues ) +: LITN 32 , , ( 32 == NUMBER ) ; + +: IMMED? 1- C@ 0x80 AND ; + +( ';' can't have its name right away because, when created, it + is not an IMMEDIATE yet and will not be treated properly by + xcomp. ) +: _ + ['] EXIT , + R> DROP ( exit : ) +; IMMEDIATE + diff --git a/blk/414 b/blk/414 new file mode 100644 index 0000000..e109431 --- /dev/null +++ b/blk/414 @@ -0,0 +1,16 @@ +XCURRENT @ ( to PSP ) +: : + (entry) + ( We cannot use LITN as IMMEDIATE because of bootstrapping + issues. Same thing for ",". + 32 == NUMBER 14 == compiledWord ) + [ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] C, + BEGIN + WORD + (find) + ( is word ) + IF DUP IMMED? IF EXECUTE ELSE , THEN + ( maybe number ) + ELSE (parse) LITN THEN + AGAIN ; +( from PSP ) ';' SWAP 4 - C! diff --git a/blk/422 b/blk/422 index 48d519b..e2ca7c8 100644 --- a/blk/422 +++ b/blk/422 @@ -1,8 +1,3 @@ -: H@ HERE @ ; -: IMMEDIATE - CURRENT @ 1- - DUP C@ 128 OR SWAP C! -; : [ INTERPRET ; IMMEDIATE : ] R> DROP ; : LITS 34 , SCPY ; diff --git a/blk/425 b/blk/425 index c081f6e..cea17a8 100644 --- a/blk/425 +++ b/blk/425 @@ -1,7 +1,3 @@ -: +! SWAP OVER @ + SWAP ! ; -: -^ SWAP - ; -: ALLOT HERE +! ; - : IF ( -- a | a: br cell addr ) COMPILE (?br) H@ ( push a ) diff --git a/emul/forth.bin b/emul/forth.bin index 15d9cb2a9a41946b2cdf4fc3e4eb47c3207695c2..67d10665ca50e1beb704965a0fcecad69e43bffc 100644 GIT binary patch delta 372 zcmbQNH(77PE-q#dhpNdw+&awKijtG_c{DiRaXB&gc!v0KPu|bvEoRJ}&cMM?#Td-M z!tjVAn1PLt1*6>e1Ti8{xA0XH6W-;#PVgmY#M}kj~8^YPn_@8M%*W{->O-zE^lQVhkK)jW_`ao*)EnZDV#=nzU z_=6ZHZVu;t!oQo^1fDpgonWIvYzLpXyd>whLLAq8LDeHy&?^h)?w{(8xbT)f506GqPBrM zVHQCU5$#&I3!_241jSsJtG*XJd&TX0Xfh1o4wCkT>+%wAE)Gb6{g+r3$5jkcJZTP*o=+d!RvPU)Ds$8sg?ZoQ=b!ISV-`MaH!z{Q3?o&P?Es zkIZHAd>W~Wi)JWLsOE*E$UGhF27>%J} MgRZ&U6V^NZ1G9cwU;qFB