質問

これは、私がどのASMをしたので、しばらくして、再びQEMUでテストし、小さなブートローダーを試してみて、書くことにしたています。私の問題は、読み込みが失敗しているので、キャリーフラグがセットされているいくつかの理由で、interupt 13です。

:現在、私のディスクイメージは次のようになります

の512バイトブートローダの< - これは(私は承知しているこれまでと同じ)は、LBA

でブロック0です

の主な機能の< - これはブロック1になります。

基本的には、メモリにBIOSのロードバイト512で、私は同じドライブから次の512のバイトをロードします。しかし私は間違って何が起こっているのかを把握することはできません。希望私は十分な情報を与えてくれた。

ここでのコードは、問題はちょうど0x7E00にジャンプする前に、第二0x13に割り込みであります:

[bits 16]
[org 0x7C00]

; Prepare Stack Segment
;-----------------------------------------------------------------
    mov sp, 0x7A00              ; 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
    xor ax, ax
    add ax, 1                   ; Clear Carry Bit

    mov si, DAPS                ; Load DAPS Struct to DS:SI
    mov ah, 0x42                ; Read Functions (AL Ignored)
    mov dl, 0x80                ; Active Boot Drive (Commented Out Due to Line 24)
    int 0x13
    jc short unsupported        ; If something goes wrong...
    jmp 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

    success:
    pop dx                      ; Pop Original Drive Identifier
    jmp $

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

; 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
          db 1                  ; Number of Sectors to Read (1x512)
          db 0                  ; Always 0 
          dw 0x7E00             ; Target Location for Reading To
          dw 0                  ; Page Table (0, Disabled)
          dd 1                  ; Read from Second Block
          dd 0                  ; Large LBAs, ignore

    db 0x55, 0xAA               ; Add Boot Record Signature

main:
    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

    jmp $
役に立ちましたか?

解決

問題は、コードが正しかった、シンプルなことになりました。最終画像は、525バイトの代わりに、512バイトの倍数であったので、しかし、リードが壊れ。ただ、読み取りがすべて512のバイトを得ることができるので、画像サイズ1024Bを作るために0でパッドに自分のイメージを持っています。

(もちろん、おそらくはるかに良いアイデアは、このような小さな未フォーマットのディスクを持っていないために、しかし、学習の目的のために、これは私が本当に必要なすべてのです)。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top