Subversion Repositories Kolibri OS

Rev

Rev 1993 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1993 Rev 1995
1
;***************************************************************
1
;***************************************************************
2
; project name:    PCI Device Enumeration
2
; project name:    PCI Device Enumeration
3
; target platform: KolibriOS
3
; target platform: KolibriOS
4
; compiler:        flat assembler 1.68
4
; compiler:        flat assembler 1.68
5
; version:         2.3
5
; version:         2.3
6
; last update:     Jule 2011
6
; last update:     Jule 2011
7
; maintained by:   Jason Delozier 
7
; maintained by:   Jason Delozier 
8
;                  Sergey Kuzmin 
8
;                  Sergey Kuzmin 
9
;                  Mihailov Ilia 
9
;                  Mihailov Ilia 
10
;                  Marat Zakiyanov 
10
;                  Marat Zakiyanov 
11
;                  Artem Jerdev  
11
;                  Artem Jerdev  
12
;                  Evgeny Grechnikov (diamond)
12
;                  Evgeny Grechnikov (diamond)
13
;                  Veronica (CleverMouse)
13
;                  Veronica (CleverMouse)
14
; old project site:  http://www.coolthemes.narod.ru/pcidev.html
14
; old project site:  http://www.coolthemes.narod.ru/pcidev.html
15
; new project site:  http://board.kolibrios.org/viewtopic.php?f=42&t=73
15
; new project site:  http://board.kolibrios.org/viewtopic.php?f=42&t=73
16
;***************************************************************
16
;***************************************************************
17
;Summary: This program will attempt to scan the PCI Bus
17
;Summary: This program will attempt to scan the PCI Bus
18
;        and display basic information about each device
18
;        and display basic information about each device
19
;        connected to the PCI Bus.
19
;        connected to the PCI Bus.
20
;***************************************************************
20
;***************************************************************
21
;-----------------------------------------------------------------------------
21
;-----------------------------------------------------------------------------
22
include '../../../macros.inc'
22
include '../../../macros.inc'
23
 
23
 
24
include	'../../../develop/libraries/box_lib/load_lib.mac'
24
include	'../../../develop/libraries/box_lib/load_lib.mac'
25
;-----------------------------------------------------------------------------
25
;-----------------------------------------------------------------------------
26
	use32
26
	use32
27
	org 0x0
27
	org 0x0
28
	db 'MENUET01'	; 8 byte id
28
	db 'MENUET01'	; 8 byte id
29
	dd 0x01		; header version
29
	dd 0x01		; header version
30
	dd START	; start of code
30
	dd START	; start of code
31
	dd IM_END	; size of image
31
	dd IM_END	; size of image
32
	dd I_END	; memory for app
32
	dd I_END	; memory for app
33
	dd stacktop	; esp
33
	dd stacktop	; esp
34
	dd 0	; I_Param
34
	dd 0	; I_Param
35
	dd path		; APPLICATION PATH
35
	dd path		; APPLICATION PATH
36
;-----------------------------------------------------------------------------
36
;-----------------------------------------------------------------------------
37
@use_library	; load_lib macro
37
@use_library	; load_lib macro
38
;-----------------------------------------------------------------------------
38
;-----------------------------------------------------------------------------
39
START:
39
START:
40
	mcall	68,11
40
	mcall	68,11
41
	mcall	66,1,1
41
	mcall	66,1,1
42
;-----------------------------------------------------------------------------
42
;-----------------------------------------------------------------------------
43
load_libraries l_libs_start,end_l_libs
43
load_libraries l_libs_start,end_l_libs
44
;-----------------------------------------------------------------------------
44
;-----------------------------------------------------------------------------
45
;OpenDialog	initialisation
45
;OpenDialog	initialisation
46
	push    dword OpenDialog_data
46
	push    dword OpenDialog_data
47
	call    [OpenDialog_Init]
47
	call    [OpenDialog_Init]
48
	
48
	
49
	mov	edi,filename_area
49
	mov	edi,filename_area
50
	mov	esi,start_temp_file_name
50
	mov	esi,start_temp_file_name
51
	call	copy_file_name_path
51
	call	copy_file_name_path
52
;-----------------------------------------------------------------------------
52
;-----------------------------------------------------------------------------
53
	mcall	68,12,4096*4 ; 16 Kb - I hope this will be enough for store of data
53
	mcall	68,12,4096*4 ; 16 Kb - I hope this will be enough for store of data
54
	mov	[store_text_area_start],eax
54
	mov	[store_text_area_start],eax
55
;-----------------------------------------------------------------------------	
55
;-----------------------------------------------------------------------------	
56
	call draw_window
56
	call draw_window
57
still:
57
still:
58
	mcall	10			; wait here for event
58
	mcall	10			; wait here for event
59
	dec	eax			; redraw request ?
59
	dec	eax			; redraw request ?
60
	jz	red
60
	jz	red
61
	dec	eax			; key in buffer ?
61
	dec	eax			; key in buffer ?
62
	jz	key
62
	jz	key
63
	dec	eax			; button in buffer ?
63
	dec	eax			; button in buffer ?
64
	jz	button
64
	jz	button
65
	jmp	still
65
	jmp	still
66
;-----------------------------------------------------------------------------
66
;-----------------------------------------------------------------------------
67
red:					; redraw
67
red:					; redraw
68
	mcall	9, Proc_Info, -1	; window redraw requested so get new window coordinates and size
68
	mcall	9, Proc_Info, -1	; window redraw requested so get new window coordinates and size
69
	mov	eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure
69
	mov	eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure
70
	mov	[Form + 2], ax		; x start position
70
	mov	[Form + 2], ax		; x start position
71
	mov	eax, [Proc_Info.box.top];
71
	mov	eax, [Proc_Info.box.top];
72
	mov	[Form + 6], ax		; ystart position
72
	mov	[Form + 6], ax		; ystart position
73
	mov	eax, [Proc_Info.box.width]	;
73
	mov	eax, [Proc_Info.box.width]	;
74
	mov	[Form], ax		; window width
74
	mov	[Form], ax		; window width
75
	mov	eax, [Proc_Info.box.height]	;
75
	mov	eax, [Proc_Info.box.height]	;
76
	mov	[Form + 4] ,ax		; window height
76
	mov	[Form + 4] ,ax		; window height
77
	call	draw_window		; go redraw window now
77
	call	draw_window		; go redraw window now
78
	jmp	still
78
	jmp	still
79
;-----------------------------------------------------------------------------
79
;-----------------------------------------------------------------------------
80
key:					; key
80
key:					; key
81
	mcall	2			; just read it and ignore
81
	mcall	2			; just read it and ignore
82
	cmp	[extended_key],1
82
	cmp	[extended_key],1
83
	je	.extended_key
83
	je	.extended_key
84
	test	al, al
84
	test	al, al
85
	jnz	still
85
	jnz	still
86
	cmp	ah, 0xE0
86
	cmp	ah, 0xE0
87
	jne	@f
87
	jne	@f
88
	mov	[extended_key],1
88
	mov	[extended_key],1
89
	jmp	still
89
	jmp	still
90
@@:
90
@@:
91
	cmp	ah,129	; Esc
91
	cmp	ah,129	; Esc
92
	je	button.exit
92
	je	button.exit
93
	cmp	ah,159
93
	cmp	ah,159
94
	je	call_OpenDialog
94
	je	call_OpenDialog
95
	jmp	still
95
	jmp	still
96
.extended_key:
96
.extended_key:
97
	mov	[extended_key],0
97
	mov	[extended_key],0
98
	cmp	ah,129	; Esc
98
	cmp	ah,129	; Esc
99
	je	button.exit
99
	je	button.exit
100
	cmp	ah,159
100
	cmp	ah,159
101
	je	call_OpenDialog
101
	je	call_OpenDialog
102
	jmp	still
102
	jmp	still
103
;-----------------------------------------------------------------------------
103
;-----------------------------------------------------------------------------
104
button: 				; button
104
button: 				; button
105
	mcall	17			; get id
105
	mcall	17			; get id
106
	cmp	ah,2
106
	cmp	ah,2
107
	je	call_OpenDialog
107
	je	call_OpenDialog
108
	cmp	ah, 1			; button id = 1 ?
108
	cmp	ah, 1			; button id = 1 ?
109
	jne	still
109
	jne	still
110
.exit:
110
.exit:
111
	mcall	-1			; close this program
111
	mcall	-1			; close this program
112
;-----------------------------------------------------------------------------
112
;-----------------------------------------------------------------------------
113
call_OpenDialog:
113
call_OpenDialog:
114
	mov	[OpenDialog_data.type],1	; Save
114
	mov	[OpenDialog_data.type],1	; Save
115
	
115
	
116
	push    dword OpenDialog_data
116
	push    dword OpenDialog_data
117
	call    [OpenDialog_Start]
117
	call    [OpenDialog_Start]
118
 
118
 
119
	cmp	[OpenDialog_data.status],2	; OpenDialog does not start
119
	cmp	[OpenDialog_data.status],2	; OpenDialog does not start
120
	je	.save_file_default_path
120
	je	.save_file_default_path
121
	
121
	
122
	cmp	[OpenDialog_data.status],1
122
	cmp	[OpenDialog_data.status],1
123
	jne	still
123
	jne	still
124
	
124
	
125
	call	store_data
125
	call	store_data
126
	jmp	still
126
	jmp	still
127
;----------------------------------------	
127
;----------------------------------------	
128
.save_file_default_path:
128
.save_file_default_path:
129
	mov	edi,file_name
129
	mov	edi,file_name
130
	mov	esi,file_default_path
130
	mov	esi,file_default_path
131
	call	copy_file_name_path
131
	call	copy_file_name_path
132
	call	store_data
132
	call	store_data
133
	jmp	still
133
	jmp	still
134
;----------------------------------------	
134
;----------------------------------------	
135
copy_file_name_path:
135
copy_file_name_path:
136
	xor	eax,eax
136
	xor	eax,eax
137
	cld
137
	cld
138
@@:
138
@@:
139
	lodsb
139
	lodsb
140
	stosb
140
	stosb
141
	test	eax,eax
141
	test	eax,eax
142
	jnz	@r
142
	jnz	@r
143
	ret
143
	ret
144
;-----------------------------------------------------------------------------
144
;-----------------------------------------------------------------------------
145
prepare_text_area:
145
prepare_text_area:
146
	mov	edi,[store_text_area_start]
146
	mov	edi,[store_text_area_start]
147
 
147
 
148
	push	edi
148
	push	edi
149
	mov	ecx,4096 ; 16 Kb - I hope this will be enough for store of data
149
	mov	ecx,4096 ; 16 Kb - I hope this will be enough for store of data
150
	mov	eax,dword '    '
150
	mov	eax,dword '    '
151
	cld
151
	cld
152
	rep	stosd
152
	rep	stosd
153
	pop	edi
153
	pop	edi
154
	
154
	
155
	mov	esi,PCIWin
155
	mov	esi,PCIWin
156
	xor	ecx,ecx
156
	xor	ecx,ecx
157
@@:
157
@@:
158
	mov	cl,[esi]
158
	mov	cl,[esi]
159
	inc	esi
159
	inc	esi
160
	rep	movsb
160
	rep	movsb
161
	mov	al,0Ah ; CR - carriage return
161
	mov	al,0Ah ; CR - carriage return
162
	stosb
162
	stosb
163
	cmp	[esi],byte 0xFF
163
	cmp	[esi],byte 0xFF
164
	jne	@r	
164
	jne	@r	
165
 
165
 
166
	mov	[store_text_area_end],edi
166
	mov	[store_text_area_end],edi
167
	
167
	
168
	xor	edi,edi
168
	xor	edi,edi
169
	ret
169
	ret
170
;-----------------------------------------------------------------------------	
170
;-----------------------------------------------------------------------------	
171
draw_window:
171
draw_window:
172
	call	prepare_text_area
172
	call	prepare_text_area
173
	
173
	
174
	mov	byte [total], 0
174
	mov	byte [total], 0
175
	mcall	12, 1			; start of draw
175
	mcall	12, 1			; start of draw
176
	; DRAW WINDOW
176
	; DRAW WINDOW
177
	mcall	0,dword [Form],dword [Form + 4],0x13ffffff,0x805080d0,title
177
	mcall	0,dword [Form],dword [Form + 4],0x13ffffff,0x805080d0,title
178
	mcall	8,<450,100>,<25,25>,2,0xC0C0C0
178
	mcall	8,<450,100>,<25,25>,2,0xC0C0C0
179
	shr	ecx,16
179
	shr	ecx,16
180
	mov	bx,cx
180
	mov	bx,cx
181
	add	ebx,13 shl 16+4
181
	add	ebx,13 shl 16+4
182
	mcall	4,,0x80000000,text_save_button
182
	mcall	4,,0x80000000,text_save_button
183
	add	bx,11
183
	add	bx,11
184
	mcall	,,,text_save_button.1
184
	mcall	,,,text_save_button.1
185
	; Insert horizontal bars  in list area
185
	; Insert horizontal bars  in list area
186
	mov	eax, 13 		; draw bar system function
186
	mov	eax, 13 		; draw bar system function
187
	mov	ebx, 18 		; set Xstart position of bar
187
	mov	ebx, 18 		; set Xstart position of bar
188
	shl	ebx, 16 		;
188
	shl	ebx, 16 		;
189
	mov	bx, word [Form] ; get width of window
189
	mov	bx, word [Form] ; get width of window
190
	sub	bx, 32			; bar is 32 pixels shorter then window width
190
	sub	bx, 32			; bar is 32 pixels shorter then window width
191
	mov	ecx, 119 * 65536 + 10	; set Ystart(109) and Height(10) of bar   109
191
	mov	ecx, 119 * 65536 + 10	; set Ystart(109) and Height(10) of bar   109
192
	mov	edx, 0xC0C0C0		; set color of bar
192
	mov	edx, 0xC0C0C0		; set color of bar
193
again:	;begin draw bar loop
193
again:	;begin draw bar loop
194
	mcall				; draw bar to window area
194
	mcall				; draw bar to window area
195
	shr	ecx, 16 		; move the Ystart position to working area
195
	shr	ecx, 16 		; move the Ystart position to working area
196
	add	ecx, 34 		; add 34 pixels to Y Start (moves bar down)
196
	add	ecx, 34 		; add 34 pixels to Y Start (moves bar down)
197
	cmp	cx, word [Form + 4]	; is the Ystart position outside of window area
197
	cmp	cx, word [Form + 4]	; is the Ystart position outside of window area
198
	jae	nomo			; if so stop drawing bars
198
	jae	nomo			; if so stop drawing bars
199
	sub	ecx, 14 		; if not, we only need 20 pixels between bar tops
199
	sub	ecx, 14 		; if not, we only need 20 pixels between bar tops
200
	shl	ecx, 16 		; set that values as Ystart
200
	shl	ecx, 16 		; set that values as Ystart
201
	add	ecx, 10 		; Bar Height is always 10 pixels
201
	add	ecx, 10 		; Bar Height is always 10 pixels
202
	jmp	again			; draw another bar
202
	jmp	again			; draw another bar
203
;-----------------------------------------------------------------------------
203
;-----------------------------------------------------------------------------
204
nomo:					;done drawing bars here
204
nomo:					;done drawing bars here
205
	; start PCI stuff
205
	; start PCI stuff
206
	call	Get_PCI_Info		; get pci version and last bus, scan for and draw each pci device
206
	call	Get_PCI_Info		; get pci version and last bus, scan for and draw each pci device
207
 
207
 
208
	; Window inteface
208
	; Window inteface
209
	mov	cx, [PCI_Version]
209
	mov	cx, [PCI_Version]
210
	add	ch, '0'
210
	add	ch, '0'
211
	mov	[PCIWin + 85], ch	; 0xBADCODE but it works !
211
	mov	[PCIWin + 85], ch	; 0xBADCODE but it works !
212
	mov	ch, cl
212
	mov	ch, cl
213
	shr	cl, 4
213
	shr	cl, 4
214
	and	ch, 0x0f
214
	and	ch, 0x0f
215
	add	cx, '00'
215
	add	cx, '00'
216
	mov	[PCIWin + 87], cx
216
	mov	[PCIWin + 87], cx
217
	mov	cl, [PCI_LastBus]	; will only work if [PCI_LastBus] < 10
217
	mov	cl, [PCI_LastBus]	; will only work if [PCI_LastBus] < 10
218
	add	cl, '0'
218
	add	cl, '0'
219
	mov	[PCIWin + 106], cl
219
	mov	[PCIWin + 106], cl
220
 
220
 
221
	mov	edx, PCIWin
221
	mov	edx, PCIWin
222
	mov	ebx, 20 * 65536 + 25	; x start, ystart of text
222
	mov	ebx, 20 * 65536 + 25	; x start, ystart of text
223
	mov	ecx, 0x224466		; color of text
223
	mov	ecx, 0x224466		; color of text
224
	mov	eax, 4
224
	mov	eax, 4
225
@@:
225
@@:
226
	movzx	esi, byte[edx]
226
	movzx	esi, byte[edx]
227
	inc	edx
227
	inc	edx
228
	mcall
228
	mcall
229
	add	ebx, 10
229
	add	ebx, 10
230
	add	edx, esi
230
	add	edx, esi
231
	cmp	byte[edx], -1
231
	cmp	byte[edx], -1
232
	jne	@b
232
	jne	@b
233
	; Quantity of devices...
233
	; Quantity of devices...
234
	movzx	ecx, byte [total]	; number to draw
234
	movzx	ecx, byte [total]	; number to draw
235
	mcall	47, 0x00020000,,150 * 65536 + 65, 0x224466
235
	mcall	47, 0x00020000,,150 * 65536 + 65, 0x224466
-
 
236
	
-
 
237
	mov	ebx,ecx
-
 
238
	mov	ecx,2
-
 
239
	mov	edi,[store_text_area_start]
-
 
240
	add	edi,157
-
 
241
	push	edi
-
 
242
	call	binary_to_hex_string
-
 
243
	pop	edi
-
 
244
	mov	[edi+2],byte 'h'
236
	
245
	
237
	mov	ah, [MMIO_allowed]
246
	mov	ah, [MMIO_allowed]
238
	or 	ah, ah
247
	or 	ah, ah
239
	jz 	@f
248
	jz 	@f
240
	mov	ah, [MMIO_Bus]	; =255 if MMIO disabled / not found
249
	mov	ah, [MMIO_Bus]	; =255 if MMIO disabled / not found
241
	and	ah, 0x7f
250
	and	ah, 0x7f
242
	inc	ah
251
	inc	ah
243
	jo	@f	
252
	jo	@f	
244
	call	Try_MMIO
253
	call	Try_MMIO
245
@@:
254
@@:
246
	mcall	12, 2			; end of draw
255
	mcall	12, 2			; end of draw
247
	ret
256
	ret
248
;-----------------------------------------------------------------------------
257
;-----------------------------------------------------------------------------
249
store_data:
258
store_data:
250
	mov	eax,[store_text_area_start]
259
	mov	eax,[store_text_area_start]
251
	mov	[fileinfo.return],eax
260
	mov	[fileinfo.return],eax
252
	mov	ebx,[store_text_area_end]
261
	mov	ebx,[store_text_area_end]
253
	sub	ebx,eax
262
	sub	ebx,eax
254
	inc	ebx
263
	inc	ebx
255
	mov	[fileinfo.size],ebx
264
	mov	[fileinfo.size],ebx
256
	mcall	70,fileinfo
265
	mcall	70,fileinfo
257
	ret
266
	ret
258
;-----------------------------------------------------------------------------
267
;-----------------------------------------------------------------------------
259
;* Gets the PCI Version and Last Bus
268
;* Gets the PCI Version and Last Bus
260
Get_PCI_Info:
269
Get_PCI_Info:
261
	mcall	62, 0
270
	mcall	62, 0
262
	mov	word [PCI_Version], ax
271
	mov	word [PCI_Version], ax
263
	mcall	62, 1
272
	mcall	62, 1
264
	mov	byte [PCI_LastBus], al
273
	mov	byte [PCI_LastBus], al
265
	;----------------------------------------------------------
274
	;----------------------------------------------------------
266
	;* Get all devices on PCI Bus
275
	;* Get all devices on PCI Bus
267
	cmp	al, 0xff		; 0xFF means no pci bus found
276
	cmp	al, 0xff		; 0xFF means no pci bus found
268
	jne	Pci_Exists		;
277
	jne	Pci_Exists		;
269
	ret				; if no bus then leave
278
	ret				; if no bus then leave
270
;-----------------------------------------------------------------------------	
279
;-----------------------------------------------------------------------------	
271
Pci_Exists:
280
Pci_Exists:
272
	mov	byte [V_Bus], 0 	; reset varibles
281
	mov	byte [V_Bus], 0 	; reset varibles
273
	mov	byte [V_Dev], 0 	;
282
	mov	byte [V_Dev], 0 	;
274
	mov	edx,  20 * 65536 + 110	; set start write position
283
	mov	edx,  20 * 65536 + 110	; set start write position
275
Start_Enum:
284
Start_Enum:
276
	mov	bl, 6			; get a dword
285
	mov	bl, 6			; get a dword
277
	mov	bh, byte [V_Bus]	; bus of pci device
286
	mov	bh, byte [V_Bus]	; bus of pci device
278
	mov	ch, byte [V_Dev]	; device number/function
287
	mov	ch, byte [V_Dev]	; device number/function
279
	mov	cl, 0			; offset to device/vendor id
288
	mov	cl, 0			; offset to device/vendor id
280
	mcall	62			; get ID's
289
	mcall	62			; get ID's
281
 
290
 
282
	cmp	ax, 0			; Vendor ID should not be 0 or 0xFFFF
291
	cmp	ax, 0			; Vendor ID should not be 0 or 0xFFFF
283
	je	nextDev 		; check next device if nothing exists here
292
	je	nextDev 		; check next device if nothing exists here
284
	
293
	
285
	cmp	ax, 0xffff		;
294
	cmp	ax, 0xffff		;
286
	je	nextDev 		;
295
	je	nextDev 		;
287
 
296
 
288
	mov	word [PCI_Vendor], ax	; There is a device here, save the ID's
297
	mov	word [PCI_Vendor], ax	; There is a device here, save the ID's
289
	shr	eax, 16 		;
298
	shr	eax, 16 		;
290
	mov	word [PCI_Device], ax	;
299
	mov	word [PCI_Device], ax	;
291
	mov	bl, 4			; Read config byte
300
	mov	bl, 4			; Read config byte
292
	mov	bh, byte [V_Bus]	; Bus #
301
	mov	bh, byte [V_Bus]	; Bus #
293
	mov	ch, byte [V_Dev]	; Device # on bus
302
	mov	ch, byte [V_Dev]	; Device # on bus
294
	mov	cl, 0x08		; Register to read (Get Revision)
303
	mov	cl, 0x08		; Register to read (Get Revision)
295
	mcall	62			; Read it
304
	mcall	62			; Read it
296
	
305
	
297
	mov	byte [PCI_Rev], al	; Save it
306
	mov	byte [PCI_Rev], al	; Save it
298
	mov	cl, 0x0b		; Register to read (Get class)
307
	mov	cl, 0x0b		; Register to read (Get class)
299
	mcall	62			; Read it
308
	mcall	62			; Read it
300
 
309
 
301
	mov	byte [PCI_Class], al	; Save it
310
	mov	byte [PCI_Class], al	; Save it
302
	mov	cl, 0x0a		; Register to read (Get Subclass)
311
	mov	cl, 0x0a		; Register to read (Get Subclass)
303
	mcall	62			; Read it
312
	mcall	62			; Read it
304
	mov	byte [PCI_SubClass], al; Save it
313
	mov	byte [PCI_SubClass], al; Save it
305
; by Mario79 august 2006
314
; by Mario79 august 2006
306
	mov	cl, 0x09		; Register to read (Get Interface)
315
	mov	cl, 0x09		; Register to read (Get Interface)
307
	mcall	62			; Read it
316
	mcall	62			; Read it
308
	
317
	
309
	mov  [PCI_Interface], al	; Save it
318
	mov  [PCI_Interface], al	; Save it
310
;
319
;
311
; by Ghost april 2007
320
; by Ghost april 2007
312
	mov	cl, 0x3c		; Register to read (Get IRQ)
321
	mov	cl, 0x3c		; Register to read (Get IRQ)
313
@@:
322
@@:
314
	mcall	62			; Read it
323
	mcall	62			; Read it
315
	
324
	
316
	mov	[PCI_IRQ], al		; Save it
325
	mov	[PCI_IRQ], al		; Save it
317
; by CleverMouse juny 2011
326
; by CleverMouse juny 2011
318
	mov	cl, 0x0e
327
	mov	cl, 0x0e
319
	mcall	62
328
	mcall	62
320
	
329
	
321
	push	eax
330
	push	eax
322
	inc	byte [total]		; one more device found
331
	inc	byte [total]		; one more device found
323
	call	Print_New_Device	; print device info to screen
332
	call	Print_New_Device	; print device info to screen
324
; don't scan for nonzero functions if zero function says "not multifunction device"
333
; don't scan for nonzero functions if zero function says "not multifunction device"
325
	pop	eax
334
	pop	eax
326
	test	al, al
335
	test	al, al
327
	js	nextDev
336
	js	nextDev
328
	
337
	
329
	test	byte [V_Dev], 7
338
	test	byte [V_Dev], 7
330
	jnz	nextDev
339
	jnz	nextDev
331
	
340
	
332
	or	byte [V_Dev], 7
341
	or	byte [V_Dev], 7
333
nextDev:
342
nextDev:
334
	inc	byte [V_Dev]		; next device on this bus
343
	inc	byte [V_Dev]		; next device on this bus
335
	jnz	Start_Enum		; jump until we reach zero
344
	jnz	Start_Enum		; jump until we reach zero
336
	;(used to be JNO which caused bug!!! 30-4-2006, JMD)
345
	;(used to be JNO which caused bug!!! 30-4-2006, JMD)
337
	mov	byte [V_Dev], 0 	; reset device number
346
	mov	byte [V_Dev], 0 	; reset device number
338
	inc	byte [V_Bus]		; next bus
347
	inc	byte [V_Bus]		; next bus
339
	mov	al, byte [PCI_LastBus]	; get last bus
348
	mov	al, byte [PCI_LastBus]	; get last bus
340
	cmp	byte [V_Bus], al	; was it last bus
349
	cmp	byte [V_Bus], al	; was it last bus
341
	jbe	Start_Enum		; if not jump to keep searching
350
	jbe	Start_Enum		; if not jump to keep searching
342
	ret
351
	ret
343
;-----------------------------------------------------------------------------
352
;-----------------------------------------------------------------------------
344
no_ummio_allowed:
353
no_ummio_allowed:
345
	xor 	al,al
354
	xor 	al,al
346
	mov 	[MMIO_allowed],al		; re-enter the subroutine
355
	mov 	[MMIO_allowed],al		; re-enter the subroutine
347
;------------------------------------------------------------------
356
;------------------------------------------------------------------
348
;* Print device info to screen
357
;* Print device info to screen
349
 
358
 
350
Print_New_Device:
359
Print_New_Device:
351
	xor 	esi, esi	    	; default text color
360
	xor 	esi, esi	    	; default text color
352
	mov 	cl, [MMIO_allowed]
361
	mov 	cl, [MMIO_allowed]
353
	or	cl,cl
362
	or	cl,cl
354
	jz	no_ummio_here
363
	jz	no_ummio_here
355
	mov 	ch, byte [V_Bus]
364
	mov 	ch, byte [V_Bus]
356
	mov 	cl, byte [V_Dev]
365
	mov 	cl, byte [V_Dev]
357
	mcall	62, 11		; detect uMMIO
366
	mcall	62, 11		; detect uMMIO
358
	
367
	
359
	and	ax,0x7fff
368
	and	ax,0x7fff
360
	inc 	ax			; -1 returned?
369
	inc 	ax			; -1 returned?
361
	jo 	no_ummio_allowed
370
	jo 	no_ummio_allowed
362
	
371
	
363
	inc 	ax			; -2 returned?
372
	inc 	ax			; -2 returned?
364
	jo 	no_ummio_here
373
	jo 	no_ummio_here
365
	
374
	
366
	inc 	ax			; -3 returned?
375
	inc 	ax			; -3 returned?
367
	jo 	no_ummio_here
376
	jo 	no_ummio_here
368
	
377
	
369
	mov 	esi, 0x990033   ; highlighted text color
378
	mov 	esi, 0x990033   ; highlighted text color
370
	mov 	bh, byte [V_Bus]
379
	mov 	bh, byte [V_Bus]
371
	mov 	bl, byte [V_Dev]
380
	mov 	bl, byte [V_Dev]
372
	mov 	byte [MMIO_Bus], bh
381
	mov 	byte [MMIO_Bus], bh
373
	mov 	byte [MMIO_Dev], bl
382
	mov 	byte [MMIO_Dev], bl
374
	add 	bh,'0'
383
	add 	bh,'0'
375
	mov 	[PCIWin + 129], bh	; uMMIO bus
384
	mov 	[PCIWin + 129], bh	; uMMIO bus
376
	mov 	al, bl
385
	mov 	al, bl
377
	shr 	al, 1
386
	shr 	al, 1
378
	shr 	al, 1
387
	shr 	al, 1
379
	shr 	al, 1
388
	shr 	al, 1
380
	add 	al,'0'
389
	add 	al,'0'
381
	mov 	[PCIWin + 131], al	; uMMIO device
390
	mov 	[PCIWin + 131], al	; uMMIO device
382
	and 	bl, 7
391
	and 	bl, 7
383
	add 	bl, '0'
392
	add 	bl, '0'
384
	mov 	[PCIWin + 133], bl	; uMMIO function
393
	mov 	[PCIWin + 133], bl	; uMMIO function
385
 
394
 
386
no_ummio_here:
395
no_ummio_here:
387
	movzx	ecx,word [PCI_Vendor]	; Pointer to number to be written
396
	movzx	ecx,word [PCI_Vendor]	; Pointer to number to be written
388
	mcall	47, 0x00040100		; Write Vendor ID
397
	mcall	47, 0x00040100		; Write Vendor ID
389
	
398
	
390
	call	store_4_digits
399
	call	store_4_digits
391
	
400
	
392
	and	edx, 0xFFFF		;*****************************************
401
	and	edx, 0xFFFF		;*****************************************
393
	or	edx, 54 * 65536 ; X start becomes 54
402
	or	edx, 54 * 65536 ; X start becomes 54
394
	movzx	ecx, word [PCI_Device]	; get Vendor ID
403
	movzx	ecx, word [PCI_Device]	; get Vendor ID
395
	mcall				; Draw Vendor ID to Window
404
	mcall				; Draw Vendor ID to Window
396
 
405
 
397
	call	store_4_digits
406
	call	store_4_digits
398
	
407
	
399
	and	edx, 0xFFFF		;*****************************************
408
	and	edx, 0xFFFF		;*****************************************
400
	or	edx, 98 * 65536 ; X start becomes 98
409
	or	edx, 98 * 65536 ; X start becomes 98
401
	movzx	ecx, byte [V_Bus]	; get bus number
410
	movzx	ecx, byte [V_Bus]	; get bus number
402
	mcall	,0x00020100		; draw bus number to screen
411
	mcall	,0x00020100		; draw bus number to screen
403
 
412
 
404
	call	store_2_digits
413
	call	store_2_digits
405
	
414
	
406
	and	edx, 0xFFFF		;*****************************************
415
	and	edx, 0xFFFF		;*****************************************
407
	or	edx, 128 * 65536	; X start becomes 128
416
	or	edx, 128 * 65536	; X start becomes 128
408
	movzx	ecx, byte [V_Dev]	; get device number
417
	movzx	ecx, byte [V_Dev]	; get device number
409
	shr	ecx, 3			; device number is bits 3-7
418
	shr	ecx, 3			; device number is bits 3-7
410
	mcall				; Draw device Number To Window
419
	mcall				; Draw device Number To Window
411
 
420
 
412
	call	store_2_digits
421
	call	store_2_digits
413
	
422
	
414
	and	edx, 0xFFFF		;*****************************************
423
	and	edx, 0xFFFF		;*****************************************
415
	or	edx, 155 * 65536	; X start becomes 155
424
	or	edx, 155 * 65536	; X start becomes 155
416
	movzx	ecx, byte [V_Dev]	; get Function number
425
	movzx	ecx, byte [V_Dev]	; get Function number
417
	and	ecx, 7			; function is first 3 bits
426
	and	ecx, 7			; function is first 3 bits
418
	mcall				; Draw Function Number To Window
427
	mcall				; Draw Function Number To Window
419
	
428
	
420
	call	store_2_digits
429
	call	store_2_digits
421
	
430
	
422
	and	edx, 0xFFFF		;*****************************************
431
	and	edx, 0xFFFF		;*****************************************
423
	or	edx, 179 * 65536	; X start becomes 179
432
	or	edx, 179 * 65536	; X start becomes 179
424
	movzx	ecx, byte [PCI_Rev]	; get revision number
433
	movzx	ecx, byte [PCI_Rev]	; get revision number
425
	mcall				; Draw Revision to screen
434
	mcall				; Draw Revision to screen
426
	
435
	
427
	call	store_2_digits
436
	call	store_2_digits
428
	
437
	
429
	and	edx, 0xFFFF		;*****************************************
438
	and	edx, 0xFFFF		;*****************************************
430
	or	edx, 215*65536		; X start becomes 215
439
	or	edx, 215*65536		; X start becomes 215
431
	movzx	ecx, byte [PCI_Class]	; get PCI_Class
440
	movzx	ecx, byte [PCI_Class]	; get PCI_Class
432
	mcall				; Draw Class to screen
441
	mcall				; Draw Class to screen
433
	
442
	
434
	call	store_2_digits
443
	call	store_2_digits
435
	
444
	
436
	and	edx, 0xFFFF		;*****************************************
445
	and	edx, 0xFFFF		;*****************************************
437
	or	edx, 250*65536		; X start becomes 250
446
	or	edx, 250*65536		; X start becomes 250
438
	movzx	ecx, byte [PCI_SubClass]; get sub class
447
	movzx	ecx, byte [PCI_SubClass]; get sub class
439
	mcall				; Draw Sub Class to screen
448
	mcall				; Draw Sub Class to screen
440
	
449
	
441
	call	store_2_digits
450
	call	store_2_digits
442
	
451
	
443
; from Mario79 august 2006
452
; from Mario79 august 2006
444
	and	edx, 0xFFFF		;*****************************************
453
	and	edx, 0xFFFF		;*****************************************
445
	or	edx, 280 * 65536	; X start becomes 280
454
	or	edx, 280 * 65536	; X start becomes 280
446
	movzx	ecx, [PCI_Interface]	; get Interface
455
	movzx	ecx, [PCI_Interface]	; get Interface
447
	mcall
456
	mcall
448
	
457
	
449
	call	store_2_digits
458
	call	store_2_digits
450
	
459
	
451
;
460
;
452
; from Ghost april 2007                 ;*****************************************
461
; from Ghost april 2007                 ;*****************************************
453
	and	edx, 0xFFFF
462
	and	edx, 0xFFFF
454
	or	edx, 310 * 65536	; X start becomes 310
463
	or	edx, 310 * 65536	; X start becomes 310
455
	movzx	ecx, [PCI_IRQ]		; get Interface
464
	movzx	ecx, [PCI_IRQ]		; get Interface
456
	cmp	cl, 0x0f		; IRQ between 0..15
465
	cmp	cl, 0x0f		; IRQ between 0..15
457
	ja	@f
466
	ja	@f
458
 
467
 
459
	mcall
468
	mcall
460
 
469
 
461
	call	store_2_digits
470
	call	store_2_digits
462
	jmp	.PCI_Vendor
471
	jmp	.PCI_Vendor
463
@@:	
472
@@:	
464
	call	store_NA
473
	call	store_NA
465
.PCI_Vendor:
474
.PCI_Vendor:
466
	;Write Names
475
	;Write Names
467
	movzx	ebx, dx 	; Set y position
476
	movzx	ebx, dx 	; Set y position
468
	or	ebx, 340 * 65536	; set Xposition to 340
477
	or	ebx, 340 * 65536	; set Xposition to 340
469
 
478
 
470
;------------------------------------------------------------------
479
;------------------------------------------------------------------
471
; Prints the Vendor's Name based on Vendor ID
480
; Prints the Vendor's Name based on Vendor ID
472
;
481
;
473
; Modified on ??-04-2007 by Ghost for size
482
; Modified on ??-04-2007 by Ghost for size
474
;------------------------------------------------------------------
483
;------------------------------------------------------------------
475
	mov	edx, VendorsTab
484
	mov	edx, VendorsTab
476
	mov	cx, word[PCI_Vendor]
485
	mov	cx, word[PCI_Vendor]
477
 
486
 
478
.fn:
487
.fn:
479
	mov	ax, [edx]
488
	mov	ax, [edx]
480
	add	edx, 6
489
	add	edx, 6
481
	test	ax, ax
490
	test	ax, ax
482
	jz	.find
491
	jz	.find
483
	
492
	
484
	cmp	ax, cx
493
	cmp	ax, cx
485
	jne	.fn
494
	jne	.fn
486
	
495
	
487
.find:
496
.find:
488
	mov	edx, [edx - 4]
497
	mov	edx, [edx - 4]
489
	mcall	4,, 0x80000000		; lets print the vendor Name
498
	mcall	4,, 0x80000000		; lets print the vendor Name
490
	
499
	
491
	mov	[store_text_size],42
500
	mov	[store_text_size],42
492
	call	store_text
501
	call	store_text
493
;------------------------------------------------------------------
502
;------------------------------------------------------------------
494
; Get description based on Class/Subclass
503
; Get description based on Class/Subclass
495
;
504
;
496
; Modified on ??-04-2007 by Ghost for size
505
; Modified on ??-04-2007 by Ghost for size
497
;------------------------------------------------------------------
506
;------------------------------------------------------------------
498
	mov	eax, dword [PCI_Class]
507
	mov	eax, dword [PCI_Class]
499
	and	eax, 0xffffff
508
	and	eax, 0xffffff
500
	xor	edx, edx
509
	xor	edx, edx
501
	xor	esi, esi
510
	xor	esi, esi
502
.fnc:
511
.fnc:
503
	inc	esi
512
	inc	esi
504
	mov	ecx, [Classes + esi * 8 - 8]
513
	mov	ecx, [Classes + esi * 8 - 8]
505
	cmp	cx, 0xffff
514
	cmp	cx, 0xffff
506
	je	.endfc
515
	je	.endfc
507
	
516
	
508
	cmp	cx, ax
517
	cmp	cx, ax
509
	jne	.fnc
518
	jne	.fnc
510
	
519
	
511
	test	ecx, 0xff000000
520
	test	ecx, 0xff000000
512
	jz	@f
521
	jz	@f
513
	
522
	
514
	mov	edx, [Classes + esi * 8 - 4]
523
	mov	edx, [Classes + esi * 8 - 4]
515
	jmp	.fnc
524
	jmp	.fnc
516
@@:
525
@@:
517
	cmp	eax, ecx
526
	cmp	eax, ecx
518
	jne	.fnc
527
	jne	.fnc
519
	
528
	
520
	xor	edx, edx
529
	xor	edx, edx
521
.endfc:
530
.endfc:
522
	test	edx, edx
531
	test	edx, edx
523
	jnz	@f
532
	jnz	@f
524
	
533
	
525
	mov	edx, [Classes + esi * 8 - 4]
534
	mov	edx, [Classes + esi * 8 - 4]
526
@@:
535
@@:
527
	and	ebx, 0x0000FFFF 	; clear X position
536
	and	ebx, 0x0000FFFF 	; clear X position
528
	or	ebx, 0x24E0000		; set X position to 590 pixels
537
	or	ebx, 0x24E0000		; set X position to 590 pixels
529
	mcall	4,, 0x80000000,, 32	; draw the text
538
	mcall	4,, 0x80000000,, 32	; draw the text
530
	
539
	
531
	mov	[store_text_size],0
540
	mov	[store_text_size],0
532
	call	store_text
541
	call	store_text
533
	call	store_CR
542
	call	store_CR
534
	
543
	
535
	movzx	edx, bx 	; get y coordinate
544
	movzx	edx, bx 	; get y coordinate
536
	add	edx, 0x0014000A 	; add 10 to y coordinate and set x coordinate to 20
545
	add	edx, 0x0014000A 	; add 10 to y coordinate and set x coordinate to 20
537
	mov	[gr_pos], edx
546
	mov	[gr_pos], edx
538
	ret
547
	ret
539
;------------------------------------------------------------------
548
;------------------------------------------------------------------
540
; Get the user-MMIO related info
549
; Get the user-MMIO related info
541
;
550
;
542
; Added on ??-12-2009 by art_zh
551
; Added on ??-12-2009 by art_zh
543
;------------------------------------------------------------------
552
;------------------------------------------------------------------
544
Try_MMIO:
553
Try_MMIO:
545
	xor	ebx, ebx
554
	xor	ebx, ebx
546
	mov	edx, ebx
555
	mov	edx, ebx
547
	mov	bh, [MMIO_BAR]
556
	mov	bh, [MMIO_BAR]
548
	or	bx, 12			; function 12
557
	or	bx, 12			; function 12
549
	mov	ecx, 4096		; =1 page to map
558
	mov	ecx, 4096		; =1 page to map
550
	mcall	62
559
	mcall	62
551
	
560
	
552
	mov	[MMIO_Map], eax 	; store MMIO lin.addr.
561
	mov	[MMIO_Map], eax 	; store MMIO lin.addr.
553
	mov	ecx, 0x80990022 	; print color : red
562
	mov	ecx, 0x80990022 	; print color : red
554
	add	bh, '0'
563
	add	bh, '0'
555
	cmp	eax, -3
564
	cmp	eax, -3
556
	jne	@f
565
	jne	@f
557
	
566
	
558
	mov	[bar_um+3], bh
567
	mov	[bar_um+3], bh
559
	mov	ebx, [gr_pos]
568
	mov	ebx, [gr_pos]
560
	mov	edx, bar_um
569
	mov	edx, bar_um
561
	mcall	4
570
	mcall	4
562
	
571
	
563
	jmp	mmio_next_bar
572
	jmp	mmio_next_bar
564
@@:
573
@@:
565
	cmp	eax, -4
574
	cmp	eax, -4
566
	jne	@f
575
	jne	@f
567
	mov	[bar_io+3], bh
576
	mov	[bar_io+3], bh
568
	mov	ebx, [gr_pos]
577
	mov	ebx, [gr_pos]
569
	mov	edx, bar_io
578
	mov	edx, bar_io
570
	mcall	4
579
	mcall	4
571
	
580
	
572
	jmp	mmio_next_bar
581
	jmp	mmio_next_bar
573
@@:
582
@@:
574
	cmp	bh, '6' 	; expansion ROM ?
583
	cmp	bh, '6' 	; expansion ROM ?
575
	je	@f
584
	je	@f
576
	mov	[bar_ram+3], bh
585
	mov	[bar_ram+3], bh
577
	mov	ebx, [gr_pos]
586
	mov	ebx, [gr_pos]
578
	mov	edx, bar_ram
587
	mov	edx, bar_ram
579
	mcall	4
588
	mcall	4
580
	
589
	
581
	jmp	mmio_dump
590
	jmp	mmio_dump
582
;-----------------------------------------------------------------------------
591
;-----------------------------------------------------------------------------
583
@@:
592
@@:
584
	mov	ebx, [gr_pos]
593
	mov	ebx, [gr_pos]
585
	mov	edx, bar_rom
594
	mov	edx, bar_rom
586
	mcall	4
595
	mcall	4
587
 
596
 
588
mmio_dump:
597
mmio_dump:
589
	mov	edx, [MMIO_Map]
598
	mov	edx, [MMIO_Map]
590
	mov	esi, 64
599
	mov	esi, 64
591
	mov	ecx, 0x099		; dump color : blue
600
	mov	ecx, 0x099		; dump color : blue
592
	add	ebx, 10
601
	add	ebx, 10
593
	mov	[gr_pos], ebx
602
	mov	[gr_pos], ebx
594
	mcall	4
603
	mcall	4
595
	
604
	
596
	mov	ecx, [MMIO_Map] 	; release the tried page
605
	mov	ecx, [MMIO_Map] 	; release the tried page
597
	mcall	62,13
606
	mcall	62,13
598
 
607
 
599
mmio_next_bar:
608
mmio_next_bar:
600
	mov	bh, [MMIO_BAR]
609
	mov	bh, [MMIO_BAR]
601
	inc	bh
610
	inc	bh
602
	cmp	bh,7
611
	cmp	bh,7
603
	je	@f
612
	je	@f
604
	
613
	
605
	mov	[MMIO_BAR], bh
614
	mov	[MMIO_BAR], bh
606
	add	[gr_pos], 10
615
	add	[gr_pos], 10
607
	jmp	Try_MMIO
616
	jmp	Try_MMIO
608
;-----------------------------------------------------------------------------
617
;-----------------------------------------------------------------------------
609
@@:
618
@@:
610
	xor	bh,bh
619
	xor	bh,bh
611
	mov	[MMIO_BAR], bh
620
	mov	[MMIO_BAR], bh
612
	ret
621
	ret
613
;-----------------------------------------------------------------------------
622
;-----------------------------------------------------------------------------
614
store_CR:
623
store_CR:
615
	pusha
624
	pusha
616
	mov	edi,[store_text_area_end]
625
	mov	edi,[store_text_area_end]
617
	mov	[edi],word 0A20h ; CR (carriage return) + SPACE
626
	mov	[edi],word 0A20h ; CR (carriage return) + SPACE
618
	add	dword [store_text_area_end],2
627
	add	dword [store_text_area_end],2
619
	popa
628
	popa
620
	ret	
629
	ret	
621
;-----------------------------------------------------------------------------
630
;-----------------------------------------------------------------------------
622
store_text:
631
store_text:
623
	pusha
632
	pusha
624
	inc	dword [store_text_area_end]
633
	inc	dword [store_text_area_end]
625
	mov	esi,edx	
634
	mov	esi,edx	
626
	mov	edi,[store_text_area_end]
635
	mov	edi,[store_text_area_end]
627
	push	edi
636
	push	edi
628
	xor	eax,eax
637
	xor	eax,eax
629
	cld
638
	cld
630
@@:
639
@@:
631
	lodsb
640
	lodsb
632
	test	eax,eax
641
	test	eax,eax
633
	jz	@f
642
	jz	@f
634
	stosb
643
	stosb
635
	inc	dword [store_text_area_end]
644
	inc	dword [store_text_area_end]
636
	jmp	@r
645
	jmp	@r
637
@@:
646
@@:
638
	pop	esi
647
	pop	esi
639
	mov	eax,[store_text_size]
648
	mov	eax,[store_text_size]
640
	test	eax,eax
649
	test	eax,eax
641
	jz	@f
650
	jz	@f
642
	sub	edi,esi
651
	sub	edi,esi
643
	sub	eax,edi
652
	sub	eax,edi
644
	add	[store_text_area_end],eax
653
	add	[store_text_area_end],eax
645
@@:
654
@@:
646
	popa
655
	popa
647
	ret	
656
	ret	
648
;-----------------------------------------------------------------------------
657
;-----------------------------------------------------------------------------
649
store_NA:
658
store_NA:
650
	pusha
659
	pusha
651
	mov	ebx,edx
660
	mov	ebx,edx
652
	mcall	4,,0x80000000,text_NA
661
	mcall	4,,0x80000000,text_NA
653
	mov	edi,[store_text_area_end]
662
	mov	edi,[store_text_area_end]
654
	mov	ax,[edx]
663
	mov	ax,[edx]
655
	mov	[edi+1],ax
664
	mov	[edi+1],ax
656
	jmp	store_2_digits.1
665
	add	[store_text_area_end],dword 5
-
 
666
	popa
-
 
667
	ret
657
;-----------------------------------------------------------------------------
668
;-----------------------------------------------------------------------------
658
store_2_digits:
669
store_2_digits:
659
	pusha
670
	pusha
660
	inc	[store_text_area_end]
671
	inc	[store_text_area_end]
661
	mov	ebx,ecx
672
	mov	ebx,ecx
662
	mov	ecx,2
673
	mov	ecx,2
663
	mov	edi,[store_text_area_end]
674
	mov	edi,[store_text_area_end]
664
	call	binary_to_hex_string
675
	call	binary_to_hex_string
665
.1:
-
 
666
	add	[store_text_area_end],dword 4
676
	add	[store_text_area_end],dword 4
667
	popa
677
	popa
668
	ret
678
	ret
669
;-----------------------------------------------------------------------------
679
;-----------------------------------------------------------------------------
670
store_4_digits:
680
store_4_digits:
671
	pusha
681
	pusha
672
	mov	ebx,ecx
682
	mov	ebx,ecx
673
	mov	ecx,4
683
	mov	ecx,4
674
	mov	edi,[store_text_area_end]
684
	mov	edi,[store_text_area_end]
675
	call	binary_to_hex_string
685
	call	binary_to_hex_string
676
	add	[store_text_area_end],dword 6
686
	add	[store_text_area_end],dword 6
677
	popa
687
	popa
678
	ret
688
	ret
679
;-----------------------------------------------------------------------------
689
;-----------------------------------------------------------------------------
680
; ebx - value
690
; ebx - value
681
; ecx - digits
691
; ecx - digits
682
; edi - output string
692
; edi - output string
683
binary_to_hex_string:
693
binary_to_hex_string:
684
	add	edi,ecx
694
	add	edi,ecx
685
	dec	edi
695
	dec	edi
686
	std
696
	std
687
.1:
697
.1:
688
	mov	al,bl
698
	mov	al,bl
689
	and	al,0xf
699
	and	al,0xf
690
	shr	ebx,4
700
	shr	ebx,4
691
	cmp	al,9
701
	cmp	al,9
692
	jbe	@f
702
	jbe	@f
693
 
703
 
694
	add	al,0x27
704
	add	al,0x27
695
@@:
705
@@:
696
	add	al,0x30
706
	add	al,0x30
697
	stosb
707
	stosb
698
	dec	ecx
708
	dec	ecx
699
	jnz	.1
709
	jnz	.1
700
	cld
710
	cld
701
	ret
711
	ret
702
;-----------------------------------------------------------------------------
712
;-----------------------------------------------------------------------------
703
include 'vendors.inc'
713
include 'vendors.inc'
704
;-----------------------------------------------------------------------------
714
;-----------------------------------------------------------------------------
705
; DATA AREA
715
; DATA AREA
706
DATA
716
DATA
707
 
717
 
708
Form:	dw 800 ; window width (no more, special for 800x600)
718
Form:	dw 800 ; window width (no more, special for 800x600)
709
	dw 100 ; window x start
719
	dw 100 ; window x start
710
	dw 620 ; window height
720
	dw 620 ; window height
711
	dw 20 ; window y start
721
	dw 20 ; window y start
712
 
722
 
713
title	db 'PCI Device Enumerator v 2.3', 0
723
title	db 'PCI Device Enumerator v 2.3', 0
714
 
724
 
715
PCIWin mls \
725
PCIWin mls \
716
	'   Don`t forget to enable PCI Access to Applications in Setup Menu.',\
726
	'   Don`t forget to enable PCI Access to Applications in Setup Menu.',\
717
	'',\
727
	'',\
718
	'PCI Version  = x.xx; Last PCI Bus = x',\
728
	'PCI Version  = x.xx; Last PCI Bus = x',\
719
	'User MMIO channel = 0F.F:F ',\
729
	'User MMIO channel = 0F.F:F ',\
720
	'Number of PCI units =',\
730
	'Number of PCI units =    ',\
721
	'',\
731
	'',\
722
	'VenID DevID Bus# Dev# Fnc Rev  Class  Subclass/ IRQ                 Company                      Description',\
732
	'VenID DevID Bus# Dev# Fnc Rev  Class  Subclass/ IRQ                 Company                      Description',\
723
	'                                      Interface',\
733
	'                                      Interface',\
724
	'----- ----- ---- ---- --- ---  -----  --------- --- ------------------------------------------ --------------------------------'
734
	'----- ----- ---- ---- --- ---  -----  --------- --- ------------------------------------------ --------------------------------'
725
 
735
 
726
bar_ram db 'BARx: MMIO block', 0
736
bar_ram db 'BARx: MMIO block', 0
727
bar_io	db 'BARx: IO ports',0
737
bar_io	db 'BARx: IO ports',0
728
bar_um	db 'BARx: unmapped',0
738
bar_um	db 'BARx: unmapped',0
729
bar_rom db 'BAR6: Expansion ROM', 0
739
bar_rom db 'BAR6: Expansion ROM', 0
730
 
740
 
731
text_save_button:
741
text_save_button:
732
	db 'Save PCI list',0
742
	db 'Save PCI list',0
733
.1:	db '(Press S key)',0
743
.1:	db '(Press S key)',0
734
 
744
 
735
text_NA:
745
text_NA:
736
	db 'NA',0
746
	db '--',0
737
;---------------------------------------------------------------------
747
;---------------------------------------------------------------------
738
system_dir_ProcLib	db '/sys/lib/proc_lib.obj',0
748
system_dir_ProcLib	db '/sys/lib/proc_lib.obj',0
739
 
749
 
740
err_message_found_lib2	db 'proc_lib.obj - Not found!',0
750
err_message_found_lib2	db 'proc_lib.obj - Not found!',0
741
 
751
 
742
err_message_import2	db 'proc_lib.obj - Wrong import!',0
752
err_message_import2	db 'proc_lib.obj - Wrong import!',0
743
 
753
 
744
head_f_i:
754
head_f_i:
745
head_f_l	db 'error',0
755
head_f_l	db 'error',0
746
;---------------------------------------------------------------------
756
;---------------------------------------------------------------------
747
l_libs_start:
757
l_libs_start:
748
 
758
 
749
library02  l_libs system_dir_ProcLib+9, path, library_path, system_dir_ProcLib, \
759
library02  l_libs system_dir_ProcLib+9, path, library_path, system_dir_ProcLib, \
750
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
760
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
751
 
761
 
752
end_l_libs:
762
end_l_libs:
753
;---------------------------------------------------------------------
763
;---------------------------------------------------------------------
754
align 4
764
align 4
755
ProcLib_import:
765
ProcLib_import:
756
OpenDialog_Init		dd aOpenDialog_Init
766
OpenDialog_Init		dd aOpenDialog_Init
757
OpenDialog_Start	dd aOpenDialog_Start
767
OpenDialog_Start	dd aOpenDialog_Start
758
;OpenDialog__Version	dd aOpenDialog_Version
768
;OpenDialog__Version	dd aOpenDialog_Version
759
        dd      0
769
        dd      0
760
        dd      0
770
        dd      0
761
aOpenDialog_Init	db 'OpenDialog_init',0
771
aOpenDialog_Init	db 'OpenDialog_init',0
762
aOpenDialog_Start	db 'OpenDialog_start',0
772
aOpenDialog_Start	db 'OpenDialog_start',0
763
;aOpenDialog_Version	db 'Version_OpenDialog',0
773
;aOpenDialog_Version	db 'Version_OpenDialog',0
764
;---------------------------------------------------------------------
774
;---------------------------------------------------------------------
765
align 4
775
align 4
766
OpenDialog_data:
776
OpenDialog_data:
767
.type			dd 0
777
.type			dd 0
768
.procinfo		dd Proc_Info	;+4
778
.procinfo		dd Proc_Info	;+4
769
.com_area_name		dd communication_area_name	;+8
779
.com_area_name		dd communication_area_name	;+8
770
.com_area		dd 0	;+12
780
.com_area		dd 0	;+12
771
.opendir_pach		dd temp_dir_pach	;+16
781
.opendir_pach		dd temp_dir_pach	;+16
772
.dir_default_pach	dd communication_area_default_pach	;+20
782
.dir_default_pach	dd communication_area_default_pach	;+20
773
.start_path		dd open_dialog_path	;+24
783
.start_path		dd open_dialog_path	;+24
774
.draw_window		dd draw_window	;+28
784
.draw_window		dd draw_window	;+28
775
.status			dd 0	;+32
785
.status			dd 0	;+32
776
.openfile_pach 		dd file_name	;+36
786
.openfile_pach 		dd file_name	;+36
777
.filename_area		dd filename_area	;+40
787
.filename_area		dd filename_area	;+40
778
.filter_area		dd Filter
788
.filter_area		dd Filter
779
.x:
789
.x:
780
.x_size			dw 420 ;+48 ; Window X size
790
.x_size			dw 420 ;+48 ; Window X size
781
.x_start		dw 10 ;+50 ; Window X position
791
.x_start		dw 10 ;+50 ; Window X position
782
.y:
792
.y:
783
.y_size			dw 320 ;+52 ; Window y size
793
.y_size			dw 320 ;+52 ; Window y size
784
.y_start		dw 10 ;+54 ; Window Y position
794
.y_start		dw 10 ;+54 ; Window Y position
785
 
795
 
786
communication_area_name:
796
communication_area_name:
787
	db 'FFFFFFFF_open_dialog',0
797
	db 'FFFFFFFF_open_dialog',0
788
open_dialog_path:
798
open_dialog_path:
789
	db '/sys/File Managers/opendial',0
799
	db '/sys/File Managers/opendial',0
790
communication_area_default_pach:
800
communication_area_default_pach:
791
	db '/sys',0
801
	db '/sys',0
792
Filter:
802
Filter:
793
dd	Filter.end - Filter.1
803
dd	Filter.end - Filter.1
794
.1:
804
.1:
795
db	'TXT',0
805
db	'TXT',0
796
db	'LOG',0
806
db	'LOG',0
797
.end:
807
.end:
798
dd	0
808
dd	0
799
 
809
 
800
file_default_path:
810
file_default_path:
801
	db '/sys/'
811
	db '/sys/'
802
start_temp_file_name:	
812
start_temp_file_name:	
803
	db 'pcidev.txt',0
813
	db 'pcidev.txt',0
804
;---------------------------------------------------------------------
814
;---------------------------------------------------------------------
805
align	4
815
align	4
806
fileinfo:
816
fileinfo:
807
.subfunction	dd 2
817
.subfunction	dd 2
808
.Offset		dd 0
818
.Offset		dd 0
809
.Offset_1	dd 0
819
.Offset_1	dd 0
810
.size		dd 4096
820
.size		dd 4096
811
.return		dd 0
821
.return		dd 0
812
		db 0
822
		db 0
813
.name:		dd file_name
823
.name:		dd file_name
814
;-----------------------------------------------------------------------------
824
;-----------------------------------------------------------------------------
815
 
825
 
816
; UNINITIALIZED DATA AREA
826
; UNINITIALIZED DATA AREA
817
IM_END:
827
IM_END:
818
total		db ?
828
total		db ?
819
V_Bus		db ?
829
V_Bus		db ?
820
V_Dev		db ?
830
V_Dev		db ?
821
PCI_Version	dw ?
831
PCI_Version	dw ?
822
PCI_LastBus	db ?
832
PCI_LastBus	db ?
823
PCI_Device	dw ?
833
PCI_Device	dw ?
824
PCI_Vendor	dw ?
834
PCI_Vendor	dw ?
825
PCI_Bus 	db ?
835
PCI_Bus 	db ?
826
PCI_Dev 	db ?
836
PCI_Dev 	db ?
827
PCI_Rev 	db ?
837
PCI_Rev 	db ?
828
; don`t change order!!!
838
; don`t change order!!!
829
PCI_Class	db ?
839
PCI_Class	db ?
830
PCI_SubClass	db ?
840
PCI_SubClass	db ?
831
PCI_Interface	db ?
841
PCI_Interface	db ?
832
PCI_IRQ 	db ?
842
PCI_IRQ 	db ?
833
 
843
 
834
align 4
844
align 4
835
MMIO_Bus	db 255
845
MMIO_Bus	db 255
836
MMIO_Dev	db 255
846
MMIO_Dev	db 255
837
MMIO_BAR	db 0
847
MMIO_BAR	db 0
838
MMIO_allowed	db 1
848
MMIO_allowed	db 1
839
MMIO_Map	rd 8
849
MMIO_Map	rd 8
840
 
850
 
841
gr_pos		dd ?
851
gr_pos		dd ?
842
 
852
 
843
store_text_area_start	dd ?
853
store_text_area_start	dd ?
844
store_text_area_end	dd ?
854
store_text_area_end	dd ?
845
store_text_size		dd ?
855
store_text_size		dd ?
846
 
856
 
847
extended_key 	rb 1
857
extended_key 	rb 1
848
;---------------------------------------------------------------------
858
;---------------------------------------------------------------------
849
library_path:
859
library_path:
850
	rb 4096
860
	rb 4096
851
;---------------------------------------------------------------------
861
;---------------------------------------------------------------------
852
path:
862
path:
853
	rb 4096
863
	rb 4096
854
;---------------------------------------------------------------------
864
;---------------------------------------------------------------------
855
temp_dir_pach:
865
temp_dir_pach:
856
	rb 4096
866
	rb 4096
857
;---------------------------------------------------------------------
867
;---------------------------------------------------------------------
858
file_name:
868
file_name:
859
	rb 4096
869
	rb 4096
860
;---------------------------------------------------------------------
870
;---------------------------------------------------------------------
861
file_name_1:
871
file_name_1:
862
	rb 4096
872
	rb 4096
863
;---------------------------------------------------------------------
873
;---------------------------------------------------------------------
864
filename_area:
874
filename_area:
865
	rb 256
875
	rb 256
866
;---------------------------------------------------------------------
876
;---------------------------------------------------------------------
867
	rb 4096
877
	rb 4096
868
stacktop:
878
stacktop:
869
;---------------------------------------------------------------------
879
;---------------------------------------------------------------------
870
Proc_Info	process_information
880
Proc_Info	process_information
871
;---------------------------------------------------------------------
881
;---------------------------------------------------------------------
872
I_END:
882
I_END:
873
;-----------------------------------------------------------------------------
883
;-----------------------------------------------------------------------------