.TITLE ASSETHCHN .IDENT /V02-002/ ; © 2000 P. Beaudoin ; This software is supplied as is and the usual warranty ; is implied - none. You may use, abuse, modify or ; or ignore this software as you see fit but are ; encouraged to give credit, as is good practice ; when stealing with permission ; ;++ ;1 ASSETHCHN ; Assigns a channel to the first available Ethernet device ; and returns the channel number to the caller. ;-- ; Modifications ; 001 1992 PB Creation ; 001 Feb-1993 PB Bug fix (note 1) ; 002 26-Apr-1993 PB If condition handler called, correct error ; is now returned. ; Modification notes: ; ; 1. Routine often returns "invalid logical name' until it has been relinked ; on local system. This does not always work. Change the method used to scan ; the 'known device' table. Each item is fixed len so we simply create a ; pointer directly to it. Much simpler and if $assign is corrupting r4 or r5 ; this !*+^& error will stop. ; Added some device types. ; Removed check for correct number of params. ; General Clean: Removed unneeded $DEFs, Fixed DATA .psect. ; 2. ;++ ;2 Inputs ; P1 .address of .long where channel number is written. ; Channel is a .word quantity, this routine uses only ; the low order word of the P1 param. ;2 Returns ; SS$_NORMAL Channel assigned OK and channel number written ; SS$_ACCVIO Can't write outp field ; SS$_NOSUCHDEV Can't find valid Ethernet device ; ;2 Abstract: ; Attempt to assign channel to first device on list ; If succesful, Exit with SS$_NORMAL ; if not try next on list ; If list exhausted exit with ss$_NOSUCHDEV ; System Service Errors are passed back to caller ;2 NOTE ; Known Ethernet device types are hard coded in this routine. As new ; devices appear, this module is updated. All callers will have to relink. ;-- ; Data .LIBRARY "SYS$LIBRARY:LIB.MLB" $CHFDEF ; Condition handler $SSDEF ; System Services .PSECT AET_DATA NOWRT,LONG ; Known Ethernet device drivers: DEVADR: .ASCID /ESA0/ .ASCID /XQA0/ .ASCID /ETA0/ .ASCID /XEA0/ .ASCID /EXA0/ .ASCID /EZA0/ .ASCID /EFA0/ .ASCID /ECA0/ .ASCID /FCA0/ .ASCID /FXA0/ .ASCID /EWA0/ .LONG 0 ; .PSECT CODE NOWRT,EXE,LONG ; .ENTRY ASSETHCHN,^M .CALL_ENTRY MAX_ARGS=12, HOME_ARGS=TRUE, INPUT=, PRESERVE=, LABEL=ASSETHCHN MOVAB ASSETHCHN_HANDLER,(FP) ; Condition handler ; ; Assign channel to the first available device ; MOVAL DEVADR,R6 MOVL 4(AP),R7 10$: TSTL (R6) ; End of list? BEQL 30$ ; Yes $ASSIGN_S- ; Attempt to assign to this dev DEVNAM=(R6),- ; CHAN=(R7) ; BLBS R0,40$ ; Br if OK ADDL #12,R6 ; Skip to next device name CMPW R0,#SS$_NOSUCHDEV ; Was the error "no such device"? BEQL 10$ ; If yes, try next device name ; ACCVIO caught here and returned RET ; If No - exit with error. 30$: MOVL #SS$_NOSUCHDEV,R0 ; No device was found. RET ; Exit with status ; Assign OK 40$: MOVL #SS$_NORMAL,R0 ; Signal Success RET ; .ENTRY ASSETHCHN_HANDLER,^M<> .CALL_ENTRY MAX_ARGS=12, HOME_ARGS=TRUE, INPUT=, PRESERVE=, LABEL=ASSETHCHN_HANDLER $UNWIND_S ; Unwind stack to previous caller MOVL #CHF$L_SIG_NAME,R0 ; Error RET ; Tell the caller .END