[comp.sys.m68k] Big/Little Endian FACTS

knudsen@ihwpt.UUCP (mike knudsen) (12/03/86)

To: ihnp4!cuae2!clyde!rutgers!mit-eddie!ll-xn!cit-vax!cit-vlsi!wen-king
Subject: Re: Byte ordering, and pros/cons
References: <1271@ihwpt.UUCP>, <1239@cit-vax.Caltech.Edu>

Well, about mis-information -- Motorola byte ordering DOES
slow down arithmetic memory-to-register operations if
the memory bus is narrower than the register.
This is becuase the MSB is added first, then the LSB,
then an extra cycle is needed to fix the carry.
You can see this in the instruction timings for the 6809
for the "double" operations.  Yes, the PC could have skipped
ahead by 2 and jerked back -1 to add in "proper" order,
but that would have probably slowed the chip down even more.

Maybe you rich guys who started out with 68000s never noticed
the above 8-bit micro problem -- but how about adding a 32-bit
int in RAM to one in a 68K register?  OK, this uses so many
68K micro-cycles that you never noticed the carry adjust
operation in the timings, but I'll bet it's there.
Then again, maybe I should have been more explicit.

As for Intel and graphics, it is definitely true that if
the video hardware maps consecutive bytes (not words) onto
the screen, then if you read two of these bytes as a word
into an 8086 and do a left or right shift on the WORD
(to move a "sprite" right or left on the screen),
and just store the WORD back into video RAM, you will get
the WRONG effect.
Granted, the video hardware could be designed by words to
fix this -- or would it?

Before people flame about mis-info, maybe they should ask
for clarification first.  And give some specifics about
their "correct" programming techniques to make the problems
I raised go away.

BTW, the "endian" dispute occured a year or so ago,
but was mostly hot air & religion.  I thought this time I'd
stick in a couple of facts.  Yes, facts.
I would not have posted this reply but it seemed my
intelligence was being insulted in public.	--mike k

-- 
Mike J Knudsen    ...ihnp4!ihwpt!knudsen
Bell Labs (AT&T)   (312)-979-4132 (work)
You think AT&T cares about CoCos, music, or Star Trek?
No?  Then, these opinions must be all mine!