real mode, segments, and NASM?
Posted: Fri Mar 14, 2003 8:14 am
How many dumb questions are we allowed. Here is my first.
I've been playing around with some bootloader code I have downloaded, and there is something I just can't seem to figure out. I'm sure it is a segment thing and have read all I can find on segmented memory, but I still don't get it.
How come the following code works
JMP 0800:0000
where this does not:
JMP 0800
This is called after the kernel is loaded by means of
MOV AH, 02h ; read sector from floppy
MOV AL, 1 ; one sector
MOV CH, 0 ;
MOV CL, 2 ; sector 2
MOV DH, 0 ; head
MOV DL,0 ; floppy
MOV BX,0800h
MOV ES, BX
MOV BX, 0
INT 13h
Earlier in the boot code, DS is set equal to CS. Also notice the MOV BX,0800.
Can someone tell me exactly what is going on with the JMP. Appearently MOV BX,0800 and then later JMP 0800:0000 are the same address (becuase it works), but I do not get it.
So what physical address are we talking about here also. The boot code (as always) starts at 7C00. What is CS in this case (becuase DS get set to the same thing)?
Basically what I am after is to understand how to address all 640K within real-mode. And how we manipulate DS to help us do that?
Mark
I've been playing around with some bootloader code I have downloaded, and there is something I just can't seem to figure out. I'm sure it is a segment thing and have read all I can find on segmented memory, but I still don't get it.
How come the following code works
JMP 0800:0000
where this does not:
JMP 0800
This is called after the kernel is loaded by means of
MOV AH, 02h ; read sector from floppy
MOV AL, 1 ; one sector
MOV CH, 0 ;
MOV CL, 2 ; sector 2
MOV DH, 0 ; head
MOV DL,0 ; floppy
MOV BX,0800h
MOV ES, BX
MOV BX, 0
INT 13h
Earlier in the boot code, DS is set equal to CS. Also notice the MOV BX,0800.
Can someone tell me exactly what is going on with the JMP. Appearently MOV BX,0800 and then later JMP 0800:0000 are the same address (becuase it works), but I do not get it.
So what physical address are we talking about here also. The boot code (as always) starts at 7C00. What is CS in this case (becuase DS get set to the same thing)?
Basically what I am after is to understand how to address all 640K within real-mode. And how we manipulate DS to help us do that?
Mark