: Ok, I am going to give it a try! Unfortunately I haven't still work
: with dynamic variables (pointers), and this and assembly code is
: difficult for me to understand...
That's OK if you don't understand those assembly routines, just use them as any other procedure on function, all pascal routines are written in asm by the way.
: its going to be 2x faster in 32bit?? How to do this (if use a 32bit
: pascal, right?) ? Anyway, thanks man! Once I put it in my program I
: am making,I am going to post again!
Borland Pascal is 16bit, if you use Free Pascal that's either 32 or 64bit. Like all Dos era programs BP is running on a virtual machine under Windows, because is emulated tends to run way slower than it would on a Dos machine. If you really looking for speed than upgrade to FP and watch the difference. How 32bit is faster, here's an example: for a 100 element array if you van to copy byte by byte to another array the it would loop 100 times. One byte is 8bit therefore if you do the copying by using words instead (16 bit) then it would loop 50 times (2 bytes at a time), so is 2x faster. Going up to 32bit you'd copy longwords so it would loop 25 times (4 bytes at a time), that's 2x faster than 16bit, 4x faster than the original 8bit operation. Is possible to do this with BP, using assembly:
procedure copyfaster(source,dest:pointer;count:word);assembler;
asm
mov dx,ds { save data segment in dx }
mov cx,count { get count in cx }
les di,dest { es:di <-- dest }
lds si,source { ds:si <-- source }
mov bl,cl { bl:=cl; }
and bl,3 { bl:=bl mod 4 }
shr cx,2 { cx:=cx div 4 }
cld { clear direction flag }
db $66;rep movsw { loop: copy one dword (32bit) from source to dest }
mov cl,bl { cl:=bl; }
rep movsb { leftover bytes ? 0..3 }
mov ds,dx { restore data segment }
end;