when a repeat enabled button is "held" it returns a BUTTON_STATE of 5
this can be the led "on" cue

when the button is "released" it returns a BUTTON_STATE of < 5 (1 or 2 )
this can be the led "off" cue


Code:
LOP:
    GOSUB  CK_BUTTON
    IF      BUTTON_STATE[0]   THEN
       IF      BUTTON_STATE[0] >4 then
           PORTD.0=1
       else
           PORTD.0=0 
           BUTTON_STATE[0]=0
       endif   
    endif
goto lop