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

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