Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. ;***************************************************************
  2. ; project name:    PCI Device Enumeration
  3. ; target platform: MenuetOS, x86 (IA-32), x86-64 achitectures
  4. ; compiler:        flat assmebler 1.60
  5. ; version:         1.25
  6. ; last update:     2th October 2005
  7. ; maintained by:   Sergey Kuzmin aka Wildwest
  8. ; e-mail:          kuzmin_serg@list.ru
  9. ; project site:    http://coolthemes.narod.ru/pcidev.html
  10. ;***************************************************************
  11. ;Summary: This program will attempt to scan the PCI Bus
  12. ;        and display basic information about each device
  13. ;        connected to the PCI Bus.
  14. ;***************************************************************
  15. ;HISTORY:
  16. ;keep dates in european format (dd/mm/yyyy), please
  17. ; '!' means big changes
  18. ; to-do:
  19. ;PCI version should be normalized (0210->02.10)
  20. ;----------------------------------------------------------------
  21. ;1.25: PCIDEV   02/10/2005
  22. ;Author:    Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
  23. ;Features:  !Description is based on Class and SubClass now (PCI 3.0)
  24. ;           deleted label Descriptions (names of Classes)
  25. ;           names of Classes and SubClasses are in the end of Vendors.inc
  26. ;----------------------------------------------------------------
  27. ;1.20: PCIDEV   16/08/2005
  28. ;Author:    Victor Alberto Gil Hanla a.k.a. vhanla <vhanla@gmail.com>
  29. ;Features: !added many vendor lists (865)
  30. ;           previous version's list deleted
  31. ;           previous Company Name searching and printing changed
  32. ;NOTE:
  33. ;           It was only tested in my old PII Computer,
  34. ;           there might be some bugs... PLZ test it and send comments
  35. ;----------------------------------------------------------------
  36. ;1.15: PCIDEV   03/06/2005
  37. ;Author:    Sergey Kuzmin aka Wildwest <kuzmin_serg@list.ru>
  38. ;Features:  added quantity of devices,
  39. ;         ! detection of Company Name based on Vendor ID,
  40. ;           database of VenID (35 ID's),
  41. ;           macros.inc for smaller size,
  42. ;           interface+(skinned window),
  43. ;           VenID before DevID in 'table'(was DevID before VenID)
  44. ;----------------------------------------------------------------
  45. ;1.0: PCIDEV    30/01/2005
  46. ;Author:    Jason Delozier
  47. ;Features:  able to detect PCI version, quantity of PCI buses,
  48. ;           Vendor&Device ID for appropriate Device on Bus;
  49. ;           detect Revision, Class and Subclass of Device,
  50. ;           and make Description based on Class
  51. ;-------------------------------------------------------------
  52. use32
  53.  
  54.                org    0x0
  55.  
  56.                db     'MENUET01'; 8 byte id
  57.                dd     0x01              ; header version
  58.                dd     START             ; start of code
  59.                dd     I_END             ; size of image
  60.                dd     0xE000    ; memory for app E000
  61.                dd     0xE000    ; esp E000
  62.                dd     0x0 , 0x0 ; I_Param , I_Icon
  63.  
  64. include 'macros.inc'
  65. include 'VENDORS.INC'
  66.  
  67. START:                          ; start of execution
  68.      call draw_window
  69.  
  70. still:
  71.     mov  eax,10                 ; wait here for event
  72.     int  0x40
  73.  
  74.     cmp  eax,1                  ; redraw request ?
  75.     je   red
  76.     cmp  eax,2                  ; key in buffer ?
  77.     je   key
  78.     cmp  eax,3                  ; button in buffer ?
  79.     je   button
  80.  
  81.     jmp  still
  82.  
  83.   red:                          ; redraw
  84.     call draw_window
  85.     jmp  still
  86.   key:                          ; key
  87.     mov  eax,2                  ; just read it and ignore
  88.     int  0x40
  89.     jmp  still
  90.   button:                       ; button
  91.     mov  eax,17                 ; get id
  92.     int  0x40
  93.  
  94.     cmp  ah,1                   ; button id=1 ?
  95.     jne  noclose
  96.  
  97.     mov  eax,-1                 ; close this program
  98.     int  0x40
  99.   noclose:
  100.     jmp  still
  101.  
  102.  
  103.  
  104.  
  105. ;   *********************************************
  106. ;   *******  WINDOW DEFINITIONS AND DRAW ********
  107. ;   *********************************************
  108.  
  109.  
  110. draw_window:
  111.     mov  eax,12                    ; function 12:tell os about windowdraw
  112.     mov  ebx,1                     ; 1, start of draw
  113.     int  0x40
  114.  
  115.                                    ; DRAW WINDOW
  116.     mov  eax,0                     ; function 0 : define and draw window
  117.     mov  ebx,20*65536+750          ; [x start] *65536 + [x size]
  118.     mov  ecx,20*65536+550          ; [y start] *65536 + [y size]
  119.     mov  edx,0x03ffffff            ; color of work area RRGGBB,8->color gl
  120.     mov  esi,0x805080d0            ; color of grab bar  RRGGBB,8->color gl
  121.     mov  edi,0x005080d0            ; color of frames    RRGGBB
  122.     int  0x40
  123.  
  124.                                    ; WINDOW LABEL
  125.     mov  eax,4                     ; function 4 : write text to window
  126.     mov  ebx,8*65536+8             ; [x start] *65536 + [y start]
  127.     mov  ecx,0x10ddeeff            ; font 1 & color ( 0xF0RRGGBB )
  128.     mov  edx,labelt                ; pointer to text beginning
  129.     mov  esi,labellen-labelt       ; text length
  130.     int  0x40
  131.  
  132.     mov [total],0
  133.  
  134.     mov ebx, 20*65536+25           ;Draw work format
  135.     mov ecx, 0x224466
  136.     mov edx, PCIWin
  137.     mov esi, 106 ; lenght of line
  138. newline:
  139.     mov eax, 4
  140.     int 0x40
  141.     add ebx, 10
  142.     add edx, 106  ; lenght of line
  143.     cmp [edx], byte 'x'
  144.     jne newline
  145.  
  146.  
  147.     call Get_PCI_Info
  148.  
  149.     mov cx, [PCI_Version]
  150.     mov eax, 47
  151.     mov ebx, 0x00040100
  152.     mov esi, 0x00000000
  153.     mov edx, 110*65536+45
  154.     int 0x40
  155.  
  156.     mov cl, [PCI_LastBus]
  157.     mov eax, 47
  158.     mov ebx, 0x00020100
  159.     mov esi, 0x00000000
  160.     mov edx, 110*65536+55
  161.     int 0x40
  162.  
  163.    call scan_Pci
  164.  
  165.     xor ecx, ecx
  166.         mov cl, [total]
  167.     mov eax, 47
  168.     mov ebx, 0x00020000
  169.     mov esi, 0x00000000
  170.     mov edx, 150*65536+65
  171.     int 0x40
  172.  
  173.  
  174.     mov  eax,12                    ; function 12:tell os about windowdraw
  175.     mov  ebx,2                     ; 2, end of draw
  176.     int  0x40
  177.  
  178.     ret
  179. ;   ***********************************************
  180. ;   *******  END WINDOW DEFINITIONS & DRAW  *******
  181. ;   ***********************************************
  182.  
  183. Get_PCI_Info:
  184.     mov eax, 62
  185.     mov ebx, 0
  186.     int 0x40
  187.     mov [PCI_Version], ax
  188.     ;mov [PCI_Version_h], ah
  189.     ;mov [PCI_Version_l], al
  190.  
  191.     mov eax, 62
  192.     mov ebx, 1
  193.     int 0x40
  194.     mov [PCI_LastBus], al
  195. ret
  196.  
  197.  
  198.  
  199. scan_Pci:
  200.    cmp [PCI_LastBus],0xff
  201.    jne Pci_Exists
  202.    ret
  203. Pci_Exists:
  204.    mov [V_Bus], 0         ;reset varibles
  205.    mov [V_Dev], 0         ;
  206.    mov edx,  20*65536+110 ;start write position
  207.  
  208. Start_Enum:
  209.    mov bl, 6         ;get Device ID / Vendor ID
  210.    mov bh, [V_Bus]
  211.    mov ch, [V_Dev]
  212.    mov cl, 0
  213.    mov eax, 62
  214.    int 0x40
  215.  
  216.    cmp ax, 0         ;check next slot if nothing exists
  217.    je nextDev
  218.    cmp ax, 0xffff
  219.    je nextDev
  220.  
  221.    mov [PCI_Vendor], ax
  222.    shr eax, 16
  223.    mov [PCI_Device], ax
  224.  
  225.    mov eax, 62            ;PCI Sys Function
  226.    mov bl, 4              ;Read config byte
  227.    mov bh, [V_Bus]        ;Bus #
  228.    mov ch, [V_Dev]        ;Device # on bus
  229.    mov cl, 0x08           ;Register to read (Get Revision)
  230.    int 0x40               ;Read it
  231.    mov [PCI_Rev], al      ;Save it
  232.  
  233.    mov eax, 62            ;PCI Sys Function
  234.    mov cl, 0x0b           ;Register to read (Get class)
  235.    int 0x40               ;Read it
  236.    mov [PCI_Class], al    ;Save it
  237.  
  238.    mov eax, 62            ;PCI Sys Function
  239.    mov cl, 0x0a           ;Register to read (Get Subclass)
  240.    int 0x40               ;Read it
  241.    mov [PCI_SubClass], al ;Save it
  242.  
  243.    call Print_New_Device
  244.  
  245. nextDev:
  246.    inc [V_Dev]
  247.    jno Start_Enum         ;jump if no overflow (<256)
  248.  
  249.    mov [V_Dev], 0
  250.    inc [V_Bus]
  251.    mov al, [PCI_LastBus]
  252.  
  253.    cmp byte [V_Bus], al
  254.    jbe Start_Enum
  255. ret
  256.  
  257. Print_New_Device:
  258.    inc [total]
  259.  
  260.    mov eax, 47            ;Write number to screen
  261.    mov ebx,0x00040100     ;4 byte number, print in hexidecimal
  262.    mov esi, 0x00000000    ;Color of text
  263.    xor ecx,ecx
  264.    mov  cx,[PCI_Vendor]   ;Pointer to number to be written
  265.    int 0x40               ;Write it
  266.  
  267.    push dx                ;Calculate position
  268.    mov dx, 62             ;
  269.    shl edx, 16            ;
  270.    pop dx                 ;
  271.    mov cx, [PCI_Device]   ;Write Vendor ID
  272.    int 0x40               ;
  273.  
  274.    mov ebx, 0x00020100    ;2 byte number, in hexidecimal format
  275.    push dx                ;move write cursor
  276.    mov dx, 110            ;
  277.    shl edx, 16            ;
  278.    pop dx                 ;
  279.    mov cl, [V_Bus]        ;write bus number
  280.    int 0x40               ;
  281.  
  282.    push dx                ;move write cursor
  283.    mov dx, 146            ;
  284.    shl edx, 16            ;
  285.    pop dx                 ;
  286.    mov cl, [V_Dev]        ;Write device number
  287.    int 0x40               ;
  288.  
  289.    push dx                ;move write cursor
  290.    mov dx, 179            ;
  291.    shl edx, 16            ;
  292.    pop dx                 ;
  293.    mov cl, [PCI_Rev]      ;Draw Revision to screen
  294.    int 0x40               ;
  295.  
  296.    push dx                ;move write cursor
  297.    mov dx, 215            ;
  298.    shl edx, 16            ;
  299.    pop dx                 ;
  300.    mov cl, [PCI_Class]    ;Draw Class to screen
  301.    int 0x40               ;
  302.  
  303.    push dx                ;move write curson
  304.    mov dx, 266            ;
  305.    shl edx, 16            ;
  306.    pop dx                 ;
  307.    mov cl, [PCI_SubClass] ;Draw Sub Class to screen
  308.    int 0x40               ;
  309.  
  310.  
  311.                           ;Write Names
  312.    push dx                ;remember our current write line
  313.    mov esi, 17            ;length of text
  314.    mov bx, 310            ;X-position of text on screen
  315.    shl ebx, 16            ;
  316.    mov bx, dx             ;Current Y position
  317.    mov ecx, 0             ;color of text
  318.  
  319.    mov [cur], dx
  320.  
  321.    mov [r],0
  322. ;**********************************************************
  323. ; modified part by vhanla (I know it is not a fastest way to search)
  324. ; it needs optimization... HELP this project!
  325. ;-------------------------------------------------------------------------------
  326.   cmp [PCI_Vendor],4807 ; Check if Vendor's value is less than this number
  327.    jae next1            ; if it is less, let's continue, or jump to next1
  328.    mov [listcount],255  ; number of available lists into this range
  329.    mov [r],1            ; counter
  330.    mov [valor],50       ; List's number of characters = 50
  331.   rep1:
  332.    push ebx
  333.    xor ebx,ebx
  334.    mov bx,[valor]
  335.    mov ax,word[_FIRSTPART+bx]
  336.    mov [address],_FIRSTPART
  337.    add [address],ebx
  338.    sub [address],50
  339.    pop ebx
  340.    cmp [PCI_Vendor],ax
  341.    jz ex
  342.    add [valor],52       ; Number of characters plus value (WORD) 50+2 bytes
  343.    push eax
  344.    mov ah,[r]
  345.    cmp [listcount],ah
  346.    pop eax
  347.    jz next1
  348.    inc [r]
  349.    jmp rep1
  350. ;-------------------------------------------------------------------------------
  351. next1:
  352.   cmp [PCI_Vendor],5320
  353.    jae next2
  354.    mov [listcount],255  ; number of available lists into this range
  355.    mov [r],1
  356.    mov [valor],50
  357.   rep2:
  358.    push ebx
  359.    xor ebx,ebx
  360.    mov bx,[valor]
  361.    mov ax,word[_SECONDPART+bx]
  362.    mov [address],_SECONDPART
  363.    add [address],ebx
  364.    sub [address],50
  365.    pop ebx
  366.    cmp [PCI_Vendor],ax
  367.    jz ex
  368.    add [valor],52
  369.    push eax
  370.    mov ah,[r]
  371.    cmp [listcount],ah
  372.    pop eax
  373.    jz next2
  374.    inc [r]
  375.    jmp rep2
  376. ;-------------------------------------------------------------------------------
  377. next2:
  378.   cmp [PCI_Vendor],5580
  379.    jae next3
  380.    mov [listcount],255  ; number of available lists into this range
  381.    mov [r],1
  382.    mov [valor],50
  383.   rep3:
  384.    push ebx
  385.    xor ebx,ebx
  386.    mov bx,[valor]
  387.    mov ax,word[_THIRDPART+bx]
  388.    mov [address],_THIRDPART
  389.    add [address],ebx
  390.    sub [address],50
  391.    pop ebx
  392.    cmp [PCI_Vendor],ax
  393.    jz ex
  394.    add [valor],52
  395.    push eax
  396.    mov ah,[r]
  397.    cmp [listcount],ah
  398.    pop eax
  399.    jz next3
  400.    inc [r]
  401.    jmp rep3
  402. ;-------------------------------------------------------------------------------
  403. next3:
  404.   cmp [PCI_Vendor],65535 ;the last in a WORD
  405.    jae next4
  406.    mov [listcount],100  ; number of available lists into this range
  407.    mov [r],1
  408.    mov [valor],50
  409.   rep4:
  410.    push ebx
  411.    xor ebx,ebx
  412.    mov bx,[valor]
  413.    mov ax,word[_FOURTHPART+bx]
  414.    mov [address],_FOURTHPART
  415.    add [address],ebx
  416.    sub [address],50
  417.    pop ebx
  418.    cmp [PCI_Vendor],ax
  419.    jz ex
  420.    add [valor],52
  421.    push eax
  422.    mov ah,[r]
  423.    cmp [listcount],ah
  424.    pop eax
  425.    jz next4
  426.    inc [r]
  427.    jmp rep4
  428. ;-------------------------------------------------------------------------------
  429. next4:
  430.  
  431. ;-------------------------------------------------------------------------------
  432. ; tHIS PART FOR OTHER ... LISTS
  433.    mov [listcount],7  ; number of available lists into this range
  434.    mov [r],1
  435.    mov [valor],50
  436.   repO:
  437.    push ebx
  438.    xor ebx,ebx
  439.    mov bx,[valor]
  440.    mov ax,word[PREVIOUSVERSIONLIST+bx]
  441.    mov [address],PREVIOUSVERSIONLIST
  442.    add [address],ebx
  443.    sub [address],50
  444.    pop ebx
  445.    cmp [PCI_Vendor],ax
  446.    jz ex
  447.    add [valor],52
  448.    push eax
  449.    mov ah,[r]
  450.    cmp [listcount],ah
  451.    pop eax
  452.    jz next5
  453.    inc [r]
  454.    jmp repO
  455. ;-------------------------------------------------------------------------------
  456. next5:
  457.    mov [address],_UNKNOWN
  458. ;-------------------------------------------------------------------------------
  459.   ex:
  460. ;  lets print the vendor Name
  461.  
  462.    mov eax,4
  463.    mov edx,[address]
  464.    mov esi,50
  465.    int 0x40
  466. ;-------------------------------------------------------------------------------
  467. ; END OF SEARCHING AND PRINTING
  468. ;------------------------------------------------------------------
  469.  
  470.   ; mov esi, 26           ;length of text
  471.   ; mov bx, 560           ;X-position of text on screen
  472.   ; shl ebx, 16           ;
  473.   ; mov bx, [cur]         ;Current Y position
  474.   ; mov ecx, 0            ;color of text
  475.  
  476.  
  477.   ; xor eax, eax          ;calculate pointer to string
  478.  ;  mov al, [PCI_Class]   ;Determine Description based on class
  479.  ;  mov dl,  26           ;Each description is 26 characters long
  480.  ;  mul dl                ;get offset to correct description
  481.  ;  mov edx, Descriptions  ;starting point of description text
  482.  ;  add edx, eax          ;calculated corresponding description
  483.  ;  mov eax, 4            ;draw text sys function
  484.  ;  int 0x40
  485.  
  486.    cmp [PCI_Class], 00h
  487.    je sub0
  488.    cmp [PCI_Class], 01h
  489.    je sub1
  490.    cmp [PCI_Class], 02h
  491.    je sub2
  492.    cmp [PCI_Class], 03h
  493.    je sub3
  494.    cmp [PCI_Class], 04h
  495.    je sub4
  496.    cmp [PCI_Class], 05h
  497.    je sub5
  498.    cmp [PCI_Class], 06h
  499.    je sub6
  500.    cmp [PCI_Class], 07h
  501.    je sub7
  502.    cmp [PCI_Class], 08h
  503.    je sub8
  504.    cmp [PCI_Class], 09h
  505.    je sub9
  506.    cmp [PCI_Class], 0Ah
  507.    je sub10
  508.    cmp [PCI_Class], 0Bh
  509.    je sub11
  510.    cmp [PCI_Class], 0Ch
  511.    je sub12
  512.    cmp [PCI_Class], 0Dh
  513.    je sub13
  514.    cmp [PCI_Class], 0Eh
  515.    je sub14
  516.    cmp [PCI_Class], 0Fh
  517.    je sub15
  518.    cmp [PCI_Class], 10h
  519.    je sub16
  520.    cmp [PCI_Class], 11h
  521.    je sub17
  522.    jmp endd
  523.    
  524. sub0:
  525.    mov [listcount],2  ; number of available lists into this range
  526.    mov [r],1
  527.    mov [valor],32
  528.   repu0:
  529.    push ebx
  530.    xor ebx,ebx
  531.    mov bx,[valor]
  532.    mov ax,word[Class0+bx]
  533.    mov [address],Class0
  534.    add [address],ebx
  535.    sub [address],32
  536.    pop ebx
  537.    cmp word [PCI_SubClass],ax
  538.    jz endd
  539.    add [valor],34
  540.    push eax
  541.    mov ah,[r]
  542.    cmp [listcount],ah
  543.    pop eax
  544.    jz next50
  545.    inc [r]
  546.    jmp repu0
  547.  
  548. jmp endd  
  549.  
  550. sub1:
  551.    mov [listcount],8  ; number of available lists into this range
  552.    mov [r],1
  553.    mov [valor],32
  554.   repu1:
  555.    push ebx
  556.    xor ebx,ebx
  557.    mov bx,[valor]
  558.    mov ax,word[Class1+bx]
  559.    mov [address],Class1
  560.    add [address],ebx
  561.    sub [address],32
  562.    pop ebx
  563.    cmp word [PCI_SubClass],ax
  564.    jz endd
  565.    add [valor],34
  566.    push eax
  567.    mov ah,[r]
  568.    cmp [listcount],ah
  569.    pop eax
  570.    jz next50
  571.    inc [r]
  572.    jmp repu1
  573. jmp endd  
  574.  
  575.  
  576. sub2:
  577.    mov [listcount],8  ; number of available lists into this range
  578.    mov [r],1
  579.    mov [valor],32
  580.   repu2:
  581.    push ebx
  582.    xor ebx,ebx
  583.    mov bx,[valor]
  584.    mov ax,word[Class2+bx]
  585.    mov [address],Class2
  586.    add [address],ebx
  587.    sub [address],32
  588.    pop ebx
  589.    cmp word [PCI_SubClass],ax
  590.    jz endd
  591.    add [valor],34
  592.    push eax
  593.    mov ah,[r]
  594.    cmp [listcount],ah
  595.    pop eax
  596.    jz next50
  597.    inc [r]
  598.    jmp repu2
  599. jmp endd  
  600.  
  601. sub3:
  602.    mov [listcount],4  ; number of available lists into this range
  603.    mov [r],1
  604.    mov [valor],32
  605.   repu3:
  606.    push ebx
  607.    xor ebx,ebx
  608.    mov bx,[valor]
  609.    mov ax,word[Class3+bx]
  610.    mov [address],Class3
  611.    add [address],ebx
  612.    sub [address],32
  613.    pop ebx
  614.    cmp word [PCI_SubClass],ax
  615.    jz endd
  616.    add [valor],34
  617.    push eax
  618.    mov ah,[r]
  619.    cmp [listcount],ah
  620.    pop eax
  621.    jz next50
  622.    inc [r]
  623.    jmp repu3
  624. jmp endd  
  625.  
  626.  
  627. sub4:
  628.    mov [listcount],4  ; number of available lists into this range
  629.    mov [r],1
  630.    mov [valor],32
  631.   repu4:
  632.    push ebx
  633.    xor ebx,ebx
  634.    mov bx,[valor]
  635.    mov ax,word[Class4+bx]
  636.    mov [address],Class4
  637.    add [address],ebx
  638.    sub [address],32
  639.    pop ebx
  640.    cmp word [PCI_SubClass],ax
  641.    jz endd
  642.    add [valor],34
  643.    push eax
  644.    mov ah,[r]
  645.    cmp [listcount],ah
  646.    pop eax
  647.    jz next50
  648.    inc [r]
  649.    jmp repu4
  650. jmp endd  
  651.  
  652. sub5:
  653.    mov [listcount],3  ; number of available lists into this range
  654.    mov [r],1
  655.    mov [valor],32
  656.   repu5:
  657.    push ebx
  658.    xor ebx,ebx
  659.    mov bx,[valor]
  660.    mov ax,word[Class5+bx]
  661.    mov [address],Class5
  662.    add [address],ebx
  663.    sub [address],32
  664.    pop ebx
  665.    cmp word [PCI_SubClass],ax
  666.    jz endd
  667.    add [valor],34
  668.    push eax
  669.    mov ah,[r]
  670.    cmp [listcount],ah
  671.    pop eax
  672.    jz next50
  673.    inc [r]
  674.    jmp repu5
  675. jmp endd  
  676.  
  677. sub6:
  678.    mov [listcount],12  ; number of available lists into this range
  679.    mov [r],1
  680.    mov [valor],32
  681.   repu6:
  682.    push ebx
  683.    xor ebx,ebx
  684.    mov bx,[valor]
  685.    mov ax,word[Class6+bx]
  686.    mov [address],Class6
  687.    add [address],ebx
  688.    sub [address],32
  689.    pop ebx
  690.    cmp word [PCI_SubClass],ax
  691.    jz endd
  692.    add [valor],34
  693.    push eax
  694.    mov ah,[r]
  695.    cmp [listcount],ah
  696.    pop eax
  697.  jz next50
  698.    inc [r]
  699.    jmp repu6
  700. jmp endd  
  701.  
  702. sub7:
  703.    mov [listcount],7  ; number of available lists into this range
  704.    mov [r],1
  705.    mov [valor],32
  706.   repu7:
  707.    push ebx
  708.    xor ebx,ebx
  709.    mov bx,[valor]
  710.    mov ax,word[Class7+bx]
  711.    mov [address],Class7
  712.    add [address],ebx
  713.    sub [address],32
  714.    pop ebx
  715.    cmp word [PCI_SubClass],ax
  716.    jz endd
  717.    add [valor],34
  718.    push eax
  719.    mov ah,[r]
  720.    cmp [listcount],ah
  721.    pop eax
  722.     jz next50
  723.    inc [r]
  724.    jmp repu7
  725. jmp endd  
  726.  
  727. sub8:
  728.    mov [listcount],8  ; number of available lists into this range
  729.    mov [r],1
  730.    mov [valor],32
  731.   repu8:
  732.    push ebx
  733.    xor ebx,ebx
  734.    mov bx,[valor]
  735.    mov ax,word[Class8+bx]
  736.    mov [address],Class8
  737.    add [address],ebx
  738.    sub [address],32
  739.    pop ebx
  740.    cmp word [PCI_SubClass],ax
  741.    jz endd
  742.    add [valor],34
  743.    push eax
  744.    mov ah,[r]
  745.    cmp [listcount],ah
  746.    pop eax
  747.     jz next50
  748.    inc [r]
  749.    jmp repu8
  750. jmp endd    
  751.  
  752. sub9:
  753.    mov [listcount],6  ; number of available lists into this range
  754.    mov [r],1
  755.    mov [valor],32
  756.   repu9:
  757.    push ebx
  758.    xor ebx,ebx
  759.    mov bx,[valor]
  760.    mov ax,word[Class9+bx]
  761.    mov [address],Class9
  762.    add [address],ebx
  763.    sub [address],32
  764.    pop ebx
  765.    cmp word [PCI_SubClass],ax
  766.    jz endd
  767.    add [valor],34
  768.    push eax
  769.    mov ah,[r]
  770.    cmp [listcount],ah
  771.    pop eax
  772.    jz next50
  773.    inc [r]
  774.    jmp repu9
  775. jmp endd  
  776.  
  777. sub10:
  778.    mov [listcount],2  ; number of available lists into this range
  779.    mov [r],1
  780.    mov [valor],32
  781.   repu10:
  782.    push ebx
  783.    xor ebx,ebx
  784.    mov bx,[valor]
  785.    mov ax,word[ClassA+bx]
  786.    mov [address],ClassA
  787.    add [address],ebx
  788.    sub [address],32
  789.    pop ebx
  790.    cmp word [PCI_SubClass],ax
  791.    jz endd
  792.    add [valor],34
  793.    push eax
  794.    mov ah,[r]
  795.    cmp [listcount],ah
  796.    pop eax
  797.   jz next50
  798.    inc [r]
  799.    jmp repu10
  800. jmp endd  
  801.  
  802. sub11:
  803.    mov [listcount],7  ; number of available lists into this range
  804.    mov [r],1
  805.    mov [valor],32
  806.   repu11:
  807.    push ebx
  808.    xor ebx,ebx
  809.    mov bx,[valor]
  810.    mov ax,word[ClassB+bx]
  811.    mov [address],ClassB
  812.    add [address],ebx
  813.    sub [address],32
  814.    pop ebx
  815.    cmp word [PCI_SubClass],ax
  816.    jz endd
  817.    add [valor],34
  818.    push eax
  819.    mov ah,[r]
  820.    cmp [listcount],ah
  821.    pop eax
  822.     jz next50
  823.    inc [r]
  824.    jmp repu11
  825. jmp endd  
  826.  
  827. sub12:
  828.    mov [listcount],10  ; number of available lists into this range
  829.    mov [r],1
  830.    mov [valor],32
  831.   repu12:
  832.    push ebx
  833.    xor ebx,ebx
  834.    mov bx,[valor]
  835.    mov ax,word[ClassC+bx]
  836.    mov [address],ClassC
  837.    add [address],ebx
  838.    sub [address],32
  839.    pop ebx
  840.    cmp word [PCI_SubClass],ax
  841.    jz endd
  842.    add [valor],34
  843.    push eax
  844.    mov ah,[r]
  845.    cmp [listcount],ah
  846.    pop eax
  847.    jz next50
  848.    inc [r]
  849.    jmp repu12
  850. jmp endd  
  851.  
  852. sub13:
  853.    mov [listcount],8  ; number of available lists into this range
  854.    mov [r],1
  855.    mov [valor],32
  856.   repu13:
  857.    push ebx
  858.    xor ebx,ebx
  859.    mov bx,[valor]
  860.    mov ax,word[ClassD+bx]
  861.    mov [address],ClassD
  862.    add [address],ebx
  863.    sub [address],32
  864.    pop ebx
  865.    cmp word [PCI_SubClass],ax
  866.    jz endd
  867.    add [valor],34
  868.    push eax
  869.    mov ah,[r]
  870.    cmp [listcount],ah
  871.    pop eax
  872.     jz next50
  873.    inc [r]
  874.    jmp repu13
  875. jmp endd  
  876.  
  877. sub14:
  878.    mov [listcount],1  ; number of available lists into this range
  879.    mov [r],1
  880.    mov [valor],32
  881.   repu14:
  882.    push ebx
  883.    xor ebx,ebx
  884.    mov bx,[valor]
  885.    mov ax,word[ClassE+bx]
  886.    mov [address],ClassE
  887.    add [address],ebx
  888.    sub [address],32
  889.    pop ebx
  890.    cmp word [PCI_SubClass],ax
  891.    jz endd
  892.    add [valor],34
  893.    push eax
  894.    mov ah,[r]
  895.    cmp [listcount],ah
  896.    pop eax
  897.    jz next50
  898.    inc [r]
  899.    jmp repu14
  900. jmp endd  
  901.  
  902. sub15:
  903.    mov [listcount],4  ; number of available lists into this range
  904.    mov [r],1
  905.    mov [valor],32
  906.   repu15:
  907.    push ebx
  908.    xor ebx,ebx
  909.    mov bx,[valor]
  910.    mov ax,word[ClassF+bx]
  911.    mov [address],ClassF
  912.    add [address],ebx
  913.    sub [address],32
  914.    pop ebx
  915.    cmp word [PCI_SubClass],ax
  916.    jz endd
  917.    add [valor],34
  918.    push eax
  919.    mov ah,[r]
  920.    cmp [listcount],ah
  921.    pop eax
  922.    jz next50
  923.    inc [r]
  924.    jmp repu15
  925. jmp endd  
  926.  
  927. sub16:
  928.    mov [listcount],3  ; number of available lists into this range
  929.    mov [r],1
  930.    mov [valor],32
  931.   repu16:
  932.    push ebx
  933.    xor ebx,ebx
  934.    mov bx,[valor]
  935.    mov ax,word[Class10+bx]
  936.    mov [address],Class10
  937.    add [address],ebx
  938.    sub [address],32
  939.    pop ebx
  940.    cmp word [PCI_SubClass],ax
  941.    jz endd
  942.    add [valor],34
  943.    push eax
  944.    mov ah,[r]
  945.    cmp [listcount],ah
  946.    pop eax
  947.    jz next50
  948.    inc [r]
  949.    jmp repu16
  950. jmp endd  
  951.  
  952. sub17:
  953.    mov [listcount],5  ; number of available lists into this range
  954.    mov [r],1
  955.    mov [valor],32
  956.   repu17:
  957.    push ebx
  958.    xor ebx,ebx
  959.    mov bx,[valor]
  960.    mov ax,word[Class11+bx]
  961.    mov [address],Class11
  962.    add [address],ebx
  963.    sub [address],32
  964.    pop ebx
  965.    cmp word [PCI_SubClass],ax
  966.    jz endd
  967.    add [valor],34
  968.    push eax
  969.    mov ah,[r]
  970.    cmp [listcount],ah
  971.    pop eax
  972.    jz next50
  973.    inc [r]
  974.    jmp repu17
  975. jmp endd  
  976.  
  977. next50:
  978.    mov [address],_UNKNOWND
  979.    
  980. endd:
  981.  
  982.    xor eax, eax
  983.    xor ebx, ebx
  984.    xor ecx, ecx
  985.    xor edx, edx
  986.    
  987.    mov bx, 560            ;X-position of text on screen
  988.    shl ebx, 16            ;
  989.    mov bx, [cur]          ;Current Y position
  990.    mov ecx, 0             ;color of text
  991.  
  992.    mov eax,4
  993.    mov edx,[address]
  994.    mov esi,32
  995.    int 0x40
  996.  
  997.    mov dx, 20             ;Starting Y coordinate
  998.    shl edx, 16            ;
  999.    pop dx                 ;
  1000.    add edx, 10            ;Next line down
  1001.  
  1002. ret
  1003.  
  1004.  
  1005.  
  1006. ; DATA AREA
  1007.  
  1008. labelt:
  1009.        db 'PCI Device Enumeration v 1.25 by J. Delozier, S. Kuzmin and V. Hanla'
  1010. labellen:
  1011.  
  1012. PCIWin:
  1013. db 'Please remember to enable PCI Access to Applications in Setup Menu.                                       '
  1014. db '                                                                                                          '
  1015. db 'PCI Version  =                                                                                            '
  1016. db 'Last PCI Bus =                                                                                            '
  1017. db 'Quantity of devices =                                                                                     '
  1018. db '                                                                                                          '
  1019. db 'VenID  DevID  Bus#  Dev#  Rev  Class  Subclass                 Company                      Description   '
  1020. db '-----  -----  ----  ----  ---  -----  -------- ------------------------------------------ ----------------'
  1021. db 'x'
  1022.  
  1023. valor dw ?
  1024. r db ?
  1025. cur dw ?
  1026. total db ?
  1027. address dd ?
  1028. listcount db ?
  1029. V_Bus        db 0
  1030. V_Dev        db 0
  1031. PCI_Version dw 0
  1032. PCI_LastBus  db 0
  1033. PCI_Device   dw 0
  1034. PCI_Vendor   dw 0
  1035. PCI_Bus      db 0
  1036. PCI_Dev      db 0
  1037. PCI_Rev      db 0
  1038. PCI_Class    db 0
  1039. PCI_SubClass db 0
  1040.  
  1041. I_END:
  1042.