mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-27 08:58:06 +11:00
Add [IF] .. [THEN]
Will be useful as kinds of "#ifdef"s during xcomp.
This commit is contained in:
parent
f97df4614e
commit
4501313410
8
blk/042
8
blk/042
@ -7,10 +7,10 @@ context, branching doesn't work.
|
||||
|
||||
f IF A ELSE B THEN: if f is true, execute A, if false, execute
|
||||
B. ELSE is optional.
|
||||
[IF] .. [THEN]: Meta-IF. Works outside definitions. No [ELSE].
|
||||
BEGIN .. f UNTIL: if f is false, branch to BEGIN.
|
||||
BEGIN .. AGAIN: Always branch to BEGIN.
|
||||
x y DO .. LOOP: LOOP increments y. if y != x, branch to DO.
|
||||
x CASE y OF A ENDOF z OF B ENDOF C ENDCASE: If x == y, execute
|
||||
A, if x == z, execute B. Otherwise, execute C. x is dropped
|
||||
in case of an OF match, *but it is kept if it reaches C*. You
|
||||
have to consume it to avoid PSP leak. (cont.)
|
||||
|
||||
|
||||
(cont.)
|
||||
|
11
blk/043
11
blk/043
@ -1,4 +1,8 @@
|
||||
(cont.)
|
||||
x CASE y OF A ENDOF z OF B ENDOF C ENDCASE: If x == y, execute
|
||||
A, if x == z, execute B. Otherwise, execute C. x is dropped
|
||||
in case of an OF match, *but it is kept if it reaches C*. You
|
||||
have to consume it to avoid PSP leak.
|
||||
|
||||
(br) -- Branches by the number specified in the 2
|
||||
following bytes. Can be negative.
|
||||
(?br) f -- Branch if f is false.
|
||||
@ -9,8 +13,3 @@
|
||||
ABORT -- Resets PS and RS and returns to interpreter.
|
||||
ABORT" x" -- *I* Compiles a ." followed by a ABORT.
|
||||
EXECUTE a -- Execute wordref at addr a
|
||||
INTERPRET -- Get a line from stdin, compile it in tmp memory,
|
||||
then execute the compiled contents.
|
||||
LEAVE -- In a DO..LOOP, exit at the next LOOP call.
|
||||
QUIT -- Return to interpreter prompt immediately
|
||||
EXIT! -- Exit current INTERPRET loop.
|
||||
|
5
blk/044
Normal file
5
blk/044
Normal file
@ -0,0 +1,5 @@
|
||||
INTERPRET -- Get a line from stdin, compile it in tmp memory,
|
||||
then execute the compiled contents.
|
||||
LEAVE -- In a DO..LOOP, exit at the next LOOP call.
|
||||
QUIT -- Return to interpreter prompt immediately
|
||||
EXIT! -- Exit current INTERPRET loop.
|
4
blk/426
4
blk/426
@ -6,3 +6,7 @@
|
||||
H@ 2- ( push a. -2 for allot offset )
|
||||
; IMMEDIATE
|
||||
|
||||
: [IF]
|
||||
IF EXIT THEN
|
||||
LIT< [THEN] BEGIN DUP WORD S= UNTIL DROP ;
|
||||
: [THEN] ;
|
||||
|
BIN
emul/stage0.bin
BIN
emul/stage0.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user