簡體   English   中英

如何從軟盤運行簡單的操作系統?

[英]How do I run a simple OS from a floppy disk?

我最近一直試圖在組裝中制作一個OS,但是我遇到了一些問題。 我可以在VirtualBox中運行我的OS,但是一旦我嘗試從軟盤驅動器中運行它,它只會告訴我從軟盤驅動器中刪除媒體。 我已經在多台計算機上嘗試過,但是他們都說相同。 我不知道還能嘗試什么,如果有幫助,我會將我的源代碼放在下面。 在此先感謝傑克·扎卡里亞·尼克松。

BITS 16

jmp short start             ;jump to start of os, past disk description
nop                         ;pad out before description

OEMLabel        db "FIRSTBOOT"  ; Disk label
BytesPerSector      dw 512      ; Bytes per sector
SectorsPerCluster   db 1        ; Sectors per cluster
ReservedForBoot     dw 1        ; Reserved sectors for boot record
NumberOfFats        db 2        ; Number of copies of the FAT
RootDirEntries      dw 224      ; Number of entries in root dir
LogicalSectors      dw 2880     ; Number of logical sectors
MediumByte      db 0F0h         ; Medium descriptor byte
SectorsPerFat       dw 9        ; Sectors per FAT
SectorsPerTrack     dw 18       ; Sectors per track (36/cylinder)
Sides           dw 2            ; Number of sides/heads
HiddenSectors       dd 0        ; Number of hidden sectors
LargeSectors        dd 0        ; Number of LBA sectors
DriveNo         dw 0            ; Drive No: 0
Signature       db 41           ; Drive signature: 41 for floppy
VolumeID        dd 00000000h    ; Volume ID: any number
VolumeLabel     db "FIRSTOS    "; Volume Label: any 11 chars
FileSystem      db "FAT12   "   ; File system type: don't change!

start:
    mov ax, 07C0h               ;4k stack space after bootloader
    add ax, 288                 ;4096 + 512 devided by 16 bytes per        paragraph
    mov ss, ax
    mov sp, 4096

    mov ax, 07C0h               ;set data segment to where we are loaded
    mov ds, ax

    mov si, text_string         ;put string position in SI
    call print_string           ;calls print string routine

    jmp $                       ;Jumps here to make infinate loop


    text_string db 'This is my awesome OS called FirstOS! I am currently building it from the ground up!', 0

print_string:                   ;routine to outpu string in SI to screen
    mov ah, 0Eh                 ;int 10h 'print char' function

.repeat:
    lodsb                       ;get char from string
    cmp al, 0                   
    je .done                    ;if char = 0 then jump to .done
    int 10h                     ;else print char
    jmp .repeat                 ;then repeat process

.done:
    ret                         ;return to other code


    times 510-($-$$) db 0       ;pad remainder of boot sector with 0s
    dw 0AA55h                   ;The standard pc boot signature

再次感謝 :)

工作正常! 我發現問題僅在於我沒有將映像正確寫入軟盤! 謝謝您的幫助。 如果其他人遇到同樣的問題,我發現的最好的軟件稱為rawwrite 它非常易於使用且非常快捷。 再次感謝傑克·扎卡里亞·尼克松。

很難確切說明問題所在,但是您可以嘗試以下兩種方法。

  1. 您使用的計算機是否設置為嘗試從軟盤驅動器啟動? 在BIOS設置中進行驗證(在啟動過程的早期,通過按特殊鍵輸入)。
  2. 磁盤可以啟動嗎? 這是OSDev教程,其中包含有關創建可啟動軟盤的OS的說明。 它在最底部給出了有關如何創建軟盤的說明: http : //wiki.osdev.org/Babystep1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM