Initial commit
This commit is contained in:
commit
298d1be60c
12
Makefile
Normal file
12
Makefile
Normal file
@ -0,0 +1,12 @@
|
||||
AS=x86_64-elf-as
|
||||
LD=x86_64-elf-ld
|
||||
|
||||
run: mbr.bin
|
||||
qemu-system-i386 -drive format=raw,file=$<
|
||||
|
||||
%.o: %.S
|
||||
$(AS) $^ -o $@
|
||||
|
||||
mbr.bin: mbr.o
|
||||
$(LD) -Ttext=0x7c00 --oformat=binary $^ -o $@
|
||||
|
||||
28
mbr.S
Normal file
28
mbr.S
Normal file
@ -0,0 +1,28 @@
|
||||
.code16
|
||||
.global _start
|
||||
_start: #точка входа
|
||||
mov $banner, %si
|
||||
call print_string
|
||||
|
||||
jmp . // loop forever
|
||||
|
||||
|
||||
print_string:
|
||||
mov $0x0e, %ah // "teletype output"
|
||||
repeat:
|
||||
lodsb // equivalent to mov (%si), %al; inc %si
|
||||
|
||||
test %al, %al
|
||||
je done
|
||||
|
||||
int $0x10 // bios interrupt
|
||||
jmp repeat
|
||||
done:
|
||||
ret
|
||||
|
||||
. = _start + 256 # pad to 256 bytes
|
||||
banner:
|
||||
.asciz "YABLOKO bootloader started\r\n"
|
||||
|
||||
. = _start + 510 # pad to 510 bytes
|
||||
.byte 0x55, 0xaa # boot sector magic value
|
||||
Loading…
x
Reference in New Issue
Block a user