IN 8-bit addr:
- This instruction is used to copy the data from the port into the accumulator.
- The address of the port is given in the instruction.
OPERATION: A = (8-bit addr)
- No flags are affected.
- It is a two byte instruction.
- Direct addressing mode is used.
Example:
If port address = 20H, (20H) = 08H, then
IN 20H ; This instruction will copy the data stored at port address 20H i.e. 08H into the accumulator.
OUT 8-bit addr:
- This instruction is used to copy the contents of the accumulator to the output port.
- The address of the port is given in the instruction.
OPERATION: (8-bit addr) = A
- No flags are affected.
- It is a two byte instruction.
- Direct addressing mode is used.
Example:
If A = 08H, then
OUT 20H ; This instruction will copy the contents of the accumulator i.e. 08H to the port whose address is 20H.
Thank you this was really helpful.
ReplyDelete