diff options
Diffstat (limited to 'jefs.fs')
| -rw-r--r-- | jefs.fs | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -2,7 +2,7 @@ : cell+ 8 + ; : cell- 8 - ; -: tell ( c-addr u -- ) swap 1 1 syscall3 drop ; +: type ( c-addr u -- ) swap 1 1 syscall3 drop ; : emit ( chr -- ) sp cell+ 1 swap 1 1 syscall3 2drop ; : cr 10 emit ; @@ -70,7 +70,7 @@ hex : ret, c3 c, ; decimal \ TODO interpret mode strings? : s" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup cmove, nip r> dup >resolve 4 + [compile] lit [compile] lit ; immediate -: ." [compile] s" ' tell compile, ; immediate \ lol this word breaks the highlighting, here have another " +: ." [compile] s" ' type compile, ; immediate \ lol this word breaks the highlighting, here have another " : z" 1 >in +! [ char " ] literal cparse branch >mark >r 2dup cmove, 0 c, nip r> dup >resolve 4 + [compile] lit drop ( 1+ [compile] lit ) ; immediate : s>z ( a u -- zstr ) here @ -rot cmove, 0 c, ; @@ -207,21 +207,21 @@ variable hld : #> drop hld @ pad over - ; : (u.) <# #s #> ; -: u. (u.) tell space ; -: u.r >r (u.) r> over - spaces tell ; +: u. (u.) type space ; +: u.r >r (u.) r> over - spaces type ; : (.) dup abs <# #s swap sign #> ; -: . (.) tell space ; -: .r >r (.) r> over - spaces tell ; +: . (.) type space ; +: .r >r (.) r> over - spaces type ; : (.byte) hex <# # # #> decimal ; -: .byte (.byte) tell space ; +: .byte (.byte) type space ; : (.word) hex <# # # # # #> decimal ; -: .word (.word) tell space ; +: .word (.word) type space ; : (.dword) hex <# # # # # # # # # #> decimal ; -: .dword (.dword) tell space ; +: .dword (.dword) type space ; : (.qword) hex <# # # # # # # # # # # # # # # # # #> decimal ; -: .qword (.qword) tell space ; +: .qword (.qword) type space ; \ }}} \ SYSCALL ERRORS {{{ @@ -267,7 +267,7 @@ decimal : mark-exec PROT_rwx bytes-allocated herestart @ mprotect errno .errno ; : grow ( n -- ) brk@ + sysbrk heremax ! mark-exec ; \ todo check error -: .free bytes-free u. ." of " bytes-allocated u. ." bytes free (used " bytes-used (.) tell ." )" cr ; +: .free bytes-free u. ." of " bytes-allocated u. ." bytes free (used " bytes-used (.) type ." )" cr ; \ }}} 6 constant #error-msgs @@ -291,7 +291,7 @@ make error-msgs #error-msgs cells allot : hide parse find drop (hide) ; \ todo error handling : hidden? ( lfa -- ? ) >ffa c@ 1 and 0<> ; -: (words) ( lfa -- ) dup hidden? not if >nfa dup w@ swap 2 + swap tell 2 spaces else drop then ; +: (words) ( lfa -- ) dup hidden? not if >nfa dup w@ swap 2 + swap type 2 spaces else drop then ; : words latest @ begin ?dup 0<> while dup (words) @ repeat cr ; : depth ( -- n ) s0 @ sp @ - 16 - ; @@ -437,7 +437,7 @@ termios TCGETS stdin ioctl ( noname ) swap execute value tty \ each change uses a different one, which is not too efficient \ Pm sequences allow multiple with ; -: CSIm ( n -- ) CSI (.) tell ." m" ; +: CSIm ( n -- ) CSI (.) type ." m" ; : foreground 30 + CSIm ; : background 40 + CSIm ; @@ -448,7 +448,7 @@ termios TCGETS stdin ioctl ( noname ) swap execute value tty : bold 1 CSIm ; : normal 0 CSIm ; -: at-xy ( x y -- ) CSI 1+ (.) tell ." ;" 1+ (.) tell ." H" ; +: at-xy ( x y -- ) CSI 1+ (.) type ." ;" 1+ (.) type ." H" ; : page CSI ." 2J" 0 0 at-xy ; 60 constant old-termios# @@ -514,9 +514,9 @@ decimal : (dumpchar) ( a -- a+1 ) dup @ >byte dup dump-colour foreground dump-char emit 1+ ; : (dumpascii) ( a -- ) 16 begin ?dup 0> while swap (dumpchar) swap 1- repeat default foreground drop ; -: (dumploc) ( a -- ) (.dword) tell ." : " ; +: (dumploc) ( a -- ) (.dword) type ." : " ; -: (d+) ( a -- a+1 ) dup @ >byte dup dump-colour foreground (.byte) tell default foreground 1+ ; +: (d+) ( a -- a+1 ) dup @ >byte dup dump-colour foreground (.byte) type default foreground 1+ ; : (dw+) ( a -- a+2 ) (d+) (d+) space ; : (dumphex) ( a -- ) (dw+) (dw+) (dw+) (dw+) (dw+) (dw+) (dw+) (dw+) drop ; |
