diff options
Diffstat (limited to 'quine.asm')
| -rw-r--r-- | quine.asm | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/quine.asm b/quine.asm index 213cb23..fdf55c9 100644 --- a/quine.asm +++ b/quine.asm @@ -5298,18 +5298,23 @@ defword guess_entry_end_in, 0 ; saying the length is zero. dq swap, drop, swap, drop, exit ; If not, search backwards from the end to find the following entry. + ; (here, original entry address) + dq dup, unroll3 + ; (original entry address, here, original entry address) dq next_newer_entry_in - ; (here, next entry address or 0) + ; (original entry address, here, next entry address or 0) ; Check whether we were able to find the next-entry address. - dq dup, lit, 0, eq, zbranch, 3*8 + dq dup, lit, 0, eq, zbranch, 4*8 + ; This is the branch where the original entry is not in the list. Return - ; "here". - ; - ; TODO it would probably be better to return the original entry address. - dq drop, exit - ; This is the branch where it's found. Return the next entry address. - dq swap, drop, exit + ; the original entry address as the result; as above, this means we're + ; saying the length is zero. Since we don't have anything else to go on, + ; this is the safe assumption. + dq drop, drop, exit + + ; This is the branch where we found it. Return the next entry address. + dq swap, drop, swap, drop, exit ; Jonesforth calls this "CFA>". Jonesforth's implementation searches the ; entire dictionary, since its word header format isn't designed to be |