Page 1 of 1

loading of an exe or com

Posted: Fri Mar 28, 2003 6:12 pm
by suhmaamiar
how is the loading of an exe or com file is done in,
lets say, dos ?

thanks

Re:loading of an exe or com

Posted: Fri Mar 28, 2003 10:13 pm
by Mr_Spam
DOS loads the executable file from disk into memory, then performrms the execution of the app code via a jmp instruction.

Re:loading of an exe or com

Posted: Sat Mar 29, 2003 2:02 pm
by suhmaamiar
this is exactly what i want to know, but how ?????

Re:loading of an exe or com

Posted: Sat Mar 29, 2003 4:47 pm
by Pype.Clicker
i would suggest you to read the "loader and linkers" online book (check the recommended reading sticky thread :)
But *very* basically,

Code: Select all

int (run*)(void);
void* com=alloc(file_size("program.com"));
file_map(com,"program.com");
run=com;
return run();

Re:loading of an exe or com

Posted: Sat Mar 29, 2003 4:51 pm
by Mr_Spam
well, DOS calls the BIOS to load sectors from the disk into memory, (bios int 13). then transfering processes execution with a jmp instruction to the location in memory where DOS told the bios to put the program. it dose't get any more simple than that.

Re:loading of an exe or com

Posted: Mon Apr 21, 2003 4:38 pm
by ghostbustor
Hi !

First u must Load the File into Memory and then Jump to its Start, the rest makes the File ;)

Re:loading of an exe or com

Posted: Tue Apr 22, 2003 2:48 pm
by slacker
i look at a file as a chunk of memory that isnt accessible until put into memory. it can be code or data.