|
|
@ -16,6 +16,7 @@
|
|
|
|
: base [ 0 _d ] literal ;
|
|
|
|
: base [ 0 _d ] literal ;
|
|
|
|
: here [ 1 cells _d ] literal @ ;
|
|
|
|
: here [ 1 cells _d ] literal @ ;
|
|
|
|
: allot [ 1 cells _d ] literal +! ;
|
|
|
|
: allot [ 1 cells _d ] literal +! ;
|
|
|
|
|
|
|
|
: _latest [ 2 cells _d ] literal ;
|
|
|
|
: state [ 3 cells _d ] literal ;
|
|
|
|
: state [ 3 cells _d ] literal ;
|
|
|
|
: _compxt [ 4 cells _d ] literal ;
|
|
|
|
: _compxt [ 4 cells _d ] literal ;
|
|
|
|
: _source [ 5 cells _d ] literal ;
|
|
|
|
: _source [ 5 cells _d ] literal ;
|
|
|
@ -111,6 +112,19 @@
|
|
|
|
swap postpone literal postpone literal ; imm
|
|
|
|
swap postpone literal postpone literal ; imm
|
|
|
|
: ." postpone s" state @ if ['] type compile, else type then ; imm
|
|
|
|
: ." postpone s" state @ if ['] type compile, else type then ; imm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
: create : here [ 4 cells ] literal + postpone literal postpone ; 0 , ;
|
|
|
|
|
|
|
|
: >body cell+ @ ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
: _does> _latest @ @ [ 4 cells ] literal +
|
|
|
|
|
|
|
|
['] _jmp @ over !
|
|
|
|
|
|
|
|
r@ [ 2 cells ] literal +
|
|
|
|
|
|
|
|
swap cell+ ! ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
: does> ['] _does> compile, ['] exit compile, ; imm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
: variable create [ 1 cells ] literal allot ;
|
|
|
|
|
|
|
|
: constant create , does> @ ;
|
|
|
|
|
|
|
|
|
|
|
|
: move dup 0 <= if drop 2drop exit then
|
|
|
|
: move dup 0 <= if drop 2drop exit then
|
|
|
|
>r 2dup < r> swap if
|
|
|
|
>r 2dup < r> swap if
|
|
|
|
1- 0 swap do over i + c@ over i + c! -1 +loop
|
|
|
|
1- 0 swap do over i + c@ over i + c! -1 +loop
|
|
|
@ -134,4 +148,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
: fibs 10 0 do i fib . loop cr ;
|
|
|
|
: fibs 10 0 do i fib . loop cr ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 constant five
|
|
|
|
|
|
|
|
five .
|
|
|
|
fibs ." hello world"
|
|
|
|
fibs ." hello world"
|
|
|
|