2d17b4e8ec
I'm not sure why I chose null-terminated initially. Probably because the z80asm version had null-terminated strings. Length-prefixes strings are the traditional form of strings in Forth and it's a bit easier to work with them with traditional forth words when they're under this form.
17 lines
696 B
Plaintext
17 lines
696 B
Plaintext
PC ORG @ 4 + ! ( find )
|
|
( Find the entry corresponding to word name where (HL) points
|
|
to in dictionary having its tip at DE and sets DE to point
|
|
to that entry. Z if found, NZ if not. )
|
|
BC PUSHqq,
|
|
HL PUSHqq,
|
|
( First, figure out string len )
|
|
A (HL) LDrr, A ORr,
|
|
( special case. zero len? we never find anything. )
|
|
IFNZ, ( fail-B296 )
|
|
( Let's do something weird: We'll hold HL by the *tail*.
|
|
Because of our dict structure and because we know our
|
|
lengths, it's easier to compare starting from the end. )
|
|
C A LDrr, B 0 LDrn, ( C holds our length )
|
|
BC ADDHLss, HL INCss, ( HL points to after-last-char )
|
|
( cont . )
|