-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe820.asm
More file actions
155 lines (130 loc) · 3.63 KB
/
Copy pathe820.asm
File metadata and controls
155 lines (130 loc) · 3.63 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
e820 struc ;Address Range Descriptor Structure
base_addr_low dd ?
base_addr_high dd ?
length_low dd ?
length_high dd ?
type_b db ?
e820 ends
.model small
.586
public display_E820
extrn first_screen:far,QUIT:far,clear_screen:far,
locate_X_Y:far,locate_DH_DY:far,hex:far,
clear_screen:far,first_screen_h:byte,space:far,assc:far,display_eax:far,
first_screen:far,D_H:BYTE,D_L:BYTE,D_H_CHANGE:byte,back_ground_color:word
.data
cow_e820 db 0
buffer e820 < >
mesg_err db 'interrupt command is not effect','$'
mesg_available db ' Available','$'
mesg_reserved db ' Reserved ','$'
mesg_ACPI db ' ACPI Reclaim ','$'
mesg_NVS db ' ACPI NVS','$'
mesg_other db ' Other ','$'
mesg_title db 'Range Start Address End Address Length Tupe','$'
MESG_RETURN DB 'Return menu: ESC Rewrite: Tab and Backspace ','$'
.code
display_E820:
include MACRO_zifu.MAC
call clear_screen
mov D_H, 1
MOV D_L, 2
call locate_DH_DY
msg mesg_title
mov ah,2
mov dl,0ah
int 21h
mov ah,2
mov dl,0dh
int 21h
input_init:
mov cow_e820,0
mov ebx,0 ;buffer pointer
input:
mov dx,seg buffer
mov es,dx
;es:di
mov di, offset buffer
mov ecx,20 ;buffer size 20 bytes
mov edx,'SMAP' ;signature
mov eax,0e820h
int 15h
output:
; jc err ;Non-Carry-Indicates No Error
; cmp eax,'SMAP' ;'SMAP' Signature to verify correct BIOS revision
; jnz err
call space
mov al,cow_e820
call assc
call space
call space
call space
inc cow_e820
mov eax,buffer.base_addr_high
call display_eax
mov eax,buffer.base_addr_low
call display_eax
call space ;display start address
;********************************************
mov eax,buffer.base_addr_low
add eax,buffer.length_low
mov edx,eax
mov eax,buffer.base_addr_high
adc eax,buffer.length_high
sub edx,1
sbb eax,0
call display_eax ;display end address
mov eax,edx
call display_eax
call space
;************************************************
mov eax,buffer.length_high
call display_eax
mov eax,buffer.length_low
call display_eax ;display length
call space
xor eax,eax
mov al,buffer.type_b
cmp eax,1
jz msg_mesg_available
cmp eax,2
jz msg_mesg_reserved
cmp eax,3
jz msg_mesg_ACPI
CMP eax,4
jz msg_mesg_NVS
msg mesg_other
jmp next_type
msg_mesg_available:
msg mesg_available
jmp next_type
msg_mesg_reserved:
msg mesg_reserved
jmp next_type
msg_mesg_ACPI:
msg mesg_ACPI
jmp next_type
msg_mesg_NVS:
msg mesg_NVS
next_type:
mov ah,2
mov dl,0ah
int 21h
mov ah,2
mov dl,0dh
int 21h
;jmp $
cmp ebx,0
jnz input
;err:
; msg mesg_err
wait_here_e820:
MOV AH,11H
INT 16H ;cheack key press
jz wait_here_e820
mov ah,0
int 16h ;读键盘输入一个字符,不回显
cmp ah,01h
jz first_screen
jmp wait_here_e820
END