I've recently been trying to make an OS in Assembly, however I have been experiencing some problems. I can run my OS in VirtualBox however it just tells me to remove media from floppy drive once I try and run it from a floppy drive. I have tried it on multiple computers but they all say the same. I don't know what else to try, I will put my source code below in case it helps you. Thanks in advance, Jake Zachariah Nixon.
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
Thanks again :)
It's working! I found out that the problem was just that I hadn't written the image to the diskette properly! Thanks for your help though. If anyone else has the same problem the best software that I found was called rawwrite . It's really easy to use and really quick. Thanks again, Jake Zachariah Nixon.
It is hard to tell exactly what the problem is, but here are two things you can try.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.