1
\$\begingroup\$

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 ?

\$\endgroup\$
4

3 Answers 3

3
\$\begingroup\$

In Verilog HDL:

always @(posedge clk)
begin
  ...
  if (is_xchg_opcode)
  begin
     DE <= HL;
     HL <= DE;
  end
\$\endgroup\$
3
  • \$\begingroup\$ I think the OP won't understand this though ... \$\endgroup\$
    – Mitu Raj
    May 3, 2018 at 10:27
  • \$\begingroup\$ It was mean as a brain teaser to encourage looking into how a hardware language works. I'll update with the term 'verilog'. \$\endgroup\$
    – Oldfart
    May 3, 2018 at 10:36
  • \$\begingroup\$ aren't you just rephrasing the question? \$\endgroup\$ May 3, 2018 at 10:48
0
\$\begingroup\$

See this part of this answer to How is XCHG implemented in a 8086 processor?:

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
\$\endgroup\$
0
\$\begingroup\$

The content of the DE register pair is stored in the WZ register pair then:

DE <= content of HL
HL <= content of WZ
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.