.MCall .Module .Module KEDMAC RELEASE=V02 VERSION=14 COMMENT=,IDENT=NO,AUDIT=NO ; 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. ;+ ;COND ; ; $KED$ DF generate call code in ERRDEF and HLPDEF ; $KED$ NDF generate message in ERRDEF and HLPDEF ;- ; ; ; MODULE: KEDMAC - Macros required for RT-11 KED modules ; ; VERSION: X01.00 ; ; AUTHOR: Cheryl Vedoe ; ; DATE: 27-April-79 ; ; .ENABL LC ;++ ; ERRDEF - Define the error macros ; ; There are two definitions for the error macro, one for the ; source and one for the error module. To determine which form ; of the macro is appropriate, the definition macro assumes ; the symbol $KED$ is not defined in the error module and is ; in all other modules which invoke the error definition macro. ;-- .Macro ErrDef Code,Subr .IIf B,Code,.Error .IIf B,Subr,.Error .If DF,$KED$ ; If not in error module ; ; Macro to print an error message ; .Er.N=1 ; Starting error number .Macro Error Txt,Lvl .IIf B,Lvl,.Error ; Error if severity blank Jsr R4,'Subr .IRp N,\.Er.N .Globl Er'Code''N .Word Er'Code''N .EndM .Er.N=.Er.N+1 .EndM Error .IfF ; If error module ; ; Assemble error message in error module ; .Er.N=1 ; Starting error number .Macro Error Txt,Lvl PSect $ERR$ .IRp N,\.Er.N Er'Code''N:: .EndR .Ascii \Lvl-Txt\<200> .Er.N=.Er.N+1 .EndM Error .EndC .EndM ErrDef ;++ ; HLPDEF - Define the help message macros ; ; There are two definitions for the help macro, one for the ; source and one for the error module. To determine which form ; of the macro is appropriate, the definition macro assumes ; the symbol $KED$ is not defined in the error module and is ; in all other modules which invoke the help definition macro. ;-- .Macro HlpDef Code .IIf B,Code,.Error .If DF,$KED$ ; If not in error module ; ; Macro to print a help message ; .HL.N = 1 ; Starting help error number .Macro Helper Txt Jsr R4,Helper .IRp N,\.HL.N .Word Hl'Code''N .EndM .HL.N=.HL.N+1 .EndM Helper .IfF ; If error module ; ; Assemble help message in error module ; .HL.N=1 ; Starting help error number .Macro Helper Txt PSect $HLP$ .IRp N,\.HL.N Hl'Code''N:: .EndR .Ascii \Txt\<200> .HL.N=.HL.N+1 .EndM Helper .EndC .EndM HlpDef ;++ ; $PRINT ; ; Print string at terminal. ;-- .Macro $Print Txt .If NB .NType .....1,Txt .If EQ .....1-27 .=.+2 Tst Txt .=.-6 Jsr R0,$PrinC .=.+2 .MExit .IfF; EQ .....1-27 .If DIF ,R0 Mov Txt,R0 .EndC; DIF ,R0 .EndC; EQ .....1-27 .EndC; NB Call $Print .EndM $Print ; ; Reset Ctrl/O (stop output) function ; .RCTRLO ; .Macro RCtrlO Call $RCtlO .EndM ; ; Define (or redefine) channels - RT-11 ; .Macro DfnChn .MCall .CDfn .CDfn #CDfnBk,Code=NoSet .EndM ;++ ; Do a file read ; $READW area,chan,buf,wcnt,blk ; ; This sets up the area argument just like .READW, then calls ; $READW rather than doing the EMT. This is for compatibility with ; RSX (same KEDSCL for RT/RSX) and to allow further processing of ; errors to handle ERR at EOF while using XX:/I ;-- .Macro $ReadW Area,Chan,Buf,WCnt,Blk .MCall .ReadW .ReadW Area,Chan,Buf,WCnt,Blk .=.-2 ;back up over EMT Call $ReadW .EndM $ReadW ;++ ; SAVREG ; ; Call coroutine to save registers R5-R0. ;-- .Macro SavReg Call SavReg .EndM SavReg ; ; Terminal input single char with no wait ; Char in R0 and C clr or C set for no char ; .TTINR DST ; .Macro TTInR Dst Call TNoWt .IIf NB,Dst,MovB R0,Dst .EndM ;++ ; Terminal input single char ; Char to R0 and Dst if present ; TTYIN DST ;-- .Macro TTyIn Dst Call TTyIn .IIf NB,Dst,MovB R0,Dst .EndM ; ; Terminal output single char ; char in R0 or Src ; .TTYOUT SRC ; .Macro TTyOut Src .IIf NB,Src,MovB Src,R0 Call $TyOut .EndM ;++ ; Do a file write ; $WRITW area,chan,buf,wcnt,blk ; ; This sets up the area argument just like .WRITW, then calls ; $WRITW rather than doing the EMT. This is for compatibility with ; RSX (same KEDSCL for RT/RSX) and to allow further processing of ; errors to handle ERR at EOF while using XX:/I ;-- .Macro $WritW Area,Chan,Buf,WCnt,Blk .MCall .WritW .WritW Area,Chan,Buf,WCnt,Blk .=.-2 ;back up over EMT Call $WritW .EndM $WritW .Sbttl . Boff - branch if bit off macro ;++ ; BOFF ; ; Branch if bit off macro. Designed to be used following BIT and TST ; instructions. ; ; BOFF .dest ; ; .dest -- symbol to branch to if bit(s) off ;-- .Macro BOff .dest Beq .dest .EndM BOff .Sbttl . Bon - branch if bit on macro ;++ ; BON ; ; Branch if bit on macro. Designed to be used following BIT and TST ; instructions. ; ; BON .dest ; ; .dest -- symbol to branch to if bit(s) off ;-- .Macro BOn .dest Bne .dest .EndM BOn .Sbttl . ...... - mark absolute transfer of control macro ;++ ; ...... ; ; Decorative macro to mark absolute transfer of control. ; ; Example: ; ; Br xxx ; ........... ; ; Note that any number of dots >= 6 are legal ;-- .Macro ...... ; ------ .EndM ...... .Sbttl . Push - push onto stack ;++ ; PUSH ; ; Push one or more items into a stack ; ; PUSH list,stack,save ; ; list - if empty => reserve one location on stack ; - if single item, place on stack ; - if list, treat each item in list as above ; stack - register used as stack pointer defaults to SP ; save - if NB, preserve carry ; ; Examples: ; ; Push ; Clr -(SP) ; Push #2 ; Mov #2,-(SP) ; Push ; Mov R1,-(SP) ; Mov R2,-(SP) ; Push ; Mov R1,-(SP) ; Clr -(SP) ; Mov R3,-(SP) ; Push R3,Stack=R2 ; Mov R3,-(R2) ; Push ,Save=*C* ; Mov R1,-(SP) ; Bic -(SP),@SP ; Mov R3,-(SP) ;-- .Macro Push list stack save .If B .If B stack .If B save Clr -(SP) .IfF ; save Bic -(SP),@SP .EndC ; save .IfF ; stack .If B save Clr -(stack) .IfF ; save Bic -(stack),@stack .EndC ; save .EndC ; stack .IfF ; .Irp .item, .If B <.item> .If B stack .If B save Clr -(SP) .IfF; save Bic -(SP),@SP .EndC; save .IfF ; stack .If B save Clr -(stack) .IfF; save Bic -(stack),@stack .EndC; save .EndC; stack .IfF ; <.item> .If IDN <.item> <#0> .If B stack .If B save Clr -(SP) .IfF; save Bic -(SP),@SP .EndC; save .IfF; stack .If B save Clr -(stack) .IfF; save Bic -(stack),@stack .EndC; save .EndC; stack .IfF ; <.item> <#0> .If B stack Mov .item,-(SP) .IfF ; stack Mov .item,-(stack) .EndC ; stack .EndC; <.item> <#0> .EndC ; <.item> .EndR .EndC ; .EndM PusH .Sbttl . Pop - pop off stack ;++ ; POP ; ; Pop one or more items off a stack ; ; POP list,stack,save ; ; list - if empty => reserve one location on stack ; - if single item, place on stack ; - if list, treat each item in list as above ; stack - register used as stack pointer defaults to SP ; save - if NB, preserve carry ; ; Examples: ; ; Pop ; Tst (SP)+ ; Pop Foo ; Mov (SP)+,Foo ; Pop ; Mov (SP)+,R1 ; Mov (SP)+,R2 ; Pop ; Mov (SP)+,R1 ; Tst (SP)+ ; Mov (SP)+,R3 ; Pop R3,stack=R2 ; Mov (R2)+,R3 ; Pop ,Save=*C* ; Mov (SP)+,R1 ; Bit @SP,(SP)+ ; Mov (SP)+,R3 ;-- .Macro Pop list stack save .If B .If B stack .If B save Tst (SP)+ .IfF ; save Bit @SP,(SP)+ .EndC ; save .IfF ; stack .If B save Tst (stack)+ .IfF ; save Bit @stack,(stack)+ .EndC ; save .EndC ; stack .IfF ; .Irp .item, .If B <.item> .If B stack .If B save Tst (SP)+ .IfF; save Bit @SP,(SP)+ .EndC; save .IfF ; stack .If B save Tst (stack)+ .IfF; save Bit @stack,(stack)+ .EndC; save .EndC; stack .IfF ; .item .If B stack Mov (SP)+,.item .IfF ; stack Mov (stack)+,.item .EndC; stack .EndC ; .item .EndR .EndC ; .EndM Pop ; ; Print an escape sequence ; ; ADR = text string address without # ; .Macro EscSeq Adr $Print #Adr .EndM EscSeq ;+ ; JOUON,JOUOFF -- turn "currently journaling" flag on and off ;- .Macro IsJou type dest Bit #T.Jou,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro JouOn Bis #T.Jou,TtInp .EndM .Macro JouOff Bic #T.Jou,TtInp .EndM ;+ ; EXEON,EXEOFF -- turn "currently executing" flag on and off ; ;- .Macro IsExe type dest Bit #T.Exe,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro ExeOn Bis #T.Exe,TtInp .EndM .Macro ExeOff Bic #T.Exe,TtInp .EndM ;+ ; LRNON,LRNOFF -- turn "currently learning" flag on and off ; ;- .Macro IsLrn type dest Bit #T.Lrn,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro LrnOn Bis #T.Lrn,TtInp .EndM .Macro LrnOff Bic #T.Lrn,TtInp .EndM ;+ ; RECON,RECOFF -- turn "currently recovering" flag on and off ; ;- .Macro IsRec type dest Bit #T.Rec,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro RecOn Bis #T.Rec,TtInp .EndM .Macro RecOff Bic #T.Rec,TtInp .EndM ;+ ; JREON,JREOFF -- turn "recovering journal" flag on and off ; ;- .Macro IsJRe type dest Bit #T.JRe,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro JReOn Bis #T.JRe,TtInp .EndM .Macro JReOff Bic #T.JRe,TtInp .EndM ;+ ; EXION,EXIOFF -- turn "inputing from macro" flag on and off ;- .Macro IsExI type dest Bit #T.ExI,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro ExIOn Bis #T.ExI,TtInp .EndM .Macro ExIOff Bic #T.ExI,TtInp .EndM ;+ ; CMDON,CMDOFF -- turn command mode flag on and off ;- .Macro IsCmd type dest Bit #T.Cmd,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro CmdOn Bis #T.Cmd,TtInp .EndM .Macro CmdOff Bic #T.Cmd,TtInp .EndM ;+ ; CRON,CROFF -- turn terminates commands flag ;- .Macro IsCR type dest Bit #T.CR,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro CROn Bis #T.CR,TtInp .EndM .Macro CROff Bic #T.CR,TtInp .EndM ;+ ; ABTON,ABTOFF -- flag if we are processing an aborted commands ;- .Macro IsAbt type dest Bit #T.Abt,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro AbtOn Bis #T.Abt,TtInp .EndM .Macro AbtOff Bic #T.Abt,TtInp .EndM ;+ ; SLFON,SLFOFF -- control reading in during recover ;- .Macro IsSLF type dest Bit #T.SLF,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro SLFOn Bis #T.SLF,TtInp .EndM .Macro SLFOff Bic #T.SLF,TtInp .EndM ;+ ; SERON,SEROFF -- turn "suppress execute errors" flag on and off ;- .Macro IsSEr type dest Bit #T.SEr,TtInp .If IDN Bne dest .EndC .If IDN Beq dest .EndC .EndM .Macro SErOn Bis #T.SEr,TtInp .EndM .Macro SErOff Bic #T.SEr,TtInp .EndM ; ; Supply correct PSECT attributes (always) ; .Macro PSect Name .IIf IDN .PSect LOWCOD RO,I,Lcl,Rel,Con .IIf IDN .PSect LOWDAT RW,D,Lcl,Rel,Con .IIf IDN .PSect ASTSCT RO,I,Gbl,Rel,Con .IIf IDN .PSect IODATA RW,D,Gbl,Rel,Con .IIf IDN <$PATCH> .PSect $PATCH RW,I,Lcl,Rel,Con .IIf IDN .PSect KEDCMD RO,I,Lcl,Rel,Con .IIf IDN .PSect IMPURE RW,D,Gbl,Rel,Con .IIf IDN .PSect KEDIO RO,I,Lcl,Rel,Con .IIf IDN <.TXT.> .PSect .TXT. RO,D,Gbl,Rel,Con .IIf IDN .PSect VWTDAT RW,D,Gbl,Rel,Con .IIf IDN .PSect HLPOVL RO,I,Gbl,Rel,Con .IIf IDN .PSect KEDSCL RO,I,Lcl,Rel,Con .IIf IDN .PSect KEDVWT RO,I,Lcl,Rel,Con .IIf IDN <$ERR$> .PSect $ERR$ RO,D,Gbl,Rel,Con .IIf IDN <$HLP$> .PSect $HLP$ RO,D,Gbl,Rel,Con .IIf IDN <$HLP1$> .PSect $HLP1$ RO,I,Lcl,Rel,Con .IIf IDN <$HLP2$> .PSect $HLP2$ RO,I,Lcl,Rel,Con .IIf IDN <$HLP3$> .PSect $HLP3$ RO,I,Lcl,Rel,Con .IIf IDN <$HLP4$> .PSect $HLP4$ RO,I,Lcl,Rel,Con .IIf IDN <$HLP5$> .PSect $HLP5$ RO,I,Lcl,Rel,Con .IIf IDN <$HLP6$> .PSect $HLP6$ RO,I,Lcl,Rel,Con .IIf IDN .PSect KedDef RO,D,Lcl,Rel,Con .IIf IDN <.LST.> .PSect .LST. RO,D,Lcl,Rel,Con .IIf IDN <.ADR.> .PSect .ADR. RO,D,Lcl,Rel,Con .....1=0 .Irp x, .IIf IDN .....1 = 1 .EndR .Irp x, .IIf IDN .....1 = 1 .EndR .Irp x,<$HLP4$,$HLP5$,$HLP6$,KEDDEF,.LST.,.ADR.,.CMD.> .IIf IDN .....1 = 1 .EndR .IIf EQ .....1 .Error ; Unknown PSECT N A M E -- NAME ; .EndM PSect .End