The 80x86 is an Octal Machine
Re: The 80x86 is an Octal Machine
Interesting.
I went through the entire instruction set, starting with the 8086 and moving all the way up to the 80386, defining all of the instructions in a name/value pair in XML, and I've used that XML file to generate XSLT transforms to convert these names into their hex values. I definitely notice some of these repeating patterns when creating these XML enumerations, but a) they didn't seem quite stable enough to rely on (for instance, one value occasionally would not be needed, and would be replaced with something completely unrelated), and b) knowing these patterns wasn't terribly helpful, as defining 255 instructions at a time was easier than trying to break them up into 8-instruction chunks (ADD, ADC, SUB, SBB, CMP, OR, AND, XOR), and then ORing those values with 9 operand values (Eb-Rb, Ew-Rw, Rb-Eb, Rw-Ew, AL-Db, AX-Dw, Eb-Db, Ew-Dw, Ew-Dc).
I just decided to create one set of 255 values for the first byte, and then several sets of 255 values for the second byte, and so on.
<cpu:CopyRegisterToOperand/>
<op:AX-DIAddress/>
But I'd be interested if someone could figure out how to use the octal values to simplify this approach.
I went through the entire instruction set, starting with the 8086 and moving all the way up to the 80386, defining all of the instructions in a name/value pair in XML, and I've used that XML file to generate XSLT transforms to convert these names into their hex values. I definitely notice some of these repeating patterns when creating these XML enumerations, but a) they didn't seem quite stable enough to rely on (for instance, one value occasionally would not be needed, and would be replaced with something completely unrelated), and b) knowing these patterns wasn't terribly helpful, as defining 255 instructions at a time was easier than trying to break them up into 8-instruction chunks (ADD, ADC, SUB, SBB, CMP, OR, AND, XOR), and then ORing those values with 9 operand values (Eb-Rb, Ew-Rw, Rb-Eb, Rw-Ew, AL-Db, AX-Dw, Eb-Db, Ew-Dw, Ew-Dc).
I just decided to create one set of 255 values for the first byte, and then several sets of 255 values for the second byte, and so on.
<cpu:CopyRegisterToOperand/>
<op:AX-DIAddress/>
But I'd be interested if someone could figure out how to use the octal values to simplify this approach.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
-
- Member
- Posts: 1146
- Joined: Sat Mar 01, 2014 2:59 pm
Re: The 80x86 is an Octal Machine
Didn't read the whole document but while I don't really know that much about the x86 opcodes it certainly sounds interesting.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
Re: The 80x86 is an Octal Machine
This is my favorite guide to x86 opcodes (especially because of C-like pseudocode that is very easy to understand). Btw, it was posted on osdev earlier (maybe even several times) but then it was removed due to uncertain situation with copyrights.
Re: The 80x86 is an Octal Machine
There is no copyright issues with linking.
Re: The 80x86 is an Octal Machine
There's a mix of high level knowledge (the command groups) with the knowledge about instruction encoding. The encoding part can be used for binary code representation generation, but the complexity of the octal picture is not anywhere less than the complexity of the Intel's manual instruction encoding description. May be because of this the octal encoding is not used actively (is it used anywhere at all?) and represents some kind of esoteric knowledge about 8086.SpyderTL wrote:But I'd be interested if someone could figure out how to use the octal values to simplify this approach.
My previous account (embryo) was accidentally deleted, so I have no chance but to use something new. But may be it was a good lesson about software reliability
Re: The 80x86 is an Octal Machine
In the last year of my computer engineering degree, I had to come up with a project. I chose to do an x86 assembler that would generate .com executables directly (think 486 / MSDOS 5-6 days).
I remember noticing this octal pattern and using it to generate the binary code. The code required was much shorter / efficient, even after taking into account the few exceptions in the pattern.
I remember noticing this octal pattern and using it to generate the binary code. The code required was much shorter / efficient, even after taking into account the few exceptions in the pattern.