Trailing-Edge
-
PDP-10 Archives
-
decuslib10-05
-
43,50337/25/suttrc.mac
There is 1 other file named suttrc.mac in the archive. Click here to see a list.
TITLE SUTTRC
SEARCH SIMMAC
SALL
MACINIT
EXTERN MAP
EXTERN PASSNO
ENTRY TRC
DEFINE ERROR(FIL,CAUSE)
<OUTSTR [ASCIZ/CAUSE ERROR FILE: *.'FIL
/]
EXIT
>
RNAME <XCH0,XCH,XBASE>,<X1,X2,X3>
RNAME <XADR,XACC,XBIN,XBIN1,XBIN2,XLSIZE,XP,XPP,XCNT,XW>,<X4,X5,X6,X7,X10,X11,X12,X13,X14,X15>
SCALAR <QBINCH,QLSTCH,QTRCCH>
IO.EOF=20000
;LOCATE/ENTER:
;------------
BINLK: LOOKUP QBINCH,LKBIN
GOTO MAPEOF
IN QBINCH,
RETURN
LSTLK: LOOKUP QLSTCH,LKLST
GOTO NEWMOD
IN QLSTCH,
RETURN
TRCLK: ENTER QTRCCH,LKTRC
GOTO [ERROR(TRC,ENTER)]
OUT QTRCCH,
RETURN
TRCBUF: BLOCK 3
LSTBUF: BLOCK 3
BINBUF: BLOCK 3
LKTRC: 0
SIXBIT /TRC/
BLOCK 2
LKLST: 0
SIXBIT /LST/
BLOCK 2
LKBIN: SIXBIT /TRACE/
SIXBIT /BIN/
BLOCK 2
;CLOSE:
;-----
BINCL: CLOSE QBINCH,
IF STATZ QBINCH,740000
GOTO FALSE
THEN
RETURN
FI
ERROR BIN,CLOSE
LSTCL: CLOSE QLSTCH,
IF STATZ QLSTCH,740000
GOTO FALSE
THEN
RETURN
FI
ERROR LST,CLOSE
TRCCL: CLOSE QTRCCH,
IF STATZ QTRCCH,740000
GOTO FALSE
THEN
RETURN
FI
ERROR TRC,CLOSE
;INPUT ONE WORD FROM TRACE.BIN
;-----------------------------
LOOP
IF IN QBINCH,
GOTO FALSE
THEN
STATZ QBINCH,IO.EOF
GOTO BINEOF
ERROR BIN,READ
FI
BININ: AS SOSGE BINBUF+2
GOTO TRUE
SA
ILDB XBIN,BINBUF+1
AND XBIN,[XWD 777,777777]
RETURN
;INPUT ONE CHARACTER FROM *.LST
;------------------------------
LOOP
IF IN QLSTCH,
GOTO FALSE
THEN
STATZ QLSTCH,IO.EOF
GOTO LSTEOF
ERROR LST,READ
FI
LSTIN: AS SOSGE LSTBUF+2
GOTO TRUE
SA
ILDB XCH,LSTBUF+1
RETURN
;OUTPUT ONE CHARACTER TO *.TRC
;-----------------------------
LOOP
IF OUT QTRCCH,
GOTO FALSE
THEN
ERROR TRC,WRITE
FI
TRCOUT: AS SOSGE TRCBUF+2
GOTO TRUE
SA
IDPB XCH,TRCBUF+1
RETURN
TOT: BLOCK 1
HIGH: BLOCK 1
LLIM: ASCII/000000' 000 00 0 00 000000/
HLIM: ASCII/999999' 999 99 9 99 999999/
INFO: ASCII/
/
EXCT: BLOCK 2
ASCII/ INSTRUCTIONS EXECUTED
/
TRCT: BLOCK 2
ASCII/ INSTRUCTIONS TRACED
/
PERC: BLOCK 1
ASCII/% OF TOTAL
/
SIMPRO: BLOCK 400
INAR: BLOCK 50
FREQ: ASCII/ /
STACK: BLOCK 50
LASTC: BLOCK 1
OACC: BLOCK 1
MODULE: BLOCK 2
DONE: BLOCK 1
PASS: ASCII/ [PAS/
ASCIZ/S ]/
;OUTPUT ONE LINE TO *.TRC AND INPUT A NEW ONE:
;--------------------------------------------
LINE: JUMPE XLSIZE,NEWIN
SETZ XCH,
L XP,[POINT 7,INAR]
LOOP
ILDB XCH,XP
EXEC TRCOUT
AS
DECR XLSIZE,TRUE
SA
NEWIN: L XP,[POINT 7,INAR]
LOOP
EXEC LSTIN
IDPB XCH,XP
AOJ XLSIZE,
CAIN XCH,14 ;<FF>
GOTO FALSE
AS CAIE XCH,12 ;<LF>
GOTO TRUE
SA
EXCH XCH,LASTC
CAIE XCH,14 ;<FF>
RETURN
EXEC LINE
GOTO LINE
;OUTPUT 8 CHARACTERS TO *.TRC
;----------------------------
FIELD: LI XW,10
LOOP
ILDB XCH,XP
EXEC TRCOUT
AS
DECR XW,TRUE
SA
RETURN
XPL=XBIN1
XPH=XBIN2
XL=XCH0
XH=X16
;SEARCH A LINE IN *.LST WITH INSTRUCTION FORMAT
;----------------------------------------------
SINSTR: EXEC LINE
LI XW,14 ;<FF>
CAMN XW,LASTC
GOTO PAGACC
L XW,[ASCII/PROGR/]
CAMN XW,INAR
GOTO FINAL
L XPL,[POINT 7,LLIM]
L XPH,[POINT 7,HLIM]
L XPP,[POINT 7,INAR+1,13]
LI XCNT,^D26
LOOP
ILDB XCH,XPP
ILDB XL,XPL
ILDB XH,XPH
IF CAMGE XCH,XL
GOTO TRUE
CAMG XCH,XH
GOTO FALSE
THEN
L XP,[POINT 7,[ASCII/ /]]
EXEC FIELD
GOTO SINSTR
FI
AS
DECR XCNT,TRUE
SA
RETURN
PAGACC: CAMN XACC,OACC
GOTO SINSTR
SUBM XACC,OACC
L XBIN,OACC
LI XCNT,7
L XPP,[POINT 7,FREQ]
EXEC DECNV
L XP,[POINT 7,FREQ]
EXEC FIELD
L XP,[POINT 7,[ASCII/ SUM OF PAGE/]]
LI XW,14
EXEC FIELD+1
ST XACC,OACC
GOTO SINSTR
PURGE XPL,XPH,XL,XH
;CONVERT TABLE ENTRY TO DECIMAL ASCII:
;------------------------------------
DECNV: L XW,XCNT
SOJ XW,
LOOP
IDIVI XBIN,12
ADDI XBIN1,60
PUSH XPDP,XBIN1
AS
DECR XCNT,TRUE
SA
LOOP
POP XPDP,XBIN
AS CAIE XBIN,60
GOTO FALSE
SUBI XBIN,20
IDPB XBIN,XPP
DECR XW,TRUE
GOTO .+3
SA
LOOP
IDPB XBIN,XPP
AS SOJL XW,FALSE
POP XPDP,XBIN
GOTO TRUE
SA
RETURN
;PROGRAM ENTRY:
;-------------
TRC:: SETZM PASSNO
SETZM DONE
OPEN QBINCH,[14
SIXBIT/DSK/
XWD 0,BINBUF]
GOTO [ERROR(BIN,OPEN)]
OPEN QLSTCH,[0
SIXBIT/DSK/
XWD 0,LSTBUF]
GOTO [ERROR(LST,OPEN)]
OPEN QTRCCH,[0
SIXBIT/DSK/
XWD TRCBUF,0]
GOTO [ERROR(TRC,OPEN)]
TRAC: AOS XW,PASSNO
ADDI XW,20 ;convert to SIXBIT
DPB XW,[POINT 6,LKBIN,35]
ADDI XW,40 ;convert to ASCII
DPB XW,[POINT 7,PASS+1,20]
NEWMOD: LI XPDP,STACK
L XP,[POINT 6,LKLST]
L XPP,[POINT 6,LKTRC]
SETZM LKLST
SETZM LKTRC
SETZM LASTC
SETZM OACC
EXEC BINLK
EXEC MAP
GOTO MAPEOF
ANDCMI XBASE,400000
;store module name in ASCIZ
STD XCH0,MODULE
;convert to sixbit, and store in LOOKUP blocks
L XW,[POINT 7,XCH0]
LI XCNT,6
LOOP ILDB XW
SUBI 40
IDPB XP
IDPB XPP
AS DECR XCNT,TRUE
SA
;OPEN DATA SETS:
;--------------
EXEC BINLK
EXEC LSTLK
EXEC TRCLK
EXEC BININ ;get total num of traced instr
ST XBIN,TOT
EXEC BININ ;get low bound
HRRZ XADR,XBIN
EXEC BININ ;get high bound
HRRZM XBIN,HIGH
;GET PROGRAM TABLE
;-----------------
HRLZI XW,-400
LOOP EXEC BININ
LDB XBIN,BINBUF+1
ST XBIN,SIMPRO(XW)
AS AOBJN XW,TRUE
SA
EXEC BININ ;get first frequency value
SETZ XACC,
SETZ XLSIZE,
SEARCH: EXEC SINSTR
L XPP,[POINT 7,INAR+1,13]
SETZ XCH0,
LI XCNT,6
;convert address field
LOOP
ILDB XCH,XPP
SUBI XCH,60
ROT XCH,-3
LSHC XCH0,3
AS
DECR XCNT,TRUE
SA
ADD XCH0,XBASE
;CHECK IF WITHIN TABLE
IF CAMGE XCH0,XADR
GOTO TRUE
CAMG XCH0,HIGH
GOTO FALSE
THEN
L XP,[POINT 7,[ASCII/ /]]
EXEC FIELD
GOTO SEARCH
FI
;WHEN WITHIN TABLE, SEEK TABLE ENTRY:
;-----------------------------------
SEEK: IF CAMN XCH0,XADR
GOTO FALSE
THEN
EXEC BININ
AOJA XADR,SEEK
FI
IF JUMPN XBIN,FALSE
THEN
L XP,[POINT 7,[ASCII/********/]]
EXEC FIELD
GOTO SEARCH
FI
ADD XACC,XBIN
LI XCNT,7
L XPP,[POINT 7,FREQ]
EXEC DECNV
L XP,[POINT 7,FREQ]
EXEC FIELD
GOTO SEARCH
FINAL: L XP,[POINT 7,[ASCII/ /]]
EXEC FIELD
EXEC LINE
L XBIN,TOT
L XPP,[POINT 7,EXCT]
LI XCNT,12
EXEC DECNV
L XBIN,XACC
L XPP,[POINT 7,TRCT]
LI XCNT,12
EXEC DECNV
L XBIN,XACC
IMULI XBIN,^D1000
IDIV XBIN,TOT
L XPP,[POINT 7,PERC]
LI XCNT,4
EXEC DECNV
L XPP,[POINT 7,PERC,27]
LDB XW,XPP
LI XBIN,"."
DPB XBIN,XPP
IDPB XW,XPP
;OUTPUT PROGRAM TABLE:
;---------------------
L XP,[POINT 7,[ASCII/
SIMULA PROGRAMS TRACED: /]]
LI XW,^D28
EXEC FIELD+1
SETO XPP,
NEWL: LI XCNT,12
LOOP ADDI XPP,1
SKIPN XBIN1,SIMPRO(XPP)
GOTO FALSE
AS LI XW,10
LOOP SETZ XBIN,
LSHC XBIN,6
ADDI XBIN,40
L XCH,XBIN
EXEC TRCOUT
AS DECR XW,TRUE
SA
DECR XCNT,TRUE
L XP,[POINT 7,[BYTE(7)15,12,11,11,11]]
LI XW,5
EXEC FIELD+1
GOTO NEWL
SA
L XP,[POINT 7,[BYTE(7)15,12,15,12,15,12]]
LI XW,6
EXEC FIELD+1
;OUTPUT INFO AREA:
;----------------
L XP,[POINT 7,INFO]
LI XW,^D100
EXEC FIELD+1
GOTO INOUT
INOUT: EXEC LINE
GOTO INOUT
BINEOF: GOTO INOUT
LSTEOF: EXEC BINCL
EXEC LSTCL
EXEC TRCCL
OUTSTR [ASCIZ/TRC: /]
OUTSTR MODULE
IF SKIPE DONE
GOTO FALSE
THEN OUTSTR PASS
SETOM DONE
FI
OUTSTR [BYTE(7)15,12,0,0,0] ;<CR> <LF>
GOTO NEWMOD
MAPEOF: SETZM DONE
LI 5
CAMLE PASSNO
GOTO TRAC
RELEASE QBINCH,
RELEASE QLSTCH,
RELEASE QTRCCH,
EXIT
LIT
END TRC