i just re-started osdevving after a long break (the last tarball of my OS is dated October 2011... ugh) by writing a bootloader.
My OS made use of GRUB to boot and supported both the Multiboot and Multiboot2 protocols; i had the feel of being too far from the machine and learn too little despite the huge time effort so i've ended up losing interest in the project.
Now, the problem is that on some hardaware/emulators i simply can't load the stage2 correctly.
This is the stage2 test code:
Code: Select all
[bits 16]
dw 0xFEDE ; signature; must remain first
; used the stack just in order to test it ;-)
push 'K'
push 'O'
pop ax
mov ah, 0x0E
int 0x10
pop ax
mov ah, 0x0E
int 0x10
Hang:
cli
hlt
jmp Hang
- JPC - emulator (from floppy)
- JPC - emulator (from disk)
- HP blue (from floppy)
- HP blue (from disk)
- HP black (from disk)
- Abaco (from disk)
- Fujitsu FMV-475NU/S (from floppy)
- DELL Inspiron N411Z (from disk)
- qemu - emulator (floppy): "Wrong signature detected, hang." (explained later)
- qemu - emulator (disk): black screen, just hangs somewhere
- Toshiba NB100 (disk): skip to hard disk and boot the installed system
The stage1's loading code looks like this (sorry for the length):
Code: Select all
;------------------------------------------------------------------------------
; reset drive and load sectors
;------------------------------------------------------------------------------
mov cx, 0x0003
DriveReset:
mov ah, 0x00
mov dl, [drive_id]
int 0x13
jnc DriveResetDone
loop DriveReset
jc LoadFailure
DriveResetDone:
;------------------------------------------------------------------------------
mov cx, 0x0003
DriveRead:
mov ax, LOAD_SEGMENT
mov es, ax ; set segment
mov bx, 0x0 ; set offset
mov ah, 0x02 ; load disk data to ES:BX
mov al, 17 ; number of sectors to load
mov ch, 0x00 ; cylinder
mov cl, 0x02 ; sector
mov dh, 0x00 ; head
mov dl, [drive_id]
int 0x13
jnc DriveReadDone
loop DriveRead
jc LoadFailure
DriveReadDone:
;------------------------------------------------------------------------------
; check signature
;------------------------------------------------------------------------------
mov ax, LOAD_SEGMENT
mov es, ax ; set segment
mov si, 0x0 ; set offset
mov ax, [es:si]
cmp ax, LOAD_SIGNATURE
jne WrongSignature
jmp LOAD_SEGMENT:2 ; jump to loaded code skipping the signature
If you think it's necessary, i can post the whole stage1 code.
Thanks