Sto cercando di avviare il mio kernel di assemblyassembly bootloader / MBR. Sto leggendo il kernel dall'offset 0x7e00 per bilanciare 0x8000 (settore 1) in memoria; e salto offset 0x7e00. Perché non salta nel mio kernel?
; Boot.asm
[org 0x7c00]
[bits 16]
ReadDisk:
push ax
push bx
push cx
push dx
mov bx, 0x0000
mov es, bx
mov bx, 0x0000
mov ah, 0x02
mov al, 0x01
mov ch, 0x00
mov cl, 0x02
mov dh, 0x00
mov dl, 0x80
int 0x13
jc ReadDisk
jmp 0x7e00
times 510 - ($ - $$) db 0
dw 0xaa55
~~~~
; Kernel.asm
; Print dot on screen and hang
[org 0x7e00]
[bits 16]
mov ah, 0x0e ; BIOS teletype subfunction
mov al, "."
int 10h
jmp $ ; hang
times 512 - ($ - $$) db 0 ; Fill sector.
Ambiente: NASM, QEMU, Windows 7 a 64 bit.
risposte:
2 per risposta № 1Dal tuo ultimo commento non riesco a capire quale mov bx, 0x0000
hai sostituito per risolvere il problema. Ecco la soluzione:
mov bx, 0x0000
mov es, bx
mov bx, 0x7E00
Invece di rischiare un numero infinito di tentativi, dovresti interromperti quando il BIOS segnala un errore! Preferibilmente con un messaggio.
Fortunatamente stai facendo tutto questo in un ambiente simulato perché altrimenti giocheresti con il primo disco fisso (mov dl, 0x80
) non è mai una buona idea.