diff options
| author | kitty <nepeta@canaglie.net> | 2026-02-16 23:40:35 +1100 |
|---|---|---|
| committer | kitty <nepeta@canaglie.net> | 2026-02-16 23:41:05 +1100 |
| commit | aa1061032d57667c5b53ab445b7942f3bbf6f681 (patch) | |
| tree | 6a4da5a9b4e15a5d15062d2565fd07bb2eb98cfb | |
| parent | 11ab7360e32aebf5dfc5a1331ebe44b0ceff6354 (diff) | |
jonesforth port improvements of stack words
| -rw-r--r-- | jefs.fs | 6 | ||||
| -rw-r--r-- | jefs.s | 17 |
2 files changed, 8 insertions, 15 deletions
@@ -7,12 +7,16 @@ : decimal 10 base ! ; : hex 16 base ! ; +hex +: ret, c3 c, ; +decimal + : cells 8 * ; : allot here @ swap here +! ; : [compile] parse find drop >cfa compile, ; immediate : ' parse find drop >cfa [compile] lit ; immediate \ note: no error handling (yet) -: constant create [compile] lit 195 ( ret ) c, ; +: constant create [compile] lit ret, ; : begin here @ ; immediate : again branch here @ 4 + - d, ; immediate \ add 4 to get to beginning of the next instruction @@ -582,20 +582,14 @@ defword "syscall3", syscall3, 0 ; ( rdx rsi rdi id -- rax ) ret ; stack {{{ -; these stack wrangling words are dreadfully inefficient right now -; i will come back and make these less terrible later defword "dup", dup, 0 mov r11, [r14] pspush r11 ret defword "2dup", twodup, 0 ; ( a b -- a b a b ) - ; todo inefficient - pspop r11 - pspop r12 - - pspush r12 - pspush r11 + mov r11, [r14] + mov r12, [r14+8] pspush r12 pspush r11 ret @@ -609,12 +603,7 @@ defword "swap", swap, 0 ret defword "over", over, 0 - ; TODO inefficient (use r14 ptr arith to only push once) - pspop r11 - pspop r12 - - pspush r11 - pspush r12 + mov r11, [r14+8] pspush r11 ret |
