Skip to content

Commit 62970b4

Browse files
committed
add 23_draw_line
1 parent 46e7baa commit 62970b4

File tree

13 files changed

+3044
-27
lines changed

13 files changed

+3044
-27
lines changed

src/23_draw_line/boot.bin

8 KB
Binary file not shown.

src/23_draw_line/boot.img

16 KB
Binary file not shown.

src/23_draw_line/boot.lst

Lines changed: 1410 additions & 0 deletions
Large diffs are not rendered by default.

src/23_draw_line/boot.s

Lines changed: 475 additions & 0 deletions
Large diffs are not rendered by default.

src/23_draw_line/kernel.bin

8 KB
Binary file not shown.

src/23_draw_line/kernel.lst

Lines changed: 905 additions & 0 deletions
Large diffs are not rendered by default.

src/23_draw_line/kernel.s

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
;***********************************************************
2+
; マクロ
3+
;***********************************************************
4+
%include "../include/define.s"
5+
%include "../include/macro.s"
6+
7+
ORG KERNEL_LOAD
8+
9+
[BITS 32]
10+
;***********************************************************
11+
; エントリポイント
12+
;***********************************************************
13+
kernel:
14+
;------------------------------------------
15+
; フォントアドレスを取得
16+
;------------------------------------------
17+
mov esi, BOOT_LOAD + SECT_SIZE
18+
movzx eax, word[esi + 0]
19+
movzx ebx, word[esi + 2]
20+
shl eax, 4
21+
add eax, ebx
22+
mov [FONT_ADR], eax
23+
24+
;------------------------------------------
25+
; フォントの一覧表示
26+
;------------------------------------------
27+
cdecl draw_font, 63, 13
28+
cdecl draw_color_bar, 63, 4
29+
30+
;------------------------------------------
31+
; 文字列を描画
32+
;------------------------------------------
33+
cdecl draw_str, 25, 14, 0x010F, .s0
34+
35+
;------------------------------------------
36+
; 線を描画
37+
;------------------------------------------
38+
cdecl draw_line, 100, 100, 0, 0, 0x0F
39+
cdecl draw_line, 100, 100, 200, 0, 0x0F
40+
cdecl draw_line, 100, 100, 200, 200, 0x0F
41+
cdecl draw_line, 100, 100, 0, 200, 0x0F
42+
43+
cdecl draw_line, 100, 100, 50, 0, 0x02
44+
cdecl draw_line, 100, 100, 150, 0, 0x03
45+
cdecl draw_line, 100, 100, 150, 200, 0x04
46+
cdecl draw_line, 100, 100, 50, 200, 0x05
47+
48+
cdecl draw_line, 100, 100, 0, 50, 0x02
49+
cdecl draw_line, 100, 100, 200, 50, 0x03
50+
cdecl draw_line, 100, 100, 200, 150, 0x04
51+
cdecl draw_line, 100, 100, 0, 150, 0x05
52+
53+
cdecl draw_line, 100, 100, 100, 0, 0x0F
54+
cdecl draw_line, 100, 100, 200, 100, 0x0F
55+
cdecl draw_line, 100, 100, 100, 200, 0x0F
56+
cdecl draw_line, 100, 100, 0, 100, 0x0F
57+
58+
;------------------------------------------
59+
; 処理の終了
60+
;------------------------------------------
61+
jmp $
62+
63+
.s0: db " Hello, kernel! ", 0
64+
65+
ALIGN 4, db 0
66+
FONT_ADR: dd 0
67+
68+
;***********************************************************
69+
; モジュール
70+
;***********************************************************
71+
%include "../modules/protect/vga.s"
72+
%include "../modules/protect/draw_char.s"
73+
%include "../modules/protect/draw_font.s"
74+
%include "../modules/protect/draw_str.s"
75+
%include "../modules/protect/draw_color_bar.s"
76+
%include "../modules/protect/draw_pixel.s"
77+
%include "../modules/protect/draw_line.s"
78+
79+
;***********************************************************
80+
; パディング
81+
;***********************************************************
82+
times KERNEL_SIZE - ($ - $$) db 0

src/modules/protect/draw_char.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ draw_char:
88
;-----------------------------------------
99
; 【レジスタの保存】
1010
;-----------------------------------------
11-
push eax
12-
push ebx
13-
push ecx
14-
push edx
15-
push esi
16-
push edi
11+
push eax
12+
push ebx
13+
push ecx
14+
push edx
15+
push esi
16+
push edi
1717

1818
;-----------------------------------------
1919
; コピー元フォントアドレスを設定

src/modules/protect/draw_color_bar.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ draw_color_bar:
88
;-----------------------------------------
99
; 【レジスタの保存】
1010
;-----------------------------------------
11-
push eax
12-
push ebx
13-
push ecx
14-
push edx
15-
push esi
16-
push edi
11+
push eax
12+
push ebx
13+
push ecx
14+
push edx
15+
push esi
16+
push edi
1717

1818
;-----------------------------------------
1919
; 基準となる位置をレジスタに保存

src/modules/protect/draw_font.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ draw_font:
88
;-----------------------------------------
99
; 【レジスタの保存】
1010
;-----------------------------------------
11-
push eax
12-
push ebx
13-
push ecx
14-
push edx
15-
push esi
16-
push edi
11+
push eax
12+
push ebx
13+
push ecx
14+
push edx
15+
push esi
16+
push edi
1717

1818
;-----------------------------------------
1919
; 基準となる位置をレジスタに保存

0 commit comments

Comments
 (0)