home *** CD-ROM | disk | FTP | other *** search
- NOLIST
- Open MACRO ; 14 Jan 88
- *------------------------------; Start of Open macro.
- NOLIST
- IFEQ NARG-4 ; If new, read, or r/w is specified, make D2
- ; indicate the accessMode accordingly.
- IFC '\4','new'
- LIST
- MOVE.L #1006,D2 ; Make D2 indicate "new" access mode.
- NOLIST
- ENDC
- IFC '\4','read'
- LIST
- MOVE.L #1005,D2 ; Make D2 indicate "read" access mode.
- NOLIST
- ENDC
- IFC '\4','r/w'
- LIST
- MOVE.L #1004,D2 ; Make D2 indicate "r/w" access mode.
- NOLIST
- ENDC
- ENDC
- IFEQ NARG-3 ; If new, read, or r/w is not specified,
- LIST
- MOVE.L #1005,D2 ; Make D2 indicate the old/new accessMode
- TST D0 ; based on D0.
- BNE 5$
- SUBQ #1,D2
- 5$:
- NOLIST
- ENDC
- IFC '\1','I' ; If <PointerToFileName> is specified, then
- LIST
- ; Put <PointerToFileName> in D1.
- MOVE.L #\2,D1
- NOLIST
- ENDC
- IFC '\1','D' ; If <filename> is specified, then
- LIST
- ; Make D1 point to the file name string.
- MOVE.L #\2.str,D1
- NOLIST
- IFND \2.str ; Unless it was previously defined,
- LIST
- SECTION DataSection,DATA ; The ASCII <filename> string goes here.
- \2.str:
- DC.B '\2',0
- CNOP 0,2
- SECTION "",CODE
- NOLIST
- ENDC
- ENDC
- LIST
- CallLib Open,dos ; Call Open to open <filename>.
- ; Put the file handle at <FileHandleName>.
- MOVE.L D0,\3
- SECTION BSS_Section,BSS
- CNOP 0,2
- \3:
- DS.L 1 ; This is the location of <FileHandleName>.
- SECTION "",CODE
- TST.L D0 ; Make the zero flag indicate failure.
- *------------------------------; End of Open macro.
- ENDM
- LIST
-