;***************************************************************************; ; ; ; MSTAT ; ; Displays dynamic memory map for all jobs ; ; ; ;***************************************************************************; ;Copyright (C) 1986 by UltraSoft. All Rights Reserved. ; ;Written by: David Pallmann ; ;Edit History: ;1.0 29-Oct-86 created. /DFP ;1.0A 31-Oct-86 correct bug where mor than seven job names were displayed. /DFP VMAJOR=1 VMINOR=0 VSUB=1 SEARCH SYS SEARCH SYSSYM SEARCH TRM MEM=A5 .OFINI .OFDEF HASH,7*4 ; memory hash totals for 7 jobs .OFDEF OFFSET,4 ; starting job offset .OFDEF BUFFER,12. ; pack-unpack buffer .OFDEF FLAGS,2 ; flags: F$HIGH=1 ; high intensity .OFSIZ MEMSIZ DEFINE CURSOR ROW,COL MOVB ROW,D1 ROLW D1,#8. MOVB COL,D1 TCRT ENDM DEFINE TCALL CODE MOVW #-1_8.+CODE,D1 TCRT ENDM DEFINE CLS=TCALL 0 DEFINE HOME=TCALL 1 DEFINE CLREOL=TCALL 9. DEFINE LOW=TCALL 11. DEFINE HIGH=TCALL 12. DEFINE GRAFIX=TCALL 23. DEFINE TEXT=TCALL 24. DEFINE CURON=TCALL 28. DEFINE CUROFF=TCALL 29. DEFINE TLCORN=TCALL 38. DEFINE TRCORN=TCALL 39. DEFINE BLCORN=TCALL 40. DEFINE BRCORN=TCALL 41. DEFINE TINTER=TCALL 42. DEFINE RINTER=TCALL 43. DEFINE LINTER=TCALL 44. DEFINE BINTER=TCALL 45. DEFINE HLINE=TCALL 46. DEFINE VLINE=TCALL 47. ;allocate impure area START: PHDR -1,,PH$REE!PH$REU ; program heaer GETIMP MEMSIZ,MEM ;set image mode, no-echo, no function key translation TERM: JOBIDX MOV JOBTRM(A6),A6 ORW #T$IMI!T$ECS!T$XLT,T.STS(A6) ;clear screen, draw graphics border SCREEN: LEA A0,HASH(MEM) MOV #7,D0 4$: CLR (A0)+ SOB D0,4$ CLS HIGH MOVW #F$HIGH,FLAGS(MEM) CUROFF GRAFIX HOME TLCORN MOV #76.,D0 5$: HLINE SOB D0,5$ TRCORN CURSOR #2,#1 VLINE CURSOR #2,#78. VLINE CURSOR #3,#1 LINTER MOV #7,D0 41$: MOV #10.,D2 42$: HLINE SOB D2,42$ CMP D0,#1 BEQ 43$ TINTER SOB D0,41$ 43$: RINTER MOV #3,D2 7$: INC D2 MOV #8.,D4 MOV #1,D3 8$: CURSOR D2,D3 VLINE ADD #11.,D3 SOB D4,8$ CMP D2,#23. BLO 7$ CURSOR #23.,#1 BLCORN MOV #7.,D0 81$: MOV #10.,D2 82$: HLINE SOB D2,82$ CMP D0,#1 BEQ 83$ BINTER 83$: SOB D0,81$ BRCORN TEXT CALL LOW CURSOR #24.,#35. TYPE MemorySTAT CALL HIGH ;output job name headers JOBHDR: MOV #4,D2 MOV JOBTBL,A0 MOV OFFSET(MEM),D0 BEQ 14$ 10$: MOV (A0)+,D7 BEQ 10$ BMI 20$ SOB D0,10$ 14$: MOV #7,D0 20$: MOV (A0)+,D7 BEQ 20$ BMI SCAN MOV D7,A1 LEA A1,JOBNAM(A1) LEA A2,BUFFER(MEM) UNPACK UNPACK CLRB @A2 CURSOR #2,D2 TTYL BUFFER(MEM) ADD #11.,D2 SOB D0,20$ ;scan memory partitions of the seven (or less) "active" jobs SCAN: CTRLC EXIT JOBIDX MOV JOBTRM(A6),A6 TST T.ICC(A6) JNE CHAR LEA A0,HASH(MEM) MOV JOBTBL,A1 MOV OFFSET(MEM),D0 BEQ 20$ 10$: MOV (A1)+,D7 BEQ 10$ BMI 20$ SOB D0,10$ 20$: MOV #7,D0 MOV #2,D2 LOOP: MOV (A1)+,D7 BEQ LOOP JMI SLEEP MOV D7,A4 MOV JOBSIZ(A4),D3 JEQ EMPTY CLR D5 MOV JOBBAS(A4),A3 20$: MOV @A3,D7 BEQ 30$ ADD D7,D5 ADD D7,A3 BR 20$ 30$: CMM D5,@A0 BEQ NEXT MOV D5,@A0 MOV JOBBAS(A4),A3 MOV #4,D3 40$: TST @A3 BEQ 50$ CURSOR D3,D2 SAVE A1 LEA A1,6(A3) LEA A2,BUFFER(MEM) UNPACK UNPACK MOVB #'.,(A2)+ UNPACK CLRB @A2 MOVW 4(A3),D6 ANDW #FIL,D6 BEQ 41$ CALL HIGH BR 42$ 41$: CALL LOW 42$: TTYL BUFFER(MEM) REST A1 INC D3 CMP D3,#24. BEQ NEXT MOV @A3,D7 BEQ 50$ ADD D7,A3 BR 40$ 50$: CURSOR D3,D2 TYPE < > INC D3 CMP D3,#23. BLO 50$ NEXT: ADD #4,A0 ADD #11.,D2 DEC D0 JNE LOOP SLEEP: CTRLC EXIT SLEEP #1000. JMP SCAN EMPTY: TST @A0 JEQ NEXT MOV #4,D3 10$: CURSOR D3,D2 TYPE < > INC D3 CMP D3,#23. BLO 10$ CLR @A0 JMP NEXT ;get char from terminal CHAR: KBD EXIT UCS CMPB D1,#'^-'@ ; HOME goes to beginning of job list JEQ HOME CMPB D1,#'H-'@ ; left arrow scrolls left JEQ SLEFT CMPB D1,#'L-'@ ; right arrow scrolls right JEQ SRIGHT CMPB D1,#33 ; ESCape exits JEQ EXIT CMPB D1,#'C-'@ ; ^C exits JEQ EXIT CMPB D1,#'Q ; Q exits JEQ EXIT CMPB D1,#'R ; R redisplays screen JEQ SCREEN JMP SCAN ;back to start of job list HOME: CLR OFFSET(MEM) JMP SCREEN ;shift display left a job SLEFT: TST OFFSET(MEM) JEQ SCAN DEC OFFSET(MEM) JMP SCREEN ;shift display right a job SRIGHT: INC OFFSET(MEM) JMP SCREEN ;exit EXIT: CURON CURSOR #24.,#1 CLREOL HIGH EXIT ;set low intensity - does no unnecessary I/O LOW: MOVW FLAGS(MEM),D7 ANDW #F$HIGH,D7 BEQ 10$ LOW ANDW #^C<F$HIGH>,FLAGS(MEM) 10$: RTN ;set high intensity - does no unnecessary I/O HIGH: MOVW FLAGS(MEM),D7 ANDW #F$HIGH,D7 BNE 10$ HIGH ORW #F$HIGH,FLAGS(MEM) 10$: RTN END