.Title MDUNLD - MD Disk Unloader .Ident /V01.01/ ; Version information ; ; Copyright ()) 1986 ; Prolifix, Inc., Frankfort, Kentucky ; ; This software is made available to any user of a Digital Equipment ; Corporation Professional 300 series computer without charge. You may ; distribute, modify, and use this software as long this copyright ; notice is included and you do not charge anything beyond the cost of ; duplication. Title to and ownership of the software shall at all ; times remain with Prolifix, Inc. ; ; No committment for support or development of this software is implied ; or intended. No responsibility for the use or reliability of this ; software shall be assumed. ; ; X01.00 Jerry W. Ethington 28-May-1986 15:58:49 ; Creation. ; ; V01.01 Jerry W. Ethington 5-Jun-1986 01:01:00 ; Add code to emit status to parent tasks. ; .Sbttl Definitions .Mcall Atrg$S,Dtrg$S,Exst$S,Qiow$,Rdbbk$,Wsig$S .Mcall .Idata,.Pcode,.Pdata ; ; Macro to type an ascic string on TI: ; .Macro Type Stradd Mov Stradd,R0 ; Point R0 at string Call Typeit ; Type out string .Endm Type ; ; Macro to create an ascic string ; .Macro .Ascic String .Nchr $Strl$,^`String` .Byte $Strl$ .Ascii `String` .Endm .Sbttl Mainline Code .Pcode ; Code psect Mdunld: ; ; First step: dismount the memory disk volume..... ; Mov #Dmoarg,R5 ; R5 => dismount argument list Call Provol ; Dismount MD0: Cmp Status+2,#Is.Suc ; Check for success Beq 20$ ; If EQ, we won big Cmp Status+2,#-2 ; QIO error? Bne 10$ ; If not, give up Cmpb Status+4,#Ie.Abo ; Abort error? Bne 10$ ; If not, give up Cmp Status+6,#15. ; Was error volume not mounted? Beq 20$ ; If so, win 10$: Mov #Dmoerr,R0 ; Load error message Call Sumerr ; Lost big - barf out POSSUM error Br Done ; Give up ; ; Second step: unload the MD: driver..... ; 20$: Mov #Unlarg,R5 ; R5 => unload argument list Call Prolod ; Unload MD: Cmp Status+2,#Is.Suc ; Check for success Beq 30$ ; If EQ, we won bigger Mov #Unlerr,R0 ; Load error message Call Sumerr ; Barf out POSSUM error Br Done ; Give up ; ; Third step: attach the MDCOM region, mark it for delete, and then ; detach the thing to delete it from memory ; 30$: Atrg$S #Rdbadr ; Attach MDCOM Bcc 40$ ; If CC, it worked Mov #Atterr,R0 ; Couldn't attach - load error message Call Direrr ; Barf out exec error Br Done ; Give up 40$: Bis #Rs.Mdl,Rdbadr+R.Gsts ; Flag we want to delete region Dtrg$S #Rdbadr ; Detach MDCOM Bcc Done ; If CC, it worked and we are done! Mov #Deterr,R0 ; Load error message Call Direrr ; Barf out exec error message ; Br Done ; Give up Done: Exst$S Exstat ; Done! .Pdata ; Switch to read-only data Dmoerr: .Ascic Unlerr: .Ascic Atterr: .Ascic Deterr: .Ascic .Sbttl User Mode Subroutines ; ; Direrr displays the error code contained in the DSW. ; ; Calling sequence: ; R0 => .Ascic string ; Call Direrr ; ; All registers preserved ; .Pcode Direrr: Jsr R2,$Savvr ; Save R0-R2 Call Typeit ; Display caller's error message Mov #Dirstr,R1 ; R1 => edit string Mov #$Dsw,R2 ; R2 => argument list ; ; Common processing for Direrr and Sumerr starts here ; Comerr: Mov #Ex$Err,Exstat ; Flag error to parent task Mov #Trmbuf+1,R0 ; R0 => output buffer Call $Edmsg ; Edit string Movb R1,Trmbuf ; Save length of string Type #Trmbuf ; Dump error text Type #Resume ; Prompt for resume key Call Wtres ; Wait for resume key Return ; All done .Idata Trmbuf: .Blkb 128. .Pdata Dirstr: .Asciz '?EXEC-F-Directive error %D.' Resume: .Ascic ; ; Sumerr displays the error codes returned by POSSUM callable services ; to the status block STATUS:. ; ; Calling sequence: ; R0 => .Ascic string ; Call Sumerr ; ; All registers preserved ; .Pcode Sumerr: Jsr R2,$Savvr ; Save R0-R2 Call Typeit ; Display caller's error message Mov #Sumstr,R1 ; R1 => edit string Mov #Status,R2 ; R2 => argument list Br Comerr ; Join common error code .Pdata Sumstr: .Ascii '?POSSUM-F-System service error; ' .Asciz 'Decimal error code(s): %VD' ; ; Typeit displays an ascic string on terminal (TI:). ; Implied carriage control is assumed. ; Input: ; R0 => Ascic string ; ; R1-R5 preserved ; .Pcode Typeit: Mov @#$Dsw,-(SP) ; Save DSW for errors Movb (R0)+,Typqio+Q.Iopl+2 ; Stuff char count into DPB Mov R0,Typqio+Q.Iopl ; Stuff address into DPB 10$: Dir$ #Typqio ; Type string out on TI: Bcc 20$ ; If CC, it worked Cmp @#$Dsw,#Ie.Upn ; Insufficient pool? Bne 10$ ; If not, try again Wsig$S ; Hang about for a significant event Br 10$ ; Try our luck again 20$: Mov (SP)+,@#$Dsw ; Restore DSW Return ; All done .Idata Typqio: Qiow$ Io.Wvb,Tt$Lun,Tt$Efn,,,,<,,40> .Sbttl Data Storage .Pdata ; Read-only data .Even Dmoarg: .Word 4 ; Number of words in block .Word Status ; Status buffer .Word Dmoreq ; Function code .Word Devnam ; Device name .Word Devlen ; Device name length Unlarg: .Word 4 ; Number of arguments .Word Status ; Status buffer address .Word Unlreq ; Address of request .Word Devnam ; Device prefix .Word Lodlen ; Always 2 Dmoreq: .Word 2 ; Dismount a volume Devnam: .Ascii /MD0:/ ; Device name Devlen: .Word 4 ; Length of device name Unlreq: .Word 2 ; Unload a driver Lodlen: .Word 2 ; Length of device driver name .Idata ; Back to impure data Exstat: .Word Ex$Suc ; Assume success Rdbadr: Rdbbk$ 0,MDCOM,, Status: .Blkw 8. ; POSSUM status buffer .End Mdunld