diff --git a/Makefile b/Makefile index dfd3afe..3784aeb 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ CFLAGS = -std=c17 -ffreestanding -fno-builtin -fno-stack-protector -fno-pie \ SRC = ./src BUILD = ./build -C_FILES = calc +C_FILES = calc editor FONTS = testfont term16n .PHONY: os clean run @@ -30,6 +30,7 @@ filesystem: bootloader kernel $(C_FILES) $(FONTS) @dd if=$(BUILD)/testfont.bin of=kern.iso bs=512 seek=60 conv=notrunc status=none @dd if=$(SRC)/fs/test.txt of=kern.iso bs=512 seek=64 conv=notrunc status=none @dd if=$(BUILD)/calc.bin of=kern.iso bs=512 seek=65 conv=notrunc status=none + @dd if=$(BUILD)/editor.bin of=kern.iso bs=512 seek=71 conv=notrunc status=none $(BUILD): @[ -d $(BUILD) ] || mkdir $(BUILD) diff --git a/src/editor.c b/src/editor.c new file mode 100644 index 0000000..dff1d79 --- /dev/null +++ b/src/editor.c @@ -0,0 +1,13 @@ +#include + +__attribute__ ((section("entry"))) +int main(int argc, char** argv) { + if (argc < 2) { + printf("Usage: %s \n", argv[0]); + return 1; + } + + printf("%s\n", argv[1]); + + return 0; +} diff --git a/src/editor.ld b/src/editor.ld new file mode 100644 index 0000000..6ba852b --- /dev/null +++ b/src/editor.ld @@ -0,0 +1,16 @@ +SECTIONS { + .text 0x400000 : { + *(entry); + *(.text*); + } + .data : { + *(.data*); + } + .rodata : { + *(.rodata*); + } + .bss : { + *(.bss*); + } +} + diff --git a/src/filetable.asm b/src/filetable.asm index b693d88..e5d17d7 100644 --- a/src/filetable.asm +++ b/src/filetable.asm @@ -19,6 +19,7 @@ filetable: db "testfont",0,0, "fnt",0,60,4 db "test",0,0,0,0,0,0, "txt",0,64,1 db "calc",0,0,0,0,0,0, "bin",0,65,6 + db "editor",0,0,0,0, "bin",0,71,10 times 512-($-$$) db 0