PREFACE: Hello, I usually would use programming Q&A website like Stack Overflow to ask a question like this, but I am reluctant to ask this question there. Nearly all my questions get down voted, and apparently they are off topic, even though I try my best to keep them on topic. So I hope this is a good place to ask this programming question. Also, I'm posting this here, not in the OS Development section. Even though this question is about my OS's boot loader, I do not feel that it is necessarily an OS Development question, but more so an x86 Assembly question in general.
Anyway, I'm still confused about segments, but I'm getting much better in that department, so sorry, also, if this is a noob question.
Now, I'm trying to write the boot loader so that it starts at the label 'START', and I want the CPU to far-jump to a another label, but also in the process, set the CS register to 7C00. So when it far-jumps, it sets the CS register and the IP register to the following: 07C0:(0000 + address of label) - where '07C0' is the CS register, and '0000' is the IP register that is set to the address of the label that was far-jumped towards. But I can't get it to work properly.
This is what I've tried so far:
Code:
START:
; Far-Jump to the boot sector's main boot code.
MOV AX, 1984
MOV DS, AX
MOV ES, AX
LEA BX, [CHKDSK]
JMP FAR [ES:BX]
and,
Code:
START:
; Far-Jump to the boot sector's main boot code.
MOV AX, 1984
MOV DS, AX
MOV ES, AX
MOV BX, [CHKDSK]
JMP [ES:BX]
and,
Code:
START:
; Far-Jump to the boot sector's main boot code.
MOV AX, 1984
MOV ES, AX
MOV BX, CHKDSK
JMP [ES:BX]
and,
Code:
START:
; Far-Jump to the boot sector's main boot code.
MOV AX, 1984
MOV ES, AX
LEA BX, [CHKDSK]
JMP FAR [ES:BX]
and,
Code:
START:
; Far-Jump to the boot sector's main boot code.
MOV AX, 1984
MOV DS, AX
MOV ES, AX
MOV BX, CHKDSK
JMP FAR [ES:BX]
Again, forgive me if this is an extremely noob question, and I appreciate any input.
Thanks.
Best Regards,
~ Joe