Last Updated: 12/9/2024
This will no doubt should be marked as being still in the process of being edited.
Please note if you are running a BASIC PDP11 sim you are not going to be doing anything nearly this fancy.
W:\hexit>od -t x1 output.bin
0000000 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10
W:\hexit>od --version
od (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Jim Meyering.
At the risk of repeating myself, imagine a file named master.bin that is 16 bytes in lengths and if you TL;DR you will have already noted that the bytes are sequential in order number 01 to 10.
W:\>od -t x1 master.bin
0000000 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10
0000020
Pay attention here class:
W:\>od master.bin
0000000 001001 002003 003005 004007 005011 006013 007015 010017
0000020
Say what?
I have to admit, on a blushing glance this was not what I was prepared to expect.
Let’s take a shot at decoding this. I thought I figured I knew what the problem was at heart, but it was time to practice sharpening the saw and revisiting things not used on a day to day basis
TL;DR – If I am looking this up again…. please remember 001001 is octal; it represents 16 bits and is in little endian format. All of this contributes to the why this is the way it is..
Let’s show how decoding 001001 is really the right answer after all.(our expectation is to produce the numbers 1 and 2 in that order). So we are going to work backwards.
(credit to chatgpt for parts of the image below)
Again, this might not be what one casually thinks – half he trick in this is understanding that OD is presenting this by default in little endian format.
One would be able to arrive to the same conclusion by taking the two bytes;1, 2, arrange for endianness (value 513); then figure out what the octal value is.
URL: https://www.rapidtables.com/convert/number/decimal-to-octal.html