home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 3 / CDPDIII.bin / pd / programming / assembler / thesource / volume2 / source / system / asmmacros.lha / Exist.i < prev    next >
Encoding:
Text File  |  1990-11-16  |  1.2 KB  |  37 lines

  1.      NOLIST
  2. Exist       MACRO              ; 14 Jan 88
  3. *------------------------------; Start of Exist macro.
  4.      MOVE.L #-2,D2             ; Make D2 indicate the read accessMode.
  5.      NOLIST
  6.      IFC '\1','I'              ; If <PointerToFileName> is specified, then
  7.      LIST
  8.                                ; Put <PointerToFileName> in D1.
  9.      MOVE.L #\2,D1
  10.      NOLIST
  11.      ENDC
  12.      IFC '\1','D'              ; If <filename> is specified, then
  13.      LIST
  14.                                ; Make D1 point to <filename>.str .
  15.      MOVE.L #\2.str,D1
  16.      NOLIST
  17.      IFND \2.str               ; Unless it was previously defined,
  18.      LIST
  19.      SECTION DataSection,DATA  ; The ASCII <filename> string goes here.
  20. \2.str:
  21.      DC.B '\2',0
  22.      CNOP 0,2
  23.      SECTION   "",CODE
  24.      NOLIST
  25.      ENDC
  26.      ENDC
  27.      LIST
  28.      CallLib Lock,dos          ; Call Lock to get a lock on <filename>.
  29.      MOVE.L D0,-(A7)           ; Save the lock which indicates existence.
  30.      MOVE.L D0,D1              ; Unlock the file.
  31.      CallLib UnLock,dos
  32.      MOVE.L (A7)+,D0           ; Get the lock back.
  33.      TST.L D0                  ; Make the zero flag indicate existence.
  34. *------------------------------; End of Exist macro.
  35.      ENDM
  36.      LIST
  37.