Propane13, on Sun May 18, 2008 8:11 AM, said:
I want to make sure that these sections of data do not cross page boundaries.
I use:
mac pcheck
if ([*-1] ^ {1}) & $FF00
echo "PCHECK: PAGE CROSSING","WARNING ",{1}," at ",*
endif
endm
Use the pcheck macro at the end of an area which should fit within a page, and give it a pointer to the start of the area.
Another possibility is to use my pagesafe macro:
wastage .set 0
mac pagesafe
if (* & $FF)+{1} > 255
echo "Wasting ",(256-*) & $FF," bytes at ",(*+255) & $FF00
wastage .set wastage+((256-*) & $FF)
ds (256-*) & $FF
endif
endm
Use the pagesafe macro before an area that should fit within a page, and give it the number of bytes in that area. It will start a new page if necessary, and keep a count of how many bytes have been skipped.
Both macros will require you to do some manual shuffling to actually obtain optimal distribution. They reduce considerably the amount of work required, though.
Incidentally, I also define macros for branches, e.g.
mac sbne
bne {1}
if (* ^ {1}) & $FF00
echo "PAGE CROSSING","WARNING ",{1}," at ",*
endif
endm
Unfortunately, these macros don't seem to work with local labels.
BTW, the reason I use "PAGE CROSSING" and "WARNING" as separate arguments is that doing so makes it possible to search the listing file for "G WA" since the "PAGE CROSSING WARNING" message is not contained intact within the macros themselves.