mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 14:48:06 +11:00
forth: add words "[" and "]"
This commit is contained in:
parent
839021e0f8
commit
684cb028ff
@ -1,7 +1,8 @@
|
||||
: H@ HERE @ ;
|
||||
: -^ SWAP - ;
|
||||
: [LITN] LITN ; IMMEDIATE
|
||||
: LIT ROUTINE S [LITN] , ;
|
||||
: [ INTERPRET 1 FLAGS ! ; IMMEDIATE
|
||||
: ] R> DROP ;
|
||||
: LIT [ ROUTINE S LITN ] , ;
|
||||
: LITS LIT SCPY ;
|
||||
: LIT< WORD LITS ; IMMEDIATE
|
||||
: _err LIT< word-not-found (print) ABORT ;
|
||||
@ -49,7 +50,7 @@
|
||||
|
||||
: CREATE
|
||||
(entry) ( empty header with name )
|
||||
ROUTINE C [LITN] ( push cellWord addr )
|
||||
[ ROUTINE C LITN ] ( push cellWord addr )
|
||||
, ( write it )
|
||||
;
|
||||
: VARIABLE CREATE 2 ALLOT ;
|
||||
@ -86,7 +87,7 @@
|
||||
|
||||
: (sysv)
|
||||
(entry)
|
||||
ROUTINE Y [LITN] ,
|
||||
[ ROUTINE Y LITN ] ,
|
||||
SYSVNXT @ ,
|
||||
2 SYSVNXT +!
|
||||
;
|
||||
|
@ -52,7 +52,6 @@ DOES> -- See description at top of file
|
||||
IMMED? a -- f Checks whether wordref at a is immediate.
|
||||
IMMEDIATE -- Flag the latest defined word as immediate.
|
||||
LITN n -- Write number n as a literal.
|
||||
[LITN] n -- *I* Immediate version of LITN.
|
||||
ROUTINE x -- a Push the addr of the specified core routine
|
||||
C=cellWord J=JUMPTBL V=nativeWord N=next S=LIT
|
||||
M=NUMBER Y=sysvarWord D=doesWord
|
||||
@ -81,6 +80,10 @@ input stream is executed immediately. In this context, branching doesn't work.
|
||||
atom's cell.
|
||||
(bbr) -- Branches backward by the number specified in its
|
||||
atom's cell.
|
||||
[ -- Begin interetative mode. In a definition, words
|
||||
between here and "]" will be executed instead of
|
||||
compiled.
|
||||
] -- End interpretative mode.
|
||||
ABORT -- Resets PS and RS and returns to interpreter
|
||||
ABORT" x" -- *I* Compiles a ." followed by a ABORT.
|
||||
AGAIN I:a -- *I* Jump backwards to preceeding BEGIN.
|
||||
|
@ -222,16 +222,16 @@
|
||||
0x10 OPJR DJNZe,
|
||||
|
||||
( Specials )
|
||||
: JPNEXT, ROUTINE N [LITN] JPnn, ;
|
||||
: JPNEXT, [ ROUTINE N LITN ] JPnn, ;
|
||||
|
||||
: CODE
|
||||
( same as CREATE, but with ROUTINE V )
|
||||
(entry)
|
||||
ROUTINE V [LITN] ,
|
||||
[ ROUTINE V LITN ] ,
|
||||
;
|
||||
|
||||
: ;CODE JPNEXT, ;
|
||||
|
||||
|
||||
( Routines )
|
||||
: chkPS, ROUTINE P [LITN] CALLnn, ;
|
||||
: chkPS, [ ROUTINE P LITN ] CALLnn, ;
|
||||
|
Loading…
Reference in New Issue
Block a user