I refers to the "The 8051 Microcontroller And Embedded Systems Using Assembly And C" by Muhammad Ali Mazidi in which it was mentioned that to use any port of 8051 as input port the logic 1 must be written to the port pins.why?
Because when u assign 1 to any pin it get connect to Vcc and if u assign 0 then it connect it to Gnd.
when i/p pin get gnd then it complete its route so we read as 0 and vice versa.