Trailing-Edge
-
PDP-10 Archives
-
steco_19840320_1er_E35
-
30,5602/ttydmp.mac
There is 1 other file named ttydmp.mac in the archive. Click here to see a list.
TITLE TTYDMP - PRINT TTY HISTORY FROM DUMP
SUBTTL DEFINITIONS
SEARCH UUOSYM
;STEPHEN WOLFE
;MR1-2/S43
;DIGITAL EQUIPMENT CORP
;200 FOREST ST.
;MARLBORO, MASS., 01752
;(617)467-5583
;AC'S
T1=1
T2=T1+1
P1=5
P2=P1+1
U=11 ;LDB
CD=12 ;CHUNK ON DISK
CC=13 ;CHUNK IN CORE
P=17
;CH'S
II==1 ;INPUT
OO==2 ;OUTPUT
;ASSEMBLY PARAMETERS
CKSIZ==4 ;SIZE OF A CHUNK IN WORDS
BLKSIZ==200 ;SIZE OF A DISK BLOCK
PDLSIZ==40 ;SIZE OF PDL
PAGSIZ==1000 ;SIZE OF A PAGE
NCHAR==200 ;NUMBER OF CHARS IN ASCII SET
CMASK==NCHAR-1 ;MASK FOR A CHAR
LA==74 ;LEFT ANGLE BRACKET
RA==76 ;RIGHT ANGLE BRACKET
;OP-CODES
OPDEF PJRST[JRST] ;POPPING JRST
;FORMAT OF LDB BLOCK
LDBNXT==0 ;POINTER TO NEXT LDB
LDBNAM==1 ;ADDR ON DISK OF LDB
LDBCK==2 ;POINTER TO FIRST CHUNK
LDBSIZ==3 ;SIZE OF LDB
SUBTTL DATA AREAS
LDBLST: BLOCK 1 ;POINTER TO FIRST LDB
NUMTAB: BLOCK 1 ;ADDR OF NUMTAB IN DUMP
PDL: BLOCK PDLSIZ ;PUSH DOWN LIST
BF: BLOCK PAGSIZ ;THE BUFFER
CURPAG: BLOCK 1 ;WHICH PAGE IS IN BUFFER
CMD: IOWD PAGSIZ,BF
0
IDEV: .IODMP ;INPUT DEVICE
SIXBIT /DEVI/
0
ODEV: .IOASC ;OUTPUT DEVICE
SIXBIT /DSK/
(OBUF)
OBUF: BLOCK 3
IFIL: .RBEXT ;INPUT FILE
0
SIXBIT /CRASH/
SIXBIT /EXE/
OFIL: .RBEXT ;OUTPUT FILE
0
SIXBIT /TTYDMP/
SIXBIT /LST/
SUBTTL MAINSTREAM
TTYDMP: JFCL ;NO CCL
RESET
MOVE P,[IOWD PDLSIZ,PDL] ;SETUP PDL
OPEN II,IDEV ;LOOKUP THE DUMP
HALT
LOOKUP II,IFIL
HALT
OPEN OO,ODEV ;ENTER THE LISTING
HALT
ENTER OO,OFIL
HALT
PUSHJ P,ONCE ;DO ONCE ONLY STUFF
PUSHJ P,READEM ;READ THE CHUNKS
PUSHJ P,WRITEM ;WRITE THE CHUNKS
CLOSE OO, ;CLOSE OUTPUT
STATZ OO,IO.ERR
HALT
EXIT
CHART: BLOCK NCHAR
DEFINE CIP(AA),<
RELOC CHART+AA
AA
>
CIP 40
CIP "!"
CIP "@"
CIP "#"
CIP "$"
CIP "%"
CIP "^"
CIP "&"
CIP "*"
CIP "("
CIP ")"
CIP "_"
CIP "-"
CIP "+"
CIP "="
CIP "["
CIP "]"
CIP "\"
CIP ":"
CIP ";"
CIP "'"
CIP ","
CIP "."
CIP "?"
CIP "/"
DEFINE CIPS(AA,BB),<
ZZ==BB
REPEAT AA,<
CIP ZZ
ZZ==ZZ+1
>
>
CIPS ^D26,"A"
CIPS ^D10,"0"
CIPS ^D26,"A"+40
DEFINE CIS(AA,BB),<
RELOC CHART+AA
ASCIZ /BB/
>
CIS 12,LF
CIS 15,CR
CIS 33,ESC
CIS 7,BELL
CIS 11,TAB
CIS 14,FF
CIS 13,VT
DEFINE CTRL(AA),<
RELOC CHART+AA-100
BYTE (7)"^",AA
>
CTRL "C"
CTRL "Z"
RELOC CHART+NCHAR
;ROUTINE TO OUTPUT A SPECIAL CHARACTER
;T1 PASSES THE CHARACTER
SCO: PUSHJ P,SAVE1 ;SAVE P1
ANDI T1,CMASK ;GET RID OF NOISE BITS
MOVE P1,T1 ;PUT CHAR IN SAFE PLACE
SKIPN T1,CHART(P1) ;GET TABLE ENTRY
JRST SCO1 ;UNKNOWN
TLNN T1,-1 ;IS IT AN ASCIZ STRING?
PJRST CO ;NO, ECHO AS TOLD
MOVEI T1,LA ;YES, TYPE LEFT ANGLE
PUSHJ P,CO
MOVEI T2,CHART(P1) ;TYPE ASCIZ STRING
PUSHJ P,STRO
JRST SCO2 ;TYPE RIGHT ANGLE
;HERE IF CHAR IS UNKNOWN
SCO1: MOVEI T1,LA ;TYPE LEFT ANGLE
PUSHJ P,CO
MOVE T1,P1 ;TYPE CHAR IN OCTAL
PUSHJ P,OCTO
SCO2: MOVEI T1,RA ;TYPE RIGHT ANGLE
PJRST CO
;ROUTINE TO OUPUT A CHAR
;T1 PASSES THE CHAR
;PRESERVES ALL ACS
CO: SOSGE OBUF+.BFCTR
JRST CO1
IDPB T1,OBUF+.BFPTR
POPJ P,
CO1: OUT OO,
JRST CO
HALT
;ROUTINE TO OUTPUT AN OCTAL NUMBER
;T1 PASSES THE NUMBER
OCTO: IDIVI T1,10
HRLM T2,(P)
SKIPE T1
PUSHJ P,OCTO
HLRZ T1,(P)
ADDI T1,"0"
PJRST CO
;ROUTINE TO PRINT AN ASCIZ STRING
;T2 PASSES ADDR OF STRING
STRO: HRLI T2,(POINT 7)
STRO1: ILDB T1,T2
JUMPE T1,CPOPJ
PUSHJ P,CO
JRST STRO1
;ROUTINE TO PRINT A CRLF
CRLFO: MOVEI T1,15
PUSHJ P,CO
MOVEI T1,12
PJRST CO
SUBTTL SAVE AC
SAVE1: EXCH P1,(P)
HRLI P1,(P)
PUSHJ P,CJRA
SOS -1(P)
JRST RET1
SAVE2: EXCH P1,(P)
HRLI P1,(P)
PUSH P,P2
PUSHJ P,CJRA
SOS -2(P)
POP P,P2
RET1: POP P,P1
CPOPJ1: AOSA (P)
TPOPJ: POP P,T1
CPOPJ: POPJ P,
POPJ P,
CJRA: JRA P1,(P1)
;ROUTINE TO PRINT ALL THE LDB'S
WRITEM: MOVE U,LDBLST ;ADDR OF 1ST LDB
WRTEM1: JUMPE U,CPOPJ ;QUIT IF NO MORE
PUSHJ P,WRITIT ;PRINT IT
PUSHJ P,CRLFO ;EXTRA CRLF
MOVE U,LDBNXT(U) ;STEP TO NEXT LDB
JRST WRTEM1
;ROUTINE TO PRINT ALL THE CHUNKS FOR AN LDB
;U PASSES THE ADDR OF THE LDB
WRITIT: MOVEI T2,[ASCIZ /LDB: /] ;PRINT LDB ADDR
PUSHJ P,STRO
MOVE T1,LDBNAM(U)
PUSHJ P,OCTO
PUSHJ P,CRLFO
PUSHJ P,REVER ;REVERSE THE ORDER OF THE CHUNKS
MOVE CC,LDBCK(U) ;GET ADDR OF FIRST CHUNK
WRTIT1: PUSHJ P,WRITCK ;PRINT IT
HRRZ CC,(CC) ;STEP TO NEXT CHUNK
JUMPN CC,WRTIT1 ;LOOP UNTIL NO MORE
POPJ P,
;ROUTINE TO REVERSE THE ORDER OF AN LDB'S CHUNKS
REVER: SETZ T1, ;NO PREDECESSOR
MOVE CC,LDBCK(U) ;ADDR OF 1ST CHUNK
REVER1: HRRZ T2,(CC) ;GET LINK TO NEXT
HRRM T1,(CC) ;SAVE POINTER TO PREDECESSOR
MOVE T1,CC ;WE ARE NOW THE NEW PREDECESSOR
MOVE CC,T2 ;STEP TO NEXT CHUNK
JUMPN CC,REVER1 ;LOOP UNTIL END OF LIST
MOVEM T1,LDBCK(U) ;LDB NOW POINTS TO OTHER END OF LIST
POPJ P,
;ROUTINE TO PRINT A CHUNK
;CC PASSES THE ADDR OF THE CHUNK
WRITCK: PUSHJ P,SAVE2 ;SAVE P1-P2
HLRZ T1,(CC) ;PRINT CHUNK ADDR
PUSHJ P,OCTO
MOVEI T2,[ASCIZ /: "/]
PUSHJ P,STRO
MOVEI P1,1(CC) ;MAKE BP TO 1ST CHAR
HRLI P1,(POINT 9)
MOVEI P2,<CKSIZ-1>*4 ;NUMBER OF CHARS
WRTCK1: ILDB T1,P1 ;GET NEXT CHAR
PUSHJ P,SCO ;PRINT IT
SOJG P2,WRTCK1 ;LOOP FOR EACH CHAR
MOVEI T2,[ASCIZ /"
/]
PJRST STRO
;ROUTINE TO FIND THE ADDR OF THE LDB BLOCK
;T1 PASSES THE LDB ADDR ON DISK
;U RETURNS THE LDB ADDR IN CORE
FNDLDB: MOVE U,LDBLST ;GET ADDR OF 1ST LDB
FNDLB2: JUMPE U,FNDLB1 ;NOT FOUND
CAMN T1,LDBNAM(U) ;THE RIGHT ONE?
POPJ P, ;YES
HRRZ U,LDBNXT(U) ;NO, GET ADDR OF NEXT LDB
JRST FNDLB2 ;AND KEEP TRYING
FNDLB1: PUSH P,T1 ;SAVE ADDR OF LDB ON DISK
MOVEI T1,LDBSIZ ;BUILD AN LDB
PUSHJ P,GETCOR
MOVE U,T1 ;SAVE ITS ADDR IN CORE
MOVE T1,LDBLST ;ADD IT TO THE LIST
MOVEM T1,LDBNXT(U)
MOVEM U,LDBLST
POP P,LDBNAM(U) ;STORE THE LDB ADDR ON DISK
SETZM LDBCK(U) ;NO CHUNKS YET
POPJ P,
;ROUTINE TO GET SOME CORE
;T1 PASSES THE NUMBER OF WORDS OF CORE TO GET
;T1 RETURNS THE ADDR OF THE BLOCK
GETCOR: PUSH P,.JBFF
ADDB T1,.JBFF
CAMG T1,.JBREL
JRST TPOPJ
CORE T1,
HALT
JRST TPOPJ
;ROUTINE TO READ ALL THE CHUNKS
READEM: SETZM LDBLST ;NO LDB'S YET
MOVE T1,[%SCTFT] ;GET ADDR OF 1ST CHUNK
PUSHJ P,GETTBL
HRRZ CD,T1
REDEM1: JUMPE CD,CPOPJ ;QUIT IF NO MORE
PUSHJ P,READCK ;READ THE CHUNK
HLRZ T1,(CC) ;FIND THE LDB BLOCK
PUSHJ P,FNDLDB
HRRZ T2,(CC) ;GET ADDR OF NEXT CHUNK ON DISK
HRRZ T1,LDBCK(U) ;LINK THE CHUNK TO THE LDB
HRRM T1,(CC)
HRRM CC,LDBCK(U)
HRLM CD,(CC) ;SAVE ADDR ON DISK IN CORE
MOVE CD,T2 ;GET ADDR OF NEXT CHUNK
JRST REDEM1
;ROUTINE TO READ A CHUNK INTO CORE
;CD PASSES THE ADDR OF THE CHUNK ON DISK
;CC RETURNS THE ADDR OF THE CHUNK IN CORE
READCK: PUSHJ P,SAVE1 ;SAVE P1
MOVEI T1,CKSIZ ;GET CORE FOR A CHUNK
PUSHJ P,GETCOR
MOVE CC,T1 ;SAVE ADDR
SETZ P1, ;SETUP LOOP COUNTER
REDCK1: MOVE T1,CD ;READ A WORD
ADD T1,P1
PUSHJ P,GETWRD
MOVE T2,CC ;STORE THE WORD
ADD T2,P1
MOVEM T1,(T2)
CAIE P1,CKSIZ-1 ;LOOP FOR EACH WORD
AOJA P1,REDCK1
POPJ P,
;ROUTINE TO DO ONCE ONLY STUFF
ONCE: SETOM CURPAG ;NOTHING IN CORE YET
MOVEI T1,410 ;GET ADDR OF NUMTAB
PUSHJ P,GETWRD
MOVEM T1,NUMTAB
ADDI T1,.GTSLF ;CHECK IT FOR CONSISTANCY
PUSHJ P,GETWRD
TLZ T1,-1
CAME T1,NUMTAB
HALT
POPJ P,
;ROUTINE TO DO A GETTAB
;T1 PASSES THE ARG
;T1 RETURNS THE RESULT
GETTBL: PUSH P,T1 ;SAVE ARG
ADD T1,NUMTAB ;INDEX INTO NUMTAB
PUSHJ P,GETWRD ;GET CONTENTS OF NUMTAB ENTRY
POP P,T2 ;RESTORE ARG
HLRZS T2 ;ISOLATE THE OFFSET
ADD T1,T2 ;INDEX INTO THE TABLE
;PJRST GETWRD ;AND READ IT
;ROUTINE TO GET THE CONTENTS OF A CORE LOCATION
;T1 PASSES THE ADDR (LH IGNORED)
;T1 RETURNS THE CONTENTS
GETWRD: TLZ T1,-1 ;IGNORE LH
IDIVI T1,PAGSIZ ;CONVERT TO PAGE AND OFFSET
PUSH P,T2 ;SAVE THE OFFSET
PUSHJ P,GETPAG ;GET THE PAGE IN CORE
POP P,T2 ;RESTORE THE OFFSET
MOVE T1,BF(T2) ;GET THE CONTENTS
POPJ P,
;ROUTINE TO GET A PAGE INTO CORE
;T1 PASSES THE PAGE NUMBER
GETPAG: CAMN T1,CURPAG ;ALREADY IN CORE?
POPJ P, ;YES
MOVEM T1,CURPAG ;NO, WILL BE SOON
IMULI T1,PAGSIZ/BLKSIZ ;CONVERT PAGE TO BLOCD
USETI II,5(T1) ;READ THE PAGE
IN II,CMD
POPJ P,
HALT
END TTYDMP