-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathboot.s
More file actions
44 lines (39 loc) · 1.62 KB
/
Copy pathboot.s
File metadata and controls
44 lines (39 loc) · 1.62 KB
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
.code16
.section .text
.global _start
SCREEN_PIXEL = 25*80
_start:
# VGA model 3
#+-------------------------------------------------------------+-------------------------------+
#| Attribute | Character |
#+-------------------------------------------------------------+-------------------------------+
#| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
#+-----------+------+-----+-----+-----------+------+-----+-----+---+---+---+---+---+---+---+---+
#| Blink | Background color | intensity | Foreground color | Code point |
#+-----------+------------------+-----------+------------------+-------------------------------+
clear_screen:
mov $0xb800, %ax
mov %ax, %es
xor %di, %di
mov $0b00010000, %ah
mov $0, %al
mov $SCREEN_PIXEL, %cx
cld #df=0
rep stosw
mov $0xb800, %ax
mov %ax,%ds
#########################直接寻址###########################
#指令是在指令的操作码后面中直接给出操作数的16位偏移地址,
#偏移地址也称为有效地址(EA, Effective Address),
#该地址与指令的操作码一起存放在内存的代码段,
#按低8位-高8位的顺序存放,
#取指令时与指令操作码一起被送入CPU.
#直接寻址指令中,默认使用DS寄存器作为操作数的段基址寄存器.
#当然也可以显式地指定使用其他段寄存器——称为段超越前缀.
############################################################
movb $'A', 0
movb $0x1e, 1
idle:
jmp idle
msg:
.string "Loading a simple OS!!!^,^"