sec_size.asm
上传用户:xiaoan1112
上传日期:2013-04-11
资源大小:19621k
文件大小:1k
源码类别:

操作系统开发

开发平台:

Visual C++

  1. ;========================================================
  2. COMMENT #
  3. SEC_SIZE.ASM
  4. Copyright (c) 1991 - Microsoft Corp.
  5. All rights reserved.
  6. Microsoft Confidential
  7. =================================================
  8. Uses the DPB to return the number of bytes per
  9. sector on the specified drive.
  10. unsigned GetSectorSize( Drive );
  11. ARGUMENTS: Drive - DOS drive number (0=default, 1=A, 2=B, ...)
  12. RETURNS:   int - TRUE if disk is removeable else false
  13. ================================================
  14. johnhe - 12-11-90
  15. END COMMENT #
  16. ; =======================================================
  17. INCLUDE disk_io.inc
  18. INCLUDE model.inc
  19. ; =======================================================
  20. .CODE
  21. ; =======================================================
  22. GetSectorSize PROC USES DS, Drive:BYTE
  23. mov AH,32h ; Get DPB request
  24. mov DL,Drive ; Drive in BL (0=default,1=A...)
  25. int 21h
  26. cmp AL,0ffh ; Check for invalid drive error
  27. je BadDrive
  28. ; Bytes per sector is offset 2
  29. ; in the DBP
  30. mov AX,[BX+2] ; AX = Bytes per sector
  31. ret
  32. BadDrive:
  33. mov AX,200h ; Default to 512 bytes sectors size
  34. ret
  35. GetSectorSize ENDP
  36. END