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

  1. /*-----------------------------------------------------------------------*
  2.  * filename - segread.cas
  3.  *
  4.  * function(s)
  5.  *        segread - reads segment registers
  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 <dos.h>
  20.  
  21. /*-----------------------------------------------------------------------*
  22.  
  23. Name            segread - reads segment registers
  24.  
  25. Usage           #include <dos.h>
  26.                 void segread(struct SREGS *segp);
  27.  
  28. Prototype in    dos.h
  29.  
  30. Description     segread places the current values of the segment
  31.                 registers (stored in SEGREGS) into the structure pointed to by
  32.                 segp.
  33.  
  34.                 This call is intended for use with intdosx and int86x.
  35.  
  36. Return value    None
  37.  
  38. *------------------------------------------------------------------------*/
  39. void segread(struct SREGS *segp)
  40. {
  41. #if (LDATA)
  42. asm mov bx,es           /* save ES */
  43. #endif
  44. asm LES_ si,segp
  45. #if (LDATA)
  46. asm mov es:[si].es,bx
  47. #else
  48. asm mov [si].es,es
  49. #endif
  50. #if (LPROG)
  51. asm mov ax,[bp+4]       /* Retrieve callers CS from stack */
  52. asm mov ES_ [si].cs,ax
  53. #else
  54. asm mov ES_ [si].cs,cs
  55. #endif
  56. asm mov ES_ [si].ss,ss
  57. #ifdef __HUGE__
  58. asm mov ax,[bp-4]       /* Retrieve saved DS from stack (SI pushed first) */
  59. asm mov ES_ [si].ds,ax
  60. #else
  61. asm mov ES_ [si].ds,ds
  62. #endif
  63. #if (LDATA)
  64. asm mov es,bx           /* Restore ES */
  65. #endif
  66. }
  67.