|
Because of this limitation, we must place memory variables that consist of multiple cells (bytes) at certain memory locations
We call these placement restrictions:
|
|
.align n // If the current memory address is divisible by 2n, // this directive is ignored // Otherwise, the assembler will skip forward to // the next memory address that is divisible by 2n |
Example usage:
|
I want to show you the effect of misaligned data definition here.
Although you don't have assembler programming, you can tell that the values used in the variables are 4 and 44.
In class, I will show you the execution of this program:
/home/cs255001/demo/asm/2-mov/align.s |
In one case, I will not use the .align directive in the program - and when I run it; you will see that the value 44 will fail to be loaded into the CPU.
In the second case, I will use the .align directive in the program - and when I run the same program; and you will see that the value 44 will appear in register r2 of the CPU.