Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!ames!ptsfa!ihnp4!inuxc!pur-ee!uiucdcs!convex!infoswx!cramer From: cramer@infoswx.UUCP Newsgroups: comp.sys.m68k Subject: Re: Question about 68K registers Message-ID: <125900002@infoswx> Date: Mon, 23-Mar-87 12:19:00 EST Article-I.D.: infoswx.125900002 Posted: Mon Mar 23 12:19:00 1987 Date-Received: Fri, 27-Mar-87 03:20:43 EST References: <1055@tekred.TEK.COM> Lines: 26 Nf-ID: #R:tekred.TEK.COM:1055:infoswx:125900002:000:1255 Nf-From: infoswx.UUCP!cramer Mar 23 11:19:00 1987 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