Skip to content

Commit 9a38116

Browse files
author
Yuma Arakawa
committed
"Hello"を出力するサンプルを追加
0 parents  commit 9a38116

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*~
2+
*.o
3+
*.bin
4+
*.dat
5+
*.img

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
AS = as
2+
3+
.s.o:
4+
$(AS) -o $*.o $<
5+
6+
all: fd.img
7+
8+
fd.img: hello.o signature.dat
9+
objcopy -O binary hello.o hello.bin
10+
dd if=/dev/zero of=zero.dat bs=1 count=$$((510 - $$(stat -c%s hello.bin)))
11+
cat hello.bin zero.dat signature.dat > fd.img
12+
13+
hello.o: hello.s
14+
15+
signature.dat:
16+
bash -c 'echo -en "\x55\xaa" > signature.dat'
17+
18+
clean:
19+
rm -f *~ *.o *.bin *.dat *.img
20+
21+
run: fd.img
22+
qemu -fda fd.img

hello.s

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.code16
2+
3+
/* ビデオモード設定(画面クリア) */
4+
movw $0x0000, %ax
5+
int $0x10
6+
7+
/* 文字列出力 */
8+
BOOTSEG = 0x07c0
9+
movw $0x0000, %dx
10+
movw $5, %cx
11+
movw $0x0007, %bx
12+
movw $BOOTSEG, %ax
13+
movw %ax, %es
14+
movw $msg, %bp
15+
movw $0x1301, %ax
16+
int $0x10
17+
18+
end:
19+
jmp end
20+
21+
msg:
22+
.ascii "Hello"

0 commit comments

Comments
 (0)