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


				page 80,132
				
				title CP/DOS DosDevIOCTl   mapper
				
 0000				dosxxx  segment byte public 'dos'
				        assume  cs:dosxxx,ds:nothing,es:nothing,ss:nothing
				;
				;**********************************************************************
				;*
				;*   MODULE:   dosdevioctl
				;*
				;*   FILE NAME: dos007.asm
				;*
				;*   CALLING SEQUENCE:
				;*
				;*       push@     dword   Data
				;*       push@     dword   Paramlist
				;*       push      word    Function
				;*       push      word    Category
				;*       push@     word    Devicehandle
				;*
				;*       call      doschgfileptr
				;*
				;*   MODULES CALLED:  PC-DOS Int 21h, ah=42h, move file pointer
				;*
				;*********************************************************************
				
				            public   dosdevioctl
				            .sall
				            .list
				
				str         struc
 0000  0000			Old_bp      dw       ?
 0002  00000000			Return      dd       ?
 0006  0000			Handle      dw       ?       ; handle
 0008  0000			Category    dw       ?       ; device category
 000A  0000			Function    dw       ?       ; device function
 000C  00000000			Parmlist    dd       ?       ; command arguments
 0010  00000000			Data        dd       ?       ; data area
 0014				str         ends
				
 0000				dosdevioctl     proc  far
				        Enter   dosdevioctl           ; push registers
				
 000C  8B 5E 06			        mov     bx,[bp].handle        ; get handle
				
 000F  83 FB E5			        cmp     bx,0ffe5h             ; is it a device handle ??
 0012  7C 03			        jl      filehandle            ; branch if not
				
				; Convert DASD device handle to drive number as follows:
				;  Drive        Open    IOCTL
				;  Letter       Handle  DASD #
				; -----------------------------
				;    A           -2      1
				;    B           -3      2
				;    C           -4      3
				;    D           -5      4
				;    E           -6      5
 0014  F7 DB			        neg     bx                    ; convert dev handle to
 0016  4B			        dec     bx                    ; drive number
				
 0017				filehandle:
 0017  8B 46 0A			        mov     ax,[bp].function      ; get function code
 001A  3D 0020			        cmp     ax,020H               ; check for right function
 001D  74 06			        je      continue1             ; continue if right function code
 001F  B8 0001			        mov     ax,01H                ; else, load error code
 0022  EB 16 90			        jmp     exit                  ; return
				
 0025				continue1:                            ; only category 8 is supported
 0025  8B 46 08			        mov     ax,[bp].category      ; set category
				
 0028  B4 44			        mov     ah,44h
 002A  CD 21			        int     21h                   ; do ioctl
 002C  73 05			        jnc     continue              ; check for error
				
 002E  3D 0001			        cmp     ax,1                  ; if error and return code = 1
Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosDevIOCTl   mapper                                 Page     1-2


 0031  75 07			        jne     exit                  ; then it is network drive
				                                      ; therefore continue
 0033				continue:
 0033  C5 76 10			        lds     si,[bp].data          ; media changable
 0036  88 04			        mov     byte ptr [si],al      ; save in data area
 0038  33 C0			        xor     ax,ax                 ; set no error coe
				
 003A				exit:   mexit                         ; pop registers
 0046  CA 000E			        ret     size str - 6          ; return
				
 0049				dosdevioctl  endp
				
 0049				dosxxx      ends
				
				            end

Microsoft (R) Macro Assembler Version 5.10                  5/16/24 23:40:15
CP/DOS DosDevIOCTl   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  . . . . . . . . . . . . . .  	0014	0007
  OLD_BP . . . . . . . . . . . .  	0000
  RETURN . . . . . . . . . . . .  	0002
  HANDLE . . . . . . . . . . . .  	0006
  CATEGORY . . . . . . . . . . .  	0008
  FUNCTION . . . . . . . . . . .  	000A
  PARMLIST . . . . . . . . . . .  	000C
  DATA . . . . . . . . . . . . .  	0010

Segments and Groups:

                N a m e         	Length	 Align	Combine Class

DOSXXX . . . . . . . . . . . . .  	0049	BYTE	PUBLIC	'DOS'

Symbols:            

                N a m e         	Type	 Value	 Attr

CONTINUE . . . . . . . . . . . .  	L NEAR	0033	DOSXXX
CONTINUE1  . . . . . . . . . . .  	L NEAR	0025	DOSXXX

dosdevioctl  . . . . . . . . . .  	F PROC	0000	DOSXXX	Global	Length = 0049

EXIT . . . . . . . . . . . . . .  	L NEAR	003A	DOSXXX

FILEHANDLE . . . . . . . . . . .  	L NEAR	0017	DOSXXX

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


    139 Source  Lines
    163 Total   Lines
     24 Symbols

  47504 + 280604 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors
