tanith@csd4.csd.uwm.edu (Michael D Kretzer) (12/23/90)
Thanks for the patch to make OS/2 recognize more than two serial ports.
However, I have one problem--I do not have a recent copy of Macro
Assembler (I won't compile on the version I have--2.0). So, could
some nice soul on the net please compile COMEXP.ASM and post COMEXP.SYS
on comp.os2.binaries? (Do I have to beg?)
Thanks...
[Save this as
COMEXP.DEF]<cut>-----<cut>-----<cut>-----<cut>-----<cut>-----<cut>
LIBRARY COMEXP INITGLOBAL
DATA PRELOAD NONSHARED
CODE PRELOAD
PROTMODE
[Save this as
COMEXP.ASM]<cut>-----<cut>-----<cut>-----<cut>-----<cut>-----<cut>
; Use this to build COMEXP.SYS
;
; MASM COMEXP;
; LINK COMEXP,COMEXP.SYS,nul,os2,COMEXP.DEF
.286p
.SEQ
COM3base EQU 03E8h ; You may need to change this !!!!!
COM3test EQU COM3base+2
COM4base EQU 02E8h
COM4test EQU COM4base+2
ADATA SEGMENT PARA PUBLIC 'AUTO'
nexthdr dd 0FFFFFFFFh ;pointer to next device driver
devattr dw 8140h ;attribute flags
stratof dw offset strategy ;offset of strategy routine
entry
reserv1 dw 0
devname db 'COMEXP00'
reserv2 db 8 dup (0)
devhelp dd 0 ;this is where we save the
DevHelp
;pointer
end_of_data label byte ;the rest isn't needed after
init
initmsg db 0Dh,0Ah
db 'COM expander, '
db 'Copyright (c) 1990, Carlo Adami',0Dh,0Ah
initmsglen equ $-offset initmsg
com3msg db 'COM3 @3E8 Found',0Dh,0Ah
com3msglen equ $-offset com3msg
com4msg db 'COM4 @2E8 Found',0Dh,0Ah
com4msglen equ $-offset com4msg
byteswritten dw 0
ADATA ENDS
DGROUP GROUP ADATA
extrn DosWrite:far
CODE SEGMENT PARA 'CODE'
ASSUME CS:CODE,DS:ADATA
strategy proc far
mov al,es:[bx+2] ;examine command code in req packet
cmp al,0 ;"initialize" command
je initialize
mov word ptr es:[bx+3],0100h
ret
end_of_code label byte ;the rest isn't needed after init
initialize:
mov ax,es:[bx+14] ;save "DevHlp" call address
mov word ptr devhelp,ax
mov ax,es:[bx+16]
mov word ptr devhelp+2,ax
push 1
push ds
push offset initmsg
push initmsglen
push ds
push offset byteswritten
call DosWrite
push es
push di
cld
mov ax, 40h
mov es, ax
mov di, 0
mov dx,COM3test
in al,dx
test al,0f8h
jnz com4
mov es:[di],COM3base
push 1 ; com3 found
push ds
push offset com3msg
push com3msglen
push ds
push offset byteswritten
call DosWrite
com4: inc di
inc di
mov dx,COM4test
in al,dx
test al,0f8h
jnz fine
mov es:[di],COM4base
push 1 ; com4 found
push ds
push offset com4msg
push com4msglen
push ds
push offset byteswritten
call DosWrite
fine: inc di
inc di
mov ax, 0 ; cleanup other addresses
stosw
mov ax, 0
stosw
pop di
pop es
mov word ptr es:[bx+14],offset end_of_code ;set ending
offsets
mov word ptr es:[bx+16],offset end_of_data
mov word ptr es:[bx+18],0 ;set other req packet fields
mov word ptr es:[bx+20],0
mov word ptr es:[bx+3],0100h ;set status and exit
ret
strategy endp
CODE
ENDS
end
--<cut>-----<cut>-----<cut>-----<cut>-----<cut>-----<cut>-----<cut>-----<cut>