Page 1 of 1
segments and NASM help again
Posted: Wed Mar 19, 2003 1:18 pm
by _mark
OK - my boot sector get loaded 0x7C00.
Question 1:
CS:0x200 is the end of the running boot loader. Right? If not, what is it?
Question 2:
How do I access memory just after the boot loader. I have been trying to do the equivelent of the following pseudo code:
BX = CS:0x200 + [offset]
where offset is a 16 bit number I have defined, but I'm still trying to come up to speed on ASM and the syntax is getting me.
Can anyone help me out?
Thanks
_mark()
Re:segments and NASM help again
Posted: Wed Mar 19, 2003 1:52 pm
by _mark
never mind...I seem to have it working.
Re:segments and NASM help again
Posted: Thu Mar 20, 2003 9:26 am
by _mark
One last question if I may, then things should be working...
MOV BX, [koff]
MOV AX, [kseg]
; JMP AX:BX
JMP 0800:0000
HLT
How can I jump to the kernel at [kseg]:[koff]. I have
tried numerous things, but I cannot seem to land on the right way to do it?
Thanks
_mark()
Re:segments and NASM help again
Posted: Thu Mar 20, 2003 9:57 am
by Pype.Clicker
check the instruction set in the documentations coming with NASM.
What you probably want is something like
farptr:
dd k_offset
dw k_segment
jmp [farptr]
Re:segments and NASM help again
Posted: Fri Mar 21, 2003 6:57 am
by _mark
Great, that is the syntax I was looking for. Now just one question about your example. Why is it you have the offset 4 bytes and the segment second. I would have expect to see both 16 bit values with the segment first:
farptr:
DD kseg
DD koff
My code is a boot loader running in real-mode.
Thanks
_mark
Re:segments and NASM help again
Posted: Fri Mar 21, 2003 8:12 am
by _mark
by trial and error, it seems like the offset does come first. Anyone know the reason for that, it seems backwards to me.
BTW:
From the manual I found that:
JMP FAR WORD [kernel]
was not required, but made it more clear to me that it was 16 bit.
Mark