Search code examples
assemblyports8051

Incrementing port bits in assembly


As part of a project, I've been asked to write a program to take input from P1 and output it to P2. The obvious method is to just say

ORG 000H

MOV C, P1.0
MOV P2.0, C
MOV C, P1.1
MOV P2.1, C

...

And so on. But I want to do this with a loop by incrementing the port bits. How would I do that?


Solution

  • There is a 'MOV direct, direct' instruction. In the manual I have OP 0x85 is MOV directly addressed data to a directly addressed location... i.e. MOV P0, P1