.Title GetDDA Alvin Get Device Desc Adr .Psect Alvin,Gbl,Con .Ident /LVL51 / .Mcall $Alv51 .Globl LDevice $Alv51 ;+ ;;************************************************************************* ;; GetDDA - Subroutine to access the device descriptor address associated ;; with a specified Alvin unit number. ;; ;; Expects calls of the form: Jsr R5,GetDDA ;Get Device Desc Address. ;; .Word ;Alvin unit number. ;; ;; ;; ;; Note: If the unit number is negative, then the requested unit is presumed ;; to be in Register 3. ;- GetDDA:: Mov R3,-(SP) ;Stack registers used. Mov R2,-(SP) Mov R1,-(SP) MOV (R5)+,R2 ;Get unit number TSTB R2 ;Is the unit # negative? BMI GetDD5 ;Yes, then unit#/control is already in reg 3. MOV R2,R3 ;Put parm in work register GetDD5: Mov R3,R1 ;Save original unit number Mov #LDevice,R2 ;Get Base address of Device Table Descriptor. GetDD6: ; CLR R0 MOVB R3,R0 ; Move unit # CMP R0,DTDmax(R2) ; Is device # less than limit? BHIS GetDDexit ; No, then must exit ASL R0 ; Multiply by 2 for offset into device table ADD (R2),R0 ; Calc actual adr in device table Cmp R0,DTDend(R2) ; Is this within the table? Bhi GetDDexit ; No, it is invalid. MOV (R0),R0 ; Address of device descriptor Beq GetDDexit ; If zero, device does not exist. Tstb REDIRECT(R0) ; Is this unit to redirect to another unit? Ble GetDD8 ; No, branch Cmpb R1,LUNIT(R0) ; Is this the original unit specified? Bne GetDD8 ; No, branch, only one redirection allowed Movb REDIRECT(R0),R3 ;Get the redirection unit number. Br GetDD6 ; Go check it out. ;; GetDD8: Clc ; Indicate success in finding the Device Descriptor. Br GetDDX ; R0 contains the address of the DD to be used. ;; GetDDexit: Clr R0 ; Invalid unit # or Device Desc not in table. Sec ; Set carry for RT error flag. GetDDX: Mov (SP)+,R1 ; Restore work registers. Mov (SP)+,R2 Mov (SP)+,R3 Rts R5 ; Return with Register 0 set. ;;**************************************************************************** .END