: cell+ 8 + ; : syswrite ( u c-addr fd -- n ) 1 syscall3 ; : say ( c-addr u -- ) swap 2 syswrite drop ; : emit ( chr -- ) sp cell+ 1 swap 1 syswrite 2drop ; : cr 10 emit ; : decimal 10 base ! ; : hex 16 base ! ; hex : ret, c3 c, ; decimal : 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) : recurse latest @ >cfa compile, ; immediate : literal [compile] lit ; immediate : constant create [compile] lit ret, ; : variable 1 cells allot create [compile] lit ret, ; 32 constant bl : space bl emit ; \ TODO interpret mode strings? : s" [ char " ] literal 1 >in +! ( skip spc ) [compile] litstring ; immediate : ." [compile] s" ' say compile, ; immediate \ lol this word breaks the highlighting, here have another " : begin here @ ; immediate : again branch here @ 4 + - d, ; immediate \ add 4 to get to beginning of the next instruction : until 0branch here @ 4 + - d, ; immediate : if 0branch here @ 0 d, ; immediate ( I: -- a ) : else branch here @ 0 d, swap dup here @ swap - 4 - swap d! ; immediate : then dup here @ swap - 4 - swap d! ; immediate : / /mod swap drop ; : mod /mod drop ; \ PNO \ mostly from pforth \ currently broken if unsigned number has more than 18 digits \ unfortunately this also seems to include any negative number \ it continues reading words but a number literal causes a crash variable hld : <# dap hld ! ; : hold 1 hld -! ( chr ) hld @ c! ; : sign 0< if [ char - ] literal hold then ; : # base @ /mod swap 9 over > if 7 + then [ char 0 ] literal + hold ; \ issue is in here i think? : #s begin # dup 0= until ; : #> drop hld @ dap over - ; : ud. <# #s #> say ; : t ." testtesttesttest" cr ; bye \ 100000000000000000 ud. bye \ t testing bye