News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Understand variables

Started by ookami, March 06, 2011, 11:57:12 AM

Previous topic - Next topic

ookami

My question is more about how the processor works, than MASM programming itself.

When I do this :

.data
hello byte 5


The processor sends to the memory (via the busses) the address where he wants to store the value, and the value, right ?

So when I do this :
.data
hello2 dword 5


Does the processor send to the memory the address of the first byte only, with the four bytes value ; or it does four operations, I mean : sends the address of the first byte with its value (0000 0101), then sends the address of the second byte and its value (0000 0000), etc ?

Thanks

MichaelW

For a 386 or later processor the data bus is at least 32-bits wide, so each bus cycle will access at least 4 bytes. I think starting with the first Pentium processor the data bus was 64-bits wide.

This is why in speed-optimized code data items should be aligned by at least their size, so that each item can be accessed in a minimum number of bus cycles.
eschew obfuscation

clive

Depends on how wide, physically, the memory interface is for the device in question, and the buses/caches within the processor, and the chipset. Or if you were talking about an 8088, 8086, or a current processor.

When you are defining memory like this in MASM, you're really indicating how the memory gets initially loaded. In your case probably from disc via a DMA interface. The MASM output could be programmed into an 8-bit EPROM device too, and then the executing processor would not be involved in storing the defined data/opcodes byte, just reading them.

I think you might be better served looking at 1970's processor design/theory to understand the basic mechanics, as things now are much more abstracted.
It could be a random act of randomness. Those happen a lot as well.

ookami