ld -oformat binary -Ttext 0 -o test.bin test.o
the command could not work.
but in linux it work good, maybe mingw build a elf cross toolchain should be ok, so i try to compile i386-elf binutils under mingw.
i use binutil-2.10.1 and configure like:
Code: Select all
./configure --target=i386-elf
make
make install
Code: Select all
.code16
.text
.global _start
_start:
movw %cs, %ax
movw %ax, %es
movw %ax, %ds
movw %ax, %ss
call printstr
jmp _exit
loop1: jmp loop1
printstr:
mov $0x9, %ah
mov $test01mesg, %dx
int $0x21
_exit:
movw $0x4c00, %ax
int $0x21
test01mesg: .byte 13, 10
.ascii "test$"
Code: Select all
i386-elf-as -o test.o test.s
i386-elf-ld --oformat binary -Ttext 0x100 -o test.com test.o
put the test.com into dos, run test.com it can print the test on screen.