Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 SMI; site sun.uucp Path: utzoo!linus!decvax!decwrl!sun!gnu From: gnu@sun.uucp (John Gilmore) Newsgroups: net.micro.68k,net.arch,net.lang Subject: Re: consistent bit addressing in the 68020 Message-ID: <1638@sun.uucp> Date: Thu, 23-Aug-84 05:12:10 EDT Article-I.D.: sun.1638 Posted: Thu Aug 23 05:12:10 1984 Date-Received: Sat, 25-Aug-84 02:51:14 EDT References: <491@turtlevax.UUCP> Distribution: net Organization: Sun Microsystems, Inc. Lines: 27 The 68000 addressed bits the wrong way (low order bit == bit 0, but high order byte == byte 0). This was reportedly fought over internally at Motorola and the people who said "Let's make BTST #0 test the data from pin D0" won out -- they didn't want to confuse hardware types. Well, all us software types beat on them mercilessly, so they fixed it for the 68020. However, they had to keep the old instructions for backward compatability. So they defined eight new instructions, which all operate in a consistent way on bit FIELDS (not just bits). You provide a byte address, a bit number, and a bit width. The bit number is a signed 32-bit number; the width is 1 thru 32. They can be immediate fields or in data registers. The instructions will figure out which byte or bytes the relevant bits are in, get them, and process them. The 8 things you can do with them are: Clear them \ Set them | Same as old 68000 instructions Invert them | Test them / Zero-extend and put them in a register Sign-extend and put them in a register Take low-order bits from a register and put them in the bitfield Find the leftmost 1-bit in the field, put its bit# in a register This is especially neat for bitmapped graphics, since you can address the screen with bit numbers on random bit boundaries and the CPU will take care of finding and lining up the data.