     NOLIST
AllocMem    MACRO              ; 15 Jan 88
*------------------------------; Start of AllocMem macro.
     NOLIST
     IFC "\2","D"              ; If \3 uses direct mode, then.
     LIST
                               ; Put the block size in D0.
     MOVE.L #\3,D0
     NOLIST
     ENDC
     IFC "\2","I"              ; If \3 uses indirect mode, then.
     LIST
                               ; Put the block size in D0.
     MOVE.L \3,D0
     NOLIST
     ENDC
     LIST
                               ; Save the block size at <MemBlockName>.Size
     MOVE.L D0,\1.Size
     NOLIST
     IFNE NARG-4               ; If \4 is not given, then
     LIST
     CLR.L D1                  ; Accept any memory.
     NOLIST
     ENDC
     IFEQ NARG-4               ; If \4 is given, then
PUBLIC SET 1
CHIP   SET 2
CLEAR  SET $10000
     LIST
                               ; Set the appropriate bits in D1.
     MOVE.L #\4,D1
     NOLIST
     ENDC
     LIST
     CallLib AllocMem,exec     ; Call AllocMem.
                               ; Save the address of the memory block at
                               ;  <MemBlockName>.Adr
     MOVE.L D0,\1.Adr
     NOLIST
     IFND \1.Adr
     LIST
     SECTION BSS_Section,BSS
     CNOP 0,2
\1.Adr:
     DS.L 1                    ; This is the location of <MemBlockName>.Adr
     SECTION   "",CODE
     NOLIST
     ENDC
     IFND \1.Size
     LIST
     SECTION BSS_Section,BSS
     CNOP 0,2
\1.Size:
     DS.L 1                    ; This is the location of <MemBlockName>.Size
     SECTION   "",CODE
     NOLIST
     ENDC
     LIST
     TST.L D0                  ; Make the zero flag indicate failure.
*------------------------------; End of AllocMem macro.
     ENDM
     LIST
