Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
686B

  1. ( Native words )
  2. H@ 4 + XCURRENT ! ( make next CODE have 0 prev field )
  3. CODE _find ( cur w -- a f )
  4. HL POP, ( w ) DE POP, ( cur ) chkPS,
  5. HL PUSH, ( --> lvl 1 )
  6. ( First, figure out string len )
  7. A (HL) LDrr, A ORr,
  8. ( special case. zero len? we never find anything. )
  9. IFZ, PUSH0, JPNEXT, THEN,
  10. BC PUSH, ( --> lvl 2, protect )
  11. ( Let's do something weird: We'll hold HL by the *tail*.
  12. Because of our dict structure and because we know our
  13. lengths, it's easier to compare starting from the end. )
  14. C A LDrr, B 0 LDri, ( C holds our length )
  15. BC ADDHLd, HL INCd, ( HL points to after-last-char )
  16. ( cont . )