
MOV P0,#00H 
MOV P1,#00H             <--- port 0 assigned as output here
MOV P2,#00H 
MOV P3,#00H 
.....
HERE: 	JNB P1.7, HERE  <--- then you try to make it an input here

CALL DEBOUNCE           <--- where is the second test of switch?
