****************************************************************************
*                    Modula-2 Software Construction Set                    *
****************************************************************************
* Name: MyLib.i                        Author: Anthon Pang                 *
* Created: 90.11.27                    Updated: 91.07.14                   *
* Desciption: My macros & equates                                          *
****************************************************************************

  NOLIST

* Ensure long alignment of code
LongAlign MACRO
_VSIZE  SET (DEF_VAR_SIZE+IMP_VAR_SIZE) ; size of variables
_HERE   SET *
_THERE  SET CODE_BLOCK_START            ; for Manx "as" compatibility
_CSIZE  SET (_HERE-_THERE)              ; size of code
_OFFSET SET ((_VSIZE+_CSIZE)&$00000003)
    IFNE _OFFSET    ; won't be long aligned in final file
      CNOP 2,4      ; align to word boundary beyond nearest (current)
                    ; long word aligned boundary
    ENDC
  ENDM

* Load ExecBase into register a6 from memory location $00000004
LoadExecBase MACRO
    dc.b $2c,$78,$00,$04     ; movea.l ($0004).w,a6
  ENDM

* REALLY empty procedure body...falls through
EMPTY_STUB MACRO <Procedure_Name>
    PARAMETER_LIST 4,0
    END_PARAMETER_LIST

    PROCEDURE_CODE \1
  ENDM

* Convert BPTRs to APTRs (register based)
B2APTR MACRO   <register>
      adda.l   \1,\1
      adda.l   \1,\1
  ENDM

  LIST
