OK - just a little more help if someone would. I'm still having a little trouble with real mode. I guess I need to know what the real limits of real-mode are. I though I could load and run a program (in my case - the kernel) of up to 640K.
I seem to be running into some unexpected limits. These are just some rough numbers.
1.) I can run a kernel of about 2K when there is significant static data in it...IE char foo[1024*10].
2.) If I just add code and very little static data I can seem to run fine up to about 6K
Possible causes:
1.) I do not understand the load & run process. I'm loading my kernel at 0x000:0x500 and jumping to it from the bootcode. this is just a flat binary file created by JLOC. I have not told either the compiler or linker what sections I want or anything like that. Is it possible I need to patch up things at load time. See attached MAP file.
2) I do not have my DS, SS and maybe other registers setup correct. See ASM code below.
3.) I need to tell the linker more about where to locate things. See jloc, and asm code below.
2 cold stars for anyone that can help...
_mark()
MAP file gerated by JLOC
Code: Select all
Base Start Lnth Segment Group Class Module
0 500 8E __NASMDEFSEG (null) test.asm test.obj
0 58E 155C MAIN_TEXT (null) CODE main.c main.obj
0 1AF0 2 MAIN5_DATA (null) FAR_DATA main.c main.obj
0 1B00 10E MAIN6_DATA (null) FAR_DATA main.c main.obj
0 1C10 149 MAIN7_DATA (null) FAR_DATA main.c main.obj
0 1D5A 128 _DATA DGROUP DATA main.c main.obj
main NASM file.
Code: Select all
[BITS 16]
CLI
PUSH CS
POP DS
PUSH CS
POP SS
MOV SP, 0xFFFF ;stack pointer
XOR AX, AX
JMP start
[EXTERN _main]
start:
CALL FAR _main
JMP $
JLOC file
Code: Select all
ALL:
test.obj
main.obj
rmos: 0 500 0
*