Board index » delphi » TASM: "ALIGN"ing addresses w/ model TPASCAL

TASM: "ALIGN"ing addresses w/ model TPASCAL

I'm trying to use the ALIGN macro to align loop points on even addresses, but
with model TPASCAL, it keeps giving me the error message "ALIGN not strict
enough".  I'm just doing things like:

  ALIGN  4      ; dword align
@@loop:
  lodsd
  dec   cx
  jnz   @@loop

Can anyone help me out?  Also does this really help alot for speed?
I've tried everything I can think of.

Thanks,
Carl

 

Re:TASM: "ALIGN"ing addresses w/ model TPASCAL


Re:TASM: "ALIGN"ing addresses w/ model TPASCAL


In article: <4t3gm4$...@dfw-ixnews4.ix.netcom.com>  simo...@ix.netcom.com (Carl

Quote
Mueller) writes:

>I'm trying to use the ALIGN macro to align loop points on even addresses, but
>with model TPASCAL, it keeps giving me the error message "ALIGN not strict
>enough".  I'm just doing things like:

>  ALIGN  4  ; dword align
>@@loop:
>  lodsd
>  dec       cx
>  jnz       @@loop

I'm afraid it's pointless using this directive for code designed for BP because
the built-in linker only aligns to byte. You'll have to do it manually to your
pascal code by telling BP to generate a detailed MAP file, which you then
correlate back to the source, adding ASM padder instructions (such as nop) at
the end of each so that all the procedures, functions and methods of a unit are
a multiple of 4 bytes long. All procedures in the unit will then be dword
aligned since the code for a unit always starts on a paragraph boundary. If it's
a DPMI program then include a "{$G UnitName} in the main program to ensure the
dword aligned unit is not appended to grouped code segment.

Quote
>Can anyone help me out?

The above does work (I've done it for my low level graphics driver unit), but
it's not the easy answer you were looking for I shouldn't think.

  Also does this really help alot for speed?

I don't think the above example will speed up the code for anything other than
386's, as later chips will be fetching the instructions from the primary cache,
but aligning procedure entry points will speed things up a little on all
machines.

 ---------------------------------------------------------------------------
| Jason Burgon - author of Graphic Vision, TV-Like GUI for 256 Colour SVGA  |
| g...@jayman.demon.co.uk   ftp://SimTel/msdos/turbopas/gv4svga1.zip          |
|                         http://www.en.com/users/grendel/prog/tv_prog.html |
 ---------------------------------------------------------------------------

Other Threads