From 1e8811261e7b7a58ff4269c9b4ef16fbcc49e3d4 Mon Sep 17 00:00:00 2001 From: kitty Date: Sun, 15 Feb 2026 13:12:05 +1100 Subject: emit, cr, sp --- jefs.fs | 7 +++++-- jefs.s | 6 ++++++ readme.md | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/jefs.fs b/jefs.fs index e1831a8..aa5d44c 100644 --- a/jefs.fs +++ b/jefs.fs @@ -6,10 +6,13 @@ : if 0branch here @ 0 d, ; immediate ( I: -- a ) : then dup here @ swap - 4 - swap d! ; immediate +: cells 8 * ; +: cell+ 8 + ; : / /mod swap drop ; : mod /mod drop ; : syswrite ( u c-addr fd -- n ) 1 syscall3 ; : say ( c-addr u -- ) swap 1 syswrite drop ; -: saying 0 if bye then ; -saying TESTSTR say bye +: emit ( chr -- ) sp cell+ 1 swap 1 syswrite 2drop ; +: cr 10 emit ; +TESTSTR say cr bye diff --git a/jefs.s b/jefs.s index e0b0c70..a6fa1b4 100644 --- a/jefs.s +++ b/jefs.s @@ -153,6 +153,12 @@ defword "c,", c_comma, 0 mov qword [here], r12 ret +; note: this puts the _address it itself pushes_ on the stack +; maybe this is not the correct approach? +defword "sp", _sp, 0 + pspush r14 + ret + ; stage 1 parser. very rudimentary, ; since it will only parse a little bit of the init file ; there won't be much error checking either. diff --git a/readme.md b/readme.md index dc3d234..58c8dc7 100644 --- a/readme.md +++ b/readme.md @@ -1,7 +1,8 @@ # jewelforth -its a subroutine threaded forth for linux x86\_64. +it's a subroutine threaded forth for linux x86\_64. mostly made for personal stuff. +it does not conform to any standards, i just implement what i want. if you use it and it breaks, too bad public domain -- cgit v1.2.3