This commit is contained in:
lukas 2022-02-23 22:56:12 +01:00
commit 38fd0cd943
2 changed files with 16 additions and 0 deletions

6
Makefile Normal file
View File

@ -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

10
boot.s Normal file
View File

@ -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!