Add mechanism for additional files on floppy
This commit is contained in:
parent
fc0dd47d48
commit
956df75dae
13
Makefile
13
Makefile
@ -2,6 +2,9 @@ FD_CYLINDERS = 40
|
|||||||
FD_HEADS = 2
|
FD_HEADS = 2
|
||||||
FD_SECTORS = 9
|
FD_SECTORS = 9
|
||||||
|
|
||||||
|
PROGRAMS = $(patsubst %.asm,%.com,$(wildcard programs/*.asm))
|
||||||
|
DISTFILES = kernel.com $(PROGRAMS)
|
||||||
|
|
||||||
QEMU_ARCH = $(shell uname -m)
|
QEMU_ARCH = $(shell uname -m)
|
||||||
QEMU = qemu-system-$(QEMU_ARCH)
|
QEMU = qemu-system-$(QEMU_ARCH)
|
||||||
|
|
||||||
@ -31,14 +34,16 @@ debug.rom: debug/*.asm lib/*.inc
|
|||||||
floppy.bs: boot/fatvbr.asm
|
floppy.bs: boot/fatvbr.asm
|
||||||
nasm -s -DCMDLINE='"KERNEL.COM"' -o $@ $<
|
nasm -s -DCMDLINE='"KERNEL.COM"' -o $@ $<
|
||||||
|
|
||||||
fdimage.img: floppy.bs kernel.com
|
programs/%.com: programs/%.asm
|
||||||
|
nasm -s -I lib -o $@ $<
|
||||||
|
|
||||||
|
fdimage.img: floppy.bs $(DISTFILES)
|
||||||
dd if=/dev/zero bs=512 count=$$(( $(FD_CYLINDERS) * $(FD_HEADS) * $(FD_SECTORS) )) of=$@
|
dd if=/dev/zero bs=512 count=$$(( $(FD_CYLINDERS) * $(FD_HEADS) * $(FD_SECTORS) )) of=$@
|
||||||
mformat -i $@ -t $(FD_CYLINDERS) -h $(FD_HEADS) -n $(FD_SECTORS) -B floppy.bs ::
|
mformat -i $@ -t $(FD_CYLINDERS) -h $(FD_HEADS) -n $(FD_SECTORS) -B floppy.bs ::
|
||||||
mcopy -i $@ kernel.com ::kernel.com
|
mcopy -i $@ $(DISTFILES) ::
|
||||||
mattrib -i $@ +s ::kernel.com
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.com *.bin *.rom *.img *.log *.bs *.lst
|
rm -f *.com *.bin *.rom *.img *.log *.bs *.lst programs/*.com
|
||||||
|
|
||||||
qemu-floppy: fdimage.img $(DEBUGROM)
|
qemu-floppy: fdimage.img $(DEBUGROM)
|
||||||
$(QEMU) $(QEMU_ARGS) -boot c -fda fdimage.img
|
$(QEMU) $(QEMU_ARGS) -boot c -fda fdimage.img
|
||||||
|
17
programs/hello.asm
Normal file
17
programs/hello.asm
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
org 0x0100
|
||||||
|
|
||||||
|
main:
|
||||||
|
mov si, hello
|
||||||
|
.loop:
|
||||||
|
lodsb
|
||||||
|
test al, al
|
||||||
|
jz .ret
|
||||||
|
mov dl, al
|
||||||
|
mov ah, 0x02
|
||||||
|
int 0x21
|
||||||
|
jmp .loop
|
||||||
|
.ret:
|
||||||
|
ret
|
||||||
|
|
||||||
|
hello:
|
||||||
|
db "Hello!", 0
|
Loading…
Reference in New Issue
Block a user