perm filename SAIKNT.FAI[S,AIL] blob
sn#191921 filedate 1975-12-15 generic text, type T, neo UTF8
SEARCH HDRFIL
COMPIL(KNT,<K.ZERO,K.OUT>,<GETCHAN,GOGTAB>
,<K.ZERO, K.OUT -- PERFORMANCE COUNTING ROUTINES>)
HERE(K.ZERO)
PUSH P,2 ;SAVE REGISTER 2
MOVE USER,GOGTAB
SKIPN 2,KNTLNK(USER) ;GET LINK TO COUNTERSS
JRST K.ZR2 ;THERE ARE NONE
PUSH P,3 ;SAVE OTHER REGS NEEDED
PUSH P,4
PUSH P,5
K.Z1: MOVE 3,2(2) ;GET SECOND IOWD OF HEADER BLOCK
MOVEI 4,2(3) ;GET <.KOUNT+1>
HRLI 4,-1(4) ;GET READY FOR BLT
HLRO 5,3 ;GET -COUNT
MOVN 5,5 ;MAKE THAT +COUNT
HRLI 5,3 ;PUT AN INDEX FIELD OF 3
SETZM -1(4) ;ZERO THE FIRST COUNTER
BLT 4,@5 ;ZERO THE REST
SKIPE 2,(2) ;GET THE NEXT SET OF COUNTERS
JRST K.Z1 ;ZERO THEM
POP P,5 ;RESTORE THE REGISTERS
POP P,4
POP P,3
K.ZR2: POP P,2
POPJ P, ;RETURN
HERE(K.OUT)
NOTENX<
MOVE USER,GOGTAB
SKIPN KNTLNK(USER) ;ARE THERE ANY COUNTERS
POPJ P, ;NO
MOVEM 16,17(P) ;SAVE IN THE STACK
MOVEI 16,1(P) ;GET READY TO STORE 0-15
BLT 16,16(P) ;DO IT
ADD P,[XWD 17,17] ;ADJUST STACK POINTER
TLNN P,400000 ;CHECK FOR OVERFLOW
ERR <PDL overflow in K.OUT routine>
MOVE 2,KNTLNK(USER) ;GET LINK TO LAST BLOCK
SKIPN 1,(2) ;GET LINK TO PREV.
JRST .+5 ;THAT'S ALL
MOVEI 0,1(2) ;GET ADDR OF 1st IOWD OF THIS BLOCK
MOVEM 0,3(1) ;STORE BELOW 2nd IOQS OF PREV BLOCK
MOVE 2,1 ;CONTINUE
JRST .-5
PUSHJ P,GETCHAN ;GET AN AVAILABLE CHANNEL
JUMPL 1,K.OERR ;NONE AVAILABLE
MOVE 0,[XWD K.OD1,3] ;MOVE CODE TO REGISTERS
BLT 0,16 ;SO THAT IT CAN BE SAFELY MODIFIED
DPB 1,[POINT 4,3,12] ;STORE CHANNEL NUMBER IN OPEN INSTR
DPB 1,[POINT 4,5,12] ;STORE CHANNEL NUMBER IN ENTER INSTR
MOVE 10,-1(2) ;PICK UP FILE NAME
JRST 3 ;OPEN AND ENTER,HOPEFULLY RETURNING TO .+1
K.O1: MOVE 0,[XWD K.OD2,3] ;DO IT AGAIN
BLT 0,7
DPB 1,[POINT 4,3,12] ;OUT INSTRUCTION
DPB 1,[POINT 4,6,12] ;RELEAS INSTRUCTION
JRST 3
K.O2: MOVSI 16,-16(P) ;PREPARE TO RESTORE REGS
BLT 16,16 ; FROM THE STACK
SUB P,[XWD 17,17] ;ADJUST STACK POINTER
POPJ P, ;RETURN
K.OERR: IOERR <I/O error in writing counter file>
K.OD1: OPEN 0,14 ;(3) OPEN DISK ON SPECIFIED CHANNEL
JRST K.OERR ;(4) TROUBLE
ENTER 0,10 ;(5)
JRST K.OERR ;(6) RIGHT HERE IN RIVER CITY
JRST K.O1 ;(7) READY TO WRITE 'EM OUT
0 ;(10) FILLED IN WITH FILE NAME
SIXBIT /KNT/ ;(11) EXTENSION
0 ;(12)
0 ;(13)
17 ;(14) DUMP MODE
SIXBIT /DSK/ ;(15) DEVICE DISK
0 ;(16) NO BUFFERS
K.OD2: OUT 0,1(2) ;(3) WRITE OUT COUNTERS
JRST 6 ;(4) ALL OK
JRST K.OERR ;(5) PROBLEMS
RELEAS 0 ;(6) CLOSE FILE
JRST K.O2 ;(7) GO BACK TO K.OUT
>;NOTENX
TENX<;TENEX VERSION OF K.OUT
MOVE USER,GOGTAB
SKIPN KNTLNK(USER) ;ANY KOUNTERS?
POPJ P,
MOVEM 14,15(P)
MOVEI 14,1(P)
BLT 14,14(P)
ADD P,[XWD 15,15]
TLNN P,400000 ;OVERFLOW?
ERR <PDL overflow in K.OUT routine>
MOVE 2,KNTLNK(USER)
SKIPN 1,(2)
JRST .+5
MOVEI 0,1(2)
MOVEM 0,3(1)
MOVE 2,1
JRST .-5
MOVE 5,2 ;SAVE POINTER TO THE CHAIN
PUSH P,-1(5) ;SIXBIT/FILENAME/
PUSHJ P,CVXSTR ;GET ASCII
PUSH P,[0]
PUSHJ P,CATCHR ;PUT A NULL BYTE ON THE END
POP SP,2 ;BP TO 2 FOR GTJFN
SUB SP,X11 ;CLEAR SP STACK
MOVEI 1,EKNT ;LONG FORM
JSYS GTJFN
JRST KNTERR ;GTJFN ERROR
MOVE 2,[XWD 440000,100000] ;36 BIT WRITE
JSYS OPENF ;JFN REMAINS IN 1
JRST KNTERR ;OPENF ERROR
MOVEI 4,1(5) ;START OF COMMAND LIST
KNTLUP: MOVE 3,(4)
JUMPE 3,KNTDUN ;0 COMMAND MEANS TO STOP
TLNE 3,-1 ;0 LEFT HALF MEANS GOTO
JRST KNTOUT ;REAL IO WORD
MOVE 4,3 ;OK DO THE GOTO
JRST KNTLUP
KNTOUT: HRRI 2,1(3) ;FIRST LOCATION
HRLI 2,444400 ;MAKE A BP
HLRO 3,3 ;WORD COUNT
JSYS SOUT
AOJA 4,KNTLUP
KNTDUN: JSYS CLOSF ;CLOSE OUT THE FILE
JFCL ;ERROR RETURN
KNTRET: MOVSI 14,-14(P) ;RESTORE ACS
BLT 14,14
SUB P,[XWD 15,15]
POPJ P, ;AND RETURN
KNTERR: ERR <K.OUT: Cannot GTJFN or OPENF file>,1
JRST KNTRET
EKNT: XWD 400000,0 ;NEW VERSION
XWD 377777,377777 ;NO EXTRA JFNS
BLOCK 3
XWD -1,[ASCIZ/KNT/] ;DEFAULT VERSION IS .KNT
BLOCK 3
>;TENX
ENDCOM (KNT)
END