Created
January 8, 2019 13:33
-
-
Save qnnnnez/6bafdf883fa3f19c7ecbea8ffa406f20 to your computer and use it in GitHub Desktop.
compile and run .COM executable in dosbox
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
OUTPUT_FORMAT("binary") | |
OUTPUT_ARCH("i386") | |
ENTRY(_start) | |
_start = 0x100; | |
SECTIONS | |
{ | |
. = 0x100; | |
.text : { *(.text) } | |
.data : { *(.data) } | |
} |
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
.data | |
hello_str: .ascii "hello from binutils$" | |
.text | |
.code16 | |
_start: .global _start | |
main: | |
mov $hello_str, %dx | |
movb $0x9, %ah | |
int $0x21 | |
exit: | |
movb $0x4c, %ah | |
int $0x21 | |
.end |
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
AS := as | |
LD := ld | |
DOSBOX := dosbox | |
%.o: %.S | |
$(AS) --32 -o $@ $< | |
output.com: hello.o | |
$(LD) -T dos.ld -o $@ $< | |
all: output.com | |
clean: | |
rm *.o *.com | |
dosbox: output.com | |
$(DOSBOX) -C "mount c: ." -C "c:" -C $< |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment