getenv.asm
来自「RTL8019 DOS 下的驱动」· 汇编 代码 · 共 38 行
ASM
38 行
phd_enviorn equ 2ch
getenv:
;enter with si->environ string to search for.
;exit with cy if not found, or nc, es:di->value if found.
mov es,cs:[phd_enviorn] ;get our enviornment segment.
xor di,di
getenv_1:
push si
push di
getenv_2:
lodsb ;get a character.
or al,al ;end of string?
je getenv_3 ;yes.
scasb ;did it match?
je getenv_2 ;yes.
getenv_3:
je getenv_4
pop di
pop si
xor al,al ;skip to the next string.
mov cx,100h ;no string can be longer than 256 bytes.
repnz scasb
jne getenv_5 ;go if environment is trashed.
cmp byte ptr es:[di],0 ;is this the last one?
jnz getenv_1 ;no - try again.
getenv_5:
stc
ret
getenv_4:
add sp,4 ;pop the old stuff off the stack.
clc
ret
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?