In short - what is the meaning of the piece of code below, commonly present at start of many circa-1992 DOS programs?
The story is - i'm making a 80186&DOS emulator (for fun), and trying to run some period correct exe programs in it. Most, if not all, of them start with the piece of code provided below, that does something i can't understand.
None of the programs in asm i seen have this, and i don't have a compiler old enough to get an original disassembly. IDA says something about possibly packed file, and fails to do anything beyond the retf.
I checked every command involved, and i think i loaded the exe properly, but not sure about the latter due to a noticeable lack of googleable information about it.
Basically, the file is loaded at 1000:0, the registers are set, relocations applied, and emulation started.
What is it, and what could be wrong?
It looks as if the program expects to find something in the middle of nowhere, where i suppose it's my job to put it?
AX:0000h BX:0000h CX:8000h DX:0000h
SP:0080h BP:0000h SI:0000h DI:4000h
CS:490Bh DS:1000h ES:1000h SS:4D11h
IP:0010h FLAGS:0206h
490B:0010:SP=0080 [8Bh]:mov bp,ax
490B:0012:SP=0080 [8Ch]:mov ax,es
490B:0014:SP=0080 [05h]:add ax,0010h
490B:0017:SP=0080 [0Eh]:push cs
490B:0018:SP=007E [1Fh]:pop ds
490B:0019:SP=0080 [A3h]:mov [490B4h],ax ;0
490B:001C:SP=0080 [03h]:add ax,[490BCh] ;3AF8h
490B:0020:SP=0080 [8Eh]:mov es,ax
490B:0022:SP=0080 [8Bh]:mov cx,[490B6h] ;1F82h
490B:0026:SP=0080 [8Bh]:mov di,cx
490B:0028:SP=0080 [4Fh]:dec di
490B:0029:SP=0080 [8Bh]:mov si,di
490B:002B:SP=0080 [FDh]:std
490B:002D:SP=0080 [A4h]:movsb
490B:002E:SP=0080 [50h]:push ax
490B:002F:SP=007E [B8h]:mov ax,0034h
490B:0032:SP=007E [50h]:push ax
490B:0033:SP=007C [CBh]:ret far
AX:0034h BX:0000h CX:0000h DX:0000h
SP:0080h BP:0000h SI:3F03h DI:3F03h
CS:4B08h DS:490Bh ES:4B08h SS:4D11h
IP:0034h FLAGS:0606h
4B08:0034:SP=0080 [00h]:add [bx+si],al
4B08:0036:SP=0080 [00h]:add [bx+si],al
4B08:0038:SP=0080 [00h]:add [bx+si],al
4B08:003A:SP=0080 [00h]:add [bx+si],al
...etc...