Memory Reference Using Labels
Posted: Wed Apr 02, 2008 11:26 pm
Hi
Well this post of mine is similar in context to a previous one but I think I wasnot able to explain my question there, so here it is:
How can I access a memory location from within my kernel which is not a part of kernel i.e. I mean after the BootSector is loaded into memory at 7c00h which inturn loads kernel at 7e00h (Still in RMode) and kernel needs to access BPB of BootSector?
If have following solutions:
1. Remember where the BPB of BootSector begins in memory and its size and then using those addresses as direct addresses in code....Not a good idea.
2. %include bootsector.asm file I am afraid there will be no distinctinction between Bootsector and Kernel and most importantly i believe i will get only 1 output file while I need 2 - bootsector and kernel.
3. %incbin bootsector.bin file Same problem as that of 2, worse I cannot address BPB using labels.
I hope all you there got what I mean....
I wish there is a way where you pseudo-include an asm file to access the variables defined there but donot embed those variables and code or increase the size of the file that includes....
A sort of c-style header file defining all symbolic constants..
Hope this is enough to make my idea clear
Well this post of mine is similar in context to a previous one but I think I wasnot able to explain my question there, so here it is:
How can I access a memory location from within my kernel which is not a part of kernel i.e. I mean after the BootSector is loaded into memory at 7c00h which inturn loads kernel at 7e00h (Still in RMode) and kernel needs to access BPB of BootSector?
If have following solutions:
1. Remember where the BPB of BootSector begins in memory and its size and then using those addresses as direct addresses in code....Not a good idea.
2. %include bootsector.asm file I am afraid there will be no distinctinction between Bootsector and Kernel and most importantly i believe i will get only 1 output file while I need 2 - bootsector and kernel.
3. %incbin bootsector.bin file Same problem as that of 2, worse I cannot address BPB using labels.
I hope all you there got what I mean....
I wish there is a way where you pseudo-include an asm file to access the variables defined there but donot embed those variables and code or increase the size of the file that includes....
A sort of c-style header file defining all symbolic constants..
Hope this is enough to make my idea clear