404 ; Example of finding an environmental variable in the environment string jmp start errmess: db 'Not found$' env_var: db 'PATH=',0 env_val: db 128 dup 0 start: mov si,0 push es mov es,ds push ds mov ds,W[02C] ;Fetch the environment one_more: es mov di,env_var l1: cmpsb je l1 sub si,1 es cmp di,env_val ; All characters match? je getval ; Yes, fetch value of variable nxtch: inc si ; Find next variable in string ds cmp b[si],0 jne nxtch inc si ds cmp b[si],0 ; End of Environment string? jne one_more ; No, check the variable pop ds pop es mov ah,09H mov dx,errmess int 21H mov ax,04c00 int 21H getval: ; Get contents of variable movsb cmp b[si-1],0 jne getval es mov b[di],'$' pop ds pop es mov ah,09H mov dx,env_val int 21H mov ax,04c00 int 21H c_end: . 0