.MCall .Module .Module KEDIO4 RELEASE=V02 VERSION=10 COMMENT=,IDENT=NO,AUDIT=NO,GLOBAL=.KEDI4 ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ;MODULE: KedIO4 ; ;ABSTRACT: ; ; This is the second part of the system dependent package ; to support the keypad editor under RT-11. It contains ; most of the editor's shutdown routines. ; .SbTtl KedIO4 RT-11 system dependent routines .Enable LC .Enable GBL .SbTtl Assembly parameters .IIf NDF VT10$0 VT10$0 = 1 ;assume VT100 version .IIf NDF VT62$ VT62$ = 0 ;Assume no VT62 support .IIf NDF Virt$ Virt$ = 0 ;assume normal, not Virtual job .IIf NDF Rsts$ Rsts$ = 0 ;assume NO RSTS support ; ;MIN$C NE To enable owner checking of output volume for ; digital and to disallow output to a 'DIGITAL' ; owned volume. ; .IIf NDF MIN$C MIN$C = 0 ;Assume not MINC version ; ; display subtitles for the flavor we are assembling ; .SbTtl .IIf NE Virt$ .SbTtl Virtual Ked .IIf EQ Virt$ .SbTtl Normal Ked .IIf NE VT10$0 .SbTtl for VT100 terminal .IIf EQ VT10$0 .SbTtl for VT52 terminal .IIf NE MIN$C .SbTtl with MINC owner checking enabled .SbTtl .SbTtl Equated symbols ; ; RT11 SYSCOM locations ; JStk =: 42 ;stack address JSW =: 44 ;status word J$NoSL =: 000020 ;disable single line editor J$NoWt =: 000100 ;don't wait for I/O on terminal J$Chain =: 000400 ;chain bit J$Rntr =: 020000 ;reenter bit of JSW J$Char =: 010000 ;character (not line) mode J$LC =: 040000 ;LC J$SpMod =: J$Char!J$LC ;LC and character mode JUSR =: 46 ;USR load address JErB =: 52 ;SYS error byte E.FetE =: -4 ;.Fetch failed (I/O or load over USR/RMON) E.DirE =: -3 ;Directory I/O Error E.EOF =: 0 ;End of File E.IOEr =: 1 ;Read/Write IO error E.FNF =: 1 ;File Not Found E.Prot =: 3 ;Protected file JRMON =: 54 ;RMON base ; ; RT11 chain area ; JChain =: 500 ;DBLK for program to chain to JChnArg =: 510 ;beginning of arguments for chain ; ; RMON offsets ; CCLRTS =: 242 ;BYTE 0 = not CCL, 0 <> CCL with args ;The above for RSTS RT11 RTS V3C USRLod =: 266 ;offset to USR load address Versi$ =: 276 ;offset in RMON to monitor version MinRel =: 5 ;minimum release supporting .CLOSZ Confg$ =: 300 ;offset in RMON to config word FB$ =: 000001 ;FB bit in above word ; ; EMT CODES ; .CMkT =: 23 ;code for .CMkT request .Enter =: 2 ;code for .Enter request .GtJb =: 20 ;code for .GtJb request .LookUp =: 1 ;code for .LookUp request .MrkT =: 22 ;code for .MrkT request .SCCA =: 35 ;code for .SCCA request .SpFun =: 32 ;code for .SpFun request SP$Siz =: 373 ;.SPFUN code for size request ; ; Area for programmed requests is in the scrollers impure area. ; The label 'Area' contains the address of the 20 word area. ; ; Symbols for $Cls ; C$HBW =: 6 ;Offset to highest block written .SbTtl Macro Definitions ; ; RT-11 Macro Definitions ; ; From SYSMAC.SML .MCall .Assume .MCall .Br .MCall .Chain .Close .ClosZ .CMkT .CSISpc .MCall .Delete .DStatus .MCall .Enter .Exit .MCall .Fetch .MCall .GTim .GtJb .GVal .MCall .HReset .MCall .Lookup .MCall .MrkT .MTAtch .MTDtch .MTGet .MTSet .MCall .Peek .Poke .Print .Purge .PVal .MCall .QSet .MCall .RCtrlO .ReadW .Renam .MCall .SCCA .SErr .SetTop .SpFun .SReset .MCall .TtInR .TtyIn .TtyOut .MCall .WritW .MCall ...CMY ...CMZ ;From KEDMAC.MLB .MCall ...... Bon Boff .MCall Pop $Print PSect Push SavReg .If EQ Virt$ .MCall Sob .EndC; EQ Virt$ .MCall CmdOn CmdOff IsCmd .MCall CROn CROff IsCR .MCall ExeOn ExeOff IsExe .MCall ExIOn ExIOff IsExI .MCall JouOn JouOff IsJou .MCall JReOn JReOff IsJRe .MCall LrnOn LrnOff IsLrn .MCall RecOn RecOff IsRec .MCall SerOn SerOff IsSer .MCall SLFOn SLFOff IsSLF .If NE Rsts$ ; ; RSTS RT-11 SetSQB EMT ; .Macro .SetFQB Emt 360 .EndM .SetFQB ; ; RSTS RT-11 emulator trap Ctrl/C ; ;input: ; R0 = AST address ; .Macro .CtrlC EMT 362 .EndM .CtrlC ; ; RSTS RT-11 emt PREFIX ; .Macro .Prefix EMT 377 .EndM .Prefix ; ; RSTS RT-11 Clear FQB emt ; .Macro .ClrFQB EMT 370 .EndM .ClrFQB ; ; RSTS UUO request ; .Macro .UUO EMT 66 .EndM .UUO .EndC; NE Rsts$ .SbTtl Define error macros $Ked$ = 1 ;Defined here but not in error module .If NE 0 ;This code is assembled in the error module ;+ ;ERROR ; .Page .SbTtl Errors from KedIO4 module .IIf NDF MIN$C MIN$C = 0 ;Assume not MINC version ;- .EndC; NE 0 ; ;The following code is included as an error section so that it will be ;pulled out and assembled in the error module also. In this module, the ;error macro is defined to print an error message and the help macro ;defined to set up a help message. In the error module, the macros are ;defined to assemble the message text. ; ;+ ;ERROR ; .MCall ErrDef, HlpDef ErrDef I4,Err ;Invoke macro to define error macro HlpDef I4 ;Invoke macro to define help macro ;- PSECT KEDIO .SbTtl .SbTtl $CLS - Close files ;+ ;$Cls ; ;functional description: ; ; close both channels and return ; does backup of file properly ; ;input: ; R0 = max block of output file ; -1 for no file ;output: ; ;- .Enable LSB $Cls:: SavReg ;~x~ Clr EdActv ;editor is no longer active Call ClsIn ;~x~close input file Tst OutFil+D.Name ;is there an output file? Boff 30$ ;~x~no Call FlSame ;~x~do we have the backup condition? Bne 10$ ;~x~not backup Mov #InFil,R1 ;setup for the rename Mov R1,R2 ;rename input to .bak Mov R2,R3 Add #8.,R3 ;use space for second input file .Rept 3 Mov (R2)+,(R3)+ .EndR Mov #^rBAK,@R3 ;new name .bak ..RBAK ==: .-2 ;extension for backup file .If NE Rsts$ Jsr R4,UsePPN ;~x~get PPN to use .Word InPPN .EndC; NE Rsts$ .Rename Area,#In$Chn,R1 ;~x~ Bcc 10$ ;~x~ok proceed Call 50$ ;~x~unable to rename input file- fail 10$: ;~x~ Mov Old.R0(SP),R0 ;restore last block used .If NE Rsts$ Tst RT$RTS ;RT11 OR RSTS Boff 40$ ;~x~rsts- close and copy file ;to correct length .EndC; NE Rsts$ Push Old.R0(SP) ;Store last block used Inc @SP ;Make length from last block .GVal Area,#Versi$ ;~x~Get RT version number SwaB R0 ;Want to check the release number CmpB #MinRel,R0 ;Is this 5.5 or later? Blos 20$ ;~x~No Mov GetJob+6,R1 ;point to channel blocks Add #+C$HBW,R1 ;point to highest block written ;location in channel block for ;output file. ;the following changes a location in RMON .Poke Area,R1,(SP)+ ;~x~ CallR ClsOut ;~x~Close output file .............. 20$: .ClosZ Area,#Ou$Chn,(SP)+ ;~x~Close output file Return ;~x~ ...... ; ; if no output purge the output channel ; 30$: CallR PurgO ;~x~purge channel ............. ; ; for rsts we will copy the file to adjust its length ; .If NE Rsts$ 40$: CallR ShutDn ;~x~call rsts close operation .EndC; NE Rsts$ 50$: ;~x~ ;+ ;ERROR Error ,W ;~x~ ;The rename of the input file to BAK file type failed. We have closed the ;output file anyway to attempt to save it. ;- .If NE Rsts$ .SbTtl CLSBTH - Close both input and output files ;++ ;CLSBTH ; ;functional description: ; ; close both input and output files, output last ; ;input: none ; ;output: ; both files closed ;-- .Enable LSB ClsBth:: ;~x~ Call ClsIn ;~x~input first CallR ClsOut ;~x~ .............. .Dsabl LSB .EndC; NE Rsts$ .If NE Rsts$ .SbTtl SHUTDN - Copy output file for rsts ;++ ;ShutDn ; ;functional description: ; ; real hack for rsts- copy output file to get correct length ; ;input: ; R0 = max block of temporary file ; ;output: ; all files closed ;-- .Enable LSB ShutDn: Mov R0,R1 ;~x~save max block in file Inc R1 ;make file length Jsr R4,UsePPN ;~x~get ppn to use .Word OutPPN .Enter Area,#Cp$Chn,#OutFil,#0 ;~x~var length Bcs 40$ ;~x~error Mov ScWds,R4 ;words to write Asl R4 ;write twice that Mov ScBlks,R2 ;blocks to write Asl R2 ;twice that Clr R3 ;block number to start 10$: ;~x~ Cmp R1,R2 ;compare blocks to write Bhis 20$ ;~x~lots of blocks left Mov R1,R2 ;trim to finish Mov R2,R4 ;and fix wd count SwaB R4 ;make wds Bic #377,R4 ;clean in case 20$: ;~x~ ; .Assume Ou$Chn EQ 0 .ReadW Area,#Ou$Chn,PlyGnd,R4,R3 ;~x~read mouthful Bcs 60$ ;~x~cough- cough .WritW Area,#Cp$Chn ;~x~swallow it Bcs 60$ ;~x~cough - cough Add R2,R3 ;next block to start Sub R2,R1 ;how many blocks left Bgt 10$ ;~x~keep going Call PurgO ;~x~purge the temporary file .Close #Cp$Chn ;~x~and close the output file Bcs 50$ ;~x~close failed 30$: ;~x~ Return ;~x~return ...... ; ; error messages for shutdn ; 40$: ;~x~ Call ClsBth ;~x~close both channels 50$: ;~x~ ;+ ;ERROR .If NE Rsts$ Error ,F ;~x~ ;RSTS only- lookup or enter failed while opening files to trim output file. ;or close failed for output channel ;- 60$: ;~x~ .Purge #Cp$Chn ;~x~purge the temp channel Call ClsBth ;~x~close both channels ;+ ;ERROR Error ,F ;~x~ ;RSTS only- .readw or .writw returned error during trim. .EndC; NE Rsts$ ;- .EndC; NE Rsts$ .SbTtl $DLJOU - Delete the journal file ;++ ;$DLJOU ; ;functional description: ; ; Delete the journal output file for a normal quit or exit ; ;-- .Enable LSB $DlJou:: ;~x~ Tst JouSsn ;Does this session have a .JOU? Beq 10$ ;~x~Nope. Good as done. Tst JoSave ;Is journal set to save? Bne 10$ ;~x~Yup Mov #Jo$Out,R4 ;Get the journal file descriptor Call $ClsFl ;~x~ close it .Delete Area,@R4,f$nama(R4) ;~x~ and blow it out of the water Tst (PC)+ ; 10$: Sec ;~x~ Return ;~x~ ...... .Dsabl LSB .End