My makefile to generate the floppy image is:
Code: Select all
# boot loader makefile
#
# - assembles boot.asm
# - creates bootable floppy image
ASSEMBLER=fasm
BOOTLDR=boot
LOADER=pmdosldr
LOADEROUT=PMDOSLDR.SYS
FLOPPYIMAGE=floppy.img
all:
if test -e $(FLOPPYIMAGE); then rm $(FLOPPYIMAGE); fi
$(ASSEMBLER) $(BOOTLDR).s
$(ASSEMBLER) $(LOADER).s $(LOADEROUT)
dd status=noxfer conv=notrunc if=boot.bin of=$(FLOPPYIMAGE) bs=512 count=2880
I tried to copy the file to the image using:
Code: Select all
sudo mount /mnt/flp floppy.img -t vfat -o loop
Code: Select all
cp PMDOSLDR.SYS /mnt/flp
Do I need to make a proper FAT12 floppy first with mkisofs?
This is my bootloader code:
Code: Select all
;; ITCHIES/OS
;;
;; Sector 1 boot loader
;;
;; Loads PMDOSLDR from FAT12
;; ====================================================================
format binary
use16
org 0x7c00
jmp short start ; jump to boot code
nop
;; -- BIOS PARAMETER BLOCK (BPB) --------------------------------------
BS_OEMName db 'MSWIN4.1'
BPB_BytesPerSec dw 512
BPB_SecPerClus db 1
BPB_RsvdSecCnt dw 1
BPB_NumFATs db 2
BPB_RootEntCnt dw 224
BPB_TotSec16 dw 2880
BPB_Media db 0xf0 ;1.4M floppy
BPB_FATSz16 dw 9
BPB_SecPerTrk dw 18
BPB_NumHeads dw 2
BPB_HiddSec dd 0
BPB_TotSec32 dd 0
BS_DrvNum dw 0
BS_BootSig db 0x29
BS_VolID dd 0xDEAD0001
BS_VolLab db 'ITCHIESBOOT'
BS_FilSysType db 'FAT12 '
LDADDR_OFFSET equ 0x0000 ;will load from 1000:0000
LDADDR_SEGMENT equ 0x1000
;; -- boot code -------------------------------------------------------
start:
cli
xor ax, ax
mov ss, ax
mov sp, 0xf000
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
sti
mov ax, 3
int 0x10 ; clear screen
lea si, byte[BOOTMSG]
call dispstr
lea si, byte[LOADMSG]
call dispstr
call resetfloppy
call readsector
jmp LDADDR_SEGMENT:LDADDR_OFFSET
include 'fdio.s'
include 'print.s'
include 'fatfs.s'
;; -- message strings and constants -----------------------------------
FAT_ENTRY_SIZE dw 32
BOOTMSG db '**** PM/DOS BOOT V0.1 ****',13,10,13,10,0
LOADMSG db 13,10,'Loading boot...',13,10,0
LOADERFILE db 'PMDOSLDRSYS'
;; -- boot signature --------------------------------------------------
db 510-($-$$) dup 0
dw 0xaa55