home *** CD-ROM | disk | FTP | other *** search
- page 58,132
- ; disk1.asm
- ; contains: seldsk(),diskreset(),curdsk(),gsetdta(),ggetdta(),dosparse()
- ;
-
- include model.h
- include prologue.h
- include equ.h
- name disk1
- pseg disk1
-
- ;==>-- int seldsk(drive)
- ;
- ;; ARGUMENTS:
- ; (unsigned) drive - Requested drive code: 0=A,1=B etc
- ;
- ;; DESCRIPTION:
- ; The specified disk/diskette drive is selected
- ;
- ;; RETURNS:
- ; Actual number of drives in system.
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc seldsk
- mov dl,parm1_ ;get drive code to DL
- mov ah,0Eh ;DOS function number
- int 21h
- xor ah,ah
- cproce
-
- ;==>-- void diskreset(void)
- ;
- ;; DESCRIPTION:
- ; All file buffers are flushed, uses dos function call 0x0d
- ;
- ;; SIDE EFFECTS:
- ; Files changed in size but not closed are not properly
- ; recorded in the disk directory
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc diskreset,,diskrese
- mov ax,0D00h
- int 21h
- xor ax,ax
- cproce
-
- ;==>-- int curdsk(void)
- ;
- ;; DESCRIPTION:
- ; Get the drive code for the currently selected disk.
- ;
- ;; RETURNS:
- ; Code for current default drive (0==A: 1==B: etc)
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;;;
- cproc curdsk
- mov ah,19h
- int 21h
- xor ah,ah
- cproce
-
- ;==>-- void gsetdta(table)
- ;
- ;; ARGUMENTS:
- ; (struct DISKTABLE *) table - points to disk table
- ; table->buffer = buffer offset, or 32 bit
- ; pointer if D or L model.
- ;; DESCRIPTION:
- ; The disk transfer address is set from the parameters in the
- ; table structure.
- ;
- ;; SIDE EFFECTS:
- ; a new disk transfer address will be established
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;
- ;; MODIFICATIONS:
- ; David Nienhiser Wed 11-Jan-1989 10:53:53
- ; Renamed from setdta()
- ;;;
- cproc gsetdta
- if _LDATA
- push ds
- lds bx,parm1_ ;get pointer to structure
- lds dx,[bx+buffer] ;ds:dx points to buffer
- else
- mov bx,parm1_ ;get ptr to structure
- mov dx,[bx+buffer] ;ds:dx points to buffer
- endif
- mov ax,1A00h ;function number
- int 21h
- if _LDATA
- pop ds
- endif
- xor ax,ax ;uniformly return 0
- cproce
-
- ;==>-- int ggetdta(table)
- ;
- ;; ARGUMENTS:
- ; (struct DISKTABLE *) table - points to variable type
- ; struct DISKTABLE that receives
- ; the current DTA.
- ; table->buffer buffer offset, or 32 bit
- ; pointer if D/L model.
- ;; DESCRIPTION:
- ; Gets disk transfer address to DISKTABLE
- ;
- ;; RETURNS:
- ; 0 if pointers are 16 bits (S/P models), or -1 if they are 32 bits
- ; (D/L models).
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;
- ;; MODIFICATIONS:
- ; "" Wed 11-Jan-1989 10:53:53
- ; Renamed from getdta().
- ;;;
- cproc ggetdta
- push es
- mov ah,2Fh
- int 21h ;es:bx now contains current DTA
- if _LDATA
- push ds
- lds si,parm1_ ;pointer to structure
- mov word ptr [si+buffer+2],es ;segment
- mov word ptr [si+buffer],bx ;offset
- pop ds
- mov ax,-1 ;indicate long pointers.
- else
- mov si,parm1_ ;pointer to structure
- mov [si+buffer],bx
- xor ax,ax ;indicate short ptrs
- endif
- pop es
- cproce
-
- ;==>-- int dosparse(table)
- ;
- ;; ARGUMENTS:
- ; (struct DISKTABLE *) table points to DISKTABLE
- ; table->string points to filename
- ;
- ;; DESCRIPTION:
- ; The string pointed to by table->string is parsed and a drive
- ; filename, and extension is placed in the FCB.
- ;
- ;; RETURNS:
- ; 0 if successful, ERROR(-1) if: (a) either "?" or "*" appear in
- ; filename or extension, or (b) if drive specifier is invalid, or
- ; (c) if backslash is found in string.
- ;
- ;; AUTHOR:
- ; Copyright (C)1987-1990 Greenleaf Software Inc. All Rights Reserved.
- ;
- ;; MODIFICATIONS:
- ;
- ;;;
- cproc dosparse
- push es
- mov ah,19h
- int 21h
- inc al
- if _LDATA
- push ds
- lds bx,parm1_ ;ds:bx points to DISKTABLE
- mov cx,ds
- mov es,cx
- mov di,bx
- push cx
- lea cx,ds:fdrive
- add di,cx ;es:di points to unopened fcb
- pop cx
- mov es:[di],al ;set drive code in fcb
- push ds
- lds si,[bx+string] ;ds:si points to string to be parsed
- mov ax,2907h
- int 21h
- pop ds ;ds:bx points back to structure
- else
- mov bx,parm1_ ;ds:bx points to DISKTABLE
- mov cx,ds
- mov es,cx ;es=ds
- mov di,bx
- add di,fdrive ;es:di points to fcb
- mov es:[di],al ;set drive code in fcb
- mov si,[bx+string] ;ds:si points to string to be parsed
- mov ax,2907h
- int 21h
- endif
- cmp al,0
- jne dosp2
- cmp byte ptr es:[di+1],' ' ;is it a blank
- je dosp2 ;if so error
- xor ax,ax ;say successful
- jmp short dosp3
- dosp2: mov ax,-1
- dosp3:
- if _LDATA
- pop ds
- endif
- pop es
- cproce
- endps
- end
-