home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / msdos / programm / 10730 < prev    next >
Encoding:
Text File  |  1992-11-17  |  2.4 KB  |  118 lines

  1. Newsgroups: comp.os.msdos.programmer
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!munnari.oz.au!titan!trlluna!bruce.cs.monash.edu.au!monu6!giaeb!s1110238
  3. From: s1110238@giaeb.cc.monash.edu.au (Lee Hollingworth)
  4. Subject: Re: Mouse Cursor Drawing .
  5. Message-ID: <s1110238.722071396@giaeb>
  6. Sender: news@monu6.cc.monash.edu.au (Usenet system)
  7. Organization: Monash University, Melb., Australia.
  8. References: <1992Nov17.153941.1446@dct.ac.uk>
  9. Date: Wed, 18 Nov 1992 07:23:16 GMT
  10. Lines: 106
  11.  
  12. buxduac@dct.ac.uk writes:
  13.  
  14. >How does a mouse driver draw it cursor on the screen ?  Does it use a
  15. >nice safe DOS function or does it have to do the bit manipulation itself ?
  16. >  I know int 33H function 09 sets the cursor shape but the drawing I
  17. >can not find !.
  18.  
  19. Int 33h 09h does indeed set the cursor shape and it uses ES:DX for pointer
  20. to screen and cursor.  (ES segment, DX offset).
  21.  
  22. You will need a function which defines segment:offset such as MSC && TC++
  23. FP_OFF() and FP_SEG().
  24.  
  25. /***
  26.  * file:    mouse.h
  27.  * purpose: mouse defines
  28.  ***/
  29.  
  30. #ifndef MOUSE
  31.  
  32. #define LBUTTON             0
  33. #define RBUTTON             1
  34.  
  35. #define SOFT_TEXT_CURSOR    0
  36. #define HARD_TEXT_CURSOR    1
  37.  
  38. #define MOUSE_BUS           1
  39. #define MOUSE_SERIAL        2
  40. #define MOUSE_INPORT        3
  41. #define MOUSE_PS2           4
  42. #define MOUSE_MP            5
  43.  
  44. #define IRQ_PS2             0
  45.  
  46. struct graph_cur {
  47.     int screen_mask[16];
  48.     int cursor_mask[16];
  49.     int spotx;
  50.     int spoty;
  51. };
  52.  
  53. /* graphics mode cursor, hour glass */
  54. static struct graph_cur far gcursor_hour = {
  55.     /* screen mask */
  56.     0x0000,
  57.     0x0000,
  58.     0x0000,
  59.     0x8001,
  60.     0xC003,
  61.     0xE007,
  62.     0xF00F,
  63.     0xE007,
  64.     0xC003,
  65.     0x8001,
  66.     0x0000,
  67.     0x0000,
  68.     0x0000,
  69.     0x0000,
  70.     0x0000,
  71.     0x0000,
  72.  
  73.     /* cursor mask */
  74.     0x0000,
  75.     0x7FFE,
  76.     0x6006,
  77.     0x300C,
  78.     0x1818,
  79.     0x0C30,
  80.     0x0660,
  81.     0x03C0,
  82.     0x0660,
  83.     0x0C30,
  84.     0x1998,
  85.     0x33CC,
  86.     0x67E6,
  87.     0x7FFE,
  88.     0x0000,
  89.     0x0000,
  90.  
  91.     /* hot spot x, y */
  92.     07, 07
  93. };
  94.  
  95. #define MOUSE
  96. #endif
  97.  
  98.  
  99. void m_cursor(struct graph_cur far *cursor)
  100. {
  101.     unsigned seg = FP_SEG(cursor);
  102.     unsigned off = FP_OFF(cursor);
  103.     int spotx = cursor->spotx;
  104.     int spoty = cursor->spoty;
  105.  
  106.     _asm {
  107.         mov     ax, 9
  108.         mov     bx, spotx
  109.         mov     cx, spoty
  110.         mov     es, seg
  111.         mov     dx, off
  112.         int     33h
  113.     }
  114. }
  115.  
  116. Lee Hollingworth
  117. s1110238@giaeb.cc.monash.edu.au
  118.