Skip to content

Commit 4d6e2a9

Browse files
committed
feat: Write string to screen with video memory
1 parent 64c7a75 commit 4d6e2a9

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

boot/mbr.S

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ start:
99
mov ax, 07C0h ; Set data segment to where we're loaded
1010
mov ds, ax
1111

12+
mov ax, 0xb800
13+
mov gs, ax
14+
15+
; clean screen
16+
mov ax, 0600h
17+
mov bx, 0700h
18+
mov cx, 0
19+
mov dx, 184fh
20+
21+
int 10h
22+
1223

1324
mov si, text_string ; Put string position into SI
1425
call print_string ; Call our string-printing routine
@@ -24,23 +35,21 @@ print_string: ; Routine: output string in SI to screen
2435
mov bh, 0
2536
int 0x10
2637

27-
.repeat:
38+
mov bx, 0
39+
mov bl, dh
2840

29-
lodsb ; Get character from string
3041
42+
.repeat:
3143

32-
mov ah, 09h ;
33-
mov bl, 02h ; green text
34-
mov bh, 0
35-
mov cx, 1h
44+
lodsb ; Get character from string
3645

3746
cmp al, 0
3847
je .done ; If char is zero, end of string
39-
int 10h ; Otherwise, print it
4048

41-
add dl, 1
42-
mov ah, 02h
43-
int 10h
49+
mov byte [gs:bx], al
50+
add bx, 1
51+
mov byte [gs:bx], 0xA4
52+
add bx, 1
4453

4554
jmp .repeat
4655

boot/mbr.bin

0 Bytes
Binary file not shown.

img/cocotiOS.img

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)