-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbootskel.S
62 lines (56 loc) · 1.07 KB
/
bootskel.S
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
58
59
60
61
62
.code16
.globl start
start:
_start:
movb $0x0e,%ah
movb thestring,%al
movb $0,%bh
movb $7,%bl
int $0x10
# print to screen
mov $msg-1, %si
loop:
add $0x1, %si
movb (%si), %al
call print
cmpb $0x0, %al
jne loop
# wait for key:
movb $0x0, %ah
int $0x16
# set video mode (vga display)
movb $0x13, %al
movb $0x0, %ah
int $0x10
# read image into memory
disp: # int13 AH=42h
movb $0x80, %dl # disk #1
xorw %ax, %ax
movw %ax, %ds
movb $0x42, %ah
mov $struct, %si # interrupt call parameters
int $0x13
# jmp disp
jmp stop
msg:
.ascii "\nhttps://github.com/sam46\npress any key to continue...\n\0"
struct: # interrupt call parameters
.byte 0x10 # struct size
.byte 0x00 # reserved
.word 0x007d # # how many blocks (block is 512 KB): filesize/512
.word 0x0 # buffer offset
.word 0xa000 # buffer base
.quad 0x1 # starting disk block
jmp stop
print: # pass char to print in %al
movb $0x0e, %ah
movb $0x0, %bh
movb $0x1, %bl
int $0x10
ret
stop:
jmp stop
thestring:
.string "Hello World"
.org 0x01fe
.word 0xAA55