Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!husc6!bbn!rochester!cornell!uw-beaver!ubc-cs!alberta!calgary!radford From: radford@calgary.UUCP (Radford Neal) Newsgroups: comp.arch Subject: Re: negative addresses Summary: 68000 small model has negative addresses Message-ID: <1582@vaxb.calgary.UUCP> Date: 11 May 88 20:06:44 GMT References: <2393@uvacs.CS.VIRGINIA.EDU> Organization: U. of Calgary, Calgary, Ab. Lines: 44 > Has anyone ever seen a machine with "negative addresses", that is, one > where the address space is -2**31..2**31-1 rather than 0..2*32-1?? > Any thoughts on what the problems with such a scheme might be (or are)? > > Why ask such a question, you ask -- well, I'm trying to remove unsigned > arithmetic from WM, and as far as I can tell, the primary (only?) use > of unsigned arithmetic is for address computations. Soooooo... > > Bill Wulf The 68000 has negative addresses when you're using it as a machine with a 16-bit address space. What do I mean by this? Well, the instructions all sign extend when moving a 16-bit address into a 32-bit address register. E.g. move.w a0@,a0 fetches a word from the address in a0, _sign extends it to 32-bits_ and replaces a0 with the result. So if you try to treat the 68000 as a 16-bit address machine (for a speed gain), you must consider the addresses to be signed, or go to a lot of effort to undo these sign extensions at times. I've no idea if anyone writes 68000 programs like this. I was going to once, but in the end decided I needed more than 2^16 bytes of memory. I see only one problem with negative addresses. A C implementation will be much assisted by an addressing scheme in which (char*)0 has all zeros as its bit pattern. In a machine with negative addresses, arrainging this might be annoying. Then again, it might be no problem, if you decide on a layout like, say: -large one +large program code data -> <- stack This seems like a reasonable layout unless you're desparate for address space and don't want the potential unused gap between the end of program code and the start of data at address 1. (You want a one-byte gap at address zero, of course, so that null is invalid.) Radford Neal