4 ms·
A few days ago, monocasa suggested I should look at the 8086's HLT instruction, so here it is. Let me know if you have other comments on what part of the 8086 w
by kens 4y ago
A few days ago, monocasa suggested I should look at the 8086's HLT instruction, so here it is. Let me know if you have other comments on what part of the 8086 would be interesting to read about.
https://news.ycombinator.com/item?id=34495317 https://news.ycombinator.com/item?id=34495317
- bonzini 4y agoPrefixes and (probably related) address generation. String instructions would be cool, I suspect microcode to have a few features only used by them in collaboration with the decode ROMs. For example REP is probably little more than one of the conditions that the microcode can test.
- rep_lodsb 4y ago>For example REP is probably little more than one of the conditions that the microcode can test. Indeed it is, and the same internal flag set by the REP prefix is also used by the multiplication and division subroutines to keep track of the sign bit. With the prefix, (I)MUL and (I)DIV will return a negated result on the 8086. The 80186 only does this for IDIV. Mul/div on that processor is already mostly handled by dedicated logic, so the microcode is a lot shorter (and no longer uses any subroutines). However, MUL and IMUL jump to a common exit point that can put the result into either DX:AX or an arbitrary register (for the three-operand form of IMUL), and again they used the REP flag to keep that extra bit of state. If it is set, the register is selected by the middle ModRM field. The usefulness of that undocumented "feature" is somewhat limited, since that is also part of the opcode, so the only choices for register are AH, CH, SP and BP. Also, BOUND uses the flag as a 1-bit "loop counter" and will fail to check the upper bound when prefixed with REP. The 80286 and everything newer either ignore the prefix or handle it similar to 0Fh: each prefixed opcode is now a separate instruction with its own microcode.
- Stratoscope 4y agoFirst time I've ever said this on HN, but just this once... Username checks out. And thank you for the interesting comments on these historical implementations!
- monocasa 4y agoI'm just now seeing this; thanks so much for so thoroughly indulging my curiosity! It was a fantastic read.
- pwg 4y agoAnother suggestion, from the previous thread: https://news.ycombinator.com/item?id=34495797 https://news.ycombinator.com/item?id=34495797