fpc/rtl/dos/ppi/move.ppi
1998-03-25 11:18:12 +00:00

287 lines
5.8 KiB
Plaintext

{
$Id$
This file is part of the Free Pascal run time library.
Copyright (c) 1993,97 by the Free Pascal development team
See the file COPYING.FPC, included in this distribution,
for details about the copyright.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
**********************************************************************}
procedure MoveLong(selector:word;dst:pointer;cnt:longint);
begin
asm
movw %fs,%dx
movw selector,%ax
movw %ax,%fs
xorl %esi,%esi
movl DST,%edi
movl CNT,%ecx
shrl $0x2,%ecx
MOVE1:
movl %fs:(%esi,%ecx,4),%eax
movl %eax,(%edi,%ecx,4)
decl %ecx
jns MOVE1
movw %dx,%fs
end;
end;
procedure ScreenToMem(Source,Target,Counter:longint);
begin
asm
pushw %ds
movl counter,%ecx
movl %ecx,%ebx
shrl $0x2,%ecx
andl $0x3,%ebx
movl target,%edi
movl source,%esi
addl _WBUFFER,%esi
movw _SEG_WRITE,%ax
movw %ax,%ds
rep
movsl
movl %ebx,%ecx
rep
movsb
popw %ds
end;
end;
procedure MemToScreen(Source,Target,Counter:longint);
begin
asm
movw %es,%dx
movl counter,%ecx
movl %ecx,%ebx
shrl $0x2,%ecx
andl $0x3,%ebx
movl target,%edi
movl source,%esi
addl _WBUFFER,%edi
movw _SEG_WRITE,%ax
movw %ax,%es
rep
movsl
movl %ebx,%ecx
rep
movsb
movw %dx,%es
end;
end;
procedure MemAndScreen(Source,Target,Counter:longint);
begin
asm
pushw %es
movl counter,%ecx
movl %ecx,%ebx
shrl $0x2,%ecx
andl $0x3,%ebx
movl target,%edi
movl source,%esi
movl $4,%edx
addl _WBUFFER,%edi
movw _SEG_WRITE,%ax
movw %ax,%es
mas_lloop:
movl (%esi),%eax
andl %eax,%es:(%edi)
addl %edx,%edi
addl %edx,%esi
decl %ecx
jnz mas_lloop
orl %ebx,%ecx
jz mas_end
mas_bloop:
movb (%esi),%al
andb %al,%es:(%edi)
incl %esi
incl %edi
decl %ecx
jnz mas_bloop
mas_end:
popw %es
end;
end;
procedure MemOrScreen(Source,Target,Counter:longint);
begin
asm
pushw %es
movl counter,%ecx
movl %ecx,%ebx
shrl $0x2,%ecx
andl $0x3,%ebx
movl target,%edi
movl source,%esi
addl _WBUFFER,%edi
movw _SEG_WRITE,%ax
movw %ax,%es
mos_lloop:
movl (%esi),%eax
orl %eax,%es:(%edi)
addl $4,%edi
addl $4,%esi
decl %ecx
jnz mos_lloop
orl %ebx,%ecx
jz mos_end
mos_bloop:
movb (%esi),%al
orb %al,%es:(%edi)
incl %esi
incl %edi
decl %ecx
jnz mos_bloop
mos_end:
popw %es
end;
end;
procedure MemXorScreen(Source,Target,Counter:longint);
begin
if is_mmx_cpu and (counter>50) then
asm
movw %es,%dx
movl counter,%ecx
movl %ecx,%ebx
shrl $0x3,%ecx
andl $0x7,%ebx
movl target,%edi
movl source,%esi
addl _WBUFFER,%edi
movw _SEG_WRITE,%ax
movw %ax,%es
jecxz mmxmxs_b
mmxmxs_lloop:
movq (%esi),%mm0
addl $8,%esi
pxor %es:(%edi),%mm0
movq %mm0,%es:(%edi)
addl $8,%edi
decl %ecx
jnz mmxmxs_lloop
mmxmxs_b:
orl %ebx,%ecx
jz mmxmxs_end
mmxmxs_bloop:
movb (%esi),%al
xorb %al,%es:(%edi)
incl %esi
incl %edi
decl %ecx
jnz mmxmxs_bloop
mmxmxs_end:
movw %dx,%es
end
else
asm
movw %es,%dx
movl counter,%ecx
movl %ecx,%ebx
shrl $0x2,%ecx
andl $0x3,%ebx
movl target,%edi
movl source,%esi
addl _WBUFFER,%edi
movw _SEG_WRITE,%ax
movw %ax,%es
jecxz mxs_b
mxs_lloop:
movl (%esi),%eax
xorl %eax,%es:(%edi)
addl $4,%edi
addl $4,%esi
decl %ecx
jnz mxs_lloop
mxs_b:
orl %ebx,%ecx
jz mxs_end
mxs_bloop:
movb (%esi),%al
xorb %al,%es:(%edi)
incl %esi
incl %edi
decl %ecx
jnz mxs_bloop
mxs_end:
movw %dx,%es
end;
end;
procedure MemNotScreen(Source,Target,Counter:longint);
begin
asm
pushw %es
movl counter,%ecx
movl %ecx,%ebx
shrl $0x2,%ecx
andl $0x3,%ebx
movl target,%edi
movl source,%esi
addl _WBUFFER,%edi
movw _SEG_WRITE,%ax
movw %ax,%es
jecxz mns_b
mns_lloop:
movl (%esi),%eax
notl %eax
movl %eax,%es:(%edi)
addl $4,%edi
addl $4,%esi
decl %ecx
jnz mns_lloop
mns_b:
orl %ebx,%ecx
jz mns_end
mns_bloop:
movb (%esi),%al
notb %al
movb %al,%es:(%edi)
incl %esi
incl %edi
decl %ecx
jnz mns_bloop
mns_end:
popw %es
end;
end;
{
$Log$
Revision 1.1 1998-03-25 11:18:42 root
Initial revision
Revision 1.4 1998/03/03 22:48:43 florian
+ graph.drawpoly procedure
+ putimage with xorput uses mmx if available
Revision 1.3 1998/01/26 11:58:25 michael
+ Added log at the end
Working file: rtl/dos/ppi/move.ppi
description:
----------------------------
revision 1.2
date: 1997/12/01 12:21:32; author: michael; state: Exp; lines: +14 -0
+ added copyright reference in header.
----------------------------
revision 1.1
date: 1997/11/27 08:33:51; author: michael; state: Exp;
Initial revision
----------------------------
revision 1.1.1.1
date: 1997/11/27 08:33:51; author: michael; state: Exp; lines: +0 -0
FPC RTL CVS start
=============================================================================
}