File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ BITS 16
2
+
3
+ start:
4
+ mov ax , 07C0h ; Set up 4K stack space after this bootloader
5
+ add ax , 32 ; 512 / 16 bytes per paragraph
6
+ mov ss , ax
7
+ mov sp , 4096
8
+
9
+ mov ax , 07C0h ; Set data segment to where we're loaded
10
+ mov ds , ax
11
+
12
+
13
+ mov si , text_string ; Put string position into SI
14
+ call print_string ; Call our string-printing routine
15
+
16
+ jmp $ ; Jump here - infinite loop!
17
+
18
+
19
+ text_string db 'Hello cocotiOS!' , 0
20
+
21
+
22
+ print_string: ; Routine: output string in SI to screen
23
+ mov ah , 3
24
+ mov bh , 0
25
+ int 0x10
26
+
27
+ .repe at :
28
+
29
+ lodsb ; Get character from string
30
+
31
+
32
+ mov ah , 09h ;
33
+ mov bl , 02h ; green text
34
+ mov bh , 0
35
+ mov cx , 1h
36
+
37
+ cmp al , 0
38
+ je .done ; If char is zero, end of string
39
+ int 10h ; Otherwise, print it
40
+
41
+ add dl , 1
42
+ mov ah , 02h
43
+ int 10h
44
+
45
+ jmp .repe at
46
+
47
+ .done:
48
+ ret
49
+
50
+
51
+ times 510 - ($ - $$) db 0 ; Pad remainder of boot sector with 0s
52
+ dw 0xAA55 ; The standard PC boot signature
You can’t perform that action at this time.
0 commit comments