mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-27 04:18:07 +11:00
ed2b91411a
I'm planning on going back to 8-bit branching. 16-bit br cells incur a non-negligible penalty and, while at first 64 words (128 bytes forward or backward) seemed a bit limiting, I now don't see why one would ever construct such a big branch. It would be un-forthy. Also, I looked at using BC instead of IY to hold IP and the transition would be a lot easier with 8-bit branching. In this commit, all I do is add overflow checks in IF. The mechanic below doesn't change. I'll give myself some time to think it over so that I avoid yet another back and forth.
17 lines
607 B
Plaintext
17 lines
607 B
Plaintext
( Now we have "as late as possible" stuff )
|
|
: _bchk DUP 0x7f + 0xff > IF LIT< br-ovfl (print) ABORT THEN ;
|
|
: DO COMPILE 2>R H@ ; IMMEDIATE
|
|
: LOOP COMPILE (loop) H@ - _bchk , ; IMMEDIATE
|
|
( LEAVE is implemented in low xcomp )
|
|
: LITN 32 , , ( 32 == NUMBER ) ;
|
|
( gets its name at the very end. can't comment afterwards )
|
|
: _ BEGIN LIT< ) WORD S= UNTIL ; IMMEDIATE
|
|
: _ ( : will get its name almost at the very end )
|
|
(entry)
|
|
[ 14 ( == compiledWord ) LITN ] C,
|
|
BEGIN
|
|
WORD FIND
|
|
IF ( is word ) DUP IMMED? IF EXECUTE ELSE , THEN
|
|
ELSE ( maybe number ) (parse) LITN THEN
|
|
AGAIN ;
|