
 ( Always configure inputs as Active Low )

 InputBit :   setb  p1.0       ; make p1.0 as input
              jb  p1.0, $      ; wait here till input is active 

 InputByte:   mov p1, #0ffh    ; to make p1 as input
              mov a,  p1       ; read the 8 bits of p1 

(now Acc contains  the input data - Use it to your hearts content )

  OutputBit:  setb  p1.0       ; makes p1.0 high
              clr   p1.0       ; makes p1.0 low

  OutputByte:  mov p1, #55h    ; makes alternate bits hi/lo. 

(And I assume you have not connected any load to  these pins as of now.. ) 

