MASM string instructions - segment register override on preceding LEA in real mode?

Solution 1:

That code looks wrong. Without a segment override prefix, movsb will use DS:SI and ES:DI always. Unless you have to worry about errata of ancient processors you can make this code work by giving a segment override prefix to movsb. es:MOVSB will tell it to use ES:SI rather than DS:SI. movsb always copies to ES:DI; no segment override prefix will change it.

The code could actually be right if DS is guaranteed to equal ES at this location. The old assemblers had their own ides of things and sometimes funny segment overrides had to be used to keep the assembler happy.