home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c005 / 4.ddi / C / SCCURST.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-05  |  2.3 KB  |  72 lines

  1. /**
  2. *
  3. * Name        sccurst -- Returns the cursor position and size from
  4. *                current display page
  5. *
  6. * Synopsis    is_off = sccurst(prow,pcol,phigh,plow);
  7. *
  8. *        int is_off      1 if cursor is off, 0 if on
  9. *        int *prow      Pointer to row value        returned
  10. *        int *pcol      Pointer to column value   returned
  11. *        int *phigh      Pointer to high scan line returned
  12. *        int *plow      Pointer to low scan line  returned
  13. *
  14. * Description    SCCURST returns the current cursor location on the
  15. *        current display device and page and the current size of
  16. *        the cursor.  It also reports whether the cursor is on or
  17. *        off.
  18. *
  19. *        This function operates by querying BIOS about the status
  20. *        of the cursor.    Some IBM programs alter the cursor size
  21. *        without alerting BIOS about the change, so the BIOS may
  22. *        report inaccurate information about cursor size.
  23. *        SCCURST is subject to such inaccuracies.
  24. *
  25. *        This function maintains records of the cursor types and
  26. *        cursor on/off states for each display page of each
  27. *        installed video adapter.  Another process may have
  28. *        changed the actual state of the cursor without updating
  29. *        the recorded cursor state.  If such a conflict occurs,
  30. *        SCCURST reports and records the actual cursor state.
  31. *
  32. * Returns    is_off          1 if cursor is off, 0 if on
  33. *        *prow,*pcol,*phigh,*plow
  34. *
  35. * Version    3.0 (C)Copyright Blaise Computing Inc. 1986
  36. *
  37. **/
  38.  
  39. #include <bscreen.h>
  40.  
  41. int sccurst(prow,pcol,phigh,plow)
  42. int *prow,*pcol,*phigh,*plow;
  43. {
  44.     int ax,bx,cx,dx,flags;          /* General registers          */
  45.     int device,mode,columns,act_page,off;
  46.  
  47.     ax    = utbyword(3,0);          /* Set up the call to the BIOS  */
  48.     bx    = utbyword(b_curpage,0);
  49.  
  50.     bios(16,&ax,&bx,&cx,&dx,&flags);
  51.  
  52.     *prow  = uthibyte(dx);
  53.     *pcol  = utlobyte(dx);
  54.  
  55.     device = scmode(&mode,&columns,&act_page);
  56.     if (act_page != b_curpage && b_curknown[device])
  57.     {                      /* Must look up table values.   */
  58.     *phigh = b_curtype[device][b_curpage].high;
  59.     *plow  = b_curtype[device][b_curpage].low ;
  60.     off    = b_curoff [device][b_curpage];
  61.     }
  62.     else                  /* Current page is active.      */
  63.     {
  64.     *phigh = utlonyb(uthibyte(cx));     /* Use actual values.     */
  65.     *plow  = utlonyb(      cx );
  66.     off    = ((cx & 0x6000) != 0);
  67.     scpgcur(off,*phigh,*plow,CUR_NO_ADJUST); /* Update the table. */
  68.     }
  69.  
  70.     return off;
  71. }
  72.