You must install 10K pullups if you are using Port 0 for anything else but addressing. Look at the datasheet.
Looks like the code below should work, as long as you have pullup resistors.
Code:
org 000h
mov p0,#0ffh ;writing ff to the port makes it an input
mov p1,#11110111b
bil:
jnb p0.0,bil
mov p1,#11100110b
end