flat assembler
Message board for the users of flat assembler.

Index > Main > What's the order of 8 bits of a single byte in memory?

Author
Thread Post new topic Reply to topic
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng 02 Apr 2004, 08:30
I think this is not cared for programming, but do we know it?
Post 02 Apr 2004, 08:30
View user's profile Send private message Reply with quote
S.T.A.S.



Joined: 09 Jan 2004
Posts: 173
Location: Ru#27
S.T.A.S. 02 Apr 2004, 11:38
There is no "left" or "right" when we speak about bits.
There are (D0..D7 for byte) D0..D31 for DWORD pins on CPU
Post 02 Apr 2004, 11:38
View user's profile Send private message Reply with quote
Intrinsic



Joined: 03 Feb 2004
Posts: 13
Intrinsic 02 Apr 2004, 13:24
7...0 for intel
Post 02 Apr 2004, 13:24
View user's profile Send private message Reply with quote
gorshing



Joined: 27 Jul 2003
Posts: 72
Location: Okla, US
gorshing 02 Apr 2004, 13:47
Please correct me if I am wrong.

But I thought that there were not any differences between OS's in the order of a single byte.

So that 10 decimal is always stored as 0000 01010

But multiple bytes the order would be different.

So 65280 could be stored as 11111111 00000000 or 00000000 11111111.

_________________
gorshing
Post 02 Apr 2004, 13:47
View user's profile Send private message Visit poster's website Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 02 Apr 2004, 13:52
It is simply human way of thinking that most significant digits (in every radix) are most "left" and less significant are most "right". (Hm, interesting how the people from arabian countries think? Very Happy) As a result we have mnemonics for shift operation: shl,rol - from less to most significant bits, shr,ror - from most to less significant bits.
Though these directions have phisical meaning only on the sceen and on piece of paper.

Regards.
Post 02 Apr 2004, 13:52
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
S.T.A.S.



Joined: 09 Jan 2004
Posts: 173
Location: Ru#27
S.T.A.S. 02 Apr 2004, 16:09
gorshing wrote:
multiple bytes the order would be different.
So 65280 could be stored as 11111111 00000000 or 00000000 11111111.

Yes, x86 (Intel and AMD) are Little Endian CPUs, they place first the least significant byte in memory: 00h,FFh
Other CPUs (like Motorola 68XX0) are Big Endian, so they use another order: FFh,00h

Also there are CPUs which can use both modes,
but they are not so cool, because of incompatibility with FASM Very Happy
Post 02 Apr 2004, 16:09
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 02 Apr 2004, 18:22
JohnFound wrote:
(Hm, interesting how the people from arabian countries think? Very Happy)

Just the same as we do, because numerical system we use was developed by them. Smile

They write right to left but they do arithmetic in the same way we do (only the characters are different)
Post 02 Apr 2004, 18:22
View user's profile Send private message Yahoo Messenger Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8353
Location: Kraków, Poland
Tomasz Grysztar 02 Apr 2004, 19:13
And that's why we write numbers from right to left... Wink
Post 02 Apr 2004, 19:13
View user's profile Send private message Visit poster's website Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 03 Apr 2004, 10:04
Very interesting thoughts I admit, on the writing side, shouldt my age be written 9 and 1, so the least significant numbers go first. Hmm, 0000001 one million:D
It seems confusing, but got used to *-hand traffic and reading/writing L2R or R2L so why wouldn't we start getting used to left 2 right writing of numbers Wink
Post 03 Apr 2004, 10:04
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
Cas



Joined: 26 Feb 2004
Posts: 82
Location: Argentina
Cas 05 Apr 2004, 05:11
Intel microps do not handle numbers directly in bigendian, but you have these instructions:

xchg ah,al ; invert 16bit number
bswap eax ; invert 32bit number

which can be very useful. Very Happy
Post 05 Apr 2004, 05:11
View user's profile Send private message Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 05 Apr 2004, 18:38
liu: i think you really could use my tutorial
http://board.flatassembler.net/topic.php?t=1178
this is one of things answered there
Post 05 Apr 2004, 18:38
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.