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
Memory Reference Using Labels
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Memory Reference Using Labels
Why not - the bootsector is loaded at 0x7c00 so it is already at your disposal at a known address.Pitchu wrote: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.
You can very well put the kernel and bootloader in one image and put them directly at the start of the disk. you will know where the kernel starts and where the bootsector ends - at the second sector.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.
Same non-problem you mean. You can use one label and add equates for each item in the struct, which is another non-problem.3. %incbin bootsector.bin file Same problem as that of 2, worse I cannot address BPB using labels.
I expected a bit more from a seasoned programmer doing os developmentI hope all you there got what I mean....