/ / Bootloader - Nie ładuje poprawnie jmp lub drugiego sektora - assembler, x86, bootloader

Bootloader - nie działa poprawnie jmp ani nie ładuje drugiego sektora - assembly, x86, bootloader

Desperacko próbowałem stworzyć program ładujący.W pewnym momencie działało, ale teraz już nie działa. Kiedy go uruchamiam, wypisuje A i B. Oznacza to, że faktycznie odczytuje, ale z jakiegoś powodu, kiedy skacze, nie robi wykonaj kod, który umieściłem w drugim sektorze dysku USB.

Zastanawiam się, czy coś jest nie tak z moim adresowaniem lub skokami?

Dołączyłem obraz mojej pamięci USB

[bits 16]
[org 0x7C00]

jmp Start

;%include "BIOS_Parameter_Block.inc"
;%include "Extensions.inc"
;%include "Print.inc"

; Prepare Stack Segment
;-----------------------------------------------------------------
Start:
xor ax, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax

mov sp, 0x7C00              ; Move Stack into SP
mov bp, sp                  ; Store current Stack Base

; Print Character to Make Sure Bootloader Has Reached this Point
;-----------------------------------------------------------------
mov ah, 0x0E                ; Print Character to Screen
mov bh, 0x00                ; No Page Numbering
mov bl, 0x07                ; White Text, Black Background
mov al, 65                  ; Print Letter A
int 0x10

; Check if INT0x13 Extentions are Supported
;-----------------------------------------------------------------
mov ah, 0x41                ; Set Function 0x41
mov word bx, 0x55AA
push dx                     ; Save old Drive Identifier
mov dl, 0x80                ; Load "Active" ID Into dl
int 0x13                    ; Call Interupt
jc short unsupported        ; If Extentions aren"t Supported, Jump
clc                         ; Clear Carry Bit

; Read from the device.
;-----------------------------------------------------------------
mov si, DAPS                ; Load DAPS Struct to DS:SI
mov ah, 0x42                ; Read Functions (AL Ignored)
mov dl, 0x80                ; Load "Active" ID Into dl
int 0x13
jc short unsupported        ; If something goes wrong...

mov ah, 0x0E                ; Print Character to Screen
mov bh, 0x00                ; No Page Numbering
mov bl, 0x07                ; White Text, Black Background
mov al, 66                  ; Print Letter B
int 0x10

; IT DOES PRINT THIS ABOVE

jmp 0x0:0x7E00                  ; Jump to main

; Errors
;-----------------------------------------------------------------
unsupported:
mov ah, 0x0E                ; Print Letter F, Gives Indication of Failure
mov bh, 0x00
mov bl, 0x07
mov al, 70
int 0x10

clc
hlt
; Memory Data Structures and Other Variables
;-----------------------------------------------------------------
; Disk Address Packet Structure (Used For Loading Rest of OS)
DAPS: db 0x10               ; Size of Structure (16 bytes)
db 0                  ; Always 0
dw 1                  ; Number of Sectors to Read (1x512)
dw 0x7E00             ; Offset to load to.
dw 0x0000             ; Segment to load to.
dq 1                  ; Read from Second Block

; Fill Out Rest of Bootloader
;-----------------------------------------------------------------
times 510-($-$$) db 0

db 0x55, 0xAA               ; Add Boot Record Signature

Stage2 umieszczony na drugim sektorze

 [ORG 0x7E00]
[bits 16]

mov ah, 0x0E                ; Print Character to Screen
mov bh, 0x00                ; No Page Numbering
mov bl, 0x07                ; White Text, Black Background
mov al, 67                  ; Print Letter C
int 0x10
cli
hlt

Mam nadzieję, że możecie mi pomóc!

Pamięć Bootloadera

Odpowiedzi:

1 dla odpowiedzi № 1

int 0x13 wywołania bios zazwyczaj używają identyfikatora dysku wrejestr DL - 0x80 jest zwykle identyfikatorem pierwszego dysku twardego. Może zajść potrzeba zmiany tego, aby załadować dodatkowy sektor z dysku USB (który prawdopodobnie nie jest pierwszym dyskiem twardym).