Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosQFileInfo mapper                                  Page     1-1


				; 0
				page 80,132
				;
				title CP/DOS DosQFileInfo mapper
				;
				
 0000				FileAttributeSegment	segment word public 'fat'
				
					 extrn	FileAttributeTable:word
				
 0000				FileAttributeSegment	ends
				
 0000				dosxxx	segment byte public 'dos'
					assume	cs:dosxxx,ds:nothing,es:nothing,ss:nothing
				;
				;**********************************************************************
				;*
				;*   MODULE:   dosQfileinfo
				;*
				;*   FILE NAME: dos052.asm
				;*
				;*   CALLING SEQUENCE:
				;*
				;*	 push	   word     filehandle
				;*	 push	   word     fileinfolevel
				;*	 push@	   other    fileinfobuffer
				;*	 push	   word     filebuffersize
				;*	 call	   dossetfileinfo
				;*
				;*   MODULES CALLED:  PC-DOS Int 21h, ah=57h, set file's date/time
				;*
				;*********************************************************************
				
					    public   dosQfileinfo
					    .sall
					    .list
				
				
				FileInfo	struc
 0000  0000			CreateDate	dw	?
 0002  0000			CreateTime	dw	?
 0004  0000			LastAccessDate	dw	?
 0006  0000			LastAccessTime	dw	?
 0008  0000			LastWriteDate	dw	?
 000A  0000			LastWriteTime	dw	?
 000C  00000000			DataLength	dd	?	; File size
 0010  00000000			FileSpace	dd	?	; falloc_size
 0014  0000			Attributes	dw	?	; attributes
 0016				FileInfo	ends
				
				
				str	    struc
 0000  0000			old_bp	    dw	     ?
 0002  00000000			return	    dd	     ?
 0006  0000			BufferSize  dw	     ?		; file data buffer size
 0008  00000000			BufferPtr   dd	     ?		; file data buffer
 000C  0000			Level	    dw	     ?		; file data info level
 000E  0000			Handle	    dw	     ?		; file handle
 0010				str	    ends
				
 0000				dosQfileinfo  proc     far
					Enter	dosQfileinfo		   ; save registers
				
 000C  8B 5E 0E				mov	bx,[bp].handle		   ;fill registers for function call
				
 000F  B8 5700				mov	ax,05700h
 0012  CD 21				int	21h			   ; get file date and time
 0014  72 70				jc	ErrorExit		   ; jump if error
				
 0016  C5 76 08				lds	si,[bp].BufferPtr	   ; copy date and time to
 0019  89 14				mov	ds:[si].CreateDate,dx	   ; file info return data area
 001B  89 4C 02				mov	ds:[si].CreateTime,cx
 001E  89 54 04				mov	ds:[si].LastAccessDate,dx
 0021  89 4C 06				mov	ds:[si].LastAccessTime,cx
 0024  89 54 08				mov	ds:[si].LastWriteDate,dx
 0027  89 4C 0A				mov	ds:[si].LastWriteTime,cx
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosQFileInfo mapper                                  Page     1-2


				
				;  Calculate the file length and file space and save in the file info data area
				
 002A  B9 0000				mov	cx,0			   ; get the current position
 002D  BA 0000				mov	dx,0
 0030  8B 5E 0E				mov	bx,[bp].handle		   ; get file handle
				
 0033  B8 4201				mov	ax,04201h
 0036  CD 21				int	21h			   ; move file pointer to the
 0038  72 4C				jc	ErrorExit		   ; current position
				
 003A  52				push	dx
 003B  50				push	ax
				
 003C  B9 0000				mov	cx,0
 003F  BA 0000				mov	dx,0
 0042  8B 5E 0E				mov	bx,[bp].Handle
				
 0045  B8 4202				mov	ax,04202h		   ; move file pointer to end-of-file
 0048  CD 21				int	21h
				
 004A  C5 76 08				lds	si,[bp].BufferPtr		  ; save the file length in
 004D  89 44 0C				mov	ds:word ptr DataLength[si+0],ax   ; file info data area
 0050  89 54 0E				mov	ds:word ptr DataLength[si+2],dx
				
 0053  A9 01FF				test	ax,511
 0056  74 09				jz	HaveSpace
				
 0058  25 FE00				and	ax,not 511
 005B  05 0200				add	ax,512
 005E  83 D2 00				adc	dx,0
				
 0061				HaveSpace:
 0061  89 44 10				mov	ds:word ptr FileSpace[si+0],ax	    ; save file space
 0064  89 54 12				mov	ds:word ptr FileSpace[si+2],dx	    ; in return data area
				
				;   calculate the file attribute  and save
				
 0067  5A				pop	dx
 0068  59				pop	cx
				
 0069  8B 5E 0E				mov	bx,[bp].Handle
				
 006C  B8 4200				mov	ax,04200h
 006F  CD 21				int	21h			       ; move the file pointer
 0071  72 13				jc	ErrorExit
				
 0073  B8 ---- R			mov	ax,seg FileAttributeSegment
 0076  8E D8				mov	ds,ax
					assume	ds:FileAttributeSegment
				
 0078  8B 5E 0E				mov	bx,[bp].Handle
 007B  03 DB				add	bx,bx
				
 007D  8B 87 0000 E			mov	ax,FileAttributeTable[bx]
 0081  89 46 14				mov	[bp].Attributes,ax	       ; save file attribute
				
 0084  2B C0				sub	ax,ax			       ; set good return code
				
 0086				ErrorExit:
					mexit				       ; restore registers
 0092  CA 000A				ret	 size  str - 6		       ; return
				
 0095				dosqfileinfo endp
				
 0095				dosxxx	    ends
				
					    end

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosQFileInfo mapper                                  Symbols-1


Macros:

		N a m e			Lines

ENTER  . . . . . . . . . . . . .  	   3
MEXIT  . . . . . . . . . . . . .  	   3
POPAL  . . . . . . . . . . . . .  	   9
PUSHAL . . . . . . . . . . . . .  	   9

Structures and Records:

                N a m e                 Width   # fields
                                        Shift   Width   Mask    Initial

FILEINFO . . . . . . . . . . . .  	0016	0009
  CREATEDATE . . . . . . . . . .  	0000
  CREATETIME . . . . . . . . . .  	0002
  LASTACCESSDATE . . . . . . . .  	0004
  LASTACCESSTIME . . . . . . . .  	0006
  LASTWRITEDATE  . . . . . . . .  	0008
  LASTWRITETIME  . . . . . . . .  	000A
  DATALENGTH . . . . . . . . . .  	000C
  FILESPACE  . . . . . . . . . .  	0010
  ATTRIBUTES . . . . . . . . . .  	0014
STR  . . . . . . . . . . . . . .  	0010	0006
  OLD_BP . . . . . . . . . . . .  	0000
  RETURN . . . . . . . . . . . .  	0002
  BUFFERSIZE . . . . . . . . . .  	0006
  BUFFERPTR  . . . . . . . . . .  	0008
  LEVEL  . . . . . . . . . . . .  	000C
  HANDLE . . . . . . . . . . . .  	000E

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

DOSXXX . . . . . . . . . . . . .  	0095	BYTE	PUBLIC	'DOS'
FILEATTRIBUTESEGMENT . . . . . .  	0000	WORD	PUBLIC	'FAT'

Symbols:            

                N a m e         	Type	 Value	 Attr

dosQfileinfo . . . . . . . . . .  	F PROC	0000	DOSXXX	Global	Length = 0095

ERROREXIT  . . . . . . . . . . .  	L NEAR	0086	DOSXXX

FileAttributeTable . . . . . . .  	V WORD	0000	FILEATTRIBUTESEGMENT	External

HAVESPACE  . . . . . . . . . . .  	L NEAR	0061	DOSXXX

@CPU . . . . . . . . . . . . . .  	TEXT  0101h		
@FILENAME  . . . . . . . . . . .  	TEXT  qfileinf		
@VERSION . . . . . . . . . . . .  	TEXT  510		


    192 Source  Lines
    216 Total   Lines
     34 Symbols

  47298 + 276715 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
