10

On the 8080 there are many instructions with parallel forms. Three of these are CALL, RET and JP, which all have conditional and immediate forms.

Note: I am using Z80 terminology because that is what I am familiar with.

In octal:

  • 3p0 - RET <cond>
  • 3p2 - JP <cond>
  • 3p4 - CALL <cond>

where p - <cond> represents a flag/value combination:

0 - NZ (Z=0, Non Zero)
1 - Z  (Z=1, Zero)
2 - NC (C=0, Non Carry)
3 - C  (C=1, Carry)
4 - PO (V=0, Parity Odd / non oVerflow)
5 - PE (V=1, Parity Even / oVerflow)
6 - P  (S=0, Sign Plus)
7 - M  (S=1, Sign Minus)

The immediate forms are:

  • 311 - RET
  • 303 - JP
  • 315 - CALL

All of the CALL and JP instructions take the next two bytes as the 16-bit address to go to, but that is irrelevant to my question.

The 8080 did not define instruction 313, which was later used by the Z80 to expand the instruction set. Why did the designers of the 8080 not use 313 for JumP immediate, and leave 303 undefined instead?

11

According to this newsgroup post, 0313 (which is 0xCB) may in fact be an undocumented variant of JP on original 8080 processors. Given this, the reason for the irregularity may be as simple as a documentation error that was never corrected due to the fact that the documented opcode did in fact work, even if it was never intended to (like many other processors of the early 70s, the 8080 only partially decoded opcodes, resulting in either copies of instructions or merged behaviours from multiple instructions appearing at opcodes that were not occupied intentionally).

  • 2
    This is correct answer, there're more duplicates caused by partial decode, see also here pastraiser.com/cpu/i8080/i8080_opcodes.html. Z80 designers used non-documented opcodes to extend functionality, and those software developers initially complying to the 8080 documentation did not have issues porting to Z80. – Anonymous Apr 14 '18 at 9:28
  • That raises another potentially-interesting question, though it's perhaps too broad to be suitable here: was there generally any particular rhyme or reason to how chip designers selected would select which form of an instruction to document? – supercat Apr 16 '18 at 17:08
  • @supercat Looking through the 8080 instruction set after posting my question, it seems in this case they just always used the lowest code in any block. So even though 313 might have been more sensible, 303 was lower. – CJ Dennis Apr 22 '18 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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