Align 256 in Pasmo?
Align 256 in Pasmo?
Is there a way to get the Pasmo assembler to align with a 256 byte memory location boundary? The align directive doesn't seem to work and the documentation does not list Align as an assembler directive.
- PROSM
- Manic Miner
- Posts: 481
- Joined: Fri Nov 17, 2017 7:18 pm
- Location: Sunderland, England
- Contact:
Re: Align 256 in Pasmo?
Here's a quick bodge I use for page alignment in Pasmo:
EDIT: Removed extraneous brackets
Code: Select all
if ($%256 != 0)
org (($/256)*256)+256 ; Align to a 256 byte page boundary
endif
All software to-date
Working on something, as always.
Working on something, as always.
Re: Align 256 in Pasmo?
Holy smokes! Thanks for that. I'll give it a try.PROSM wrote: ↑Wed Aug 26, 2020 11:19 pm Here's a quick bodge I use for page alignment in Pasmo:
EDIT: Removed extraneous bracketsCode: Select all
if ($%256 != 0) org (($/256)*256)+256 ; Align to a 256 byte page boundary endif
Re: Align 256 in Pasmo?
I use something very similar to that, but use DEFS instead of ORG to allocate the required space to align the next instruction.
I also find it useful to store a label of that ‘padding’ size in case it’s large enough to store some data in. That also helps when re-arranging code to reduce such unused space.
I also find it useful to store a label of that ‘padding’ size in case it’s large enough to store some data in. That also helps when re-arranging code to reduce such unused space.
-
- Manic Miner
- Posts: 401
- Joined: Fri Jan 03, 2020 10:00 am
Re: Align 256 in Pasmo?
Maybe defs (-$)&255 will work, if Pasmo allows defs 0.
Re: Align 256 in Pasmo?
Code: Select all
org ($+255)/256*256
p.s.: or without mul/div. ;-)
Code: Select all
org ($+255)&0xff00
Re: Align 256 in Pasmo?
PROSM's suggestion worked - Thanks! I like bobs idea of using a label to keep track of the unused space so that it can be used for something later. Will give that a try.
Thanks for the other suggestions!
Thanks for the other suggestions!