-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCPUID.asm
More file actions
305 lines (254 loc) · 7.33 KB
/
Copy pathCPUID.asm
File metadata and controls
305 lines (254 loc) · 7.33 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
.model small
.586
public display_CPUID
extrn clear_screen:far,space:far,back_ground_color:word ,first_screen:far
.data
veder_word dd 0
d_eax dd 0
d_ebx dd 0
d_ecx dd 0
d_edx dd 0
func dd 0
font_color db 0
processor_type db 0
family db 0
model db 0
stepping_id db 0
extended_flag db 0
extended_model_id db 0
mesg_veder db'Vender ID String: ','$'
mesg_barand db'Brand string: $'
mesg_processor db' Processor type:0x','$'
mesg_familay db' family:0x','$'
mesg_model db' model:0x','$'
mesg_step db'stepping id:0x','$'
mesg_suport db'this computer suport serial number','$'
mesg_not_support_brand_string db'processor brand string not supported','$'
MESG_not_suport_brand db' not support brand string function','$'
.code
.startup
display_CPUID:
include MACRO_zifu.MAC
mov al,3
mov ah,0
int 10h
mov back_ground_color,21h
CALL clear_screen
mov func, 80000002h
;-----------------------------------------------------
msg mesg_veder ;diaplay vender id
call display_vender
;--------------------------------------------------------
msg mesg_barand
call dispaly_brand ;dispaly_brand
call change_line
;-----------------------------------------------------
call display_extended_information
wait_here_cpuid:
MOV AH,11H
INT 16H ;cheack key press
jz wait_here_cpuid
mov ah,0
int 16h
cmp ah,01h
jz first_screen
jmp wait_here_cpuid
;dispaly_extended_information
display_extended_information proc far public
pusha
mov eax,80000000h ;cheack Check whether support extended information funct
cpuid
and eax,80000000h
jz not_suport_extended
jmp suport_extended
not_suport_extended:
mov extended_flag,0 ;not suport
suport_extended:
mov extended_flag,1 ;suport falg=1
mov eax,1
cpuid
mov stepping_id,al
and stepping_id,0fh
mov model,al
and model,0f0h
shr model,4
mov family,ah
and family,0fh
mov processor_type,ah
and processor_type,30h
shr eax,16
mov extended_model_id,al
and extended_model_id,0fh
msg mesg_step
mov al,stepping_id
call asscc_high_low
call space
;--------------------------------------------
cmp extended_flag,0 ;if suport extended information show extend_mode
jz dispaly_mode ;else not show
msg mesg_model
mov al,extended_model_id
call asscc_high_low
dispaly_mode:
mov al,model
call asscc_high_low
call space
msg mesg_familay
mov al,family
call asscc_high_low
call space
msg mesg_processor
mov al,processor_type
call asscc_high_low
call space
jmp wait_here_cpuid
popa
ret
display_extended_information endp
asscc_high_low proc far ;hex to asscii from al
pusha ;reserve al_high
add al,30h
cmp al,'9'
jLE next11
add al,7
next11:
mov font_color,24h
call change_font_color
mov ah,2
mov dl,al
int 21h
popa
ret
asscc_high_low endp
;************************
;display vender id
display_vender proc
pusha
mov EAX,0 ;get vender id string
cpuid ;ecx ebx ebx
mov d_ebx,ebx
mov d_ecx,ecx
mov d_edx,edx ;copy string
mov eax,d_ebx
call display_word ;display vender
mov eax,d_edx
call display_word
mov eax,d_ecx
call display_word
call change_line
popa
ret
display_vender endp
;***************************
;purpose: dipaly barand string
;input: func
;output:eax,ebx,ecx,edx
dispaly_brand proc
mov eax,80000000h
cpuid
test eax,80000000h
jz not_suport_brand
cmp eax,80000004h
jae support_brand
not_suport_brand:
msg MESG_not_suport_brand
jmp brand_end
support_brand:
mov cx,3
barand_string_gain:
push cx
mov eax,func
cpuid
mov d_eax,eax
mov d_ebx,ebx
mov d_ecx,ecx
mov d_edx,edx
mov eax,d_eax
call display_word
mov eax,d_ebx
call display_word
mov eax,d_ecx
call display_word
mov eax,d_edx
call display_word
add func,1
pop cx
loop barand_string_gain
brand_end:
ret
dispaly_brand endp
asscc proc far ;hex to asscii from al
PUSHA
;reserve al_high
;
add al,30h ;
cmp al,'9' ;
jLE next11
add al,7
next11:
mov ah,09 ;调用DOS功能显示高四位对应的数字
mov bh,0
mov bl,24h
mov cx,1
int 10h
mov ah,2
mov dl,al
int 21h
popa
ret
asscc endp
;***********************************************************************************************
assc_cpuid proc far ;hex to asscii from al
PUSHA
mov ah,09
mov bh,0
mov bl,024h
mov cx,1
int 10h
mov Dl,al
mov ah,2
int 21h
popa
ret
assc_cpuid endp
;************change_font_color*******************
;set font color
;input font_color
;output : NO
change_font_color proc far
mov ah,09
mov bh,0
mov bl,font_color
mov cx,1
int 10h
ret
change_font_color endp
;**************************************************
;display eax (asscii)
;input:vender_word
;**************************************************
display_word proc far
pusha
;mov eax,veder_word
mov cx,4
display_al:
call assc_cpuid
shr eax,8
loop display_al
popa
ret
display_word endp
change_line proc far
push ax
push dx
mov ah,2
mov dl,0dH
int 21H
mov ah,2
mov dl,0aH
int 21H
pop dx
pop ax
ret
change_line endp
end