~vdupras/duskos

5752ef1179d4f8ecebbb6cbb4c377c9dfbebc556 — Virgil Dupras 1 year, 3 months ago 5b6fad2
bootlo: optimize tuck and 2dup

I can't, for the life of me, remember why I wrote them thus during the HAL
rewrite. Minimize stack operations while leveraging the speed of W and A
interactions? or maybe in early HAL designs it made more sense.

In any case, tuck goes from 6 HAL operations to 4 and 2dup goes from 6 HAL
operations to 5.
1 files changed, 2 insertions(+), 2 deletions(-)

M fs/xcomp/bootlo.fs
M fs/xcomp/bootlo.fs => fs/xcomp/bootlo.fs +2 -2
@@ 8,8 8,8 @@ code dup dup, exit,
: rot, PSP) @!, PSP) 4 +) @!, ; code rot rot, exit,
code rot> PSP) 4 +) @!, PSP) @!, exit,
: over, dup, PSP) 4 +) @, ; code over over, exit,
code tuck W>A, PSP) @, dup, W<>A, PSP) 4 +) !, exit,
code 2dup W>A, PSP) @, -8 ps+, PSP) !, W<>A, PSP) 4 +) !, exit,
code tuck swap, over, exit,
code 2dup -8 ps+, PSP) 4 +) !, PSP) 8 +) @, PSP) !, PSP) 4 +) @, exit,

code @ W) @, exit,
code16b HERE @ W) 16b) @, exit,