CodeAlign - Align your codeAssembler/80386

This may seem like a stupid macro, but consider this. If you use ALIGN 16, and you allready are on a 16 byte boundary, you will get 16 useless bytes. This smart macro prevents that from happening.

CODEALIGN    MACRO
LOCAL        _NOW,_THEN
_NOW:
ALIGN   16
_THEN:
IF (_THEN-_NOW)
   IF (_THEN-_NOW) LE 3
      DB (_THEN-NOW) DUP (90h)
   ELSE
      ORG _NOW
      ALIGN 16
   ENDIF
ENDIF
ENDM
This is not fully optimized from speed point of view. Instead of two NOP's (when two bytes remain) one MOV ESP,ESP would be faster and istead of three NOP's use ADD ESP,0.
Gem writer: Ervin Toth
last updated: 1998-03-16