.TITLE LOAD .IDENT /08/ ;+ ; load ; ; Manually load the defined segment. This routine has to be called ; before any call to a subroutine on that segment. ; ; Translated: ; ; 19-APR-82 ; ; David Klotzbach - AIC ; ; on Entry: ; ; R0 -> Load segment parameter block. ; ; Where: ; ; A load parameter block is defined as: ; ; +-------------------+-------------------+ ; | efn | Size in bytes | +00 ; +-------------------+-------------------+ ; | | +02 ; +---- RAD50 of the segment name -----+ ; | | +04 ; +---------------------------------------+ ; | [ Pointer to an IOSB ] | +06 (opt) ; +---------------------------------------+ ; | [ Pointer to an AST ] | +10 (opt) ; +---------------------------------------+ ; ; on return: ; ; CC - Load was okay ; CS - Load request failure ;- .mcall alodf$,owddf$ alodf$ ; Define the segment descriptor symbols. owddf$ ; Define the autoload wdb symbols. .PSECT $$LOAD $LOAD: CMPB (R0),#3 ;Is the size of the parameter block less than 3? BLO 100$ ;LO - Yes exit with C bit set. JSR R5,$SAVRG ;Else save the volatile registers and MOV R2,-(SP) ;R2. MOV @#N.OVPT,R2 ;Fetch the address of the work area. MOV N.SZSG(R2),R4 ;copy size of Segment descriptor block MOV R2,R3 ;Save address of work area MOV N.STBL(R2),R2 ;Point to the first segment 10$: TST (R2) ;Is it a valid Segment descriptor? SEC ;Assume it isn't BEQ 60$ ;EQ- Guessed right so exit with error CMP s.name(R2),2(R0) ;Compare the LPB name with this segment BNE 20$ ;NE - Skip the next SDB CMP s.name+2(R2),4(R0) ;First half okay how about the second? BEQ 30$ ;EQ - This is the segment. 20$: ADD R4,R2 ;Advance to the next segment BR 10$ ;and repeat the test. 30$: BIC #ss.dsk,(R2) ;No longer loaded from disk CMP R4,#s.lgth ;Does the task have memory resident overlays? BLO 40$ ;LO - No MOV 20(R2),R4 ;Else Get the window descriptor block address BEQ 40$ ;EQ - No window so ignore this one BIC #wf.map,w.nflg(R4) ;Else mark is as not mapped 40$: CLR R5 ;Assume the defaults for the AST CLR R4 ; And the IOSB CMPB (R0),#4 ;Was LPB size less than 4? BLO 50$ ;LO- Yes so ready to go MOV 6(R0),R4 ;ELSE Transfer the Users IOSB address CMPB (R0),#5 ; Was LPB size less than 5? BLO 50$ ;LO - Yes so now ready to go MOV 10(R0),R5 ;Else transfer the Users AST address 50$: ADD #N.RDSG,R3 ; Point to the load and map routine MOV (R3)+,-(SP) ; Save the routine address and point to the unmap routine MOV (R3)+,-(SP) ; And save it CLR R3 ;Use the users EFN if this is to be BISB 1(R0),R3 ;an Asyncronous load. CALL @(SP)+ ; Call the unmap routine CALL @(SP)+ ;Call the map routine 60$: MOV (SP)+,R2 ; Restore R2, the rest will be restored in the co-routine 100$: RETURN .END