[ASM] Tips and tricks
Posted: Tue Aug 30, 2011 3:11 pm
Heya,
This thread will be about assembly tips and tricks. If you have any cool piece of code or some ninja technique, this is the place to post them!
Let me start with a simple one for pceas.
Align some piece of code or data to 256 bytes boundary:
* is a special operand that'll return the current address/offset. So basically, the formula calculates the smallest multiple of 256 greater or equal to the current offset. It can be generalized to:
Note that the macro argument must be a power of 2. Otherwise you'll get funky results.
This thread will be about assembly tips and tricks. If you have any cool piece of code or some ninja technique, this is the place to post them!
Let me start with a simple one for pceas.
Align some piece of code or data to 256 bytes boundary:
Code: Select all
.org ((*+$ff) & $ff00)
Code: Select all
align_org .macro
.org (* + (\1 - 1)) & ( ~(\1 - 1) )
.endm