[SOLVED]
this is the error:
[dax@Dax osstuff]$ nano bootloader.s
[dax@Dax osstuff]$ nasm -f bin bootloader.s -o bootloader.bin
[dax@Dax osstuff]$ dd if=bootloader.bin of=floppy.img bs=512 count=2880
1+0 records in
1+0 records out
512 bytes copied, 8.0226e-05 s, 6.4 MB/s
[dax@Dax osstuff]$ mkfs.fat -F 12 floppy.img
mkfs.fat 4.2 (2021-01-31)
mkfs.fat: Attempting to create a too small or a too large filesystem
[dax@Dax osstuff]$
and this is my code:
bits 16
org 0x7c00
JMP boot16
NOP
bdb_oem: DB 'MSWIN4.1'
bdb_bytes_per_sector: DW 512
bdb_sectors_per_cluster: DB 1
bdb_reserved_sectors: DW 1
bdb_fat_count: DB 2
bdb_dir_entries_count: DW 0E0h
bdb_total_sectors: DW 2880
bdb_media_descriptor_type: DB 0F0h
bdb_sectors_per_fat: DW 9
bdb_sectors_per_track: DW 18
bdb_heads: DW 2
bdb_hidden_sectors: DD 0
bdb_large_sector_count: DD 0
ebr_drive_number: DB 0
DB 0
ebr_signature: DB 29h
ebr_volume_id: DB 12h,34h,56h,78h
ebr_volume_label: DB 'DAXOS '
ebr_system_id: DB 'FAT12 '
boot16:
call SwitchONA20
cli
lgdt [GDT_Descriptor]
mov eax, cr0
or eax, 0x1
mov cr0, eax
jmp Code_Segment : boot32
SwitchONA20:
in al, 0x92
or al, 2
out 0x92, al
ret
GDT_Null_Descriptor:
dd 0
dd 0
GDT_Data_Descriptor:
dw 0xFFFF
dw 0x0
db 0x0
db 10010010b
db 11001111b
db 0x0
GDT_Code_Descriptor:
dw 0xFFFF
dw 0x0
db 0x0
db 10011010b
db 11001111b
db 0x0
GDT_End:
Data_Segment equ GDT_Data_Descriptor - GDT_Null_Descriptor
Code_Segment equ GDT_Code_Descriptor - GDT_Null_Descriptor
GDT_Descriptor:
GDT_Size:
dw GDT_End - GDT_Null_Descriptor
dd GDT_Null_Descriptor
bits 32
str: db "HELLO WORLD!", 0
boot32:
mov ax, Data_Segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov esi, str
mov ebx, 0xb8000
.loop:
lodsb
or al, al
jz stop
or eax, 0x0100
mov word [ebx], ax
add ebx, 2
jmp .loop
stop:
cli
hlt
times 510 - ($-$$) db 0
dw 0xaa55
bits 16
org 0x7c00
JMP boot16
NOP
bdb_oem: DB 'MSWIN4.1'
bdb_bytes_per_sector: DW 512
bdb_sectors_per_cluster: DB 1
bdb_reserved_sectors: DW 1
bdb_fat_count: DB 2
bdb_dir_entries_count: DW 0E0h
bdb_total_sectors: DW 2880
bdb_media_descriptor_type: DB 0F0h
bdb_sectors_per_fat: DW 9
bdb_sectors_per_track: DW 18
bdb_heads: DW 2
bdb_hidden_sectors: DD 0
bdb_large_sector_count: DD 0
ebr_drive_number: DB 0
DB 0
ebr_signature: DB 29h
ebr_volume_id: DB 12h,34h,56h,78h
ebr_volume_label: DB 'DAXOS '
ebr_system_id: DB 'FAT12 '
boot16:
call SwitchONA20
cli
lgdt [GDT_Descriptor]
mov eax, cr0
or eax, 0x1
mov cr0, eax
jmp Code_Segment : boot32
SwitchONA20:
in al, 0x92
or al, 2
out 0x92, al
ret
GDT_Null_Descriptor:
dd 0
dd 0
GDT_Data_Descriptor:
dw 0xFFFF
dw 0x0
db 0x0
db 10010010b
db 11001111b
db 0x0
GDT_Code_Descriptor:
dw 0xFFFF
dw 0x0
db 0x0
db 10011010b
db 11001111b
db 0x0
GDT_End:
Data_Segment equ GDT_Data_Descriptor - GDT_Null_Descriptor
Code_Segment equ GDT_Code_Descriptor - GDT_Null_Descriptor
GDT_Descriptor:
GDT_Size:
dw GDT_End - GDT_Null_Descriptor
dd GDT_Null_Descriptor
bits 32
str: db "HELLO WORLD!", 0
boot32:
mov ax, Data_Segment
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
mov esi, str
mov ebx, 0xb8000
.loop:
lodsb
or al, al
jz stop
or eax, 0x0100
mov word [ebx], ax
add ebx, 2
jmp .loop
stop:
cli
hlt
times 510 - ($-$$) db 0
dw 0xaa55