if (State->Flags.Df)
{
- /* Reduce ESI and EDI by the number of bytes to transfer */
+ /* Move ESI and EDI to the start of the block */
if (AddressSize)
{
- State->GeneralRegs[FAST486_REG_ESI].Long -= Processed * DataSize;
- State->GeneralRegs[FAST486_REG_EDI].Long -= Processed * DataSize;
+ State->GeneralRegs[FAST486_REG_ESI].Long -= (Processed - 1) * DataSize;
+ State->GeneralRegs[FAST486_REG_EDI].Long -= (Processed - 1) * DataSize;
}
else
{
- State->GeneralRegs[FAST486_REG_ESI].LowWord -= Processed * DataSize;
- State->GeneralRegs[FAST486_REG_EDI].LowWord -= Processed * DataSize;
+ State->GeneralRegs[FAST486_REG_ESI].LowWord -= (Processed - 1) * DataSize;
+ State->GeneralRegs[FAST486_REG_EDI].LowWord -= (Processed - 1) * DataSize;
}
}
State->GeneralRegs[FAST486_REG_EDI].LowWord += Processed * DataSize;
}
}
+ else
+ {
+ /* Reduce ESI and EDI */
+ if (AddressSize)
+ {
+ State->GeneralRegs[FAST486_REG_ESI].Long -= DataSize;
+ State->GeneralRegs[FAST486_REG_EDI].Long -= DataSize;
+ }
+ else
+ {
+ State->GeneralRegs[FAST486_REG_ESI].LowWord -= DataSize;
+ State->GeneralRegs[FAST486_REG_EDI].LowWord -= DataSize;
+ }
+ }
/* Reduce the total count by the number processed in this run */
Count -= Processed;
if (State->Flags.Df)
{
- /* Reduce EDI by the number of bytes to transfer */
- if (AddressSize) State->GeneralRegs[FAST486_REG_EDI].Long -= Processed * DataSize;
- else State->GeneralRegs[FAST486_REG_EDI].LowWord -= Processed * DataSize;
+ /* Set EDI to the starting location */
+ if (AddressSize) State->GeneralRegs[FAST486_REG_EDI].Long -= (Processed - 1) * DataSize;
+ else State->GeneralRegs[FAST486_REG_EDI].LowWord -= (Processed - 1) * DataSize;
}
/* Write to memory */
if (AddressSize) State->GeneralRegs[FAST486_REG_EDI].Long += Processed * DataSize;
else State->GeneralRegs[FAST486_REG_EDI].LowWord += Processed * DataSize;
}
+ else
+ {
+ /* Reduce EDI */
+ if (AddressSize) State->GeneralRegs[FAST486_REG_EDI].Long -= DataSize;
+ else State->GeneralRegs[FAST486_REG_EDI].LowWord -= DataSize;
+ }
/* Reduce the total count by the number processed in this run */
Count -= Processed;