The following code scans for all PCI-devices in the system:
loop bus from 0 to lastbus
	loop devfn from 0 to 255
	begin
		mov bl,6
		mov bh,bus
		mov ch,devfn
		mov cl,0	; register address
		mov eax,62
		int 0x40
		test ax,ax
		jz  next
		cmp ax,0xffff
		jz  next
		; we have found a device!
		; eax = (deviceID shl 16) + vendorID
	next:
	end