First page Back Continue Last page Overview Text
This code clears bit 4 of port A without affecting other bits in port S. The bit 4 position in the mask is zero and when ANDed, the result in the bit 4 position of accumulator A will always be zero. The other bits in accumulator A will be unaffected since they are ANDed with ones.
This technique is extremely useful when more than one bit of an output port is connected to hardware. If a fixed value were to be written to all bits of port S without regard to the current settings in port S, bits other than the one requiring modification would likely be changed to states that were not desired. Your subroutine may not know what state the other bits in the port should be in, so you would not want to arbitrarily write ones or zeros to the other bits of the output port.