Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  Function 1BH (decimal 27) returns important information about the disk in
  the current drive. Function 1CH performs the identical service for any
  drive. Function 36H performs a nearly identical service. (See Chapter
  17.)

  The following information is returned through this function call:

  .  AL contains the number of sectors per cluster.

  .  CX contains the size, in bytes, of the disk sectors (512 bytes for all
     standard PC formats).

  .  DX contains the total number of clusters on the disk.

  .  DS:BX points to a byte in DOS's work area containing the DOS media
     descriptor. Prior to DOS version 2.0, the DS:BX register pair pointed
     to the complete disk FAT (which could be guaranteed to be in memory,
     complete), whose first byte would be the ID byte. In later DOS
     versions, DS:BX points only to the single ID byte.

  Beware: Function 1BH uses the DS register to return the address of the
  media descriptor byte. If your program relies on the DS register to point
  to data--and most high-level and assembly-language programs do--then you
  should be careful to preserve the contents of the DS register while you
  call function 1BH.

  The following example shows how to do this:

  push    ds              ; preserve DS
  mov     ah,1Bh
  int     21h             ; call function 1BH; DS:BX -> media descriptor
  mov     ah,[bx]         ; get a copy of the media descriptor byte
  pop     ds              ; restore DS

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson