From e3b77b76497fe3f59867d426bd3a7b1ceaee3245 Mon Sep 17 00:00:00 2001 From: kitty Date: Thu, 26 Feb 2026 16:10:36 +1100 Subject: add end of input handling to cparse --- jefs.s | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/jefs.s b/jefs.s index 03436f6..2a566fd 100644 --- a/jefs.s +++ b/jefs.s @@ -275,9 +275,13 @@ defword "cparse", cparse, 0 pspop r15 ; c mov r13, qword [to_in] add r13, qword [tib] + mov r10, qword [tib] + add r10, qword [num_tib] mov r12b, byte [r13] .wordloop_start: + cmp r13, r10 + jge .empty push r13 ; keep start address of this word for later mov r11, 1 ; W: word length count .wordloop: @@ -286,6 +290,8 @@ defword "cparse", cparse, 0 inc r11 inc r13 + cmp r13, r10 + jge .empty mov r12b, byte [r13] jmp .wordloop @@ -298,6 +304,12 @@ defword "cparse", cparse, 0 pspush r11 ; u ret +.empty: + xor r13, r13 + pspush r13 + pspush r13 + ret + defword "find", find, 0 pspop r10 ; u pspop r11 ; c-addr -- cgit v1.2.3