Chuck(G)
25k Member
Plantronics
ToUpper simply converts the value in (AL) to uppercase.
Code:
;* Search_Env - Search for an environment variable.
; ------------------------------------------------
;
; On entry - (es) = PSP segment
; (ds:bx) = search string, terminated by '=',0
;
; Returns - (es:di) = first character of value if carry clear.
; if carry set, no such variable was found.
;
Search_Env proc near public
push es
mov si,bx
mov ax,word ptr es:[02ch] ; get param paragraph
mov es,ax
xor di,di ; es:0 is search start
cld
Search_Env2:
xor bx,bx
test byte ptr es:[di],-1
jnz Search_Env4 ; if need to keep on searching
; There was no variable, return failure.
pop es
stc
ret ; exit...
Search_Env4:
mov al,es:[di] ; get a character of search string
inc di
test al,al
jz Search_Env2 ; if at end of source string
call ToUpper
cmp al,[bx+si] ; see if match here
jne Search_Env6 ; if not
inc bx
test byte ptr [bx+si],-1
jnz Search_Env4 ; keep looping
pop ax ; clear stack
clc
ret ; exit, success
; No hit here, go to next string.
Search_Env6:
xor al,al
mov cx,-1
repne scasb ; scan past the 00 byte terminator
jmp Search_Env2 ; look at next string
Search_Env endp
ToUpper simply converts the value in (AL) to uppercase.
Last edited: