Skip to content

Commit ddc89c2

Browse files
committed
Prefix asm print/println functions with real_mode_
1 parent 616ec7f commit ddc89c2

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

src/stage_1.s

+18-18
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _start:
2323
mov sp, 0x7c00
2424

2525
lea si, boot_start_str
26-
call println
26+
call real_mode_println
2727

2828
enable_a20:
2929
# enable A20-Line via IO-Port 92, might not work on all motherboards
@@ -107,38 +107,38 @@ spin:
107107
# esi: points at zero-terminated String
108108
# CLOBBER
109109
# ax
110-
println:
111-
call print
110+
real_mode_println:
111+
call real_mode_print
112112
mov al, 13 # \r
113-
call print_char
113+
call real_mode_print_char
114114
mov al, 10 # \n
115-
jmp print_char
115+
jmp real_mode_print_char
116116

117117
# print a string
118118
# IN
119119
# esi: points at zero-terminated String
120120
# CLOBBER
121121
# ax
122-
print:
122+
real_mode_print:
123123
cld
124-
print_loop:
124+
real_mode_print_loop:
125125
# note: if direction flag is set (via std)
126126
# this will DECREMENT the ptr, effectively
127127
# reading/printing in reverse.
128128
lodsb al, BYTE PTR [esi]
129129
test al, al
130-
jz print_done
131-
call print_char
132-
jmp print_loop
133-
print_done:
130+
jz real_mode_print_done
131+
call real_mode_print_char
132+
jmp real_mode_print_loop
133+
real_mode_print_done:
134134
ret
135135

136136
# print a character
137137
# IN
138138
# al: character to print
139139
# CLOBBER
140140
# ah
141-
print_char:
141+
real_mode_print_char:
142142
mov ah, 0x0e
143143
int 0x10
144144
ret
@@ -148,7 +148,7 @@ print_char:
148148
# bx: the number
149149
# CLOBBER
150150
# al, cx
151-
print_hex:
151+
real_mode_print_hex:
152152
mov cx, 4
153153
.lp:
154154
mov al, bh
@@ -161,24 +161,24 @@ print_hex:
161161
.below_0xA:
162162
add al, '0'
163163

164-
call print_char
164+
call real_mode_print_char
165165

166166
shl bx, 4
167167
loop .lp
168168

169169
ret
170170

171-
error:
172-
call println
171+
real_mode_error:
172+
call real_mode_println
173173
jmp spin
174174

175175
no_int13h_extensions:
176176
lea si, no_int13h_extensions_str
177-
jmp error
177+
jmp real_mode_error
178178

179179
rest_of_bootloader_load_failed:
180180
lea si, rest_of_bootloader_load_failed_str
181-
jmp error
181+
jmp real_mode_error
182182

183183
boot_start_str: .asciz "Booting (first stage)..."
184184
error_str: .asciz "Error: "

src/stage_2.s

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ kernel_load_failed_str: .asciz "Failed to load kernel from disk"
1111

1212
kernel_load_failed:
1313
lea si, [kernel_load_failed_str]
14-
call println
14+
call real_mode_println
1515
kernel_load_failed_spin:
1616
jmp kernel_load_failed_spin
1717

1818
stage_2:
1919
lea si, [second_stage_start_str]
20-
call println
20+
call real_mode_println
2121

2222
set_target_operating_mode:
2323
# Some BIOSs assume the processor will only operate in Legacy Mode. We change the Target

0 commit comments

Comments
 (0)