diff options
| -rw-r--r-- | jefs.s | 41 | ||||
| -rw-r--r-- | readme.md | 8 |
2 files changed, 43 insertions, 6 deletions
@@ -46,6 +46,9 @@ %assign smudge_mask 0x1 %assign immemdiate_mask 0x2 + +%assign false 0x0 +%assign true 0xffffffffffffffff ;;; }}} ;; syscall @@ -141,7 +144,44 @@ defword "parse", parse, 0 pspush r11 ; u ret +; probably fucked up and broken. have not tested any of this yet defword "find", find, 0 + pspop r10 ; u + pspop r11 ; c-addr + mov r12, latest + mov r13, qword [r12] + mov r12, r13 + +.check_smudge: + add r13, 8 + mov r9b, byte [r13] + test r9b, smudge_mask + jnz .no + +.no_smudge: + inc r13 + mov r9w, word [r13] + cmp r9w, r10w + jne .no + mov rsi, r13 + add rsi, 2 + mov rdi, r11 + repz cmpsb + jnz .no + sub r13, 9 + pspush r13 + mov r13, true + pspush r13 + ret + +.no: + mov r13, qword [r12] + mov r12, r13 + cmp r13, 0 ; end of dictionary? fallthrough to notfound if so + jne .check_smudge + + mov r13, false + pspush r13 ret ; stage 1 interpreter, just reads from initfile @@ -149,6 +189,7 @@ defword "interpret", interpret, 0 ret defvar ">in", to_in, 0, initfile +defvar "latest", latest, 0, lfa_latest initfile: incbin "jefs.fs" @@ -30,13 +30,9 @@ x86's `repz` for it. maybe there is a counted string version though, i don't know ## forth registers -there are a set of 'virtual registers' (see moving forth part 1) -- W, the working register, is r11. -- X, the secondary working register, is r12. -- Y, the tertiary working register, is r13. -- SP, the working stack pointer, is r14. -- RSP, the return stack pointer, is rsp. +- the working stack pointer, is `r14`. +- `r11`, `r12`, `r13`, and occcasionally `r10` and `r9` are general purpose working registers. ## miscellaneous notes and stuff |
