In assembly language, instruction
MOV A B
means moving the content of B
(source) to A
(destination).
I suddenly came up with the instruction
MOV D D
What does it imply?
I have seen this in my lab manual. Screenshot:
The 8085 register-to-register MOV instructions are orthogonal. That is, there are opcodes to move any of the 8-bit registers to any of the other 8-bit registers. So MOV D,D
moves the contents of the D register to the D register. It doesn't do anything useful and doesn't affect any of the flags, but it's a valid instruction just as are MOV A,A
, MOV B,B
, etc.
Copying a register to itself is effectively a "no operation" or NOP
instruction. The "official" 8085 NOP
is opcode 00
, but any of the register-move-to-itself instructions have the same effect.
It's really just an artifact of the way the processor was designed. There are some tricks you can do that make use of those instructions, but they're not generally useful.
You have to keep the era in mind, 8085 was designed back in 1977. Integrated circuit process technology was not nearly as advanced back then, there was a pretty hard upper limit on the number of transistors they could put on a die. It only uses 6,500 of them.
That puts a heavy limit on the kind of logic they could use to implement a processor. The bits in the opcode that selects the operands are passed directly to the register bank multiplexer. And occupy the same bit positions and meaning in other instructions that use a register. The budget to burn up additional transistors to make special exceptions for operands that don't make sense just wasn't available. It was much simpler and cheaper to leave them in place and not use up logic to deal with the exceptional case.
Not much of a problem, nobody was going to use the nonsensical instructions by accident.
It worked the other way around too btw, sometimes a processor had an obvious hole in the instruction set. The Z80 was like that. Intended for an instruction that was bugged in the first few silicon passes and not considered essential enough to fix. So they just left it out of the documentation. Or left them in place, 6502 was notoriously buggy. Had a very attractive price though :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With