From b618fbabca4660203ea4801ddc1b4fb38ca5347e Mon Sep 17 00:00:00 2001 From: kitty Date: Tue, 27 Jan 2026 18:42:13 +1100 Subject: untested @ ! and some notes --- jefs.fs | 0 jefs.s | 19 ++++++++++++++++++- readme.md | 21 ++++++++++++++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 jefs.fs diff --git a/jefs.fs b/jefs.fs new file mode 100644 index 0000000..e69de29 diff --git a/jefs.s b/jefs.s index dd861df..a53b8d4 100644 --- a/jefs.s +++ b/jefs.s @@ -62,8 +62,25 @@ section .text global _start _start: ; init - mov r14, wstack + mov r14, wstack ; point SP to top mov rdi, 0 mov rax, __NR_exit syscall + +defword "@", fetch, 0 + pspop r11 + mov r12, qword [r11] + pspush r12 + ret + +defword "!", store, 0 + pspop r11 + pspop r12 + mov qword [r11], r12 + ret + +initfile: +incbin "jefs.fs" +initlen equ $ - initfile +initfile_end: diff --git a/readme.md b/readme.md index abeafe8..e01353b 100644 --- a/readme.md +++ b/readme.md @@ -44,7 +44,26 @@ so a wonky but hopefully not too slow solution is to compile - `mov r11, [cfa]` = `94 BB [CFA]` - `call r11` = `41 FF D3` -## Some Links +### words to bootstrap from +i want to make the kernel reasonably small, +especially if i add an assembler. +but obviously we need *something* to bootstrap from. +(this list is Inspired by [miniforth](https://github.com/meithecatte/miniforth)'s builtins) + +- `!` (`val addr -- `): store a 64 bit word +- `@` (`addr -- val`): fetch a 64 bit word +- `c!` (`byte addr -- `): store a byte +- `c@` (`addr -- byte`): fetch a byte +- `:` (` -- `): compile a word from the current input source +- `;` (` -- `): stop compiling the current word +- `parse` (` -- c-addr u`): parse a word from the *forth init* (see footnote) +- `latest`: a variable, the latest defined word +- `state`: a variable, determines current mode (interp./compiling) + +on `parse`: i don't want to deal with file access and stuff from the kernel. +so this word will be Upgraded in the forth init to read from a file. + +### Some Links - starting forth part 1: http://www.bradrodriguez.com/papers/moving1.htm - a forum thread about determining empty stack with TOS register: http://forum.6502.org/viewtopic.php?t=8424 -- cgit v1.2.3