From de7c0151df9e1aed2289b4848030cdbcb24eda2d Mon Sep 17 00:00:00 2001 From: kitty Date: Thu, 22 Jan 2026 22:40:50 +1100 Subject: changed mind: TOS in memory i don't actually think this matters, especially on this hardware. plus it complicates implementation. --- jefs.s | 9 +++------ readme.md | 6 +----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/jefs.s b/jefs.s index c97f2f6..dd861df 100644 --- a/jefs.s +++ b/jefs.s @@ -3,13 +3,11 @@ ;; MACROS {{{ %macro pspush 1 lea r14, [r14-8] - mov qword [r14], r15 - mov r15, %1 + mov qword [r14], %1 %endmacro %macro pspop 1 - mov %1, r15 - mov r15, qword [r14] + mov %1, qword [r14] lea r14, [r14+8] %endmacro @@ -64,8 +62,7 @@ section .text global _start _start: ; init - mov r14, wstack + 16 ; two cells ahead; signifies empty stack - xor r15, r15 + mov r14, wstack mov rdi, 0 mov rax, __NR_exit diff --git a/readme.md b/readme.md index a4d38f3..abeafe8 100644 --- a/readme.md +++ b/readme.md @@ -29,13 +29,9 @@ 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. - IP, the instruction pointer, is r13. (this will only be needed if we switch to DTC, otherwise this can be Y, a third general purpose register) -- NOS, the next-on-stack pointer, is r14. -- TOS, the top of the stack, is r15. +- SP, the working stack pointer, is r14. - RSP, the return stack pointer, is rsp. -on NOS (r14): TOS is kept in a register, -NOS points to the *second* item in the stack. - ## miscellaneous notes and stuff ### COMPILE, -- cgit v1.2.3