
Re: How do i get my kernel to load binary programs?
DudeOfX wrote:
ok, firrst.... I don't think you can just treat the pointer 'memory' as a function and call it because you have to prep the registers first. COM programs assume that all segment registers equal each other (DS = ES = SS = CS) which is defined by the segment portion of pointer 'memory'
yes you can
Quote:
SP = 0FFFEh if you are using a stack
and if you are using a stack you would need to allocate 65278 bytes not just the file size, but this is not fatal, the stack can be less...
huh?
Quote:
make sure the offset portion of the pointer 'memory' must equal 0100h because thats what .COM programs expect.
how can you change that? its getting its address from malloc
Quote:
the fopen makes me a little nervous because of the "r" instead of "rb" I just had a bug once where it read the file as text.
i created the fopen myself and it is always binary
Quote:
if you are issuing a CALL instruction instead of a JMP it means your program and the kernel will share the stack. If you go this route don't change the SS and SP registers, just let them be.
typecasting makes the compiler issue a call instruction
Quote:
the consequence of not updating the DS register and maybe the ES register is that the program would be accessing the kernel's data segments thinking its his own.
and what is it suppose to point to?
sorry i am terriable with segments and data alignment