Doing it better 2000-06-08 g ### From Reuben. > Eh? What defines the endianness, then? (Yes, this is just like sMite - > endianness is not defined except in terms of the semantics of the > byte-access instructions). Is the status register really telling you the > endianness of the network card (the only device which accesses bytes)? No, it's generally OS-dependent. The OS decides which endianness it wants, and the chip is configured by having a signal sent to the right pin (in theory it could be software controlled, I suppose). > > Both. But it's only a basis for Tau for raw code execution. e.g. it's not > > the same sort of thing as MIN; you could easily implement MIN in > > sMite. It *is* the same sort of thing as an x86 or Alpha, or Cintcode, > > i.e. a code target. It's just that, unlike the real chips, but like > > Cintcode, it provides binary portability (at a low level, and in ways > > which you can violate). > > I have to object that binaries are not portable between sMite and > Cintcode. I know what you mean, but your analogy is confused. My analogy isn't confused. sMite is the same sort of thing as Cintcode. Cintcode provides binary portability; so does sMite. I'm not providing binary portability between different processors (e.g. x86 and Alpha) as that's impossible by the definition of their instruction sets. > Now I've got it too. You have two languages, one of which is like C, and > one of which is like a processor. They are extremely similar, and both > called sMite, except that one has muddy semantics, and the other has a > couple of extra restrictions. Sigh. > That assumes you want to compile Forth to the muddier version of sMite. Yes. I was thinking of Beetle, where C@ and C! were always little-endian, so that the memory image (of my Forth compiler) could be loaded big or little endian, and strings would still be right. Suppose you have the string: GOODBYE Then on a 32-bit little-endian architecture it will be loaded as 01234567 GOODBYE and on a 32-bit big-ender: 32107654 GOODBYE However, on a big-ender, C@ and C! flip the bottom two bits of the address, hence mapping little-ender byte addresses to big-ender addresses. This is compensating after the fact for the data having been reversed. In sMite no automatic translation is done, so you have to compensate manually. -- http://sc3d.org/rrt/ | aphorism, n. a wise lie