52 lines
655 B
NASM
52 lines
655 B
NASM
|
config_tokens:
|
||
|
.buffers:
|
||
|
db 8, "BUFFERS="
|
||
|
.drives:
|
||
|
db 7, "DRIVES="
|
||
|
.files:
|
||
|
db 6, "FILES="
|
||
|
.none:
|
||
|
db 0
|
||
|
|
||
|
; IN SI offset of needle
|
||
|
; DI offset to haystack table
|
||
|
; OUT DI found offset in table
|
||
|
; ZF zero flag set if match
|
||
|
config_search_token:
|
||
|
push bp
|
||
|
push cx
|
||
|
.loop:
|
||
|
cmp BYTE [di], 0
|
||
|
je .fail
|
||
|
push si
|
||
|
push di
|
||
|
mov bp, di
|
||
|
xor ch, ch
|
||
|
mov cl, [di]
|
||
|
inc di
|
||
|
add bp, cx
|
||
|
inc bp
|
||
|
repe cmpsb
|
||
|
pop di
|
||
|
pop si
|
||
|
je .end
|
||
|
mov di, bp
|
||
|
jmp .loop
|
||
|
.fail:
|
||
|
stc
|
||
|
.end:
|
||
|
pop cx
|
||
|
pop cx
|
||
|
ret
|
||
|
|
||
|
config_parse_int:
|
||
|
ret
|
||
|
|
||
|
; IN BX offset to config data
|
||
|
config_first_run:
|
||
|
mov si, bx
|
||
|
mov di, config_tokens
|
||
|
call config_search_token
|
||
|
int3
|
||
|
ret
|