diff --git a/blk.fs b/blk.fs index 7c818ea..1d443e6 100644 --- a/blk.fs +++ b/blk.fs @@ -1753,16 +1753,16 @@ SYSVARS 0x40 + :** A! SYSVARS 0x42 + :** A, ( ----- 356 ) SYSVARS 0x53 + :** EMIT -: (print) C@+ ( a len ) 0 DO C@+ EMIT LOOP DROP ; +: STYPE C@+ ( a len ) 0 DO C@+ EMIT LOOP DROP ; : BS 8 EMIT ; : LF 10 EMIT ; : CR 13 EMIT ; : CRLF CR LF ; : SPC 32 EMIT ; SYSVARS 0x0a + :** NL -: ERR (print) ABORT ; +: ERR STYPE ABORT ; : (uflw) LIT" stack underflow" ERR ; XCURRENT @ _xapply ORG @ 0x06 ( stable ABI uflw ) + ! : (oflw) LIT" stack overflow" ERR ; XCURRENT @ _xapply ORG @ 0x13 ( stable ABI oflw ) + ! -: (wnf) (print) LIT" word not found" ERR ; +: (wnf) STYPE LIT" word not found" ERR ; ( ----- 357 ) ( r c -- r f ) ( Parse digit c and accumulate into result r. @@ -2102,7 +2102,7 @@ SYSVARS 0x55 + :** KEY BEGIN WORD DUP @ 0x0401 = ( EOT ) IF DROP EXIT THEN FIND NOT IF (parse) ELSE EXECUTE THEN - C IF LIT" br ovfl" (print) ABORT THEN ; +: _bchk DUP 0x7f + 0xff > IF LIT" br ovfl" STYPE ABORT THEN ; : DO COMPILE 2>R H@ ; IMMEDIATE : LOOP COMPILE (loop) H@ - _bchk C, ; IMMEDIATE ( LEAVE is implemented in low xcomp ) @@ -2190,7 +2190,7 @@ XCURRENT @ _xapply ORG @ 0x04 ( stable ABI BOOT ) + ! ; IMMEDIATE ( ----- 394 ) ( We don't use ." and ABORT in core, they're not xcomp-ed ) -: ." [COMPILE] LIT" COMPILE (print) ; IMMEDIATE +: ." [COMPILE] LIT" COMPILE STYPE ; IMMEDIATE : ABORT" [COMPILE] ." COMPILE ABORT ; IMMEDIATE : BEGIN H@ ; IMMEDIATE : AGAIN COMPILE (br) H@ - _bchk C, ; IMMEDIATE diff --git a/cvm/stage.bin b/cvm/stage.bin index ca07d06..559b09e 100644 Binary files a/cvm/stage.bin and b/cvm/stage.bin differ diff --git a/doc/dict.txt b/doc/dict.txt index 4b9591c..db098bb 100644 --- a/doc/dict.txt +++ b/doc/dict.txt @@ -217,6 +217,9 @@ NOT f -- f Push the logical opposite of f # Strings +Strings in Collapse OS begin with a one byte length, followed +by the contents of the string. + LIT" x" -- Read following characters and write to HERE as a string literal. S= a1 a2 -- f Returns whether string a1 == a2. @@ -227,7 +230,7 @@ S= a1 a2 -- f Returns whether string a1 == a2. result in n as well as whether parsing was a success in f (false = failure, true = success) -(print) a -- Print string at addr a. Stops at 0x0 or 0xd. +STYPE a -- EMIT all chars of string at at addr a. . n -- Print n in its decimal form .x n -- Print n's LSB in hex form. Always 2 characters. @@ -236,7 +239,7 @@ S= a1 a2 -- f Returns whether string a1 == a2. "-1 .X" --> ffff ," xxx" -- Write xxx to HERE ." xxx" -- *I* Compiles string literal xxx followed by a - call to (print). + call to STYPE. C