Skip to content

Commit e5442e8

Browse files
committed
feat: Add message string before entering protect mode
1 parent e0f187e commit e5442e8

File tree

1 file changed

+11
-33
lines changed

1 file changed

+11
-33
lines changed

Diff for: boot/loader.S

+11-33
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jmp loader_start
1313
DATA_STACK_DESC: dd 0x0000FFFF
1414
dd DESC_DATA_HIGH4
1515

16-
VIDEO_DESC : dd 0x80000007 ;limit=(0xbffff-0xb8000)/4k=0x7
16+
VIDEO_DESC: dd 0x80000007 ;limit=(0xbffff-0xb8000)/4k=0x7
1717
dd DESC_VIDEO_HIGH4
1818

1919
GDT_SIZE equ $ - GDT_BASE
@@ -28,40 +28,18 @@ jmp loader_start
2828
gdt_ptr dw GDT_LIMIT
2929
dd GDT_BASE
3030

31+
loadermsg db 'loader in real mode...'
3132

32-
mov si, text_string ; Put string position into SI
33-
call print_string ; Call our string-printing routine
34-
35-
; mov byte [gs:0x00], '2'
36-
; mov byte [gs:0x01], 0xA4
33+
loader_start:
3734

38-
jmp $
39-
40-
text_string db 'Loader is ready!!!', 0
35+
; INT: 0x10 function: 0x13 print string
36+
mov sp, LOADER_BASE_ADDR
37+
mov bp, loadermsg ; ES:BP = string addr
38+
mov cx, 22 ; CX = string length
39+
mov ax, 0x1301 ; AH = 13, AL = 01h
40+
mov bx, 0x001f ; page num is 0 (BH = 0) some color(BL= 1fh)
41+
mov dx, 0x1800
42+
int 0x10
4143

42-
print_string: ; Routine: output string in SI to screen
43-
mov ah, 3
44-
mov bh, 0
45-
int 0x10
4644

47-
mov bx, 0
48-
mov bl, dh
49-
add bx, 32
50-
51-
.repeat:
52-
53-
lodsb ; Get character from string
54-
55-
cmp al, 0
56-
je .done ; If char is zero, end of string
57-
58-
mov byte [gs:bx], al
59-
add bx, 1
60-
mov byte [gs:bx], 0xA4
61-
add bx, 1
62-
63-
jmp .repeat
64-
65-
.done:
66-
ret
6745

0 commit comments

Comments
 (0)