80386-80686+: isn't recommended use of EBX register by software programmers, because is a particular register of CPU, or couldn't it be used because the O.S. (as for as Windows) need it for some reasons...?
But if i save it into the stack before using it (and restore it on exit) what problems could exist ? What may be the consequences ?
With this simply routine to emulate sprites management I use the EBX register, but it seems, only under Windows 7.0 and ACER machines the video game i've created slow down. is only a doubt...
my answer: Because each program need of data area or (16 Bit) data segment and the EBX register in Delphi is used to save this data pointer each write to EBX slow down my program.
Procedure Sub_MoveSprite; Assembler;
/* Sub-ROUTINE per MoveSprite (FlipX-FlipY).
INPUT:
EAX= Attributi immagine.
EBX= Scarto X per origine.
ECX= Quantità X di Pixel per LINEA.
EDX= Quantità Y di linee da trasf.
EBP= Scarto X per destinazione.
ESI= OFFSET per origine.
EDI= OFFSET per destinaz */
Asm
Push EBP
Push EBX
Push ECX
BT EAX,Def_Target_DirX_D
SbB EBP,EBP
LEA EBP,[2*EBP+1]
BT EAX,Def_Source_DirX_D
SbB EBX,EBX
LEA EBX,[2*EBX+1]
@@01:Mov AL,[ESI]
Cmp AL,AH
JE @@00
Mov [EDI],AL
@@00:Add ESI,EBX
Add EDI,EBP
Loop @@01
Mov ECX,[ESP]
Add ESI,[ESP+4]
Add EDI,[ESP+8]
Dec EDX
JNE @@01
Add ESP,12
End;
Excuse me, mr. Peter Cordes, but I answer only one cause of setbacks. My tests are: INTEL COMPAQ NX7400 portable 2 GHz with 2 GB of RAM, AMD ASUS X53U portable 1 GHz with 2 GB of RAM and SVGA RADEON, AMD SEMPRON (tm) 2400+, 1.68 GHz, 1 GB of RAM, SVGA NVIDIA GeForce 6600, main. O.S. Windows XP. But I only had a suspicion on it problem that causes some little-time blink-breaks on running of a my software. This problem was also mentioned by some Stack Overflow users (EBX register).
The code are all that seems uses ASM on Borland Delphi 7.0 and access to EBX register after previously push it on the stack on entry code en pop it from the stack on exit.
I state that I use a strategy of polling and non a management of events by objects, with exception for to the main form, that uses a system timer that does the main-program-procedure, more management events OnPaint (which does not synchronize the optical brush, but this is not the problem ), OnActivate, OnCreate, OnDestroy, FormKeyUp/ Down and MouseClick.
The problem is that my software goes slightly jerky at a distance of variable frequencies and I do not even understand what it depends on.
I nested the code here. Why other code colud be needed to explained all? Now, why, except for the cpu: INTEL/AMD 80386+, PENTIUM (double core) and others similar that i've used for tests i have explained all, perhaps.