From c2f00cb50d8507c83b45798fb287dff407d18cdd Mon Sep 17 00:00:00 2001 From: faissaloo Date: Sat, 23 Jul 2016 19:31:17 +0100 Subject: Path finder now compares a qword at a time for speed --- sh.asm | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'sh.asm') diff --git a/sh.asm b/sh.asm index a1dc0be..0c5d707 100644 --- a/sh.asm +++ b/sh.asm @@ -154,27 +154,17 @@ _parse_path2: ; Reads the PATH variable _pathfinder: inc r8 - xor rax, rax - mov byte al, [r8] - cmp al, `P` - jne _pathfinder - mov byte al, [r8+1] - cmp al, `A` - jne _pathfinder - mov byte al, [r8+2] - cmp al, `T` - jne _pathfinder - mov byte al, [r8+3] - cmp al, `H` - jne _pathfinder - mov byte al, [r8+4] - cmp al, `=` - jne _pathfinder - mov byte al, [r8+5] - cmp al, `"` - jne _pathfinder - test al, al ;checks for 0 - je _quit + + ;Check that we've found the PATH variable + mov r10, `\0\0PATH="` + mov rax, [r8] + shl rax, 16 + cmp rax,r10 + jne _pathfinder ;if we haven't, let's move right one and see if it's there + shr rax, 56 + test al, al ;checks for a null terminator after 'PATH=' + jz _quit + add r8, 0x6 mov r10, 0x1 push 0x0 -- cgit v1.2.3