summaryrefslogtreecommitdiff
path: root/jefs.s
diff options
context:
space:
mode:
authorkitty <nepeta@canaglie.net>2026-02-16 22:55:40 +1100
committerkitty <nepeta@canaglie.net>2026-02-16 22:55:40 +1100
commit9085321aa274b63a30fc6a1edf75820ab6875437 (patch)
treef89b5ee9c61e1bb158cb88eb78c13d752ddb6fbb /jefs.s
parent660a99ca247cea4f9de3e5b6744728dd385a9494 (diff)
CREATE asm word
i Probably should change : to use this. and while i'm at it make a word for setting/unsetting the smudge bit.
Diffstat (limited to 'jefs.s')
-rw-r--r--jefs.s55
1 files changed, 55 insertions, 0 deletions
diff --git a/jefs.s b/jefs.s
index 555d430..5101a8f 100644
--- a/jefs.s
+++ b/jefs.s
@@ -165,6 +165,28 @@ defword "c,", c_comma, 0
mov qword [here], r12
ret
+defword "cmove", _cmove, 0 ; ( a1 a2 u -- )
+ pspop rcx
+ pspop rdi
+ pspop rsi
+
+ rep movsb
+ ret
+
+defword "cmove,", _cmove_comma, 0 ; ( c-addr u -- )
+ mov r12, qword [here]
+
+ pspop r9
+ mov rcx, r9
+ pspop rsi
+ mov rdi, r12
+
+ rep movsb
+
+ add r12, r9
+ 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
@@ -376,6 +398,7 @@ defword "compile,", compile_comma, 0
mov qword [here], r12
ret
+; todo: separate the CREATE functionality out
defword ":", colon, 0
call parse
pspop r9 ; u
@@ -421,6 +444,38 @@ defword ";", semicolon, immediate_mask
mov qword [state], interpreting
ret
+; this is basically an edited copy of :
+; which should probably be rewritten to use this word
+; the differences:
+; this word does not change state
+; smudge mask is not set
+defword "create", create, 0
+ call parse
+ pspop r9 ; u
+ pspop r10 ; c-addr
+ mov r11, [latest]
+ mov r12, [here]
+ push r12 ; keep for LATEST
+
+ mov qword [r12], r11
+ add r12, 8
+ mov byte [r12], 0
+ inc r12
+ mov word [r12], r9w ; r9w from r9: safe?
+ add r12, 2
+
+ ; strcpy
+ mov rcx, r9
+ mov rsi, r10
+ mov rdi, r12
+ rep movsb
+ add r12, r9
+
+ mov qword [here], r12
+ pop r12
+ mov qword [latest], r12
+ ret
+
defword "number", number, 0 ; ( c-addr u -- ?n flag )
pspop r11 ; u
pspop r12 ; c-addr