From 38fd0cd943a7109c414746f22372afa2a7f922ab Mon Sep 17 00:00:00 2001 From: lukas Date: Wed, 23 Feb 2022 22:56:12 +0100 Subject: [PATCH] init --- Makefile | 6 ++++++ boot.s | 10 ++++++++++ 2 files changed, 16 insertions(+) create mode 100644 Makefile create mode 100644 boot.s diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..96ab501 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +all: + as -o boot.o boot.s + ld -o boot.bin --oformat binary -e init boot.o + +run: + qemu-system-x86_64 boot.bin \ No newline at end of file diff --git a/boot.s b/boot.s new file mode 100644 index 0000000..e23fead --- /dev/null +++ b/boot.s @@ -0,0 +1,10 @@ +.code16 # tell the assembler that we're using 16 bit mode +.global init # makes our label "init" available to the outside + +init: # this is the beginning of our binary later. + jmp init # jump to "init" + +.fill 510-(.-init), 1, 0 # add zeroes to make it 510 bytes long +# . is current position - start position +.word 0xaa55 # magic bytes that tell BIOS that this is bootable +# x86 is little endian - so bytes are swapped in memory!