-
It seems wise to me to test my code before calling it slow. I assure you I'm not in the habit of writing slow code.
Besides text mode at 80x50x2 is only 800 bytes. You won't see any shearing - I doubt at full speed you will be able to see much.
Code:
mov edi,[screen_selector]
mov esi,[buffer_selector]
mov ecx,200d
rep movsd
800 bytes is only 200 DWORDs. This would go fast on a 386 machine let alone a modern CPU.
-
Code:
mov edi,[screen_selector]
mov esi,[buffer_selector]
mov ecx,200d
rep movsd
What does it make, I have just some kind of idea of that? :)
mov makes a variable but are edi, esi and ecx registers where it's saved into? and what about rep?
If you know a good site for assembly, can u tell me? :) I know it's hard to learn it, but I'd like to try.
-
Well mov e{di/si},[buffer_ptr] is the same as the 16-bit l{ds/es/gs/fs},[buffer_ptr].
Except that in 32-bit Windows you don't want to change the current selector so you just use the mov opcode.
mov edi,[screen_selector]
This places the screen selector (essentially it's address) into edi or the 32-bit destination index register.
mov esi,[buffer_selector]
This places the buffer selector (essentially it's address) in esi or the 32-bit source index register.
mov ecx,200d
This places the value of 200 in decimal (d = decimal, h=hex, b=binary, o=octal) into the 32-bit cx register or ecx. The (e)cx register is known as the count register and it is the register that the rep opcode looks at to determine the loop count. If the direction flag is clear then rep will auto-decrement (e)cx and if it's set it will auto-increment (e)cx.
rep movsd
MOVSD is a string operation that moves a DWORD from DS:ESI to ES:EDI or in this case from ESI to EDI. The REP prefix will repeat this operation until ECX reaches 0 - see above for increment/decrement behavior.