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.
Hi,
I have problems with loading com files in my os.
The problem is:
my os normally execute com file wich file size is les than 100 bytes but when i
try to load com file wich file size is 2KB then system block...
This is a code:
As far as i remember, com programs are loaded from the offset 0x100 in the segment. So, you mustn't sub 0x10 from segment regs.
E.g.: program is loaded from disk to 0x5000:0x0100 and when you jump to it, it must see CS=0x5000, IP=0x0100, but it seems to me that you load file to 0x5000:0x0000 and program has CS=DS=ES=0x4F00 and IP=0x0000 and it's wrong.
There's nothing in that code in particular that seems to cause that failure. There are several other issues though:
- You didn't write the code or you don't sufficiently know what it does. There are too many dummy moves and indentation errors around AX and ES.
- The typical (expected) status flag if used is CF (which gets set on error), you're checking ZF instead.
- You haven't posted the code for actually loading the file.
@nable: image at 0x5000, which gets bootstrapped with a far return to 4ff0:0100 (i.e. jumps to the first byte of the image while making sure the org directive matches)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]