Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/nml/nmut20.mac
There are 2 other files named nmut20.mac in the archive. Click here to see a list.
; NET:<DECNET20-V3P1.NMU>NMUT20.MAC.2 20-May-81 12:07:24, Edit by JENNESS
;
; Add SS%CLMESSAGE routine. It just outputs the string with
; no vertical or horizontal adjustments.
;
; NET:<DECNET20-V3P1.NMU>NMUT20.MAC.2 5-May-81 10:55:06, Edit by JENNESS
;
; Add SS%CMESSAGE routine. It doesn't print the task name.
; Fix SS%MESSAGE routine to suppress printing null characters at
; end of the task name.
;
; NET:<DECNET20-V3P1.NMU>NMUT20.MAC.16 18-Mar-81 13:44:02, Edit by JENNESS
; Rewrite context switch routine so that it doesn't require a stack
; to be valid when called.
; NMUT20 - TOPS20 specific utility functions
; LSG DECnet Network Management
;
; COPYRIGHT (c) 1980, 1981, 1982
; DIGITAL EQUIPMENT CORPORATION
; Maynard, Massachusetts
;
; This software is furnished under a license and may be used
; and copied only in accordance with the terms of such license
; and 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. No title to
; and ownership of the software is hereby transferred.
;
; The information in this software is subject to change
; without notice and should not be construed as a commitment
; by DIGITAL EQUIPMENT CORPORATION.
;
; DIGITAL assumes no responsibility for the use or reliability
; of its software on equipment which is not supplied by
; DIGITAL.
;
TITLE NMUT20 - TOPS20 specific utility functions
SUBTTL Introduction
Comment &
This set of routines implements the TOPS20 versions
of utility functions required. There are two cases
for these functions:
(A) TOPS20 only functions. These are functions
that are required for TOPS20 only, and no
other operating system uses them.
(B) Generic system specific functions. These
functions are required of all operating
system interfaces, have a standard calling
convention, but have different code sets to
implement them.
&
SUBTTL Definitions
SALL ; Suppress macro expansions
; for a clean listing
SEARCH MONSYM ; Monitor symbol definitions
SEARCH MACSYM ; Useful macros
SEARCH JOBDAT ; Job data area
; Register definitions
T0==0 ; Temporaries (scratchable)
T1==1
T2==2
T3==3
T4==4
P==17 ; Stack pointer
define OFF%INTERRUPT
< MOVEI T1,.FHSLF
DIR
AOS INTNST##>
define ON%INTERRUPT
< MOVEI T1,.FHSLF
SOSG INTNST##
EIR>
SUBTTL SS%SWITCH
; Routine - SS%SWITCH
;
; Function - This routine is called with the address of two task
; blocks. One is the "current" task, the other is for
; the "future" task. When this routine completes a
; context switch between the two tasks will have been
; done.
;
; Parameters -
;
; -1(P) Future task block address
; CURTSK/ Address of current task's task block
ENTRY SS%SWITCH
INTERN CURTSK, PRVTSK
CURTSK: BLOCK 1 ; Current task block address
PRVTSK: BLOCK 1 ; Previous task block address
SS%SWITCH:
EXCH T1,CURTSK ; Save register and get task blk addr
MOVEM T1,PRVTSK ; Save as the previous task
JUMPE T1,SSS.1 ; If no task ... just run new one
MOVEM T0,TB.CTX##+T0(T1) ; Save register 0 in context block
MOVE T0,CURTSK ; Get contents of register 1
MOVEM T0,TB.CTX##+T1(T1) ; Save register 1 in context block
MOVEI T0,TB.CTX##+P(T1) ; Calculate end of context block
ADD T1,[T2,,TB.CTX##+T2] ; Start of registers to BLT
BLT T1,@T0 ; Copy into context block
SSS.1: HRLZ T0,-1(P) ; Get new task block address
HLRZM T0,CURTSK ; Save current task block address
ADD T0,[TB.CTX##+T1,,T1] ; Offset to saved registers
BLT T0,P ; Copy back registers
MOVE T0,CURTSK ; Get current task block address
ADDI T0,TB.CTX##+T0 ; Offset to register 0
MOVE T0,@T0 ; Get register 0
POPJ P, ; Return to new task
SUBTTL SS%TINIT
; Routine - SS%TINIT
;
; Function - This routine sets up a task block for running it
; the first time. It does not start the task, only
; initializes the task block stack.
;
; Parameters -
;
; -1(P) Size of task's stack
; -2(P) Task block to initialize
ENTRY SS%TINIT
SS%TINIT:
MOVE T1,-2(P) ; Get address of task block
MOVEI T2,TB.STK##(T1) ; Copy it for a stack pointer
MOVN T3,-1(P) ; Get length of stack
HRL T2,T3 ; Make initial stack pointer
PUSH T2,[US%FINI##] ; Put task exit routine onto stack
HRRZ T3,TB.STR##(T1) ; Get starting address
PUSH T2,T3 ; Put starting address onto stack
MOVEM T2,TB.CTX##+P(T1) ; Set initial stack pointer for task
POPJ P, ; Return
SUBTTL SS%MESSAGE
; Routine - SS%MESSAGE
;
; Function - This routine outputs a message to the operator
; or console.
;
; Parameters -
;
; -1(P) Byte pointer to error message string
ENTRY SS%MESSAGE
ENTRY SS%CMESSAGE
ENTRY SS%CLMESSAGE
SS%CLMESSAGE:
MOVE T1,-1(P) ; Get byte pointer
PSOUT ; Output supplied message
POPJ P, ; Return
SS%CMESSAGE:
HRROI T1,[BYTE (7)15,12] ; Point to a CRLF
PSOUT ; Start message on new line
SETZ T4, ; Output all the alignment spaces
JRST SS%MS2 ; Go print message
SS%MESSAGE:
HRROI T1,[BYTE (7)15,12] ; Point to a CRLF
PSOUT ; Start message on new line
SKIPN T2,CURTSK ; Get address of current task block
JRST [HRROI T1,[ASCIZ \ [(none)]:\]
PSOUT
MOVEI T4,^d10
JRST SS%MS2]
HRROI T1,[ASCIZ \ [\] ; Start task name output
PSOUT
SETZ T4, ; Clear count of characters
MOVEI T2,TB.NAM##(T2) ; Point to name of task
HRLI T2,440700
SS%MS1: ILDB T3,T2 ; Get next character in name
SKIPE T3 ; Check for null character
AOJA T4,SS%MS1 ; No .. increment count and loop
CAILE T4,^d16 ; Check bigger than 16 character name
MOVEI T4,^d16 ; Yes .. limit to 16 character output
MOVEI T1,.PRIOU ; Primary output (TTY)
MOVE T2,CURTSK ; Point to task name
HRROI T2,TB.NAM##(T2)
MOVN T3,T4 ; Get number of characters in name
SOUT ; Output name string
HRROI T1,[ASCIZ \]:\] ; Terminate the task name
PSOUT
ADDI T4,4 ; Add " [", "]:" to count
SS%MS2: MOVE T1,[POINT 7,[ASCIZ \ \]]
EXCH T1,T4
ADJBP T1,T4
PSOUT ; Output alignment spaces
MOVE T1,-1(P) ; Get byte pointer
PSOUT ; Output supplied message
POPJ P, ; Return
NMU$FATAL==:SS%TFATAL
SS%TFATAL::
HRROI T1,[ASCIZ \? Fatal error - \]
PSOUT
PUSH P,-1(P)
PUSHJ P,SS%MESSAGE
HALTF ; Stop execution
JRST .-1
END