int 13h 42h não carrega nada em Bochs
Mudei meu gerenciador de inicialização de CHS para LBA, então substituíint 13h 02h
comint 13h 42h
. Funciona corretamente no QEMU, no entanto, tenho problemas ao executá-lo com o Bochs e meu laptop.
Eu escrevi o bootloader para a unidade flash USB comdd if=main.bin of=/dev/sdb bs=512
. O laptop carrega o Intel UNDI e me fornece o seguinte erro:No bootable device - insert boot disk and press any key
.
Então, tentei depurá-lo com o Bochs e notei que o Bochs reconhece esse arquivo binário como inicializável. No entanto, nada foi carregado depoisint 13h
executado.
Então eu tentei carregar o meu PC antigo a partir desta unidade flash, e ele funciona! Carrega o programa e o executa corretamente. QEMU me dá o mesmo resultado.
Aqui está o código do carregador de inicialização:
org 0x7c00
bits 16
boot:
cli
; Overlap CS and DS
mov ax, cs
mov ds, ax
mov es, ax
; Setup 4K stack before this bootloader
mov ax, 0x07c0
mov ss, ax
mov sp, 4096
; Load next sectors
mov si, DAP
mov ah, 42h
; DL didn't changed
int 13h
; Start
jmp bootend
; Disk address packet
DAP:
db 10h, 0
dw %1 ; Number of sectors to be loaded
dd bootend
dq 1
; Fill the rest of bootsector with zeroes and end it
times 510 - ($ - boot) db 0
dw 0xAA55
bootend:
bochsrc:
megs: 32
romimage: file=/usr/share/bochs/BIOS-bochs-latest, address=0xfffe0000
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest
floppya: 1_44=main.bin, status=inserted
boot: a
panic: action=ask
log: bochsout.txt
mouse: enabled=0
keyboard: type=mf, serial_delay=200, paste_delay=100000
display_library: x, options="gui_debug"