move.ppi 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1993,97 by the Free Pascal development team
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. procedure MoveLong(selector:word;dst:pointer;cnt:longint);
  12. begin
  13. asm
  14. movw %fs,%dx
  15. movw selector,%ax
  16. movw %ax,%fs
  17. xorl %esi,%esi
  18. movl DST,%edi
  19. movl CNT,%ecx
  20. shrl $0x2,%ecx
  21. MOVE1:
  22. movl %fs:(%esi,%ecx,4),%eax
  23. movl %eax,(%edi,%ecx,4)
  24. decl %ecx
  25. jns MOVE1
  26. movw %dx,%fs
  27. end;
  28. end;
  29. procedure ScreenToMem(Source,Target,Counter:longint);
  30. begin
  31. asm
  32. pushw %ds
  33. movl counter,%ecx
  34. movl %ecx,%ebx
  35. shrl $0x2,%ecx
  36. andl $0x3,%ebx
  37. movl target,%edi
  38. movl source,%esi
  39. addl _WBUFFER,%esi
  40. movw _SEG_WRITE,%ax
  41. movw %ax,%ds
  42. rep
  43. movsl
  44. movl %ebx,%ecx
  45. rep
  46. movsb
  47. popw %ds
  48. end;
  49. end;
  50. procedure MemToScreen(Source,Target,Counter:longint);
  51. begin
  52. asm
  53. movw %es,%dx
  54. movl counter,%ecx
  55. movl %ecx,%ebx
  56. shrl $0x2,%ecx
  57. andl $0x3,%ebx
  58. movl target,%edi
  59. movl source,%esi
  60. addl _WBUFFER,%edi
  61. movw _SEG_WRITE,%ax
  62. movw %ax,%es
  63. rep
  64. movsl
  65. movl %ebx,%ecx
  66. rep
  67. movsb
  68. movw %dx,%es
  69. end;
  70. end;
  71. procedure MemAndScreen(Source,Target,Counter:longint);
  72. begin
  73. asm
  74. pushw %es
  75. movl counter,%ecx
  76. movl %ecx,%ebx
  77. shrl $0x2,%ecx
  78. andl $0x3,%ebx
  79. movl target,%edi
  80. movl source,%esi
  81. movl $4,%edx
  82. addl _WBUFFER,%edi
  83. movw _SEG_WRITE,%ax
  84. movw %ax,%es
  85. mas_lloop:
  86. movl (%esi),%eax
  87. andl %eax,%es:(%edi)
  88. addl %edx,%edi
  89. addl %edx,%esi
  90. decl %ecx
  91. jnz mas_lloop
  92. orl %ebx,%ecx
  93. jz mas_end
  94. mas_bloop:
  95. movb (%esi),%al
  96. andb %al,%es:(%edi)
  97. incl %esi
  98. incl %edi
  99. decl %ecx
  100. jnz mas_bloop
  101. mas_end:
  102. popw %es
  103. end;
  104. end;
  105. procedure MemOrScreen(Source,Target,Counter:longint);
  106. begin
  107. asm
  108. pushw %es
  109. movl counter,%ecx
  110. movl %ecx,%ebx
  111. shrl $0x2,%ecx
  112. andl $0x3,%ebx
  113. movl target,%edi
  114. movl source,%esi
  115. addl _WBUFFER,%edi
  116. movw _SEG_WRITE,%ax
  117. movw %ax,%es
  118. mos_lloop:
  119. movl (%esi),%eax
  120. orl %eax,%es:(%edi)
  121. addl $4,%edi
  122. addl $4,%esi
  123. decl %ecx
  124. jnz mos_lloop
  125. orl %ebx,%ecx
  126. jz mos_end
  127. mos_bloop:
  128. movb (%esi),%al
  129. orb %al,%es:(%edi)
  130. incl %esi
  131. incl %edi
  132. decl %ecx
  133. jnz mos_bloop
  134. mos_end:
  135. popw %es
  136. end;
  137. end;
  138. procedure MemXorScreen(Source,Target,Counter:longint);
  139. begin
  140. if is_mmx_cpu and (counter>50) then
  141. asm
  142. movw %es,%dx
  143. movl counter,%ecx
  144. movl %ecx,%ebx
  145. shrl $0x3,%ecx
  146. andl $0x7,%ebx
  147. movl target,%edi
  148. movl source,%esi
  149. addl _WBUFFER,%edi
  150. movw _SEG_WRITE,%ax
  151. movw %ax,%es
  152. jecxz mmxmxs_b
  153. mmxmxs_lloop:
  154. movq (%esi),%mm0
  155. addl $8,%esi
  156. pxor %es:(%edi),%mm0
  157. movq %mm0,%es:(%edi)
  158. addl $8,%edi
  159. decl %ecx
  160. jnz mmxmxs_lloop
  161. mmxmxs_b:
  162. orl %ebx,%ecx
  163. jz mmxmxs_end
  164. mmxmxs_bloop:
  165. movb (%esi),%al
  166. xorb %al,%es:(%edi)
  167. incl %esi
  168. incl %edi
  169. decl %ecx
  170. jnz mmxmxs_bloop
  171. mmxmxs_end:
  172. movw %dx,%es
  173. end
  174. else
  175. asm
  176. movw %es,%dx
  177. movl counter,%ecx
  178. movl %ecx,%ebx
  179. shrl $0x2,%ecx
  180. andl $0x3,%ebx
  181. movl target,%edi
  182. movl source,%esi
  183. addl _WBUFFER,%edi
  184. movw _SEG_WRITE,%ax
  185. movw %ax,%es
  186. jecxz mxs_b
  187. mxs_lloop:
  188. movl (%esi),%eax
  189. xorl %eax,%es:(%edi)
  190. addl $4,%edi
  191. addl $4,%esi
  192. decl %ecx
  193. jnz mxs_lloop
  194. mxs_b:
  195. orl %ebx,%ecx
  196. jz mxs_end
  197. mxs_bloop:
  198. movb (%esi),%al
  199. xorb %al,%es:(%edi)
  200. incl %esi
  201. incl %edi
  202. decl %ecx
  203. jnz mxs_bloop
  204. mxs_end:
  205. movw %dx,%es
  206. end;
  207. end;
  208. procedure MemNotScreen(Source,Target,Counter:longint);
  209. begin
  210. asm
  211. pushw %es
  212. movl counter,%ecx
  213. movl %ecx,%ebx
  214. shrl $0x2,%ecx
  215. andl $0x3,%ebx
  216. movl target,%edi
  217. movl source,%esi
  218. addl _WBUFFER,%edi
  219. movw _SEG_WRITE,%ax
  220. movw %ax,%es
  221. jecxz mns_b
  222. mns_lloop:
  223. movl (%esi),%eax
  224. notl %eax
  225. movl %eax,%es:(%edi)
  226. addl $4,%edi
  227. addl $4,%esi
  228. decl %ecx
  229. jnz mns_lloop
  230. mns_b:
  231. orl %ebx,%ecx
  232. jz mns_end
  233. mns_bloop:
  234. movb (%esi),%al
  235. notb %al
  236. movb %al,%es:(%edi)
  237. incl %esi
  238. incl %edi
  239. decl %ecx
  240. jnz mns_bloop
  241. mns_end:
  242. popw %es
  243. end;
  244. end;
  245. {
  246. $Log$
  247. Revision 1.1 1998-03-25 11:18:42 root
  248. Initial revision
  249. Revision 1.4 1998/03/03 22:48:43 florian
  250. + graph.drawpoly procedure
  251. + putimage with xorput uses mmx if available
  252. Revision 1.3 1998/01/26 11:58:25 michael
  253. + Added log at the end
  254. Working file: rtl/dos/ppi/move.ppi
  255. description:
  256. ----------------------------
  257. revision 1.2
  258. date: 1997/12/01 12:21:32; author: michael; state: Exp; lines: +14 -0
  259. + added copyright reference in header.
  260. ----------------------------
  261. revision 1.1
  262. date: 1997/11/27 08:33:51; author: michael; state: Exp;
  263. Initial revision
  264. ----------------------------
  265. revision 1.1.1.1
  266. date: 1997/11/27 08:33:51; author: michael; state: Exp; lines: +0 -0
  267. FPC RTL CVS start
  268. =============================================================================
  269. }