Humanist Discussion Group, Vol. 33, No. 124. Department of Digital Humanities, King's College London Hosted by King's Digital Lab www.dhhumanist.org Submit to: email@example.com Date: 2019-06-30 12:35:29+00:00 From: Gabriel Egan
Subject: 'Bastard octal' Dear HUMANISTs I wonder if any HUMANIST can confirm my recollection about a numbering system known as 'bastard octal' that was popular in microprocessor programming in the 1970s. I have failed to find any online references to it, but my recollection is strong. In case it helps to jog anyone's memory, I include below a description of 'bastard octal' and the rationale for its use. I would be grateful for any recollections of using this numbering system, or pointers to printed or online references to it. Regards Gabriel Egan De Montfort University ____"WHY USE 'BASTARD OCTAL'?" BEGINS_____ True octal numbering groups the binary digits in a binary number into groups of three, starting at the right end. Each group of three bits is represented by its equivalent in the decimal range 0 through 7, so for example 001 is 1, 011 is 3, 110 is 6, and 111 is 7. For an 8-bit number (a byte) this grouping-by-threes runs out of bits for the third group, so that the last two bits (the most significant, left-most bits) are represented by an octal digit from 0 to 3 since the 11 is the highest value that these 2 bits can take. Thus the largest 8-bit number (11111111) is represented in true octal as 377. The next largest binary number, which requires 9 bits, is 100000000 and this can be grouped from the right into three groups of three bits (100, 000, and 000) so its equivalent in true octal is 400. Often in microprocessor applications it is desirable to be able to specify a 16-bit number (typically a memory address) as two 8-bit numbers, one representing the lowest 8 bits (the "low byte") of the 16-bit number and another representing the highest 8 bits (the "high byte") of the 16-bit number. (For example, the 6502 and 8080 microprocessors require that the 16-bit operand of an instruction, such as a memory address, is stated as two bytes, the first being the low byte and the second being the high byte. True octal representation cannot do this. We cannot divide 400 octal into a low byte and a high byte because the digit "4" encodes the two most-significant bits of the low byte and the least-significant bit of the high byte. In 'bastard octal' this problem is avoided by encoding separately the two bytes within a 16-bit number separately. Instead of collecting groups of three bits from the right all the way along the 16 bits (with one bit, the 16th bit on the left, forming the final group), 'bastard octal' groups the low byte from the right as a group of three bits, another group of three bits, and then a group of two bits, and then groups the high byte from the right as a group of three bits, another group of three bits, and then a group of two bits. Thus whereas in true octal the 16-bit number 0000 0001 0000 0000 is grouped as 0 000 000 100 000 000 and represented as 400 octal, in 'bastard' octal it is grouped as 00 000 001 00 000 000 and represented as 001,000 octal. (The comma shows that we treated each byte separately.) In 'bastard octal', we can specify this 16-bit number as a pair of bytes and if required to give them in low-byte-then-high-byte order we just reverse the 'bastard octal' numbers so that 001,000 is specified as 000 followed by 001. ____"WHY USE 'BASTARD OCTAL'?" ENDS_____ _______________________________________________ Unsubscribe at: http://dhhumanist.org/Restricted List posts to: firstname.lastname@example.org List info and archives at at: http://dhhumanist.org Listmember interface at: http://dhhumanist.org/Restricted/ Subscribe at: http://dhhumanist.org/membership_form.php
Editor: Willard McCarty (King's College London, U.K.; Western Sydney University, Australia)
Software designer: Malgosia Askanas (Mind-Crafts)
This site is maintained under a service level agreement by King's Digital Lab.