home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 2.ddi / CLIB2.ZIP / BIOSDISK.CAS < prev    next >
Encoding:
Text File  |  1990-06-07  |  2.2 KB  |  66 lines

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