mouse.pp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1993,97 by Florian Klamepfl,
  5. member of the Free Pascal development team
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. {
  13. History:
  14. 30.3.1994: Version 0.5
  15. Unit ist elementar implementiert
  16. (INT $33 Funktionen 0-3)
  17. 2.4.1995: Version 0.55
  18. - mousereset in eine function umgewandelt
  19. - mousesetpos implementiert
  20. - mouserelx, mouserely implementiert
  21. - mousex und mousey erweitern nun ihre Resultate
  22. immer auf 32 Bit
  23. 14.4.1995: Version 0.56
  24. - mouserelx und mouserely m�ssen ihre
  25. Resultate nat�rlich Vorzeichen erweitert auf
  26. 32 Bit kopieren
  27. - mouserelx und mouserely zu einer Funktion zusammen-
  28. gefaát, da sonst viele Bewegungen verloren gehen
  29. }
  30. {$E-}
  31. unit mouse;
  32. {$I os.inc}
  33. interface
  34. function mousereset : word;
  35. procedure mouseon;
  36. procedure mouseoff;
  37. function mousex : longint;
  38. function mousey : longint;
  39. procedure mouserel(var x,y : longint);
  40. function mousebuttons : longint;
  41. procedure mousesetpos(x,y : longint);
  42. implementation
  43. function mousereset : word;
  44. begin
  45. asm
  46. movw $0,%ax
  47. pushl %ebp
  48. int $0x33
  49. popl %ebp
  50. leave
  51. ret
  52. end;
  53. end;
  54. procedure mouseon;
  55. begin
  56. asm
  57. movw $1,%ax
  58. pushl %ebp
  59. int $0x33
  60. popl %ebp
  61. end;
  62. end;
  63. procedure mouseoff;
  64. begin
  65. asm
  66. movw $2,%ax
  67. pushl %ebp
  68. int $0x33
  69. popl %ebp
  70. end;
  71. end;
  72. function mousex : longint;
  73. begin
  74. asm
  75. movw $3,%ax
  76. pushl %ebp
  77. int $0x33
  78. popl %ebp
  79. movzwl %cx,%eax
  80. leave
  81. ret
  82. end;
  83. end;
  84. function mousey : longint;
  85. begin
  86. asm
  87. movw $3,%ax
  88. pushl %ebp
  89. int $0x33
  90. popl %ebp
  91. movzwl %dx,%eax
  92. leave
  93. ret
  94. end;
  95. end;
  96. function mousebuttons : longint;
  97. begin
  98. asm
  99. movw $3,%ax
  100. pushl %ebp
  101. int $0x33
  102. popl %ebp
  103. movl %ebx,%eax
  104. andl $7,%eax
  105. leave
  106. ret
  107. end;
  108. end;
  109. procedure mousesetpos(x,y : longint);
  110. begin
  111. asm
  112. movw $4,%ax
  113. movl 8(%ebp),%ecx
  114. movl 12(%ebp),%edx
  115. pushl %ebp
  116. int $0x33
  117. popl %ebp
  118. end;
  119. end;
  120. procedure mouserel(var x,y : longint);
  121. begin
  122. asm
  123. movw $11,%ax
  124. pushl %ebp
  125. int $0x33
  126. popl %ebp
  127. movswl %cx,%ecx
  128. movl 8(%ebp),%eax
  129. movl %ecx,(%eax)
  130. movswl %dx,%edx
  131. movl 12(%ebp),%eax
  132. movl %edx,(%eax)
  133. end;
  134. end;
  135. end.
  136. {
  137. $Log$
  138. Revision 1.1.1.1 1998-03-25 11:18:41 root
  139. * Restored version
  140. Revision 1.3 1998/01/26 11:56:50 michael
  141. + Added log at the end
  142. Working file: rtl/dos/mouse.pp
  143. description:
  144. ----------------------------
  145. revision 1.2
  146. date: 1997/12/01 12:15:47; author: michael; state: Exp; lines: +12 -5
  147. + added copyright reference in header.
  148. ----------------------------
  149. revision 1.1
  150. date: 1997/11/27 08:33:50; author: michael; state: Exp;
  151. Initial revision
  152. ----------------------------
  153. revision 1.1.1.1
  154. date: 1997/11/27 08:33:50; author: michael; state: Exp; lines: +0 -0
  155. FPC RTL CVS start
  156. =============================================================================
  157. }