中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-01 18:38
48,037 主题排行 / 350,122 发帖 / 今日 2 篇 / 48,249 会员排行
DOS开发编程 & 发展交流 (开发室) » dos下如阿检测pci设备?
可打印版本  1,465 / 2
第1楼 zhgwbzhd 发表于 2006-03-29 10:50
高级用户 发帖 187 积分 506
dos下如阿检测pci设备?
并且知道他是什么设备???谢谢。
第2楼 Kinglion 发表于 2006-04-07 04:21
铂金会员 发帖 1,924 积分 5,798 来自 金獅電腦軟體工作室
DOs下汇编实现PCI 扫瞄 SourceCode
---http://www.cn-dos.net/forum/viewthread.php?tid=8329&fpage=6

.model small,c

.386

.data
message1 db '---------------------------------------------------',13,10
db 'Index Bus. Dev. func. DeviceID VendorID DeviceType',13,10
db '---------------------------------------------------',13,10
db '$'
return db 13,10,'$'
moreMessage db 'press any key for more .',13,10,'$'
bus db 00h
dev db 00h
func db 00h
bcode db 00h
Lindex db 00h

bc00 db 'Device built before Define BC','$'
bc01 db 'Mass Storage Controller','$'
bc02 db 'Network Controller','$'
bc03 db 'Display Controller','$'
bc04 db 'Mutimedia device','$'
bc05 db 'Memory Controller','$'
bc06 db 'Bridge device','$'
bc07 db 'Simple communication controllers','$'
bc08 db 'Base system peripherals','$'
bc09 db 'Input devices','$'
bc0a db 'Docking stations','$'
bc0b db 'Processors','$'
bc0c db 'Serial bus controllers','$'
bc0d db 'Wireless controller','$'
bc0e db 'Intelligent I/O controllers','$'
bc0f db 'Satellite communication controllers','$'
bc10 db 'Encryption/Decryption controllers','$'
bc11 db 'Data acquisition and signal processing controllers','$'
BCTable label byte
dw offset bc00
dw offset bc01
dw offset bc02
dw offset bc03
dw offset bc04
dw offset bc05
dw offset bc06
dw offset bc07
dw offset bc08
dw offset bc09
dw offset bc0a
dw offset bc0b
dw offset bc0c
.stack

.code

;--------------------------------------------------------------------
;Display space
;
;Input : None
;Output : None
;--------------------------------------------------------------------

Disp_spc proc

push dx
push ax

mov dl,20h
mov ah,2
int 21h
pop ax
pop dx

ret
Disp_spc endp


;--------------------------------------------------------------------
;Display the character '0'~'9' and 'A'~'F'
;
;Input : DL = Number
;Ouput : None
;--------------------------------------------------------------------

Disp_chr proc

push dx
push ax

cmp dl,10
jns letter
add dl,30h
jmp down
letter:
add dl,37h
down:
mov ah,2
int 21h
pop ax
pop dx

ret
Disp_chr endp

;--------------------------------------------------------------------
;Display the Bus number,Device number and Function number
;
;Input : EBX = Bus#, Dev#, Func#
;Output : None
;--------------------------------------------------------------------

Disp_add proc


;;;;;;Display Bus Number
rol ebx,16
mov dl,bl
and dl,0fh
call Disp_chr
call Disp_spc
call Disp_spc
call Disp_spc
call Disp_spc

;;;;;;Display Device Number
;;;;;;Display the high 1 bit
rol ebx,1
mov dl,bl
and dl,1
call Disp_chr
;;;;;;Display the low 4 bits
rol ebx,4
mov dl,bl
and dl,0fh
call Disp_chr
call Disp_spc
call Disp_spc
call Disp_spc
call Disp_spc

;;;;;;Display Function Number
rol ebx,3
mov dl,bl
and dl,7
call Disp_chr
call Disp_spc
call Disp_spc
call Disp_spc
call Disp_spc


ret

Disp_add endp
;------------------------------------
disp_sp proc
push cx

mov cl,4
p: rol eax,4
mov dl,al
and dl,0fh
call disp_chr

dec cl
jnz p
call disp_spc
call disp_spc
call disp_spc
call disp_spc
call disp_spc

pop cx

ret
disp_sp endp
;----------------------------------------------
disp_sd proc
push cx
mov cl,4
rol eax,16
p1: rol eax,4
mov dl,al
and dl,0fh
call disp_chr

dec cl
jnz p1
call disp_spc
call disp_spc


pop cx

ret
disp_sd endp
;---------------------
;-------------------------------------------------------------------
;------------------------------------------------------------
;Start Program Here
;------------------------------------------------------------
Begin:
;;;;;;Display the table head
mov ah,9
mov dx,seg message1
mov ds,dx
mov dx,offset message1
int 21h

;************************************************************
;************************************************************

; Add Scan PCI Code here
;loop1:
loop1:
and eax,00000000h
and ebx,00000000h
mov ah,dev
mov cl,03h
rol ah,cl
add ah,func
mov al,00h ;register num.=00h
mov bx,ax
mov ax,8000h
add al,bus
mov cl,10h
rol eax,cl
add eax,ebx
mov ebx,eax ;save bus#,dev#,func# in ebx
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in eax,dx
cmp ax,0ffffh
; int 3h
jz next2

display:
;;;;;;;;;Get Base ClassCode and save it in bcode memory
push eax
mov eax,ebx
add eax,08h
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in eax,dx

mov cl,08h
rol eax,cl
mov bcode,al

call Disp_spc
call Disp_spc
;;;;;;;;;display the PCI Devices list index
push ax
mov al,Lindex
mov cl,4
rol al,cl
mov dl,al
and dl,0fh
call Disp_chr
rol al,cl
mov dl,al
and dl,0fh
call Disp_chr

;;;;;inc Lindex
inc al
mov Lindex,al

pop ax

call Disp_spc
call Disp_spc
;;;;;;;;;display the bus number, device number , function number
call disp_add
pop eax
push eax
pop eax
push eax
call Disp_spc
call disp_sp
pop eax

call Disp_spc
call disp_sd
;;;;;;Display Base Class Code
push eax
mov al,bcode
sal al,1
mov ah,0
mov si, offset BCTable
add si, ax
mov dx,word ptr ds:
mov ah,09h
int 21h
pop eax
;;;;;;change to a new line
push eax
mov ah,9
mov dx,seg return
mov ds,dx
mov dx,offset return
int 21h
pop eax

;;;;;;;;;;;check the cusor at the bottom of the screen

next2: mov ah,func
inc ah
cmp ah,07h
jg next3
mov func,ah
jmp loop1

next3: mov func,00h
mov ah,dev
inc ah
cmp ah,1fh
jg next4
mov dev,ah
jmp loop1

next4: mov func,00h
mov dev,00h
mov ah,bus
inc ah
cmp ah,0fh
jg N1 ;jz or jg
mov bus,ah
jmp loop1
;************************************************************
;************************************************************

N1: mov ah,4ch
int 21h

end Begin
第3楼 Chearv 发表于 2006-04-26 19:06
初级用户 发帖 15 积分 36
这个程序不错,可惜我太鸟了,看不懂。
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023