[comp.sys.apple] MSB Confusion!

ST702174@BROWNVM.BITNET (Dan Bornstein) (11/23/88)

From my machine language experience, I know for a fact that the Apple II line/
65xx series processors store integers with the Least Significant Byte (LSB)
first. I would assume that higher level number formats (like longints for
example) would also be stored that way, because it would be easier to implement
(you can use direct (not reversed) loads and stores).

On an aside, the Mac line/ 68xxx series uses the MSB first.

I hope that (finally) clears things up...

-dan

friedman@porthos.rutgers.edu (Gadi ) (11/24/88)

> From my machine language experience, I know for a fact that the Apple II line/
> 65xx series processors store integers with the Least Significant Byte (LSB)
> first. I would assume that higher level number formats (like longints for
> example) would also be stored that way, because it would be easier to implement
> (you can use direct (not reversed) loads and stores).
> 
> On an aside, the Mac line/ 68xxx series uses the MSB first.
> 
> I hope that (finally) clears things up...
> 
> -dan

Boy, you  know some strange facts. 
Say you have the command 
LDA $11ff -> 300:opcode 11 ff
   In the apple.  Hence, the MSByte is stored first.  How did you say
you have been programming?  Anyway, on a PC, the instruction
MOV A, $11ff  ->  300:opcode ff 11 
With the LSByte first.  Now in this case, it might be better to print 
MOV A, 11ffH  ->  11 ff opcode:300 
so that the output look right.  On the mac you have
MOV $11ff, D0 -> 300:opcode 11 ff 00 00  (Absolut Addressing!!!!)
which is similar to the 6502.  The addresses are longer, but
the MSByte is still in the lowest address.  In all these, however
the MSBit is in the highest bit location (bit7).   
   As as I mentioned in my previous posting.  On the Perken Elmer
machine.  The MSbit is bit0.  I don't know if that machine has bytes,
or what its word size is, so I can't show an actual example.

                         Gadi

BTW. Bfox wrote Emacs(Amacs) for the AppleII in assembly language,
so don't make fun of his 6502 programming!.
-- 


uucp:   {ames, cbosgd, harvard, moss}!rutgers!aramis.rutgers.edu!friedman
arpa:   FRIEDMAN@ARAMIS.RUTGERS.EDU

friedman@porthos.rutgers.edu (Gadi ) (11/28/88)

> > From my machine language experience, I know for a fact that the Apple II line/
> > 65xx series processors store integers with the Least Significant Byte (LSB)
> > first. I would assume that higher level number formats (like longints for
> > example) would also be stored that way, because it would be easier to implement
> > (you can use direct (not reversed) loads and stores).
> > 
> > On an aside, the Mac line/ 68xxx series uses the MSB first.
> > 
> > I hope that (finally) clears things up...
> > 
> > -dan
> 
> Boy, you  know some strange facts. 
> Say you have the command 
> LDA $11ff -> 300:opcode 11 ff
>    In the apple.  Hence, the MSByte is stored first.  How did you say
> you have been programming?  Anyway, on a PC, the instruction
> MOV A, $11ff  ->  300:opcode ff 11 
...
>                          Gadi
> 
> BTW. Bfox wrote Emacs(Amacs) for the AppleII in assembly language,
> so don't make fun of his 6502 programming!.
> -- 
OK, it seems that I must eat my words!!!

LDA $11ff  -> 300:AD FF 11 
and
MOV A,$11FF  -> 300:opcode 11 FF.

Hence on the 6502, the MSB is stored last, and on the 80x86 its stored
forst, thats what I get for switching between processors, and not
checking my facts.

                              Gadi

PS Something new.
Has anyone seen the Price of Apple Stock recently.  $36 last Fri.
Pretty low.  Looks like Wallstreet is having a sale.
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
-- 


uucp:   {ames, cbosgd, harvard, moss}!rutgers!aramis.rutgers.edu!friedman
arpa:   FRIEDMAN@ARAMIS.RUTGERS.EDU