( VCAT - Vocabulary catalog for HP-71 FORTH) ( up-arrow displays previous word, any other next) ( Tapani Tarvainen 85/05/16) ( needs ?FORGET and NTYPE from FLIB) ( Vocabulary consists of 14 lists:) ( in RAM, pointer addr in CONTEXT,) ( and 13 in ROM, pointers at E0000-E003C) ( list starting at E0000 contains only null word) BASE @ HEX ?FORGET PREVWD : PREVWD ( list-head-pt1 NFA1 -- lhp2 NFA2) ( find previous word in vocabulary) OVER @ OVER = ( are we at beg of list?) IF DUP 0> ( in RAM, i.e. at very 1st word?) IF EXIT ( stay there) THEN ( get previous list) DROP DUP E0000 = ( in 0-ch word list?) IF DROP CONTEXT @ ( go to RAM list) ELSE 5- ( previous ROM list) THEN 0 ( search for list end) THEN ( searched NFA or 0 on top, list head addr below it) ( search list for previous entry) OVER BEGIN ( NFA1 LFA) 2DUP @ <> WHILE @ 5- ( next LFA) REPEAT 5+ ( LFA -- NFA) SWAP DROP ( discard NFA1) ; : VCAT ( --) CONTEXT @ ( pointer to 1st word in search order) BEGIN ( list-head-pointer ) DUP @ BEGIN ( list-head-pt NFA) DUP COUNT NTYPE CR KEY 12 = ( up-arrow pressed?) IF PREVWD ( get previous word) ELSE 5- @ ( next word's NFA) THEN ?DUP 0= ( end of list?) UNTIL ( next list) DUP 0> IF DROP E0000 ELSE 5+ THEN DUP E003C > UNTIL DROP ; BASE !