loading of an exe or com

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
suhmaamiar

loading of an exe or com

Post by suhmaamiar »

how is the loading of an exe or com file is done in,
lets say, dos ?

thanks
Mr_Spam

Re:loading of an exe or com

Post by Mr_Spam »

DOS loads the executable file from disk into memory, then performrms the execution of the app code via a jmp instruction.
suhmaamiar

Re:loading of an exe or com

Post by suhmaamiar »

this is exactly what i want to know, but how ?????
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:loading of an exe or com

Post 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();
Mr_Spam

Re:loading of an exe or com

Post 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.
ghostbustor

Re:loading of an exe or com

Post by ghostbustor »

Hi !

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

Re:loading of an exe or com

Post 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.
Post Reply