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


				;0
				page 80,132
				
				title CP/DOS  DosClose  mapper   * * *
				
 0000				dosxxx	segment byte public 'dos'
					assume	cs:dosxxx,ds:nothing,es:nothing,ss:nothing
				;
				; ************************************************************************* *
				; *
				; *	 MODULE: DosClose
				; *
				; *	 FUNCTION: This module will close a file or a device.
				; *
				; *	 CALLING SEQUENCE:
				; *
				; *		   PUSH  WORD  FileHandle ;  File Handle or device handle
				; *		   CALL  DosClose
				; *
				; *	 RETURN SEQUENCE:
				; *
				; *		   IF ERROR (AX not = 0)
				; *
				; *		      AX = Error Code:
				; *
				; *		      o   Invalid file handle
				; *
				; *
				; *	 MODULES CALLED:  DOS int 21H function 3EH
				; *
				; *
				; *************************************************************************
				
					public	DosClose
					.sall
					.list
				
				str	struc
 0000  0000			old_bp	   dw	  ?
 0002  00000000			return	   dd	  ?
 0006  0000			FileHandle dw	  ?	     ; file or device handle
 0008				str	ends
				
				
 0000				DosClose  proc	 far
					Enter	DosClose	       ; push registers
				
				; Only files are closed.  Devices are not closed, since OPEN creates
				; a dummy device handle without actually openning the device.
				
 000C  8B 5E 06				mov	bx,[bp].FileHandle     ; load the handle
 000F  8B C3				mov	ax,bx		       ; check for device handle
 0011  F7 D8				neg	ax		       ; if device handle, return
 0013  79 07				jns	GoodExit	       ; do not close the device
				
 0015				FileCloseRequest:
 0015  B8 3E00				mov	ax,03e00h	       ; load opcode
 0018  CD 21				int	21h		       ; close the file
 001A  72 02				jc	ErrorExit	       ; return if error
				
 001C				GoodExit:
 001C  2B C0				sub	ax,ax		       ; else, set good return code
				
 001E				ErrorExit:
					mexit			       ; pop registers
 002A  CA 0002				ret	size str - 6	       ; return
				
 002D				DosClose  endp
				
 002D				dosxxx	ends
				
					end

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:13
CP/DOS  DosClose  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

STR  . . . . . . . . . . . . . .  	0008	0003
  OLD_BP . . . . . . . . . . . .  	0000
  RETURN . . . . . . . . . . . .  	0002
  FILEHANDLE . . . . . . . . . .  	0006

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

DOSXXX . . . . . . . . . . . . .  	002D	BYTE	PUBLIC	'DOS'

Symbols:            

                N a m e         	Type	 Value	 Attr

DosClose . . . . . . . . . . . .  	F PROC	0000	DOSXXX	Global	Length = 002D

ERROREXIT  . . . . . . . . . . .  	L NEAR	001E	DOSXXX

FILECLOSEREQUEST . . . . . . . .  	L NEAR	0015	DOSXXX

GOODEXIT . . . . . . . . . . . .  	L NEAR	001C	DOSXXX

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


    120 Source  Lines
    144 Total   Lines
     19 Symbols

  47544 + 310788 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
