PRGNAME$() returns the name of the program in the current slot by default, and you can compare the result with PRGNAME$(SlotNumber).
DEF CURRENTSLOT() VAR NAME$=PRGNAME$() VAR SLOT% FOR SLOT%=0 TO 3 IF NAME$==PRGNAME$(SLOT%) THEN RETURN I% NEXT RETURN -1 ENDEDIT: there's a possibly better way using BACKTRACE and CHKCHR