summaryrefslogtreecommitdiff
path: root/jefs.fs
blob: b4e2624ec927beba0d04031ca649ff4c0eeda16b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
: decimal 10 base ! ;
: hex 16 base ! ;

: cells 8 * ;
: allot here @ swap here +! ;

: [compile] parse find drop >cfa compile, ; immediate
: ' parse find drop >cfa [compile] lit ; immediate \ note: no error handling (yet)

: begin here @ ; immediate
: again branch here @ 4 + - d, ; immediate \ add 4 to get to beginning of the next instruction
: if 0branch here @ 0 d, ; immediate ( I: -- a )
: then dup here @ swap - 4 - swap d! ; immediate

: cell+ 8 + ;
: / /mod swap drop ;
: mod /mod drop ;

: syswrite ( u c-addr fd -- n ) 1 syscall3 ;
: say ( c-addr u -- ) swap 1 syswrite drop ;
: emit ( chr -- ) sp cell+ 1 swap 1 syswrite 2drop ;
: cr 10 emit ;
TESTSTR say cr bye