📄 pnppd.asm
字号:
;################################################################################
;
; Title: RTL8019 Plug-And-Play Packet Driver
;
; History: V1.00 -- 1994.07.29
; V1.10 -- 1994.09.05
; V1.20 -- 1994.10.05
; V1.30 -- 1995.07.05
;
; Notes: All changed codes are marked with the release date 'DD/MM/YY'.
; In other words, you may search '07/12/90' if you want to find
; the changed codes of a source program released on 1990.07.12,
;
;################################################################################
;
;
; Name: PNPPD.100
;
; Version: V1.00
;
; Released By: tflin
;
; Release Date: 1994.07.29
;
; Changed File:
;
; Reason: New release version.
;
; Comment: When 2 or more 8019 cards are installed. This program will use
; the one which has lower PnP serial Number.
;
;################################################################################
;
;
; Name: PNPPD.110
;
; Version: V1.10
;
; Released By: tflin
;
; Release Date: 1994.09.05
;
; Changed File: EXE/PNPPD.COM
; SOURCE/PNPPD.ASM
; SOURCE/TAIL.ASM
;
; Reason: 1. Driver supports at most 4 RTL8019 Cards.
;
; 2. Fixed the bug when in PnP environments, Jumper/Jumpless Card
; will not be found.
;
; 3. In multiple-card case, driver will print out all cards'
; information and prompt user to select one.
;
; Comment: 1. After the driver runs, CSN values of PnP Cards will be
; preserved. For Jumper/Jumpless cards, CSNs are set back to 0.
;################################################################################
;
;
; Name: PNPPD.120
;
; Version: V1.20
;
; Released By: Jasper
;
; Release Date: 1994.10.05
;
; Changed File: EXE/PNPPD.COM
; SOURCE/PNPPD.ASM
;
; Reason: 1. Driver supports up to 8 RTL8019 Cards.
;
; 2. Uses direct IO scanning method to locate 8019 cards.
;
;
;################################################################################
;
;
; Name: PNPPD.130
;
; Version: V1.30
;
; Released By: C.C.Liu
;
; Release Date: 1994.07.05
;
; Changed File: EXE/PNPPD.COM
; SOURCE/PNPPD.ASM
; SOURCE/TAIL.ASM
;
; Reason: 1. Processing parameters about commnd line.
;
; 2. Add help option -h .
;
;################################################################################
version equ 4
;History:76,1 0
; The following people have contributed to this code: David Horne, Eric
; Henderson, and Bob Clements.
; Copyright, 1988-1992, Russell Nelson, Crynwr Software
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, version 1.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include defs.asm
code segment word public
assume cs:code, ds:code
;*****************************************************************************
;
; NE2000 controller board offsets
; IO port definition (BASE in io_addr)
;*****************************************************************************
NE_DATAPORT EQU 10h ; NE2000 Port Window.
NE_RESET EQU 1fh ; Issue a read for reset
EN_OFF equ 0h
include 8390.inc
; Shared memory management parameters
SM_TSTART_PG equ 040h ; First page of TX buffer
SM_RSTART_PG equ 046h ; Starting page of RX ring
SM_RSTOP_PG equ 080h ; Last page +1 of RX ring
pause_ macro
; jmp $+2
;
; The reason for the pause_ macro is to establish a minimum time between
; accesses to the card hardware. The assumption is that the fetch and execution
; of the jmp $+2 instruction will provide this time. In a fast cache machine
; this may be a false assumption. In a fast cache machine, there may be
; NO REAL TIME DIFFERENCE between the two I/O instruction streams below:
;
; in al,dx in al,dx
; jmp $+2
; in al,dx in al,dx
;
; To establish a minimum delay, an I/O instruction must be used. A good rule of
; thumb is that ISA I/O instructions take ~1.0 microseconds and MCA I/O
; instructions take ~0.5 microseconds. Reading the NMI Status Register (0x61)
; is a good way to pause on all machines.
;
; The National 8390 Chip (NIC) requires 4 bus clocks between successive
; chip selects (National DP8390 Data Sheet Addendum, June 1990 -- it took them
; long enough to figure this out and tell everyone) or the NIC behaves badly.
; Therefor one I/O instruction should be inserted between each successive
; NIC I/O instruction that could occur 'back - to - back' on a fast cache
; machine.
; - gft - 910529
;
push ax
in al, 61h
pop ax
;
endm
reset_8390 macro
loadport
setport NE_RESET
in al,dx
longpause
out dx,al ; should set command 21, 80
endm
terminate_board macro
endm
public int_no, io_addr
int_no db 2,0,0,0 ;must be four bytes long for get_number.
io_addr dw 0300h,0 ; I/O address for card (jumpers)
public driver_class, driver_type, driver_name, driver_function, parameter_list
driver_class db BLUEBOOK, IEEE8023, 0 ;from the packet spec
driver_type dw 54 ;from the packet spec
driver_name db 'PNPPD ',0,0,0,0 ;name of the driver.
driver_function db 2
parameter_list label byte
db 1 ;major rev of packet driver
db 9 ;minor rev of packet driver
db 14 ;length of parameter list
db EADDR_LEN ;length of MAC-layer address
dw GIANT ;MTU, including MAC headers
dw MAX_MULTICAST * EADDR_LEN ;buffer size of multicast addrs
dw 0 ;(# of back-to-back MTU rcvs) - 1
dw 0 ;(# of successive xmits) - 1
int_num dw 0 ;Interrupt # to hook for post-EOI
;processing, 0 == none,
;; extrn is_186: byte ;=0 if 808[68], =1 if 80[123]86.
is_16_slot db 1
;
; Block input routine
; CX = byte count, es:di = buffer location, ax = buffer address
public block_input
block_input:
push ax ; save buffer address
loadport
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,cl
out dx,al
setport EN0_RCNTHI
pause_
mov al,ch
out dx,al
pop ax ; get our page back
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_
;; cmp is_186,0
cmp is_16_slot,0
jnz read_186
read_loop:
in al,dx ; get a byte
stosb ; save it
loop read_loop
ret
read_186:
shr cx,1 ; word count
.286
rep insw
.8086
jnc read_186_1 ;is there an extra byte?
in ax,dx ;yes, read the next word and store a
stosb ; byte.
read_186_1:
ret
;
; Block output routine
; CX = byte count, ds:si = buffer location, ax = buffer address
block_output:
assume ds:nothing
push ax ; save buffer address
inc cx ; make even
and cx,0fffeh
loadport
setport EN_CCMD
pause_
mov al,ENC_NODMA+ENC_START
out dx,al ; stop & clear the chip
setport EN0_RCNTLO ; remote byte count 0
pause_
mov al,cl
out dx,al
setport EN0_RCNTHI
pause_
mov al,ch
out dx,al
pop ax ; get our page back
setport EN0_RSARLO
pause_
out dx,al ; set as lo address
setport EN0_RSARHI
pause_
mov al,ah
out dx,al
setport EN_CCMD
pause_
mov al,ENC_RWRITE+ENC_START ; write and start
out dx,al
setport NE_DATAPORT
pause_
;; cmp is_186,0
cmp is_16_slot,0
jnz write_186
write_loop:
lodsb ; get a byte
out dx,al ; save it
loop write_loop
jmp short block_output_1
write_186:
shr cx,1 ; word count
.286
rep outsw
.8086
block_output_1:
mov cx,0
setport EN0_ISR
tx_check_rdc:
in al,dx
test al,ENISR_RDC ; dma done ???
jnz tx_start
loop tx_check_rdc
stc
ret
tx_start:
clc
ret
include 8390.asm
public usage_msg
usage_msg db "Usage: PNPPD [options] [packet_int_no(default=0x60)]",CR,LF,'$'
public copyright_msg
copyright_msg db "Packet driver for REALTEK 8019 Plug&Play Ethernet Card, version "
; ;;;;;;;;;;;;; db '0'+(majver / 10),'0'+(majver mod 10),".",'0'+version,".",'0'+dp8390_version,CR,LF,'$'
db "1.31 (950705)",CR,LF,'$'
db 80 dup(20h)
int_no_name db "Interrupt(IRQ) number ",'$'
io_addr_name db "I/O port ",'$'
extrn set_recv_isr: near
;enter with si -> argument string, di -> word to store.
;if there is no number, don't change the number.
extrn get_number: near
;enter with dx -> name of word, di -> dword to print.
extrn print_number: near
;
; For PnP use varibles
;
; Jasper 10/05/94 {
;MAX_MEM_REGISTERS equ 9
;MAX_IO_PORTS equ 20
;MAX_IRQS equ 7
;MAX_DMA_CHANNELS equ 7
;
;Config_Info struc
; dBusID dd 0
; dDevID dd 0
; dSerialNum dd 0
; dLogicalID dd 0
; dFlags dd 0
;
; bCSN db 0
; bLogicalDevNumber db 0
; WReadDataPort dw 0
;
; wNumMemWindows dw 0
; dMemBase dd MAX_MEM_REGISTERS dup(0)
; dMemLength dd MAX_MEM_REGISTERS dup(0)
; wMemAttrib dw MAX_MEM_REGISTERS dup(0)
; wNumIOPorts dw 0
; wIOPort_Base dw MAX_IO_PORTS dup(0)
; wIOPort_Length dw MAX_IO_PORTS dup(0)
; wNumIRQs dw 0
; bIRQRegisters db MAX_IRQS dup(0)
; bIRQAttrib db MAX_IRQS dup(0)
; wNumDMAs dw 0
; bDMALst db MAX_DMA_CHANNELS dup(0)
; wDMAAttrib dw MAX_DMA_CHANNELS dup(0)
;Config_Info ends
;
;CM_OK db 0
;CM_Entry dd 0
;ConfigBuf Config_Info <>
;;
;; PnP I/O Port Addresses
;PnPAddress equ 279h
;PnPWrite equ 0a79h
;;PnP index registers
;SetRD equ 0h
;Isolation equ 1h
;ConfigCtrl equ 2h
;Wake equ 03h
;CSN equ 06h
;Activate equ 30h
;IOCheck equ 31h
;SetIO_1 equ 60h
;SetIO_0 equ 61h
;IRQLevel equ 70h
;CSNSAV equ 0F5h ; RTL8019 defined
;RTResetCSN equ 0F6h ; RTL8019 defined
;
NICNotFound db 'There is no 8019 PnP Card on your system !',0dh,0ah,'$',10 dup (20h)
;PnPDeviceNotFound db 'Realtek 8019 PnP Card does not register to PnP Config Manager.',0Dh,0Ah,'$'
PnPIRQTooBig db 'The card is on an 8-bit slot. Please config IRQ less than 8.',0Dh,0Ah
; db ' Or move it to a 16-bit ISA slot for IRQ larger than 8.',0Dh,0Ah,'$'
;DotString db '.$'
;PnPCMVersion db 'PnP Configuration Manager of this system is version ','$'
;PnPCMNotPresent db 'There is no PnP Configuration Manager present. Using Realtek PnP protocol.',0Dh,0Ah,'$'
;BoardConflictMessage1 db 'The 8019 card at I/O:','$'
;BoardConflictMessage2 db ' is conflict with other device, please check it!!',0Dh,0Ah,'$'
;TooManyBoards db 'More than 4 RTL8019 ethernet cards found. Driver will support only 4 cards.',0Dh,0Ah,'$'
; } Jasper 10/05/94
;
; Print Board Data
BoardDataString1 db 'Found Card ','$'
BoardDataString2 db ': EtherID=','$'
BoardDataString3 db ',IO=','$'
BoardDataString4 db ',IRQ=','$'
;BoardDataString5 db ',PnPCSN=','$' ; Jasper 10/05/94
BoardDataString6 db ' on ','$'
BoardDataString7 db '-bit slot.',0Dh,0Ah,'$'
;
PromptString1 db 'Please specify which card the driver attach (0-','$'
PromptString2 db '):','$'
; Liu 7/05/95 {
public AttachString1
public AttachString3
AttachString1 db CR,LF,'Driver is attached to card ','$'
;AttachString2 db '. It is configurated as:',0Dh,0Ah,'$'
AttachString3 db 'Error : Parameter not recognized ,driver is NOT loaded',CR,LF,CR,LF,'$'
;} Liu 7/05/95
;---------------------------------------------------------
; Wait 200ns*Number
;---------------------------------------------------------
; Jasper 10/05/94 {
;Slow MACRO Number
; LOCAL Slow_lp
; push cx
; push ax
; mov cx,Number
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -