[comp.sys.m68k] Question about 68K registers

cramer@infoswx.UUCP (03/23/87)

There is a bit of a paradox as to what to do with data registers 
when you're not using the whole register, and the designer of the 
processor must decide whether to make signed bytes or unsigned bytes
the default action.  On a PDP-11 processor, the CPU automatically 
sign extends byte values when you move them into a register. 
This means that if you want to use unsigned bytes you must 
follow the move with an AND instruction.  As you found out, 
the 68K processor makes the assumption that you want to use 
unsigned bytes, so you must follow a MOVE.B with an EXTB.L.

As for sign extending address registers, I am somewhat at a loss
of the reasoning behind what the 68K does.  One thing that I
can think of is that since several of the addressing modes can
use address registers as offsets in calculating the effective
address, the sign extension makes the use of negative offsets
possible (for example, since the stack grows down, if you use a 
register as a frame pointer, you may want to use a negative 
offset from the frame pointer).

Since the 68k started out with a 16 bit data/address bus, I might
venture a guess and say that putting these constraints on sign 
extension made for a faster processor or a cleaner chip design.

Bill Cramer

leed@hplsla.UUCP (03/27/87)

	On the address  register  issue, I don't have an  opinion.  

	On the data register, I do.  The reason you don't want byte or
	word  operations to affect the upper bits is because the upper
	bits could be holding data that you do not want to be affected
	by operations on the lower 8/16 bits.  This can be useful when
	most of your  data is in a 16 bit  format  and you  need  more
	registers.  You can  access  the  upper  bits  using  the SWAP
	instruction.

	That is my guess.

	Lee Darrow
	Hewlett Packard
	hplsla!leed
	(206)-335-2619