⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pnppd.asm

📁 RTL8019 DOS 下的驱动
💻 ASM
📖 第 1 页 / 共 3 页
字号:
;        jmp     short Set_Slot_OK
;In_8_Slot:
;        mov     [di].SlotSize,8
;Set_Slot_OK:
;        lea     di,[di].NodeID
;        mov     cx,3
;   rep  movsw
;
;        inc     BoardIndex
;Device_Conflict_back:
;        jmp     CSN_Already_0
;Device_Conflict:
;        mov     dx,offset BoardConflictMessage1
;        mov     ah,9
;        int     21h
;        mov     cl,'0'
;        mov     ax,SavedIOBase          ; IO value
;        call    wordout
;        mov     dx,offset BoardConflictMessage2
;        mov     ah,9
;        int     21h
;        jmp     Device_Conflict_back
;
;No_BoardData_space:
;        mov     dx,offset TooManyBoards
;        mov     ah,9
;        int     21h
;No_more_Card:                           ; Set cards back to their origin CSN
;
;        cmp     BoardIndex,0            ; If no card found
;        je      Back_SavedCSN_OK
;        xor     cx,cx
;        mov     ah,60h                  ; We set CSN=60h+BoardIndex
;        mov     di,offset BoardData
;Back_SavedCSN_lp:
;        mov     dx,PnPAddress
;        mov     al,Wake
;        out     dx,al
;        mov     dx,PnPWrite
;        mov     al,ah
;        out     dx,al                   ; Wake CSN 60+BoardIndex
;        mov     dx,PnPAddress
;        mov     al,CSN
;        out     dx,al
;        mov     dx,PnPWrite
;        mov     al,[di].CardCSN
;        out     dx,al                   ; Save Back SavedCSN
;        inc     cx
;        inc     ah
;        add     di,BoardDataLen
;        cmp     cl,BoardIndex
;        jb      Back_SavedCSN_lp
;Back_SavedCSN_OK:
;        mov     dx,PnPAddress           ; Set our card back to WAIT FOR KEY
;        mov     al,ConfigCtrl
;        out     dx,al
;        mov     dx,PnPWrite
;        mov     al,02
;        out     dx,al

        mov     dx, 200h                        ; IOBase starts with 200h
Scan_ID:
        add     dx,0Ah
        in      al,dx
        cmp     al,'P'
        je      CM_PassChipID1
        sub     dx, 0ah
        jmp     Try_Next
CM_PassChipID1:
        inc     dx
        in      al,dx
        cmp     al,'p'
        je      CM_PassChipID2
        sub     dx, 0bh
        jmp     Try_Next
CM_PassChipID2:
        sub     dx, 0bh
        mov     di,offset cs:BoardData         ; Adjust DI to right position
        mov     cl,BoardIndex
        and     cx,0fh
        cmp     cx,0
        je      Save_CM_Board_Data
Add_CM_BoardData_lp:
        add     di,BoardDataLen
        loop    Add_CM_BoardData_lp
Save_CM_Board_Data:
        mov     al, 0e1h
        out     dx, al                          ; switch to page 3
        add     dx, 4                           ;
        in      al, dx                          ;

        and     al, 70h                         ; get IRQS2_0
        shr     al, 1                           ;
        shr     al, 1                           ;
        shr     al, 1                           ;
        shr     al, 1                           ;
        mov     ah, 0                           ;

        mov     si, offset cs:IRQTable          ; get IRQ from IRQTable
        add     si, ax                          ;
        mov     al, [si]                        ;

        mov     [di].IRQ,al                     ; Save IRQ

        sub     dx, 4                           ; switch to page 0
        mov     al, 21h                         ;
        out     dx, al                          ;

        mov     ax, dx
        mov     [di].IOBase,ax                  ; Save IOBase
        mov     SavedIOBase,ax

        mov     dx,SavedIOBase
        mov     al,21h
        out     dx,al
        add     dx,0eh                          ; DX--> DCR
        mov     al,49h
        out     dx,al

        mov     dx,SavedIOBase
        add     dx,08                           ; DX--> RemoteAddress0
        xor     al,al
        out     dx,al
        inc     dx
        out     dx,al
        inc     dx                              ; DX--> RemoteByteCount
        mov     al, 16*2
        out     dx,al
        inc     dx
        xor     al,al
        out     dx,al

        mov     dx,SavedIOBase
        mov     al,09
        out     dx,al
        add     dx,10h
        push    di                              ; Saved DI
        mov     di,offset cs:BoardPROM
        mov     cx,16
In_ID_loop:
        in      al,dx
        stosb
        loop    In_ID_loop
;  rep  insb
        mov     si,offset cs:BoardPROM
        pop     di                              ; Take back DI
        cmp     BYTE PTR [si]+14,'W'
        jne     CM_In_8_Slot
        mov     [di].SlotSize,16
        jmp     short CM_Set_Slot_OK
CM_In_8_Slot:
        mov     [di].SlotSize,8
CM_Set_Slot_OK:
        lea     di,[di].NodeID
        mov     cx,3
   rep  movsw                                   ; Move to BoardData.NodeID

        mov     dx, SavedIOBase
        inc     BoardIndex
Try_Next:
        add     dx, 20h
        cmp     dx, 3e0h
        ja      ScanComplete
        jmp     Scan_ID
ScanComplete:

        cmp     BoardIndex,0
        jne     Print_BoardData
        mov     dx,offset NICNotFound
        stc
        ret
Print_BoardData:
        xor     cx,cx
        mov     di,offset BoardData
Print_BoardData_lp:
        push    cx                      ; Save CX, some print will destroy it
        mov     dx,offset BoardDataString1
        mov     ah,9
        int     21h
        mov     al,cl                   ; BoardIndex
        call    digout
        mov     dx,offset BoardDataString2
        mov     ah,9
        int     21h
        lea     si,[di].NodeID          ; NodeID
        call    print_ether_addr
        mov     dx,offset BoardDataString3
        mov     ah,9
        int     21h
        mov     ax,[di].IOBase          ; IO
        mov     cl,'0'                  ; For remove leading zero
        call    wordout
        mov     dx,offset BoardDataString4
        mov     ah,9
        int     21h
        mov     al,[di].IRQ             ; IRQ
        call    digout
; Jasper 10/05/94 {
;        mov     dx,offset BoardDataString5
;        mov     ah,9
;        int     21h
;        mov     al,[di].CardCSN         ; CSN
;        call    byteout
; } Jasper 10/05/94
        mov     dx,offset BoardDataString6
        mov     ah,9
        int     21h
        mov     al,[di].SlotSize        ; SlotSize
        and     ax,0FFh
        xor     dx,dx                           ;DX:AX=num
        push    di                              ; DI will be destroyed
        call    decout
        pop     di                              ; Tack back DI
        mov     dx,offset BoardDataString7
        mov     ah,9
        int     21h
        pop     cx                      ; Take Back CX
        inc     cx
        add     di,BoardDataLen
        cmp     cl,BoardIndex
        jb      Print_BoardData_lp

        cmp     BoardIndex,1
        je      One_Card_Only
;;        call    MatchEtherID
;;        cmp     BoardChoice,-1
;;        jne     BoardChoice_OK
        call    PromptBoardChoice
        jmp     short BoardChoice_OK
One_Card_Only:
        mov     BoardChoice,0
BoardChoice_OK:
;       mov     dx,offset AttachString1
;       mov     ah,9
;       int     21h
;       mov     al,BoardChoice
;       call    digout
;       mov     dx, offset AttachString2
;       mov     ah,9
;       int     21h

;
;       Set io_addr and int_no
;
        mov     di,offset BoardData
        mov     cl,BoardChoice
        and     cx,0Fh
        cmp     cx,0
        je      BoardDataOffset_OK
Add_BoardData_Offset:
        add     di,BoardDataLen
        loop    Add_BoardData_Offset
BoardDataOffset_OK:
        mov     ax,[di].IOBase                  ; Set IOAddress1
        mov     io_addr,ax

        mov     al,[di].IRQ                     ; Set IntLine1
        mov     int_no,al
PnP_Installed:
        clc
        ret

;***********************************
; On Entry:
;
;   si --> PnPID (8 data, 1 check sum)
;
; On return:
;   if PnPID OK => carry is clear
;            Bad => carry is set
;***********************************
;VerifyPnPID    proc
;        mov     al,6Ah
;        xor     cx,cx
;
;PnPVerifyLoop:
;        test    al,02h
;        jz      short Bit1_zero
;        mov     ah,1
;        jmp     short Got_Bit1
;Bit1_zero:
;        xor     ah,ah
;Got_Bit1:
;        mov     dl,al
;        xor     ah,dl                   ; Bit0 xor Bit1 in AH bit 1
;
;        mov     dx,cx
;        shr     dx,3
;        mov     di,si
;        add     di,dx                   ; EDI -> Byte number
;        push    cx                      ; shl will use cl, Save CX
;        and     cx,07                   ; cl==the bit in Byte
;        mov     dl,1
;        shl     dl,cl                   ; DL is the Flag
;        pop     cx                      ; Take back CX
;        test    [di],dl
;        jz      Input_zero
;        mov     dl,1
;        jmp     short Got_Input
;Input_zero:
;        xor     dl,dl
;Got_Input:                              ; input bit in DL
;        xor     ah,dl
;        shr     ah,1                    ; Result in Carry
;        rcr     al,1
;
;        inc     cx
;        cmp     cx,64                   ; all 8 Byte done ?
;        jb      short PnPVerifyLoop
;
;        cmp     al,[si]+8
;        je      short PnPIDGood
;        stc
;        ret
;PnPIDGood:
;        clc
;        ret
;VerifyPnPID    endp
;******************************************
; Prompt for user key-in a choice
;******************************************
PromptBoardChoice       proc
        mov     dx,offset PromptString1
        mov     ah,9
        int     21h
        mov     al,BoardIndex
        dec     al
        mov     bl,al
        mov     cl,'0'                  ; For removing leading zero
        call    byteout
        mov     dx,offset PromptString2
        mov     ah,9
        int     21h
Get_BoardChoice_lp:
        xor     ah,ah
        int     16h
        mov     dl,al                   ; Save ASCII code to DL
        sub     al,30h
        cmp     al,0
        jl      Get_BoardChoice_lp
        cmp     al,bl
        jg      Get_BoardChoice_lp
        mov     BoardChoice,al          ; Save value to BoardChoice
        mov     ah,2
        int     21h                     ; Print the good choice
        call    crlf
        ret
PromptBoardChoice       endp

        extrn   etopen_diagn: byte

init_card:
;get the board data. This is (16) bytes starting at remote
;dma address 0. Put it in a buffer called board_data.
        assume  ds:code
        or      endcfg,ENDCFG_WTS

        loadport
        mov     al,endcfg
        setport EN0_DCFG
        pause_
        out     dx,al

        mov     cx,10h          ; get 16 bytes,
        movseg  es,ds
        mov     di,offset board_data

        setport EN_CCMD
        pause_
        mov     al,ENC_NODMA+ENC_PAGE0+ENC_START
        out     dx,al
        setport EN0_RCNTLO      ; remote byte count 0
        pause_
        mov     al,20h          ; count is actually doubled.
        out     dx,al
        setport EN0_RCNTHI
        pause_
        xor     al,al           ; high byte of count is zero.
        out     dx,al

        mov     ax,0            ; from address 0

        setport EN0_RSARLO
        pause_
        out     dx,al           ; set as hi address
        setport EN0_RSARHI
        pause_
        mov     al,ah
        out     dx,al
        setport EN_CCMD
        pause_
        mov     al,ENC_RREAD+ENC_START  ; read and start
        out     dx,al
        setport NE_DATAPORT
        pause_
sp_read_loop:
        in      al,dx           ; get a byte
        stosb                   ; save it
        loop    sp_read_loop

;;        push    ds              ; Copy from card's address to current address
;;        pop     es

        mov si, offset board_data       ; address is at start
        mov di, offset rom_address
        mov cx, EADDR_LEN       ; Copy one address length
        rep     movsb           ; ..

        cmp     byte ptr [board_data+14],'W'
        je      in_16_ISA
        mov     is_16_slot,0            ; Set our flag flase
        and     endcfg,NOT ENDCFG_WTS   ; Set DCR to byte transfer
        mov     sm_rstop_ptr,60h        ; Set the PSTOP to 60h only
        cmp     int_no,8                ; Check if IRQ is less than 8
        jb      in_16_ISA
        mov     di,offset int_no        ; Print the wrong IRQ number
        mov     dx,offset int_no_name
        call    print_number
        mov     dx,offset PnPIRQTooBig  ; Prepare error message
        stc
        ret
in_16_ISA:
        clc
        ret

        public  print_parameters
print_parameters:
;echo our command-line parameters
        mov     di,offset int_no
        mov     dx,offset int_no_name
        call    print_number
        mov     di,offset io_addr
        mov     dx,offset io_addr_name
        call    print_number
        ret

code    ends

        end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -