Trailing-Edge
-
PDP-10 Archives
-
bb-k345a-sb
-
pivot.mac
There are 5 other files named pivot.mac in the archive. Click here to see a list.
TITLE PIVOT
SUBTTL DEFINITIONS
SEARCH JOBDAT,UUOSYM
TWOSEG
SALL
;STEVEN M. WOLFE
;INFORMATION PROCESSING SEVICES
;DIGITAL EQUIPMENT CORPORATION
;PK1-1/E33
;AC'S
F=0 ;FLAGS
T1=1 ;TEMPS
T2=T1+1
T3=T2+1
P1=5 ;PRESERVED
C=10 ;CURRENT CHAR
L=11 ;BP ASCII LINE
P=17 ;PDL
;FLAGS
F.CCL==1 ;CCL ENTRY
F.TRM==2 ;TRMOP SUCCESS
F.TMP==4 ;TMPCOR ENTRY FOUND
F.SCN==10 ;PPN FOUND BY RESCAN
;ASSEMBLY PARAMETERS
PDLSIZ==20 ;SIZE OF PDL
IFNDEF BRKMSK<BRKMSK=1401016200>;MASK FOR BREAK CHARS
IFNDEF FTTRM<FTTRM==0> ;TRMOP THE OPR
IFNDEF FTLB<FTLB==0> ;SNITCH TO LITTLE BROTHER
IFNDEF %SILB<%SILB=<XWD 21,.GTSID>>;GETTAB FOR LB'S PID
IFNDEF LBPVT<LBPVT==17> ;CODE NUMBER
IFNDEF SFDS<SFDS==10> ;LEVELS OF SFD'S
IFNDEF FTCHG<FTCHG==-1> ;USE CHGPPN INSTEAD OF POKE
LINSIZ==^D60/5 ;SIZE OF LINE
BUFSIZ==SFDS+4 ;NUMBER TMPCOR&PATH WORDS
IFNDEF FTWHL<FTWHL==0> ;WHEEL (DON'T CHANGE PATH)
;VERSION
VWHO==0
VMAJOR==4
VMINOR==1
VEDIT==6
VEDIT==7 ;TRMOP. "OPR0" INSTEAD OF "OPR1"
;MAKE "OPR0" PHYSICAL ONLY
VEDIT==10 ;ONLY CHANGE SCAN WHEN PIVOTING
;BACK TO ORIGINAL PATH
VEDIT==11 ;LOTS OF PEOPLE USE PIVOT AS
;A CCL VERSION OF SETSRC.
;DON'T DO THE POKE IF ONLY CHANGING
;SFD (I.E. NOT CHANGING PPN).
;AND DON'T DO THE TRMOP.
VEDIT==12 ;ADD ^R AS BREAK CHAR (IN CASE
;TTY IS SET RTCOMP)
VEDIT==13 ;CHANGE DEFAULT TO NO LB
LOC .JBVER
BYTE (3)VWHO(9)VMAJOR(6)VMINOR(18)VEDIT
LOC .JB41
JRST VERBO
;OP CODES
OPDEF ERR[1B8] ;ERROR UUO
;MACROS
DEFINE ERROR(AA,BB,CC)<
ERR [<SIXBIT /AA/>+BB
ASCIZ /CC/]>
;PIVOT IS A CUSP TO CHANGE YOUR PPN TO [1,2] AND BACK.
;THE FIRST TIME PIVOT IS RUN, IT WRITES YOUR OLD PPN
;AND PATH TO TMPCOR, POKES YOUR PPN TO [1,2], AND
;CHANGES YOUR PATH TO [1,2].
;THE SECOND TIME PIVOT IS RUN, IT READS YOUR OLD PPN AND PATH
;FROM TMPCOR AND RESTORES THEM. TO KEEP TRACK OF WHICH
;IS HAPPENING, PIVOT ALWAYS TELLS YOU WHAT PPN YOU ARE BECOMING
;OPTIONALLY YOU CAN USE PIVOT TO CHANGE TO ANY PPN AND BACK.
;ADD "-[P,PN]" TO THE END OF THE RUN COMMAND.
;IF A TMPCOR ENTRY ALREADY EXISTS, IT WILL NOT BE OVERWRITEN.
;THUS YOU CAN PIVOT FROM PPN TO PPN AND STILL RETURN TO THE ORIGINAL
;PPN
;FORMAT OF THE TMPCOR FILE:
;WORD 0=PPN (JBTPPN TYPE)
;WORD 1=SCANNING SWITCH (PATH UUO)
;WORD 2=PPN (PATH TYPE)
;WORD 3=SFD 1
;WORD N=SFD N-2
;IF THERE IS NO ROOM IN TMPCOR, DISK IS NOT USED INSTEAD.
SUBTTL DATA AREAS
RELOC 0
MFDPPN: BLOCK 1 ;[1,1] PPN
PDL: BLOCK PDLSIZ ;PUSH DOWN LIST
BUF: BLOCK BUFSIZ ;PATH BLOCK AND TMPCOR BUF
TPTH: BLOCK BUFSIZ ;TARGET PATH
LINE: BLOCK LINSIZ ;LINE OF ASCII TEXT
PKBLK: BLOCK 3 ;POKE BLOCK
IFN FTLB<
IPCSIZ==5 ;SIZE OF IPCF PACKET
PACK: BLOCK IPCSIZ ;THE PACKET
>
LOW:
RELOC 400000
CRLF: BYTE (7)15,12 ;<CR><LF>
HI: PHASE LOW
TMPBLK: IFE FTWHL<SIXBIT /PVT/>
IFN FTWHL<SIXBIT /WHL/>
BUF-1 ;RH OF IOWD
IFN FTTRM<
TRMBLK: .TOOUS ;TRMOP BLOCK
BLOCK 1
LINE
>
IFN FTLB<
HDR: IP.CFP ;PRIVED
0 ;FROM US
BLOCK 1 ;TO
XWD IPCSIZ,PACK ;POINTER
>
DEPHASE
LOWSIZ=.-HI
RELOC LOW
BLOCK LOWSIZ
RELOC
SUBTTL INITIALIZATION
;START HERE
PIVOT: TRZA F,-1 ;CLEAR FLAGS
HRRZI F,F.CCL ;CCL ENTRY
MOVE P,[IOWD PDLSIZ,PDL] ;SET UP PDL
MOVE T1,[XWD HI,LOW] ;SET UP LOWSEG
BLT T1,LOW+LOWSIZ-1
MOVE T1,[%LDMFD] ;GET [1,1] PPN
GETTAB T1,
HALT
MOVEM T1,MFDPPN
MOVE T1,[XWD .GTPPN,.GTSLF] ;COMPUTE OUR ADDRESS IN JBTPPN
GETTAB T1,
HALT
PJOB T2,
ADDI T2,(T1)
MOVEM T2,PKBLK
HRROI T1,.GTPPN ;GET OUR PPN
GETTAB T1,
HALT
MOVEM T1,PKBLK+1
;BUILD TARGET ENTRY IN CASE RESCAN FAILS (ASSUME WANTS TO BE OPR)
MOVE T1,[%LDFFA] ;GET [1,2] PPN
GETTAB T1,
HALT
MOVEM T1,TPTH+.PTFCN ;STORE AS TARGET PPN
MOVEM T1,TPTH+.PTPPN ;AND PATH
SETZM TPTH+.PTPPN+1 ;NO SFDS
SETZM TPTH+.PTSWT ;DON'T CHANGE SCAN
;BUILD TMPCOR ENTRY IN CASE READ FAILS
MOVEI T1,.PTFRD ;READ PATH
MOVEM T1,BUF+.PTFCN
MOVE T1,[XWD BUFSIZ,BUF]
PATH. T1,
HALT
MOVEI T1,.PTSCN+.PTSCY ;GET RID OF NOISE BITS
ANDM T1,BUF+.PTSWT
MOVE T1,PKBLK+1 ;GET CURRENT PPN
MOVEM T1,BUF+.PTFCN
HRLZI T1,-BUFSIZ ;READ TMPCOR
HLLM T1,TMPBLK+1
MOVE T1,[XWD .TCRDF,TMPBLK]
TMPCOR T1,
TRZA F,F.TMP
TRO F,F.TMP ;FOUND TMPCOR ENTRY
SUBTTL RESCAN
TRNE F,F.CCL ;CCL ENTRY?
JRST NOSCN ;YES, DON'T RESCAN
RESCAN ;RESCAN PREVIOUS MONITOR COMMAND
DSHLOP: INCHWL C ;GET CHAR
CAIN C,"-" ;DASH?
JRST PPNLOP ;YES, INPUT PPN
PUSHJ P,BP ;ESC CHAR?
JRST DSHLOP ;NO, KEEP LOOKING
JRST NOSCN ;USER DIDN'T SPECIFY PPN
BADPPN: OUTSTR [ASCIZ /PPN: /] ;PROMPT USER
;HERE TO INPUT PPN
PPNLOP: INCHWL C ;EAT DASH
PUSHJ P,EATS ;EAT SPACES
CAIL C,"A" ;A DEVICE?
CAILE C,"Z"
CAIL C,"a"
CAILE C,"z"
JRST NRMPPN ;NO, MUST BE PPN
PUSHJ P,SIXI ;YES, GET DEVICE NAME
MOVEM T1,TPTH ;GET ITS PATH
MOVE T1,[XWD BUFSIZ,TPTH]
PATH. T1,
ERROR PPN,BADPPN,<ILLEGAL PPN, TRY AGAIN>
SETZM TPTH+.PTSWT ;DON'T CHANGE SCAN
CAIN C,":" ;EAT COLON
INCHWL C
JRST PDON
NRMPPN: CAIN C,"[" ;EAT LEFT BRACKET
INCHWL C
MOVEI T1,.PTFRD ;READ PATH
MOVEM T1,TPTH+.PTFCN
MOVE T1,[XWD BUFSIZ,TPTH]
PATH. T1,
HALT
MOVEI T1,.PTSCN+.PTSCY ;GET RID OF NOISE BITS
ANDM T1,TPTH+.PTSWT
PUSHJ P,OCTI ;INPUT PROJECT
TDNE T1,[777777400000]
ERROR PPN,BADPPN,<ILLEGAL PPN, TRY AGAIN>
SKIPE T1
HRLM T1,TPTH+.PTPPN
PUSHJ P,EATS ;EAT SPACES
CAIE C,"," ;EAT COMMA OR SLASH
CAIN C,"/"
INCHWL C
PUSHJ P,OCTI ;INPUT PROGRAMMER
TLNE T1,-1
ERROR PPN,BADPPN,<ILLEGAL PPN, TRY AGAIN>
SKIPE T1
HRRM T1,TPTH+.PTPPN
MOVEI P1,1 ;SETUP LOOP
PPN1: PUSHJ P,EATS ;EAT SPACES
CAIE C,"," ;ANOTHER SFD?
JRST PPN2 ;NO
INCHWL C ;YES, EAT THE COMMA
CAILE P1,SFDS ;TOO MANY?
ERROR PPN,BADPPN,<ILLEGAL PPN, TRY AGAIN>
PUSHJ P,SIXI ;INPUT THE SFD
SKIPE T1 ;ZERO MEANS DEFAULT
MOVEM T1,TPTH+.PTPPN(P1) ;STORE IT
AOJA P1,PPN1 ;LOOP
PPN2: SETZM TPTH+.PTPPN(P1) ;TERMINATE PATH
CAIN C,"]" ;EAT RIGHT BRACKET
INCHWL C
PDON: PUSHJ P,EATS ;EAT SPACES
PUSHJ P,BP ;ESC CHAR?
ERROR PPN,BADPPN,<ILLEGAL PPN, TRY AGAIN>
MOVE T1,TPTH+.PTPPN ;[1,1] IS ILLEGAL
CAMN T1,MFDPPN
ERROR PPN,BADPPN,<ILLEGAL PPN, TRY AGAIN>
MOVEM T1,TPTH+.PTFCN ;STORE AS TARGET PPN
TRO F,F.SCN ;RESCAN FOUND PPN
NOSCN:
SUBTTL CHANGE PPN
TRNE F,F.TMP ;RETURNING?
TRNE F,F.SCN
JRST NORET ;NO
;HERE WHEN RETURNING TO ORIGINAL PPN
MOVE T1,[XWD BUF,TPTH] ;GET OLD ENTRY FROM TMPCOR
BLT T1,TPTH+BUFSIZ-1
JRST COMMON
;HERE WHEN NOT RETURNING TO ORIGINAL PPN
NORET: MOVEI T1,.PTPPN+1 ;COMPUTE SIZE OF PATH
SKIPE BUF(T1)
AOJA T1,.-1
MOVNI T1,1(T1)
HRLM T1,TMPBLK+1
MOVE T1,[XWD .TCRWF,TMPBLK] ;WRITE TO TMPCOR
TMPCOR T1,
ERROR TMP,EXT,CAN'T WRITE TEMP CORE
COMMON: MOVE T1,TPTH+.PTFCN ;TARGET PPN
MOVEM T1,PKBLK+2
CAMN T1,PKBLK+1 ;SAME PPN?
JRST CHGOK2 ;YES, MIGHT NOT HAVE PRIVS
PUSHJ P,TRMOPR ;TRMOP THE OPR
IFN FTCHG<
MOVE T1,PKBLK+2 ;TRY CHGPPN 1ST
CHGPPN T1,
CAIA ;LOST
JRST CHGOK ;WON
>
MOVE T1,[XWD 3,PKBLK] ;POKE JBTPPN
POKE. T1,
ERROR POK,EXT,POKE FAILED
CHGOK: PUSHJ P,TRMOPR ;TRMOP THE OPR
CHGOK2: IFE FTWHL<
HRRZI T1,.PTFSD ;CHANGE PATH
MOVEM T1,TPTH+.PTFCN
MOVE T1,[XWD BUFSIZ,TPTH]
PATH. T1,
ERROR PTH,EXT,CAN'T CHANGE PATH
>
SUBTTL REPORTING
MOVE L,[POINT 7,LINE] ;SET UP BP
IFN FTWHL<
MOVE T1,PKBLK+2 ;TELL WHAT PPN BECOMMING
PUSHJ P,PPNO
>
IFE FTWHL<
MOVE T1,PKBLK+2 ;MY PPN (JBTPPN)
CAMN T1,TPTH+.PTPPN ;NOT MY PPN (PATH)?
SKIPN TPTH+.PTPPN+1 ;OR NO SFD?
PUSHJ P,PPNO ;YES, OUTPUT PPN (JBTPPN)
MOVE T1,PKBLK+2 ;MY PPN (JBTPPN)
SKIPN TPTH+.PTPPN+1 ;PATH IS AN SFD?
CAME T1,TPTH+.PTPPN ;OR NOT MY PPN (PATH)?
PUSHJ P,PTHO ;YES, TYPE PATH TOO
>
MOVEI T1,CRLF ;<CR><LF>
PUSHJ P,STRO
SETZ T1, ;MAKE ASCIZ
IDPB T1,L
OUTSTR LINE
EXT: EXIT 1,
JRST EXT
IFE FTWHL<
;ROUTINE TO TYPE A PATH
PTHO: MOVEI T1,"["
IDPB T1,L
HLRZ T1,TPTH+.PTPPN ;PROJECT
PUSHJ P,OCTO
MOVEI T1,","
IDPB T1,L
HRRZ T1,TPTH+.PTPPN ;PROGRAMMER
PUSHJ P,OCTO
MOVEI P1,1 ;SETUP LOOP
PTHOLP: SKIPN T2,TPTH+.PTPPN(P1) ;ANOTHER SFD?
JRST PTHO2 ;NO
MOVEI T1,"," ;YES, COMMA
IDPB T1,L
PUSHJ P,SIXO ;OUTPUT SFD
AOJA P1,PTHOLP ;LOOP
PTHO2: MOVEI T1,"]" ;END OF PATH
IDPB T1,L
POPJ P,
>
SUBTTL TRMOP
;JOB NNN (XXXXXXXXXXXX) PIVOTING TO [NNNNNN,NNNNNN]
TRMOPR: TRNE F,F.TRM ;SUCCEEDED ALREADY?
POPJ P, ;YES, DON'T DO AGAIN
IFN FTLB<
MOVEI T1,LBPVT ;CODE NUMBER
MOVEM T1,PACK
PJOB T1, ;JOB NUMBER
MOVEM T1,PACK+1
HRROI T1,.GTNM1 ;USER NAME
GETTAB T1,
HALT
MOVEM T1,PACK+2
HRROI T1,.GTNM2
GETTAB T1,
HALT
MOVEM T1,PACK+3
MOVE T1,PKBLK+2 ;NEW PPN
MOVEM T1,PACK+4
MOVE T1,[%SILB] ;GET LB'S PID
GETTAB T1,
POPJ P,
MOVEM T1,HDR+.IPCFR
MOVE T1,[XWD 4,HDR] ;SEND THE PACKET
IPCFS. T1,
POPJ P,
> ;END FTLB
IFN FTTRM<
MOVE T1,[SIXBIT /OPR0/] ;GET I/O INDEX OF OPR
IONDX. T1,UU.PHY
POPJ P,
MOVEM T1,TRMBLK+1
MOVE L,[POINT 7,LINE] ;SET UP BP
MOVEI T1,[ASCIZ /
JOB /]
PUSHJ P,STRO
PJOB T1, ;JOB NUMBER
PUSHJ P,DECO
MOVEI T1,[ASCIZ / (/]
PUSHJ P,STRO
HRROI T2,.GTNM1 ;GET USER NAME
GETTAB T2,
POPJ P,
HRROI T3,.GTNM2
GETTAB T3,
POPJ P,
PUSHJ P,TWOO ;OUTPUT USER NAME
MOVEI T1,[ASCIZ /) PIVOTING TO /]
PUSHJ P,STRO
MOVE T1,PKBLK+2 ;OUTPUT NEW PPN
PUSHJ P,PPNO
MOVEI T1,CRLF ;<CR><LF>
PUSHJ P,STRO
SETZ T1, ;MAKE ASCIZ
IDPB T1,L
MOVE T1,[XWD 3,TRMBLK] ;TRMOP THE OPR
TRMOP. T1,
POPJ P,
> ;END FTTRM
TRO F,F.TRM ;SUCCESS
POPJ P,
SUBTTL INPUT ROUTINES
;EAT SPACES AND TABS
INCHWL C ;EAT IT
EATS: CAIE C," " ;SPACE OR TAB?
CAIN C,11
JRST EATS-1 ;YES
POPJ P,
;INPUT AN OCTAL NUMBER
;T1 RETURNS THE NUMBER
OCTI: SETZ T1, ;DEFAULT IS ZERO
PUSHJ P,EATS ;EAT SPACES
OCTLOP: CAIL C,"0" ;NUMERIC?
CAILE C,"7"
POPJ P, ;NO, MUST BE END
LSH T1,3 ;YES, APPEND TO NUMBER
ADDI T1,-"0"(C)
INCHWL C ;TRY NEXT CHAR
JRST OCTLOP
;TEST IF CHAR IS ESC CHAR
;SKIP IF YES
BP: CAIN C,15 ;EAT CR
INCHWL C
MOVEI T1,1 ;AN ESC CHAR?
LSH T1,(C)
TDNE T1,[BRKMSK]
CPOPJ1: AOS (P) ;YES, SKIP
CPOPJ: POPJ P,
;ROUTINE TO INPUT A SIXBIT NAME
;T1 RETURNS NAME
SIXI: PUSHJ P,EATS ;EAT SPACES
SETZ T1,
MOVEI T2,6*6 ;BIT COUNT
SIXILP: SUBI C,40 ;CONVERT LOWER CASE TO UPPER
CAIL C,"A"
CAILE C,"Z"
ADDI C,40
CAIL C,"0" ;ALPHANUMERIC?
CAILE C,"9"
CAIL C,"A"
CAILE C,"Z"
JRST SIXI3 ;NO
JUMPE T2,SIXI2 ;YES, ONLY 6
LSH T1,6 ;APPEND TO NAME
ADDI T1,-40(C)
SUBI T2,6 ;COUNT IT
SIXI2: INCHWL C ;GET NEXT CHAR
JRST SIXILP ;LOOP
SIXI3: LSH T1,(T2) ;LEFT JUSTIFY
POPJ P,
SUBTTL OUTPUT ROUTINES
;OUTPUT AN ASCIZ STRING
;T1 PASSES ADDRESS OF STRING
STRO: HRLI T1,(POINT 7,0)
ILDB T2,T1
JUMPE T2,CPOPJ
IDPB T2,L
JRST .-3
;OUTPUT A PPN <CRLF>
;T1 PASSES THE PPN
PPNO: PUSH P,T1 ;SAVE PPN
MOVEI T1,"[" ;OUTPUT LEFT BRACKET
IDPB T1,L
HLRZ T1,(P) ;OUTPUT PROJECT
PUSHJ P,OCTO
MOVEI T1,"," ;OUTPUT COMMA
IDPB T1,L
HRRZ T1,(P) ;OUTPUT PROGRAMMER
PUSHJ P,OCTO
MOVEI T1,"]"
IDPB T1,L
POP P,T1 ;RECALL PPN
POPJ P,
;OUTPUT A DECIMAL NUMBER
;T1 PASSES THE NUMBER
DECO: SKIPA T3,[^D10] ;RADIX
;FALL TO OCTO
;OUTPUT AN OCTAL NUMBER
;T1 PASSES NUMBER
OCTO: MOVEI T3,10 ;RADIX
;FALL TO NUMO
;ROUTINE TO OUTPUT A NUMBER
;T1 PASSES THE NUMBER
;T3 PASSES THE RADIX
NUMO: IDIV T1,T3 ;DIVIDE BY RADIX
HRLM T2,(P) ;SAVE REMAINDER
SKIPE T1 ;LOOP UNTIL 0
PUSHJ P,NUMO
HLRZ T1,(P) ;RECALL REMAINDER
ADDI T1,"0" ;OUTPUT AS DIGIT
IDPB T1,L
POPJ P, ;LOOP FOR EACH DIGIT
;ROUTINE TO OUTPUT AN SIXBIT NAME
;T2 PASSES THE NAME
SIXO: SETZ T3,
;FALL TO TWOO
;ROUTINE TO OUTPUT A SIXBIT DOUBLE WORD
;T2&T3 PASS THE DOUBLE WORD
TWOO: LSHC T1,6 ;GET HIGH CHAR
LSH T2,-6
LSHC T2,6
ANDI T1,77
ADDI T1,40 ;MAKE ASCII
IDPB T1,L ;STORE IT
JUMPN T2,TWOO ;LOOP UNTIL ALL GONE
JUMPN T3,TWOO
POPJ P,
SUBTTL ERRORS
VERBO: PUSH P,@.JBUUO ;SAVE RETURN ADR
HRROI P1,.GTWCH ;GET VERBOSITY BITS
GETTAB P1,
SETZ P1,
TLNN P1,(JW.WPR+JW.WFL)
TLO P1,(JW.WPR+JW.WFL)
CLRBFI ;EAT TYPE AHEAD
MOVE L,[POINT 7,LINE] ;SETUP BP
MOVEI T1,[BYTE (7)15,12,"?"] ;FATAL
PUSHJ P,STRO
HLRZ T2,@.JBUUO ;GET PREFIX
IFE FTWHL<HRLI T2,'PVT'>
IFN FTWHL<HRLI T2,'WHL'>
TLNE P1,(JW.WPR) ;WANT PREFIX?
PUSHJ P,SIXO ;YES
TLNN P1,(JW.WFL) ;WANT FIRST?
JRST VERBO1 ;NO
MOVEI T1," " ;YES
IDPB T1,L
AOS T1,.JBUUO ;TYPE FIRST
PUSHJ P,STRO
VERBO1: MOVEI T1,CRLF
PUSHJ P,STRO
SETZ T1,
IDPB T1,L
OUTSTR LINE
POPJ P,
END PIVOT