Here is my boot sector boot.s
Code: Select all
.section .boot
.start:
# Set up the serial port.
movb $0, %ah # Initialize opcode
movb $0b11100011, %al # Parameter data.
movw $0, %dx # COM1: port.
int $0x14
# Test the serial port.
mov $0x100, %cl
.loop:
movw $0, %dx # Select COM1:
# NEXT LINE IS THE PROBLEM!
movb %cl, %al # Character to transmit
movb $1, %ah # Transmit opcode
int $0x14
dec %cl
jnz .loop
# Infinite loop.
.idle:
jmp .idle
.end:
# Fill out rest of the boot sector.
.skip 512 - 2 - (.end - .start)
.word 0xaa55
Code: Select all
floppya: 1_44=boot.img, status=inserted
boot: floppy
display_library: sdl2
com1: enabled=1, mode=file, dev=logfile.log
magic_break: enabled=1
Code: Select all
build:
as boot.s -o boot.o
objcopy -O binary --set-section-flags .boot=alloc --only-section=.boot boot.o boot.img
install:
dd if=boot.img of=/dev/sdb
run: bochs
bochs:
bochs -f bochs.cfg
qemu:
qemu-system-x86_64 -hda boot.img -nographic -serial file:logfile.log
clean:
rm -f *.o boot.img *.log