eval('07') works, eval('08') fails, why?

Grant Edwards invalid at invalid
Fri Jan 9 14:47:27 EST 2009


On 2009-01-09, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
> On Thu, 08 Jan 2009 09:46:26 -0600, Grant Edwards <invalid at invalid>
> declaimed the following in comp.lang.python:
>
>
>> Heathkit Z80 stuff used octal notation too.
>
> 	Octal worked well for the old 8080 and derivative processors as
> there were only 7 registers and "memory/indirect" to encode in an
> instruction... So (pseudo example) a MOV command might have been
>
> 	01sssddd (binary)
>
> or
>
> 	1SD (octal)
>
>
> 	and S or D representing
>
> 	A		1
> 	B		2
> 	C		3
> 	D		4
> 	E		5
> 	H		6
> 	L		7
> 	Mem	0	(indirect via contents of HL pair)

I presume that's why DEC chose octal for the PDP-11 also. There
were 8 registers and 8 addressing modes, so they ended up with
several fields within the opcodes that were three-bits wide and
aligned with octal digits:

  http://en.wikipedia.org/wiki/PDP-11#Instruction_set

When I was in University, we spent an entire quarter studying
the PDP-11 instruction set at the binary/octal level and
discussing instruction decoding and sequencing.  We wrote a few
PDP-11 assembly language programs as well, but the course was
more about machine level instruction sets than about assembly
language.

Octal made a lot of sense if you had to deal with raw memory,
but once you had access to an assembler and disassembler it
didn't really matter.

-- 
Grant Edwards                   grante             Yow! NANCY!!  Why is
                                  at               everything RED?!
                               visi.com            



More information about the Python-list mailing list