Octal versus hexadecimal
Posted: April 29th, 2018, 1:04 pm
I wonder if anyone has a view on the pros and cons of expressing numbers (especially machine code) in octal rather than hexadecimal? If I've understanding the history right, the Altair appeared when octal was commonly favoured, not least because it makes toggling in binary numbers quite easy: only the binary patterns for 0-7 have to be memorized. In hex, on the other hand, one has to memorize twice as many bit patterns to cover 0-thru-F. But on the downside, the PRN listing output of the CP/M Assember are in hex not octal. (Or am I missing something, is there a way to get the assembler to produce octal listings for easy toggling?)
I'm asking because I'm debating with myself whether my students (non-technical, Humanities undergraduates) should learn octal and hex or just hex? One big problem I have with the octal used with the Altair is that we can't think about the two bytes of a 16-bit number independently in the way we can with hex. In hex, the address 01FFh (=0000000111111111b) breaks neatly into two bytes of 01h (00000001b) and FFh (11111111b). By contrast, you can't easily break the octal equivalent 777Q into two bytes, since thinking byte-wise the address's high byte 00000001b would be 001Q and its low byte 11111111b would be 377Q. In hex, you can stick the 01h before the FFh to get back your 01FFh (=0000000111111111b) but you can't stick 001Q before 377Q to get back 777Q: instead you get 1377Q (=1011111111b), a different number.
What do others think: has working in octal thrown up problems like this? Can the mind easily memorize the 16 bit patterns for hex's 0-thru-F digits?
Regards
Gabriel Egan
I'm asking because I'm debating with myself whether my students (non-technical, Humanities undergraduates) should learn octal and hex or just hex? One big problem I have with the octal used with the Altair is that we can't think about the two bytes of a 16-bit number independently in the way we can with hex. In hex, the address 01FFh (=0000000111111111b) breaks neatly into two bytes of 01h (00000001b) and FFh (11111111b). By contrast, you can't easily break the octal equivalent 777Q into two bytes, since thinking byte-wise the address's high byte 00000001b would be 001Q and its low byte 11111111b would be 377Q. In hex, you can stick the 01h before the FFh to get back your 01FFh (=0000000111111111b) but you can't stick 001Q before 377Q to get back 777Q: instead you get 1377Q (=1011111111b), a different number.
What do others think: has working in octal thrown up problems like this? Can the mind easily memorize the 16 bit patterns for hex's 0-thru-F digits?
Regards
Gabriel Egan