943,985 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 560
  • Assembly RSS
Oct 23rd, 2009
0

80x86 Word Memory Access

Expand Post »
80X86 Speeding up word memory access.
When the address of the first byte of a word lies
at an odd address the processor must make two memory
fetches for each byte of the word.
But if the address of the first byte of the word lies
at an even address the processor can pull in both bytes
of the word in one memory fetch.

If the first word of an array of words lies at an even
address so will every other word in the array.
1st Word__2nd Word__3rd Word
|0100|0101|0102|0103|0104|0105
^________^________^_______
This speeds up performance when accessing an array
of words.

Assemblers usually provide an ALIGN directive to align
a word at an even address.

I was looking through the i386 arch manual on this, and
it mentioned that there could be a slight increase in speed
when the target address of control transfer instructions
were evenly divisible by four, does this apply to the 8086/real-mode?


Good day.
Similar Threads
Reputation Points: 36
Solved Threads: 19
Junior Poster
NotNull is offline Offline
198 posts
since Oct 2008
Oct 23rd, 2009
0
Re: 80x86 Word Memory Access
If memory serves, it could be any even address on the 16 bit processors. Of course, if you're running 16 bit code on a 32 bit processor, go with divisible by four.
Reputation Points: 12
Solved Threads: 5
Light Poster
dan63043 is offline Offline
36 posts
since Dec 2007
Oct 23rd, 2009
0
Re: 80x86 Word Memory Access
Yes, DWORD alignment is always preferred. But check with the standard literature on optimization:

http://www.agner.org/optimize/
Reputation Points: 99
Solved Threads: 5
Junior Poster
Evenbit is offline Offline
140 posts
since Mar 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: code for fan timer
Next Thread in Assembly Forum Timeline: Counting 1's in 16 bit word





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC