www.pudn.com > snoop.lzh > PACK.ASM


 
.model large 
 
.code 
 
 
teststring db 'PKT DRVR' 
 
newbuffer dw 0 
countera dw 0 
counterb dw 0 
countx dw 0 
buffer db 16384 dup(0) 
 
public _packetvector 
_packetvector: 
    push bp 
    mov bp,sp 
    push di 
    push si 
    push ds 
    push es 
    mov ah,35h 
    mov al,[bp+6] 
    int 21h 
    mov di,bx 
    add di,3 
    push cs 
    pop ds 
    mov si,offset teststring 
    mov cx,8 
    repe cmpsb 
    mov ax,cx 
packetvectorreturn: 
    pop es 
    pop ds 
    pop si 
    pop di 
    pop bp 
    retf 
packetvectorinvalid: 
    mov ax,0007h 
    jmp packetvectorreturn 
 
public _usepacketvector 
_usepacketvector: 
    push bp 
    mov bp,sp 
    mov al,[bp+6] 
    mov bx,offset driverinfoint + 1 
    mov [bx],al ;there has to be a better way! 
    mov bx,offset accesstypeint + 1 
    mov [bx],al ;there has to be a better way! 
    mov bx,offset releasetypeint + 1 
    mov [bx],al ;there has to be a better way! 
    mov bx,offset getaddressint + 1 
    mov [bx],al ;there has to be a better way! 
    mov bx,offset setrcvmodeint + 1 
    mov [bx],al ;there has to be a better way! 
    mov bx,offset sendpacketint + 1 
    mov [bx],al ;there has to be a better way! 
    pop bp 
    retf 
 
public _driverinfo 
_driverinfo: 
    push bp 
    mov bp,sp 
    push di 
    push si 
    push ds 
    push es 
    mov ax,01FFh 
    mov bx,[bp+6] 
driverinfoint: 
    int 60h 
    jc driverinfoerror 
    mov di,[bp+8] 
    mov es,[bp+10] 
    mov es:[di],bx 
    mov es:[di+2],ch 
    mov byte ptr es:[di+3],0 
    mov es:[di+4],dx 
    mov es:[di+6],cl 
    mov byte ptr es:[di+7],0 
    mov es:[di+8],si 
    mov es:[di+10],ds 
    mov es:[di+12],al 
    mov byte ptr es:[di+13],0 
    mov ax,0000h 
driverinforeturn: 
    pop es 
    pop ds 
    pop si 
    pop di 
    pop bp 
    retf 
driverinfoerror: 
    mov al,dh 
    mov ax,10h ;just to make sure non-zero 
    jmp driverinforeturn 
 
public _accesstype 
_accesstype: 
    push bp 
    mov bp,sp 
    push di 
    push si 
    push ds 
    push es 
    mov ah,02h 
    mov al,[bp+6] 
    mov bx,[bp+8] 
    mov dl,[bp+10] 
    mov si,[bp+12] 
    mov ds,[bp+14] 
    mov cx,[bp+16] 
    mov di,offset receiver 
    push cs 
    pop es 
accesstypeint: 
    int 60h 
    jc accesstypeerror 
    mov dx,0000h 
accesstypereturn: 
    pop es 
    pop ds 
    pop si 
    pop di 
    pop bp 
    retf 
accesstypeerror: 
    mov ax,0000h 
    mov dl,01h 
    jmp accesstypereturn 
 
receiver: 
    cmp ax,0000h 
    jz receiveralloc 
    cmp ax,0001h 
    jnz receiverreturn 
    inc word ptr cs:[counterb] 
    mov word ptr cs:[newbuffer],0001h 
    jmp receiverreturn 
receiveralloc: 
    inc word ptr cs:[countera] 
    cmp cx,16384 
    jg receivernot 
    cmp word ptr cs:[newbuffer],0 
    jz receiverready 
receivernot: 
    mov di,0000h 
    mov es,di 
    retf 
receiverready: 
    mov cs:[countx],cx 
    push cs 
    pop es 
    mov di,offset buffer 
receiverreturn: 
    retf 
 
public _getbufferaddress 
_getbufferaddress: 
    mov ax,offset buffer 
    mov dx,cs 
    retf 
 
public _getaddress 
_getaddress: 
    push bp 
    mov bp,sp 
    push di 
    push es 
    mov ah,6 
    mov bx,[bp+6] 
    mov di,[bp+8] 
    mov es,[bp+10] 
    mov cx,[bp+12] 
getaddressint: 
    int 60h 
    jc getaddresserror 
    xor ax,ax 
getaddressreturn: 
    pop es 
    pop di 
    pop bp 
    retf 
getaddresserror: 
    mov al,dh 
    mov ah,10h 
    jmp getaddressreturn 
 
public _sendpacket 
_sendpacket: 
    push bp 
    mov bp,sp 
    push ds 
    push si 
    mov ah,04h 
    mov si,[bp+6] 
    mov ds,[bp+8] 
    mov cx,[bp+10] 
sendpacketint: 
    int 60h 
    jc sendpacketerror 
    mov ax,0000h 
sendpacketreturn: 
    pop si 
    pop ds 
    pop bp 
    retf 
sendpacketerror: 
    mov al,dh 
    mov ah,10h 
    jmp sendpacketreturn 
 
public _releasetype 
_releasetype: 
    push bp 
    mov bp,sp 
    mov ah,03h 
    mov bx,[bp+6] 
releasetypeint: 
    int 60h 
    jc releasetypeerror 
    mov ax,0000h 
releasetypereturn: 
    pop bp 
    retf 
releasetypeerror: 
    mov al,dh 
    mov ah,10h 
    jmp releasetypereturn 
 
public _newbuffer 
_newbuffer: 
    mov ax,cs:[newbuffer] 
    retf 
 
public _freebuffer 
_freebuffer: 
    mov word ptr cs:[newbuffer],0 
    retf 
 
public _getcountera 
_getcountera: 
    mov ax,cs:[countera] 
    retf 
 
public _getcounterb 
_getcounterb: 
    mov ax,cs:[counterb] 
    retf 
 
public _getcountx 
_getcountx: 
    mov ax,cs:[countx] 
    retf 
 
public _setrcvmode 
_setrcvmode: 
    push bp 
    mov bp,sp 
    mov ah,20 
    mov bx,[bp+6] 
    mov cx,[bp+8] 
setrcvmodeint: 
    int 60h 
    jc setrcvmodeerror 
    mov ax,0000h 
setrcvmodereturn: 
    pop bp 
    retf 
setrcvmodeerror: 
    mov al,dh 
    mov ah,10h 
    jmp setrcvmodereturn 
 
end