home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
telecom
/
uucp_450
/
src
/
getty
/
icept.asm
< prev
next >
Wrap
Assembly Source File
|
1991-02-03
|
2KB
|
126 lines
; ICEPT.ASM
;
; Intercept OpenDevice() for serial.device and force
; SERF_SHARED for the first openner, EXLUSIVE for
; other openners (required because I had to remove the
; serial port refcnt checking from uucico to support
; multi-serial ports)
;
; A1 holds IOExtSer request ptr. D0-D1/A0-A1 are NOT
; scratch.
;
; You CANNOT use A4 relative addressing since this routine
; is called from a different context.
;
; Various hacks have been added (checking the unit number
; against $FFFF) because, apparently, the A2232 serial
; device re-vectors through its opendevice vector for
; some ungodly reason.
include "exec/types.i"
include "devices/serial.i"
section text,CODE
xdef _AsmOpenIntercept
xdef _AsmCloseIntercept
xref _OldOpenVector
xref _OldCloseVector
;xref _OldBeginIOVector
xref _DeviceUnit
xref _DeviceName
xref _RefCnt
xref _UnitPtr ; check unit on close
xref _strcmp
; OpenDevice
;
; A0 = devName
; D0 = unitNumber
; A1 = iORequest
; D1 = flags
_AsmOpenIntercept:
cmp.l _DeviceUnit,D0
beq aovalid
move.l _OldOpenVector,-(sp)
rts
aovalid
tst.l _RefCnt
beq oivalid10
bmi oivalid10
moveq.l #1,D0 ; return error
move.b D0,31(A1) ; store in io_Error
clr.l 20(A1) ; clear io_Device
rts
oivalid10
or.b #SERF_SHARED,IO_SERFLAGS(A1)
move.l A1,-(sp)
pea oirts(pc)
move.l _OldOpenVector,-(sp)
rts
oirts
move.l (sp)+,A1
tst.b 31(A1) ; error code
bne oifailed
move.l 24(A1),_UnitPtr
addq.l #1,_RefCnt
oifailed
rts
_AsmCloseIntercept:
move.l A0,-(sp)
move.l 24(A1),A0
cmp.l _UnitPtr,A0
bne ci10
subq.l #1,_RefCnt
ci10
move.l (sp)+,A0
move.l _OldCloseVector,-(sp)
rts
; A2232 serial.device fix
; xdef _A2232BeginIOFix
;
;_A2232BeginIOFix
; movem.l A2/A5-A6,-(sp)
; move.l A1,-(sp)
; move.l $18(A1),A5
; movea.l 8(A5),A6
; move.b #5,8(A1)
; move.l $1C(A1),D0
; andi.w #$100,D0
; move.w D0,$1E(A1)
; clr.w D0
; swap D0
; cmpi.w #$B,D0
; bls sk10
; moveq.l #0,D0
;sk10 lsl.w #2,D0
; move.l D0,-(sp)
; lea $40(A5),A0
; jsr -$234(A6)
; move.l (sp)+,A0
; add.l _OldBeginIOVector,A0
; add.l #$50,A0
; move.l (A0),A0
; jsr (A0)
; move.l D0,-(sp)
; lea $40(A5),A0
; jsr -$23A(A6)
; move.l (sp)+,D0
; move.l (sp)+,A1
; andi.b #$41,D0
; bne sk20
; jsr -$17A(A6)
;sk20 movem.l (sp)+,A2/A5-A6
; rts
END