OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Apr 18, 2024 5:30 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: The 80x86 is an Octal Machine
PostPosted: Wed Sep 23, 2015 2:24 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
http://www.dabo.de/ccc99/www.camp.ccc.de/radio/help.txt

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: The 80x86 is an Octal Machine
PostPosted: Wed Sep 23, 2015 2:44 pm 
Offline
Member
Member
User avatar

Joined: Sun Sep 19, 2010 10:05 pm
Posts: 1074
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.

_________________
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


Top
 Profile  
 
 Post subject: Re: The 80x86 is an Octal Machine
PostPosted: Thu Sep 24, 2015 1:59 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
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


Top
 Profile  
 
 Post subject: Re: The 80x86 is an Octal Machine
PostPosted: Thu Sep 24, 2015 5:53 pm 
Offline
Member
Member

Joined: Tue Nov 08, 2011 11:35 am
Posts: 453
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.


Top
 Profile  
 
 Post subject: Re: The 80x86 is an Octal Machine
PostPosted: Thu Sep 24, 2015 6:05 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
There is no copyright issues with linking.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: The 80x86 is an Octal Machine
PostPosted: Fri Sep 25, 2015 6:01 am 
Offline
Member
Member

Joined: Wed Jun 03, 2015 5:03 am
Posts: 397
SpyderTL wrote:
But I'd be interested if someone could figure out how to use the octal values to simplify this approach.

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.

_________________
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 :)


Top
 Profile  
 
 Post subject: Re: The 80x86 is an Octal Machine
PostPosted: Fri Sep 25, 2015 10:29 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
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.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 47 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group