-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathboot.asm
57 lines (44 loc) · 893 Bytes
/
boot.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "std.asm"
#org 0x330000
#define SECOND_OFFSET 0x00330210 ; where we should load the kernel
; second stage for audr32
.word 0x5969 ; boot magic
boot:
mov r0, msg
call puts
mov r10, 0x02
mov ax, 0x00
mov bx, SECOND_OFFSET
mov dx, 0x01
mov cx, 512 ; an amount worth of sectors
int 0x05
jmp SECOND_OFFSET ; jump to high level second stage
jmp boot
printuint:
mov r10, 0x07
mov dx, r0
mov cx, 0
mov bx, 0x0F00
int 0x10
ret
printchar:
mov r10, 0x01
mov dx, r0
mov bx, 0x0F00
ret
puts:
puts_print_loop:
mov r10, 0x01
cmp [8:r0], 0
je puts_print_loop_end
mov dx, [8:r0]
push r0
mov bx, 0x0F00
int 0x10
pop r0
add r0, 1
jmp puts_print_loop
puts_print_loop_end:
ret
msg:
.asciiz "Loading Second Stage!\n"