Boot Loader Setup
Posted: Tue Sep 06, 2011 10:59 am
I am writing a two stage bootloader and the two modules are linking correctly, and when I jump to the second stage, the first stops executing (tested); so the jump is working, however, stage_two (which I jump to) never executes. I think it might have something to do with segment register setup; I haven't done anything with the segment registers yet, but when I try to initialize them with something like:
Then code stops executing at that point; so I assume that's wrong..
Here's the source's that pertain:
stage_one.asm:
stage_two
Help very much appreciated,
Brodeur235
Code: Select all
mov ax,0x00
mov cs,ax
mov ds,ax
mov es,ax
mov fs,ax
Here's the source's that pertain:
stage_one.asm:
Code: Select all
extern _stage_two
[BITS 16]
global _start
_start:
; disable interrupts
cli
; clear screen
mov ah,0x07
mov bh,0x07
mov al,0x00
mov ch,0x00
mov cl,0x00
mov dh,0x19
mov dl,0x50
int 0x10
; reposition cursor
mov ah,0x02
mov bh,0x00
mov dh,0x00
mov dl,0x00
int 0x10
jmp _stage_two
; Padding and boot flags
times 510-($-$$) db 0x00
db 0x55, 0xAA
Code: Select all
[BITS 16]
global _stage_two
_stage_two:
; Code here will not execute.
; LOOP
jmp $
Brodeur235