Created
September 30, 2018 10:16
-
-
Save rain-1/52a0be541364d0212a8b526396503c7a to your computer and use it in GitHub Desktop.
GNU assembly bootloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.code16 | |
.global _start | |
_start: | |
cli | |
xor %ax, %ax | |
mov %ax, %ds | |
mov $msg, %si | |
cld | |
loop: | |
lodsb | |
or %al, %al | |
jz hang | |
mov $0x0E, %ah | |
mov $0x00, %bh | |
int $0x10 | |
jmp loop | |
hang: | |
jmp hang | |
msg: | |
.string "BOOTLOADER" | |
.byte 0x0D, 0x0A, 0x00 | |
.org 510 | |
.byte 0x55 | |
.byte 0xAA |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -ex | |
rm -f boot.o boot.elf boot.bin | |
i686-elf-as -o boot.o boot.S | |
i686-elf-ld -Ttext 0x7C00 -o boot.elf boot.o | |
objcopy -O binary boot.elf boot.bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
we do cli, should we be enabling interrupts later using sti