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

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