i am new to os development and i am trying to write everything from scratch(just a hobby project)
and i am currently writing the bootloader but i found no info on how to make a bootloader
that can boot to a kernel so as there are a few tutorials for nasm
i am trying to convert nasm code to Gnu Assembler
so i started with the disk description
but when i assembled the program i got these errors:
boot.s: Assembler messages:
boot.s:59: Error: junk at end of line, first unrecognized character is `o'
boot.s:65: Error: floating point number invalid
boot.s:65: Error: junk at end of line, first unrecognized character is `h'
boot.s:73: Error: junk at end of line, first unrecognized character is `h'
boot.s:74: Error: junk at end of line, first unrecognized character is `o'
boot.s:75: Error: junk at end of line, first unrecognized character is `A'
as i only understand very basic x86 assembly
i dont rely know what i did wrong
can anyone on these fourms see a problem?
sorry that the code is not formatted well don't know how to fix it i have tried manually fixing it but it still looks werid
original nasm code
Code: Select all
OEMLabel db "MIKEBOOT" ; 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
; (224 * 32 = 7168 = 14 sectors to read)
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 "MIKEOS "; Volume Label: any 11 chars
FileSystem db "FAT12 " ; File system type: don't change!
Code: Select all
###########################################################################
# Copyright Tom Lukeywood 2014 #
#This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
##########################################################################
.code16 #generate 16-bit code
.text
.globl _start;
_start:
#Prints Booting Notix OS
movb $'B' , %al
movb $0x0e, %ah
int $0x10
movb $'o' , %al
int $0x10
movb $'o' , %al
int $0x10
movb $'t' , %al
int $0x10
movb $'i' , %al
int $0x10
movb $'n' , %al
int $0x10
movb $'g' , %al
int $0x10
movb $' ' , %al
int $0x10
movb $'N' , %al
int $0x10
movb $'o' , %al
int $0x10
movb $'t' , %al
int $0x10
movb $'i' , %al
int $0x10
movb $'x' , %al
int $0x10
movb $' ' , %al
int $0x10
movb $'O' , %al
int $0x10
movb $'S' , %al
int $0x10
###############
###############
#start of code i am trying to convert from nasm
OEMLabel: .byte 'TEST_OS '
bytes_per_sector: .byte 512
sectors_per_cluster: .byte 1
reserved_for_boot: .word 1
number_of_fats: .word 2
root_dir_entries: .word 224
logical_sectors: .word 2880
medium_byte: .byte 0F0h
sectors_per_fat: .word 9
sectors_per_track: .word 18
sides: .word 2
hidden_sectors: .long 0
large_sectors: .long 0
drive_no: .word 0
signature: .byte 41
volume_id: .long 48h #the volume id can be any number 48 is my favrote number!
volume_label: .long 'VOLUME_LABL'
file_system: .long 'FAT12 '
#end of code i am trying to convert from nasm
###############
. = _start + 510 #mov to 510th byte from 0 pos
.byte 0x55 #append boot signature
.byte 0xaa #append boot signature
###############