📄 pnppd000.asm
字号:
;Slow_lp:
; in al,61h
; loop Slow_lp
; pop ax
; pop cx
;
; ENDM
;
;RTInitKey db 0DAh,6Dh,36h,1Bh,8Dh,46h,23h,91h
; db 48h,0A4h,0D2h,69h,34h,9Ah,4Dh,26h
; db 13h,89h,44h,0A2h,51h,28h,94h,0CAh
; db 65h,32h,19h,0Ch,86h,43h,0A1h,50h
;PnPID db 9 dup(0) ; PnP Serial ID and Checksum
;
;RD_Port dw 203h ; 203-3FFh (step 4)
;RD_Port_IO db 80h ; bit 2-9 of RD_Port for I/O (80-FFh)
;RD_Port_OK db 0 ; Flag if RD_Port found
; } Jasper 10/05/94
BoardIndex db 0
;SavedCSN db 0 ; Jasper 10/05/94
SavedIOBase dw 0
BoardPROM db 16 dup(0)
BoardDataStruct struc
; CardCSN db 0 ; Jasper 10/05/94
IRQ db 0
IOBase dw 0
NodeID db 6 dup(0)
SlotSize db 0
BoardDataStruct ends
BoardDataLen equ size BoardDataStruct
BoardData BoardDataStruct 8 dup (<>) ; Jasper 10/05/94
public BoardChoice
BoardChoice db -1
IRQTable db 9,3,4,5,10,11,12,15 ; Jasper 10/05/94
extrn decout: near
extrn wordout: near
extrn byteout: near
extrn digout: near
extrn crlf: near
extrn print_ether_addr: near
public parse_args
parse_args:
;exit with nc if all went well, cy otherwise.
;
; Use PnP Config Manager to get our card's config
;
movseg es,cs
; mov bx,1000h
; mov ah,4Ah ; Reallocate memory to 64K
; int 21h ; ES == CS already
;
; push es
; xor di,di ; ES:DI-> 0:0
; mov es,di
; mov bx,34h
; mov ax,1684h ; Get PnP Config Manager Entry Point
; int 2Fh
; mov ax,es
; or ax,di ; If ES:DI is still 0:0
; mov word ptr CM_Entry,di
; mov word ptr CM_Entry+2,es
; pop es
; jnz Int2f_OK
; jmp CM_NotPresent
;Int2f_OK:
; xor ax,ax
; call [CM_Entry]
; or ax,ax
; jnz CM_Entry_OK
; jmp CM_NotPresent
;CM_Entry_OK:
; mov bx,ax ; Save the version to BX
; mov CM_OK,1 ; Turn on CM_OK Flag
; mov dx,offset PnPCMVersion
; mov ah,9
; int 21h
; mov cl,'0' ; Prepare to remove leading 0
; mov al,bh
; call byteout
; mov dx, offset DotString
; mov ah,9
; int 21h
; mov cl,'0'
; mov al,bl
; call byteout
; mov dx, offset DotString
; mov ah,9
; int 21h
; call crlf
;
; xor bx, bx ; Device index starts with 0
;Get_Device_Config:
; mov di, offset ConfigBuf
; mov ax,1
; call [CM_Entry]
; or ax,ax
; jz Still_Have_CM_Device
; jmp No_more_CM_Device
;Still_Have_CM_Device:
; mov dx, ConfigBuf.wIOPort_Base
; add dx,0Ah
; in al,dx
; cmp al,'P'
; je CM_PassChipID1
; jmp Try_Next
;CM_PassChipID1:
; inc dx
; in al,dx
; cmp al,'p'
; je CM_PassChipID2
; jmp Try_Next
;CM_PassChipID2:
; mov RD_Port_OK,1 ; Turn on RD_Port_OK flag
; mov ax,ConfigBuf.wReadDataPort
; mov RD_Port,ax ; Save the RD_Port of PnP_CM
; shr ax,2
; mov RD_Port_IO,al ; Save RD_Port_IO,too
;
; mov di,offset 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,ConfigBuf.bCSN ; Save CardCSN
; mov [di].CardCSN,al
;
; mov al, ConfigBuf.bIRQRegisters
; mov [di].IRQ,al ; Save IRQ
;
; mov ax, ConfigBuf.wIOPort_Base
; 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 BoardPROM
; mov cx,16
; .286
; rep insb
; .8086
; mov si,offset 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
;
; inc BoardIndex
;Try_Next:
; inc bx
; jmp Get_Device_Config
;No_more_CM_Device:
;; mov dx,offset PnPDeviceNotFound
;; stc
;; ret
;
;CM_NotPresent:
; cmp CM_OK,1
; je Print_PnPCMNotPresent_OK
; mov dx, offset PnPCMNotPresent
; mov ah,9
; int 21h
;Print_PnPCMNotPresent_OK:
; ; Do our own PnP initialization
; mov dx,PnPAddress
; mov al,ConfigCtrl
; out dx,al
; mov dx,PnPWrite
; mov al,02h
; out dx,al ; Go to Wait-4-Key State
;
; mov dx,PnPAddress
; xor al,al
; out dx,al
; out dx,al ; 2 successive 0 for reset Key
; mov cx,32
; cld
; mov si,offset RTInitKey
; .286
; rep outsb ; Send out Realtek init Key
; .8086
;Next_RD_Port:
; cmp CM_OK,1
; je CSN_Already_0 ; Search Jumperless/Jumper only
; mov dx,PnPAddress
; mov al,RTResetCSN ; Use RT Reset CSN
; out dx,al
; mov dx,PnPWrite
; mov al,04h ; temporay reset our cards CSN
; out dx,al
;CSN_Already_0:
; mov dx,PnPAddress
; mov al,Wake ; Wake 0
; out dx,al
; mov dx,PnPWrite
; xor al,al
; out dx,al
;
; cmp RD_Port,3ffh
; jb short Continue_Try_Isolation
; jmp No_more_Card
;Continue_Try_Isolation:
; ;cmp RD_Port_OK,1 ; If we are searching Jumper(less)
; ;jz Pass_Set_RD_Port ; card, we must set RD_Port.
;
; mov dx,PnPAddress
; mov al,SetRD
; out dx,al
; mov dx,PnPWrite
; mov al,RD_Port_IO ; Set I/O Read Port
; out dx,al
;Pass_Set_RD_Port:
; mov di,offset PnPID ; clear PnPID
; xor al,al
; mov cx,9
; rep stosb
;
; mov dx,PnPAddress
; mov al,Isolation
; out dx,al
; Slow 1000 ; Wait 1ms
; xor cx,cx ; set cx=0
; mov dx,RD_Port
;Isolation_lp:
; in al,dx
; cmp al,55h
; je Iso_Pass1
; in al,dx
; jmp Iso_next
;Iso_Pass1:
; in al,dx
; cmp al,0AAh
; jne Iso_next
; mov bx,cx
; shr bx,3
; lea di,PnPID[bx]
; push cx ; Will use cl for shl, Save CX
; and cx,07h
; mov al,1
; shl al,cl
; or [di],al
; pop cx ; Take Back CX
;Iso_next:
; Slow 250 ; Wait 250 us
; inc cx
; cmp cx,72
; jb Isolation_lp
;
; mov si,offset PnPID
; call VerifyPnPID
; jnc PnPID_OK
; cmp RD_Port_OK,0
; je Set_Next_RD_Port
; jmp No_more_Card ; if RD_Port is OK, no more card
;
;Set_Next_RD_Port: ; Read Port Conflict
; add RD_Port,4
; inc RD_Port_IO
; mov ax,RD_Port
; and al,0Fh
; cmp al,0Fh
; jne Avoid_F_OK
; add RD_Port,4
; inc RD_Port_IO
;Avoid_F_OK:
; mov ax,RD_Port
; test al,10h
; jz Avoid_RDMA_OK
; add ax,10h
; mov RD_Port,ax
; add RD_Port_IO,4
;Avoid_RDMA_OK:
; jmp Next_RD_Port
;
;PnPID_OK:
; mov RD_Port_OK,1
; cmp BoardIndex,3
; jbe Have_space
; jmp No_BoardData_space
;Have_space:
; mov dx,PnPAddress
; mov al,CSNSAV
; out dx,al
; mov dx,RD_Port
; in al,dx
; mov SavedCSN,al
;
; mov dx,PnPAddress
; mov al,CSN
; out dx,al
; mov dx,PnPWrite
; mov al,BoardIndex
; add al,60h ; CSN=BoardIndex+60h
; out dx,al ; Now our card is in Config mode
;
; mov dx,PnPAddress ; Get Card I/O address
; mov al,SetIO_1
; out dx,al
; mov dx,RD_Port
; in al,dx
; mov ah,al
; mov dx,PnPAddress
; mov al,SetIO_0
; out dx,al
; mov dx,RD_Port
; in al,dx
; mov SavedIOBase,ax
;
; mov dx,PnPAddress ; Disable I/O Range Check
; mov al,IOCheck ; before we activate the Card
; out dx,al
; mov dx,PnPWrite
; xor al,al
; out dx,al
; mov dx,PnPAddress ; Activate our Card
; mov al,Activate
; out dx,al
; mov dx,PnPWrite
; mov al,1
; out dx,al
;
; mov ax,SavedIOBase ; We have an inactivate card
; and ax,0FF0h ; which makes RD_Port conflict
; mov bx,RD_Port ; after its activation.
; and bx,0FF0h ; This case should happen when
; cmp ax,bx ; the card is a PnP card.
; jne Check_ChipID
; mov RD_Port_OK,0
; add RD_Port,4
; inc RD_Port_IO
; mov BoardIndex,0
; jmp Next_RD_Port ; Totally re-do our search
;
;Check_ChipID:
; mov dx,SavedIOBase ; Check Chip's ID
; mov al,21h
; out dx,al
; add dx,0ah
; in al,dx
; cmp al,'P'
; je PassChipID1
; jmp Device_Conflict
;PassChipID1:
; inc dx
; in al,dx
; cmp al,'p'
; jne Device_Conflict
; ; Passed ChipID("Pp") check
; mov cl,BoardIndex
; and cx,0Fh
; mov di,offset BoardData
; cmp cx,0
; je Save_BoardData
;Add_BoardData_lp:
; add di,BoardDataLen
; loop Add_BoardData_lp
;Save_BoardData:
; mov al,SavedCSN ; Save CardCSN
; mov [di].CardCSN,al
;
; mov dx,PnPAddress ; Get Card's IRQ
; mov al,IRQLevel
; out dx,al
; mov dx,RD_Port
; in al,dx
; mov [di].IRQ,al ; Save IRQ
;
; mov dx,SavedIOBase ; Save IOBase
; mov [di].IOBase,dx
;
; 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 BoardPROM
; mov cx,16
; .286
; rep insb
; .8086
; mov si,offset BoardPROM
; pop di ; Take back DI
; cmp BYTE PTR [si]+14,'W'
; jne In_8_Slot
; mov [di].SlotSize,16
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -