3 ms·
Apart from unique functionality such as the separate I/O port bus and the ability to access the 16-bit registers' two 8-bit halves, there are quite a few instru
by bonzini 4y ago
Apart from unique functionality such as the separate I/O port bus and the ability to access the 16-bit registers' two 8-bit halves, there are quite a few instruction encoding quirks that reveal the ancestry of the 8086:
* the x86 encodes the first four registers in the order AX, CX, DX, BX. This roughly matches the Z80 ordering of AF (accumulator), BC (used as counter for string operations), DE (no particular purpose), HL (the "main" address register).
* PUSH/POP operate only on 16-bit registers
* the encoding of flags (SZ0H0P1C on x86, SZuHuPNC where u is undocumented on Z80). The "auxiliary carry" and instructions such as DAA, and the "parity" flag, are particularly weird and common to both Z80 and 8086. Flags exclusive to the 8086 (interrupt, direction, overflow) are kept in the high bit of the flag register, so that the LAHF instruction makes AX look like the Z80 AF register.
* the eight conditional jumps of the Z80 are encoded in the same order in the 8086 (C<NC<Z<NZ<S<NS<PE<PO; the 8086 fits 8 more conditions in the holes)