Quote:
Originally Posted by jiangzhengwenjzw
That is to say there's no need to add any ".hword 0x0000" in any code?
Another question: Could you tell me more about the .align? At first I think it align the code to be 2-byte long, but why should we add another before defining the labels?
Thank you very much for your patient reply!
|
I suggest always just leaving it in there, because during compile time the assembler will ignore it if it isn't needed. In the end it doesn't really impact your code in an unhealthy way, so I just leave it in for everything. You might here someone like daniilS come in and say stuff about not using it unneedingly , but it ultimately causes no harm while causing good in some cases. So just have it there all the time.
.align 2, iirc, just tells the assembler to start working on an address which is divisible by 2^n, in this case it's 2^2, i.e 4. It becomes important depending on context. You don't particularly need it in many cases, but in some cases you do. So like I said, just keep it there all the time.