home *** CD-ROM | disk | FTP | other *** search
- NOLIST
- Read MACRO ; 14 Jan 88
- *------------------------------; Start of Read macro.
- ; Put the file handle in D1.
- MOVE.L \1,D1
- ; Make D2 point to the start of the buffer.
- NOLIST
- IFC '\2','D'
- LIST
- MOVE.L #\3,D2
- NOLIST
- ENDC
- IFC '\2','I'
- LIST
- MOVE.L \3.Adr,D2
- NOLIST
- ENDC
- IFEQ NARG-3 ; If there is no fourth argument, and
- IFC '\2','D' ; <BufferStartAddr> is specified, then
- LIST
- ; Calculate the buffer size as
- ; <BufferStartAddr>End minus
- ; <BufferStartAddr>. Put it in D3.
- MOVE.L #\3End-\3,D3
- NOLIST
- ENDC
- IFC '\2','I' ; If <MemBlockName> is specified, then
- LIST
- ; Get the buffer size from <MemBlockName>.Size
- MOVE.L \3.Size,D3
- NOLIST
- ENDC
- ENDC
- IFEQ NARG-4 ; If the fourth argument exists,
- IFNC '\4','D3' ; and it is not "D3", then
- LIST
- ; Use the buffer size of the fourth argument.
- MOVE.L #\4,D3
- NOLIST
- ENDC
- ENDC
- LIST
- CallLib Read,dos ; Call Read.
- NOLIST
- IFC '\2','D' ; If <BufferStartAddr> is specified, then
- LIST
- ; Store the actual length read at
- ; <BufferStartAddr>.Len .
- MOVE.L D0,\3.Len
- NOLIST
- ENDC
- IFC '\2','I' ; If <MemBlockName> is specified, then
- LIST
- ; Store the actual length read at
- ; <MemBlockName>.Len .
- MOVE.L D0,\3.Len
- NOLIST
- ENDC
- NOLIST
- IFND \3.Len ; If <BufferStartAddr>.Len or
- ; <MemBlockName>.Len is not already defined,
- LIST
- SECTION BSS_Section,BSS ; Define \3.Len .
- CNOP 0,2
- \3.Len:
- DS.L 1
- SECTION "",CODE
- NOLIST
- ENDC
- LIST
- CMPI.L #-1,D0 ; Make the zero flag indicate failure.
- *------------------------------; End of Read macro.
- ENDM
- LIST
-