Assembly 如何从软盘运行简单的操作系统?
我最近一直在尝试在汇编中制作操作系统,但是我遇到了一些问题。我可以在VirtualBox中运行我的操作系统,但它只是告诉我,一旦我尝试从软盘驱动器中运行,就要从软盘驱动器中删除介质。我在多台电脑上都试过,但他们都说相同的。我不知道还能尝试什么,我会把我的源代码放在下面,以防它对你有所帮助。 提前感谢,, 杰克·撒迦利亚·尼克松Assembly 如何从软盘运行简单的操作系统?,assembly,operating-system,boot,Assembly,Operating System,Boot,我最近一直在尝试在汇编中制作操作系统,但是我遇到了一些问题。我可以在VirtualBox中运行我的操作系统,但它只是告诉我,一旦我尝试从软盘驱动器中运行,就要从软盘驱动器中删除介质。我在多台电脑上都试过,但他们都说相同的。我不知道还能尝试什么,我会把我的源代码放在下面,以防它对你有所帮助。 提前感谢,, 杰克·撒迦利亚·尼克松 BITS 16 jmp short start ;jump to start of os, past disk description nop
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
再次感谢:)很难说到底是什么问题,但这里有两件事你可以试试
它起作用了!我发现问题在于我没有正确地将图像写入软盘!谢谢你的帮助。如果其他人也有同样的问题,我找到的最好的软件就叫做。它非常容易使用,而且速度非常快。 再次感谢,
杰克·撒迦利亚·尼克松。对不起!在发布答案后的一段时间内,我才能够做到这一点。然后我就忘了,哈哈:)谢谢你的提醒!
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