How XCHG instruction is executed by 8085 microprocessor ? By default XCHG instruction takes place between DE pair and HL pair. Suppose let us assume contents of DE pair is replaced by the contents of HL pair, then how contents of HL pair are replaced by the contents of DE pair, because it is already replaced by contents of HL pair. How this is possible ?
In Verilog HDL:
always @(posedge clk) begin ... if (is_xchg_opcode) begin DE <= HL; HL <= DE; end
Using a hidden register. The 8085 has 2 hidden registers, but it is unknown if it used those registers for the xchange instruction. The 8086 has not been reverse engineered as of yet, so we don't know how many hidden registers it has.
Temp = A A = B B = Temp
The content of the DE register pair is stored in the WZ register pair then:
DE <= content of HL HL <= content of WZ