ASM = $(wildcard *.s) OBJ = $(ASM:.s=.o) BIN = $(basename $(ASM)) ATT = $(ASM:.s=.att) all: $(ATT) qemu clean: kill -rm -rfv $(ATT) $(BIN) $(OBJ) *~ curses: $(BIN) | kill PROMPT_COMMAND='echo -en "\e]0;Type Ctrl-A X to exit\a"' qemu-system-i386 -display curses -drive file=$<,format=raw -serial mon:stdio debug: qemu gdb -q $(BIN) \ -ex 'target remote 127.0.0.1:1234' \ -ex 'set architecture i8086' \ -ex 'layout asm' \ -ex 'layout regs' \ -ex 'b *0x7c00' \ -ex 'c' kill: -killall -q gdb qemu-system-i386 || true qemu: $(BIN) | kill qemu-system-i386 -drive file=$<,format=raw -s &> /dev/null & $(BIN): $(OBJ) ld --oformat binary -Ttext 0x7c00 $< -o $@ %.att: % objdump -b binary -D -m i8086 $< > $@ %.o: %.s as $< -o $@ .PHONY: all clean curses debug kill qemu