On 8/31/06, aliensrcooluk at yahoo.co.uk <aliensrcooluk at yahoo.co.uk> wrote:
Hi,
Someones signiture (the "real programmers
get confused as Oct 31 = Dec 25") reminded
me about Octal.
I have heard of it, and know it's still used
on the Calculator program on Windoze (2K),
on the computers at work, but unlike Hex,
Dec and Binary I have no idea what it could
be used for, and why it would still be used
today. Anyone care to fill in the gaps, please?
In some contexts, it can make some patterns more apparent
than using decimal or hex. One example is the PDP-11
instruction set - if you look at the way the register selection
and addressing modes are specified, it's much clearer when
you view the instructions in octal rather than hex, even though
it's a 16-bit machine.
(cf -
http://en.wikipedia.org/wiki/PDP-11 and
http://www.village.org/pdp11/faq.pages/PDPinst.html )
In binary, many instructions are of the form "biiissssssdddddd",
where 'b' is byte vs word, 'iii' is the operand (instruction type),
'ssssss' is the source operand, and 'dddddd' is the destination
operand. In octal, it would be represented as 6 digits (000000-
177777) and you can think of the instructions more like 'BISSDD'
where 'B' is still byte vs word, 'I' is a single octal digit for the
operand, and 'SS' and 'DD' are the source and destination as two
octal digits - one being the addressing mode type, the other the
register to apply the addressing mode to.
As you can see, it's not tough to look at, say, a MOV instruction
and see what it does... 010304 copies the contents of R3 to R4.
In hex, that would be 0x40C4 and not at all obvious what it's doing
at first glance.
There are other applications, such as using 7-segment displays
where it might be easier to represent things in octal than hex or
decimal.
It's just another number base, but not as commonly used anymore
as hex.
-ethan
| | | : | : |
| | Op | Source | Dest |