diff --git a/Worksheet2/source/loader.asm b/Worksheet2/source/loader.asm new file mode 100644 index 0000000000000000000000000000000000000000..af3f29974f03cc5852c2586a311d46cb10db2f21 --- /dev/null +++ b/Worksheet2/source/loader.asm @@ -0,0 +1,16 @@ +global loader ; Entry point label for ELF + +MAGIC_NUMBER equ 0x1BADB002 ; Define the magic number constant +FLAGS equ 0x0 ; Multiboot flags +CHECKSUM equ -MAGIC_NUMBER ; Calculate the checksum + +section .text ; Start of the text (code) section +align 4 ; Code must be aligned to 4 bytes +dd MAGIC_NUMBER ; Write the magic number into machine code +dd FLAGS ; Write the flags +dd CHECKSUM ; Write the checksum + +loader: ; Loader label (defined as the entry point in the linker script) + mov eax, 0xCAFEBABE ; Set the value 0xCAFEBABE into the EAX register +.loop: + jmp .loop ; Infinite loop