Skip to content

Commit

Permalink
"Hello"を出力するサンプルを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuma Arakawa committed Feb 8, 2015
0 parents commit 9a38116
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*~
*.o
*.bin
*.dat
*.img
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
AS = as

.s.o:
$(AS) -o $*.o $<

all: fd.img

fd.img: hello.o signature.dat
objcopy -O binary hello.o hello.bin
dd if=/dev/zero of=zero.dat bs=1 count=$$((510 - $$(stat -c%s hello.bin)))
cat hello.bin zero.dat signature.dat > fd.img

hello.o: hello.s

signature.dat:
bash -c 'echo -en "\x55\xaa" > signature.dat'

clean:
rm -f *~ *.o *.bin *.dat *.img

run: fd.img
qemu -fda fd.img
22 changes: 22 additions & 0 deletions hello.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.code16

/* ビデオモード設定(画面クリア) */
movw $0x0000, %ax
int $0x10

/* 文字列出力 */
BOOTSEG = 0x07c0
movw $0x0000, %dx
movw $5, %cx
movw $0x0007, %bx
movw $BOOTSEG, %ax
movw %ax, %es
movw $msg, %bp
movw $0x1301, %ax
int $0x10

end:
jmp end

msg:
.ascii "Hello"

0 comments on commit 9a38116

Please sign in to comment.