home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC1.ZIP / BIOSDISK.CAS < prev    next >
Encoding:
Text File  |  1992-06-10  |  1.7 KB  |  66 lines

  1. /*---------------------------------------------------------------------------
  2.  * filename - biosdisk.cas
  3.  *
  4.  * function(s)
  5.  *        biosdisk - hard disk/floppy I/O
  6.  *--------------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #pragma inline
  18. #include <asmrules.h>
  19. #include <bios.h>
  20.  
  21.  
  22. /*--------------------------------------------------------------------------*
  23.  
  24. Name            biosdisk - hard disk/floppy I/O
  25.  
  26. Usage           int biosdisk(int cmd, int drive, int head, int track,
  27.                              int sector, int nsects, void *buffer);
  28.  
  29. Prototype in    bios.h
  30.  
  31. Description     interface for BIOS interrupt 0x13, disk services.
  32.  
  33. Return value    value returned through AH register by int 013h.
  34.  
  35. Note            See DOS Technical Reference Manual for further details of
  36.                 BIOS interrupt 0x13.
  37.  
  38. *---------------------------------------------------------------------------*/
  39. int biosdisk(int cmd, int drive, int head, int track,
  40.              int sector, int nsects, void *buffer)
  41. {
  42. #if !(LDATA)
  43. asm     push    ds
  44. asm     pop     es
  45. #endif
  46. asm     mov     ah, cmd
  47. asm     mov     al, nsects
  48. asm     LES_    bx, buffer
  49. asm     mov     cx, track
  50. asm     shr     cx, 1
  51. asm     shr     cx, 1
  52. asm     and     cl, 0C0h
  53. asm     add     cl, sector
  54. asm     mov     ch, track
  55. asm     mov     dh, head
  56. asm     mov     dl, drive
  57. asm     int     013h
  58. asm     cmp     BY0(cmd), 8
  59. asm     jne     BiosDiskEnd
  60. asm     LES_    bx, buffer
  61. asm     mov     W0(ES_ [bx]), cx
  62. asm     mov     W1(ES_ [bx]), dx
  63. BiosDiskEnd:
  64.         return _AH;
  65. }
  66.