30 lines
821 B
Plaintext
Executable file
30 lines
821 B
Plaintext
Executable file
: nip swap drop ;
|
|
: 2drop drop drop ;
|
|
|
|
: @! ( newval v -- oldval ) dup @ >rot ! ;
|
|
: !+ ( v p -- ) dup @ <rot + swap ! ;
|
|
|
|
: expile state if , else execute then ;
|
|
: ['] word lookup drop , ; immediate
|
|
|
|
: :noname here $DOCOLON , ] ;
|
|
|
|
: array new-word $DOVAR , ;
|
|
: create new-word $DOCREATE , 0 , ;
|
|
: var, array , ;
|
|
|
|
: finishcreate ( ipfirst -- )
|
|
( set cell after codepointer to first instruction of does> )
|
|
latest codepointer cell + ! ;
|
|
|
|
: does> here 4 cells + lit ' finishcreate , ' return , ] ; immediate
|
|
|
|
: dbg" ['] s" :| type bl .s cr |; expile ; immediate
|
|
|
|
: .hexnib ( x -- )
|
|
dup 0 >= over 9 <= and if [ key 0 lit ]
|
|
else 10 - [ key A lit ] then + emit ;
|
|
: .bhex dup 0xf0 & 4 >> .hexnib 0x0f & .hexnib bl ;
|
|
: .hex dup 0xf000 & 12 >> 0x0f & .hexnib dup 0x0f00 & 8 >> .hexnib .bhex ;
|
|
|