.MCALL .MODULE .MODULE IPUT,VERSION=06,COMMENT=,IDENT=NO,LIB=YES ; 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. .SBTTL Module Declaration .NLIST .ENABL LC .DSABL GBL .NLIST CND .LIST ; ++ ; FACILITY: ; ; RT-11 System Subroutine Library ; ; CALLABLE ENTRIES: ; ; IPUT, ISPY, KPEEK, KPOKE ; ; ENVIRONMENT: ; ; This routine can be used by any job running in a single-job or ; multi-job environment. ; ; ; INCLUDE FILES: ; ; SYSMAC.SML ; RT-11 system macro library. .MCALL .CKXX .Assume .CKXX .CKXX ; ; EXTERNAL REFERENCES: ; .GLOBL $SYSLB, $NXADR, $NXVAL .GLOBL $ERRM0 .WEAK $MSARG .SBTTL IPUT, ISPY, KPEEK, KPOKE FORTRAN callable routines ; ; ++ ; FUNCTIONAL DESCRIPTION: ; ; The IPUT function returns the old value of a location in the ; monitor, then replaces that location's contents. ; ; The ISPY function returns the value of a location in the monitor. ; ; The KPOKE function returns the old value of a location in kernel ; mapping, then replaces that location's contents. ; ; The KPEEK function returns the value of a location in the kernel ; mapping. ; ; CALLING SEQUENCE: ; ; ; i = ISPY(offset [,error]) ; i = IPUT(offset ,value [,operation] [,error]) ; i = KPEEK(address [,error]) ; i = KPOKE(address ,value [,operation] [,error]) ; ; ; INPUT PARAMETERS: ; ; Offset - specifies an RMON offset ; Address - specifies a kernel address ; Value - specifies a value to replace with or a ; BIC/BIS mask. ; Operation - is optional, and specifies the type of ; replacement (MOV, BIC, or BIS). ; ; If operation is specified, the following string ; values are allowed: ; ; MOV,mov =replace with a MOV operation (default) ; BIC,bic =change with a BIC operation ; BIS,bis =change with a BIS operation ; ; ; ; OUTPUT PARAMETERS: ; ; i = the old (replaced) value ; ; Error - is optional, and specifies a word that is to ; get the error status of the request. ; ; ; ROUTINE VALUE: ; ; the old (replaced) value ; ; ERRORS: ; ; A missing required argument, or an invalid operation ; cause the TRAP instruction to be executed. ; ; Error = 0 means success (except for the TRAP above) ; Error = -1 offset out of range (ISPY and IPUT) ; Error = -2 Trap 4 (odd address / non-existant ; memory) ; Error = -??? or ?MON-F-Invalid EMT message for logic ; error in this routine. ; ; -- .SbTtl PSect selection .PSECT SYS$I .SbTtl Macro definitions .MACRO .MAX Out, List Out=-1 .Irp x, .IIf GT -Out Out=x .EndR .ENDM .MAX .MACRO ...... .ENDM ...... .SbTtl Symbol definitions F.ARGS =: -2 ;offset from parm base to parm count PADDR =: 0 ;Address / Offset argument PVALU =: 2 ;Value argument (not .GVAL / .PEEK) PERR1 =: 2 ;Optional error return (.GVAL / .PEEK) PTYPE =: 4 ;Movement type (not .GVAL / .PEEK) PERR2 =: 6 ;Optional error return (not .GVAL / .PEEK) .SbTtl Test values for CK.%%*s S.RET =: 1000 ;stack check value V.ARGS =: 1776 ;number of arguments passed from FTN V.ADDR =: 2000 ;address/offset value in reg V.VALU =: 2002 ;value value in reg V.ERR1 =: 2002 ;first error flag addr in reg (ISPY) V.TYPE =: 2004 ;type address in reg V.ERR2 =: 2006 ;second error flag addr in reg X.VALU =: 3000 ;return value in reg X.ERR =: 3002 ;error code in reg .GVAL =: 28. ;code for .GVAL .PEEK =: 28. ;code for .PEEK .PVAL =: 28. ;code for .PVAL .POKE =: 28. ;code for .POKE ..GVAL =: ^b000 ;subcode (chan) for .GVAL ..PEEK =: ^b001 ;subcode (chan) for .PEEK ..PVAL =: ^b010 ;subcode (chan) for .PVAL / MOV ..POKE =: ^b011 ;subcode (chan) for .POKE / MOV ..BICV =: ^b100 ;subcode (chan) for .PVAL / BIC ..BICO =: ^b101 ;subcode (chan) for .POKE / BIC ..BISV =: ^b110 ;subcode (chan) for .PVAL / BIS ..BISO =: ^b111 ;subcode (chan) for .POKE / BIS ...GVA =: ^o375 ;EMT code for .GVAL ...PEE =: ^o375 ;EMT code for .PEEK ...PVA =: ^o375 ;EMT code for .PVAL ...POK =: ^o375 ;EMT code for .POKE .MAX MaxRea,<..GVAL,..PEEK> .SbTtl Entry points .ENABL LSB CK.R5=F.ARGS CK.SP=S.RET .SbTtl ISPY (.GVAL) ISPY:: MOV #<.GVAL*400>+..GVAL,R3 ;.GVAL code and subcode CK.R3=.GVAL*400+..GVAL BR 10$ ;join common code ........... .SbTtl KPEEK (.PEEK) KPEEK:: MOV #<.PEEK*400>+..PEEK,R3 ;.PEEK code and subcode CK.R3A=.PEEK*400+..PEEK BR 10$ ;join common code ........... .SbTtl IPUT (.PVAL) PUT:: IPUT:: MOV #<.PVAL*400>+..PVAL,R3 ;.PVAL code and subcode CK.R3B=.PVAL*400+..PVAL BR 10$ ;join common code ........... .SbTtl KPOKE (.POKE) KPOKE:: MOV #<.POKE*400>+..POKE,R3 ;.POKE code and subcode CK.R3C=.POKE*400+..POKE 10$: CK.R5 F.ARGS,+2 MOV (R5)+,R4 ;Get count of arguments CK.R4=V.ARGS CK.R5 PADDR,+2 CK.R4 V.ARGS CALL $NXVAL ;Get offset CK.R0=V.ADDR CK.SPA=CK.SP BCS 40$ ;Required Arg missing? MOV R0,R1 ;Save first argument CK.R1=CK.R0 CK.R3 .GVAL*400+..GVAL CK.R3A .PEEK*400+..PEEK CK.R3B .PVAL*400+..PVAL CK.R3C .POKE*400+..POKE CMPB #MaxRea,R3 ;.GVAL or .PEEK? CK.R5A=CK.R5 BHIS 20$ ;yes (0 or 1 subcode) CK.R5 PVALU,+2 CK.R4 V.ARGS CALL $NXVAL ;Get value CK.SPB=CK.SP BCS 40$ ;Required Argument missing CK.R0=V.VALU MOV R0,R2 ;Save second argument CK.R2=CK.R0 CK.R5 PTYPE,+2 CK.R4 V.ARGS CALL $NXADR ;get third, optional, argument BCS 20$ ;missing, use default CK.R0=V.TYPE MOVB 2(R0),R0 ;get third char of third argument BIC #040,R0 ;force uppercase CMP R0,#'V ;is it MOV? BEQ 20$ ;Yes ADD #..BICO-..POKE,R3 ;assume BIC CK.R3D=CK.R3B CK.R3E=CK.R3C CK.R3D ,+..BICO-..POKE CK.R3E ,+..BICO-..POKE CMPB R0,#'C ;is it BIC? BEQ 20$ ;yes ADD #..BISO-..BICO,R3 ;assume BIS CK.R3F=CK.R3D CK.R3G=CK.R3E CK.R3F ,+..BISO-..BICO CK.R3G ,+..BISO-..BICO CMPB R0,#'S ;is it BIS? CK.SPC=CK.SP BNE 40$ ;invalid optional argument value 20$: CK.R2 V.VALU MOV R2,-(SP) ;Get replacement value CK.SP ,-2,S.VALU CK.R1 V.ADDR MOV R1,-(SP) ;Get offset CK.SP ,-2,S.ADDR CK.R3 .GVAL*400+..GVAL CK.R3A .PEEK*400+..PEEK CK.R3B .PVAL*400+..PVAL CK.R3C .POKE*400+..POKE CK.R3D .PVAL*400+..BICV CK.R3E .POKE*400+..BICO CK.R3F .PVAL*400+..BISV CK.R3G .POKE*400+..BISO MOV R3,-(SP) ;Set up PVAL EMT code CK.SP ,-2,S.REQ MOV SP,R0 ;R0 -> area CK.R0=CK.SP .Assume CK.R0+0 EQ S.REQ .Assume CK.R0+2 EQ S.ADDR .Assume CK.R0+4 EQ S.VALU .Assume ...GVA EQ ...PEE .Assume ...GVA EQ ...PVA .Assume ...GVA EQ ...POK EMT ...GVA ;issue request CK.R0=X.VALU MOV R0,R2 ;*C*save returned value CK.R2=CK.R0 CALL $ERRM0 ;process any error CK.R0=X.ERR MOV R0,R1 ;save error flag value CK.R1=CK.R0 CK.R5A PERR1,+2 CK.R5 PERR2,+2 CK.R4 V.ARGS CALL $NXADR ;optional error argument? BCS 30$ ;no CK.R0=V.ERR2 CK.R0 V.ERR2 CK.R1 X.ERR MOV R1,@R0 ;yes, return it 30$: MOV R2,R0 ;value to return CK.R0=CK.R2 ADD #6,SP ;Clean arguments off stack CK.SP ,+6 CK.SP S.RET CK.R0 X.VALU RETURN ...... 40$: TRAP $MSARG CK.SPA S.RET CK.SPB S.RET CK.SPC S.RET RETURN ...... .DSABL LSB .END