X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=wordlists.asm;h=5f4f281c6be3ea3f2bcb1047b7379bedcd9c40ec;hb=0d3bd729048b79778f83f100fbaab1970f4efc05;hp=705f360927b5dd001be626ecdde81721efa63b12;hpb=2f357c67f0323aafe05e997053b180e6e79d8ea0;p=rrq%2Frrqforth.git diff --git a/wordlists.asm b/wordlists.asm index 705f360..5f4f281 100644 --- a/wordlists.asm +++ b/wordlists.asm @@ -19,34 +19,10 @@ ;;; ;;; WORDLIST ( "name" -- ) = start - WORD p_tfa2cfa,'TFA>CFA',fasm - ;; ( tfa -- cfa ) - ;; Advance a word tfa pointer to the cfa field - mov rax,qword[rsp] - tfa2cfa rax - mov qword [rsp],rax - next - - WORD p_tfa2dfa,'TFA>DFA',fasm - ;; ( tfa -- dfa ) - ;; Advance a word tfa pointer to the dfa field - mov rax,qword[rsp] - tfa2dfa rax - mov qword [rsp],rax - next - - WORD p_dfa2tfa,'DFA>TFA',fasm - ;; ( dfa -- tfa ) - ;; Advance a word tfa pointer to the dfa field - mov rax,qword[rsp] - mov rax,qword [rax-24] ; tfa - mov qword [rsp],rax - next - WORD p_wordlist,'CURRENT-WORDLIST',dovariable ;; CURRENT-WORDLIST points to cfa of the currently active wordlist. dq p_forth_DFA - + WORD p_words,'WORDS',fasm ;; ( -- ) ;; Dump all words @@ -88,7 +64,7 @@ p_words_END: inc rdx p_strncmp_loop: dec rdx - je p_strncmp_end + jle p_strncmp_end mov cl,[rax] inc rax sub cl,[rbx] @@ -109,16 +85,16 @@ p_strncmp_end: p_find_loop: cmp rcx,0 je p_find_notfound ; jump at end of word list - cmp rbx,qword [rcx+16] ; compare lengths + cmp rbx,qword [rcx+24] ; compare lengths jne p_find_nextword ; jump on length mismatch push rcx ; save tfa for later ;; check word push rsi ; input chars tfa2pname rcx - push rcx ; word chars + push rcx ; word pname push rbx ; length - DOFORTH p_strncmp - pop rax ; return value + DOFORTH p_strncmp ; ( s1* s2 n -- v ) + pop rax ; return value v pop rcx ; restore tfa cmp rax,0 je p_find_found