Elektrine lite

← Feed

@millihertz@oldbytes.space

Post #1493700

2026-04-20 09:31 UTC

well, that's odd. the 8085 has a bunch of undocumented instructions - basically, like the 6803 does the 6800, the 8085 attempts to fill some of the more obvious gaps in the 8080's capabilities. among them is the K flag, which as Ken Shirriff documented, is basically the XOR of the V flag (also new to the 8085) and the MSB of an ALU result - which, in the case of a subtraction, results in it being set if A < B. in other words, the 8085's JU is the equivalent of the 8086's JL (and JNU ≡ JGE). but the other use of the U flag is to indicate when INX and DCX have wrapped around - unsigned overflow. since INX and DCX set no other flags, this is, again, a useful addittion. the puzzling thing, though, is that apparerntly the 8085 instructions were left undocumented because they weren't compatible with the 8086. but honestly, i can't see how that could possibly be the case. consider the instructions: instr action 8086 eqv DSUB HL ← HL - BC SUB BX,CX ARHL HL ← HL / 2 SAR BX,1 RDEL RAL but on DE ADC CX,CX LDHI n DE ← HL + n LEA CX,[BX+$00nn] LDSI n DE ← SP + n no direct ¹ RSTV call $40 if V set INTO SHLX (DE) ← HL no direct ² LHLX HL ← (DE) no direct ³ JNK a PC ← a if U=0 JGE n ⁴ JK a PC ← a if U=1 JL n ⁵ ¹ XCHG SP,BP; LEA CX,[BP+$00nn]; XCHG SP,BP ² XCHG BX.CX; MOV [BX], CX; XCHG BX,CX ³ XCHG BX,CX; MOV CX,[BX]; XCHG BX,CX ⁴ or JNZ after INC rx, or CMP rx,-1; JE after DEC rx ⁵ or JZ after INC rx, or CMP rx,-1; JNE after DEC rx what's more puzzling is why, if compatibility with the 8086 was desired, the instructions with no direct equivalent weren't implemented differently. OK, there's no saving LDSI, but if LHLX and SHLX had been implemented as LDEX and SDEX instead, they too would have had direct 8086 eqivalents. is it possible that the 8086 was originally intended to be much more flexible than it ended up being, and the 8085 assumed that CX would be usable as an address register too? but then, there are 8080 instructions with no readily apparent 8086 equivalents too. all the conditional call and return instructions; LDAX and STAX; XTHL (which itself has to be simulated using XCHG SP,BP; XCHG BX,0[BP]; XCHG SP,BP - a 7 byte sequence!) - so it's not as though having to use a compound set would have disqualified those instructions. and it's ironic that the two additional instructions that were documented for the 8085 are the only two that really do have no 8086 equivalents - because the hardware just isn't there! i wonder, then, whether the undocumented instructions were held back because they would have been upward compatible with the 8086 - but would also have persuaded some potential 8086 customers that they could have gone for an 8085 instead?

Replies (0)

No replies.