2 ; Ullrich von Bassewitz, 2005-04-21
4 ; char* __fastcall__ getenv (const char* name);
6 ; Beware: putenv() knows about zero page usage in this module!
10 .import __environ, __envcount
13 .import ptr1:zp, ptr3:zp, tmp1:zp
17 ;----------------------------------------------------------------------------
23 stx ptr1+1 ; Save name
25 ; Search for the string in the environment. searchenv will set the N flag if
26 ; the string is not found, otherwise X contains the index of the entry, ptr3
27 ; contains the entry and Y the offset of the '=' in the string.
31 jmp return0 ; Not found, return NULL
33 ; Found the entry. Calculate the pointer to the right side of the environment
34 ; variable. Because we want to skip the '=', we will set the carry.
36 found: ldx ptr3+1 ; High byte of result