XA and page boundary allignment

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

User avatar
Twilighte
Game master
Posts: 819
Joined: Sat Jan 07, 2006 12:07 am
Location: Luton, UK
Contact:

XA and page boundary allignment

Post by Twilighte »

I know that the line...

Code: Select all

 .dsb 256-(*&255)
can be used to allign to a page boundary, but does anyone know how i can allign to half a page boundary or an exact low address?
Essentially, i am creating a backup of the screen ($bb80) and need to restore parts of it, passing the screen address to the routine.
User avatar
Dbug
Site Admin
Posts: 4444
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: XA and page boundary allignment

Post by Dbug »

Twilighte wrote:I know that the line...

Code: Select all

 .dsb 256-(*&255)
can be used to allign to a page boundary, but does anyone know how i can allign to half a page boundary or an exact low address?
Essentially, i am creating a backup of the screen ($bb80) and need to restore parts of it, passing the screen address to the routine.
Well, in theory we should use the .align directives, but I never managed to understand how they work.
What the line do, is to reserve a number of bytes (.dsb) equal to 256 minus the current position of the program counter (*) modulo 255.
So I guess that for you the following would do it:

Code: Select all

 .dsb 256-((*+256-$80)&255)
(I haven't tested, I have no compiler here)
Post Reply