;       DJOB1.M68 - Dynamic memory display DJOB13.LIT part 2
;
;       Copyright [c] STUYVESANT SofSystems


        SEARCH  SYS
        SEARCH  SYSSYM
        SEARCH  TRM
        
        RADIX 8.
        

        AUTOEXTERN

;
;MACROS

DEFINE  DPACK   ADDR,COUNT                              ; SET UP FOR UNPACK ADDR= WHERE RAD50 IS COUNT=# OF WORDS @(ADDR)
        LEA     A1,ADDR                                 ; EA=> A1
        MOV     #COUNT-1,D0                             ; D0 GETS COUNT-1 SO BEQ TRUE FOR 1 WORD
        CALL UPACK                                      ; UNPACK IT ONTO SCREEN AT CURRENT POSITION
        ENDM
        
DEFINE  L.CRT   ROW,COL                                 ; SET A WORD=ROW/COL CODE
        WORD    <ROW_8.>+<COL>
        ENDM

DEFINE  DSPLY   ROW,COL,TEXT                            ; SET BYTES = 
        WORD    <ROW_8.>+<COL>                          ; ROW/COL CODE
        BYTE    20$$-10$$                               ; LENGTH OF MESSAGE
10$$:   ASCIZ   ?TEXT?                                  ; BYTES OF MESSAGE
        EVEN                                            ; FORCE EVEN FOR NEXT NESSAGE
20$$:                                                   ; NEED FOR SUBTRACTION ABOVE
        ENDM

DEFINE  LOW                                             ; SET REDUCED INTENSITY
        MOV     #177400+11.,D1
        TCRT
        ENDM

DEFINE  HIGH                                            ; SET NORMAL INTENSITY
        MOV     #177400+12.,D1
        TCRT
        ENDM

        
;
;
;
; DISPLAY USER NAME
;
D$USN::
        LEA     A3,JOBUSN(A0)                           ; SET POINTER FOR JOBS USER LINE
        LEA     A2,J%USN(A5)                            ; SET POINTER FOR SAVED USER LINE
        MOVW    #19.,D0                                 ; SET COUNTER

10$:    CMMB    0(A3)[~D0],0(A2)[~D0]                   ; CMP A BYTE
        BNE     100$                                    ; BR IF # THEREFORE CHANGED
        DBF     D0,10$                                  ; DEC COUNTER AND CMP NEXT
        RTN                                             ; IF WE GET TO HERE NO CHANGE FOR WHOLE LINE

100$:   MOV     #<D%USN-C.SCR>,D0                       ; LOAD DSPLY LOCATION
        CALL    POSCRT                                  ; MOVE CURSOR
        MOVW    #0.,D0                                  ; PRECLEAR D0 COUNTER

120$:   MOVB    0(A3)[~D0],D1                           ; GET NEW BYTE
        BEQ     140$                                    ; BR IF 0
        TTY                                             ; TYPE IT OUT
        MOVB    D1,0(A2)[~D0]                           ; SAVE IT
        INC     D0                                      ; POINT TO NEXT
        CMPW    D0,#20.                                 ; HAVE WE DONE THEM ALL ?
        BNE     120$                                    ; BR IF NOT

140$:   RTN
;
;
; DISPLAY COMMAND LINE
;
;
D$CMD::
        LEA     A3,JOBCMD(A0)                           ; SET POINTER FOR JOBS CMD LINE
        LEA     A2,J%CMD(A5)                            ; SET POINTER FOR SAVED CMD LINE
        MOVW    #29.,D0                                 ; SET COUNTER

10$:    CMMB    0(A3)[~D0],0(A2)[~D0]                   ; CMP A BYTE
        BNE     100$                                    ; BR IF # THEREFORE CHANGED
        DBF     D0,10$                                  ; DEC COUNTER AND CMP NEXT
        RTN                                             ; IF WE GET TO HERE NO CHANGE FOR WHOLE LINE

100$:   MOV     #<D%CMD-C.SCR>,D0                       ; LOAD DSPLY LOCATION
        CALL    POSCRT                                  ; MOVE CURSOR
        MOVW    #0.,D0                                  ; PRECLEAR D0 COUNTER

120$:   MOVB    0(A3)[~D0],D1                           ; GET NEW BYTE
        BEQ     140$                                    ; BR IF 0
        TTY                                             ; TYPE IT OUT
        MOVB    D1,0(A2)[~D0]                           ; SAVE IT
        INC     D0                                      ; POINT TO NEXT
        CMPW    D0,#30.                                 ; HAVE WE DONE THEM ALL ?
        BNE     120$                                    ; BR IF NOT

140$:   RTN
;
;
; DISPLAY CURRENT USER LEVEL            - currently un used
;
D$LVL:: MOVB    JOBLVL(A0),D2                           ; MOV CURRENT JOBS USER-LEVEL TO D2
        CMPB    D2,J%LVL(A5)                            ; CMP W/ LAST KNOWN
        BNE     100$                                    ; IF NE THEN TO RTN TO REPLACE AND PRINT
        RTN                                             ; RTN IF EQ

100$:   MOVB    D2,J%LVL(A5)                            ; REPLACE OLD WITH CURRENT
        MOV     #<D%LVL-C.SCR>,D0                       ; LOCATE MESSAGE LINE
        CALL    POSCRT                                  ; MOVE CURSOR
        TSTB    D2                                      ; TEST THAT L-WORD IF =0 OR (-)
        BEQ     200$                                    ; BRANCH IF 0
        
        MOV     #0,D1
        MOVB    D2,D1                                   ; MOV FOR PRINT OUT
        OCVT    8.,OT$TRM!OT$ZER!OT$TSP                 ; DISPLAY ON SCREEN IN OCTAL (or hex)/ NO LEAD ZERO/ W-TRAIL SP
        RTN                                             ; FINISHED WITH THIS RTN
        
200$:   LOW                                             ; TYPE LOW INTENSITY
        TYPE    < un-used>                              ; TELL THEM
        EVEN
        HIGH                                            ; NORM INTENSITY
        RTN
;       
;
; DISPLAY ROOT LOG IN  {CLOG}
;
D$RLOG::MOV     #0,D1                                   ; PRE CLEAR D1 FOR WORD OPER S
        MOVW    JOBRTP(A0),D1                           ; GET NEW ROOT PPN
        BEQ     400$                                    ; IF 0 THEN LOGGED OFF
        CMPW    D1,J%RTP(A5)                            ; COMPARE TO OLD ROOT PPN
        BNE     100$                                    ; IF NE UPDATE EVERY BODY
        MOVW    JOBRTD(A0),D1                           ; GET NEW ROOT DRIVE
        CMPW    D1,J%RTD(A5)                            ; CMP W/OLD
        BNE     100$                                    ; IF NE UPDATE EVERYBODY
        MOVW    JOBRTU(A0),D1                           ; GET NEW ROOT UNIT
        CMPW    D1,J%RTU(A5)                            ; CMP W/OLD
        BNE     100$                                    ; IF NE UPDATE EVERYBODY
        RTN                                             ; NO ONE CHANGED FINISH

100$:   MOVW    JOBRTP(A0),J%RTP(A5)                    ; SAVE ROOT PPN
        MOVW    JOBRTD(A0),J%RTD(A5)                    ; SAVE ROOT DEVICE
        MOVW    JOBRTU(A0),J%RTU(A5)                    ; SAVE ROOT UNIT
        MOV     #<D%RPN-C.SCR>,D0                       ; FIND MESSAGE STRING
        CALL    POSCRT                                  ; LOCATE CURSOR
        TYPE    <                >                      ; CLEAR OLD
        EVEN
        CALL    POSCRT                                  ; REPOSITION
        DPACK   J%RTD(A5),1                             ; DISPLAY DEVICE
        MOVW    J%RTU(A5),D1                            ; SET D1=UNIT
        DCVT    0,OT$TRM                                ; PRINT UNIT AS DECIMAL/ SPACE AS REQD/ @TRM
        TYPE    <:[>                                    ; PRINT TERMINATING COLON AND PPN BRACKET
        PRPPN   J%RTP(A5)                               ; PRINT ROOT PPN
        TYPE    <]>                                     ; PRINT TERM BRACKET
        EVEN
        RTN
        
400$:   CLRW    J%RTP(A5)                               ; CLEAR ROOT PPN
        CLRW    J%RTD(A5)                               ; CLEAR ROOT DEVICE
        CLRW    J%RTU(A5)                               ; CLEAR ROOT UNIT
        MOV     #<D%RPN-C.SCR>,D0                       ; LOCATE MESSAGE STRING
        CALL    POSCRT                                  ; LOCATE CURSOR
        LOW                                             ; PRINT @ LOW INTENSITY
        TYPE    <no root log-in >                       ; TELL THEM NOT LOGGED IN
        EVEN
        HIGH                                            ; NORM. VID
        RTN
;
;
; DISPLAY CURRENT USER EXPERTISE        - currently un used
;
D$EXP:: MOVB    JOBEXP(A0),D2                           ; MOV CURRENT JOBS USER-EXPERTISE TO D2
        CMPB    D2,J%EXP(A5)                            ; CMP W/ LAST KNOWN
        BNE     100$                                    ; IF NE THEN TO RTN TO REPLACE AND PRINT
        RTN                                             ; RTN IF EQ

100$:   MOVB    D2,J%EXP(A5)                            ; REPLACE OLD WITH CURRENT
        MOV     #<D%EXP-C.SCR>,D0                       ; LOCATE MESSAGE LINE
        CALL    POSCRT                                  ; MOVE CURSOR
        TSTW    D2                                      ; TEST THAT L-WORD IF =0 OR (-)
        BEQ     200$                                    ; BRANCH IF 0
        
        MOV     #0,D1
        MOVB    D2,D1                                   ; MOV FOR PRINT OUT
        OCVT    8.,OT$TRM!OT$ZER!OT$TSP                 ; DISPLAY ON SCREEN IN OCTAL (or hex)/ NO LEAD ZERO/ W-TRAIL SP
        RTN                                             ; FINISHED WITH THIS RTN
        
200$:   LOW                                             ; TYPE LOW INTENSITY
        TYPE    < un-used>                              ; TELL THEM
        EVEN
        HIGH                                            ; NORM INTENSITY
        RTN
;
;
; DISPLAY CURRENT LANGUAGE POINTER
;
D$LNG:: MOVW    JOBLNG(A0),D2                           ; MOV CURRENT JOBS LANGUAGE POINTER
        CMPW    D2,J%LNG(A5)                            ; CMP W/ LAST KNOWN
        BNE     100$                                    ; IF NE THEN TO RTN TO REPLACE AND PRINT
        RTN                                             ; RTN IF EQ

100$:   MOVW    D2,J%LNG(A5)                            ; REPLACE OLD WITH CURRENT
        MOV     #<D%LNG-C.SCR>,D0                       ; LOCATE MESSAGE LINE
        CALL    POSCRT                                  ; MOVE CURSOR
        TSTW    D2                                      ; TEST THAT L-WORD IF =0 OR (-)
        BEQ     200$                                    ; BRANCH IF 0
        
        MOV     #0,D1
        MOVW    D2,D1                                   ; MOV FOR PRINT OUT
        OCVT    8.,OT$TRM!OT$ZER!OT$TSP                 ; DISPLAY ON SCREEN IN OCTAL (or hex)/ NO LEAD ZERO/ W-TRAIL SP
        RTN                                             ; FINISHED WITH THIS RTN
        
200$:   LOW                                             ; TYPE LOW INTENSITY
        TYPE    <    none>                              ; TELL THEM
        EVEN
        HIGH                                            ; NORM INTENSITY
        RTN
;
;
; DISPLAY CURRENT PENDING MESSAGE POINTER       - currently un used
;
D$MSR:: MOVW    JOBMSR(A0),D2                           ; MOV CURRENT JOBS PENDING MESSAGE POINTER
        CMPW    D2,J%MSR(A5)                            ; CMP W/ LAST KNOWN
        BNE     100$                                    ; IF NE THEN TO RTN TO REPLACE AND PRINT
        RTN                                             ; RTN IF EQ

100$:   MOVW    D2,J%MSR(A5)                            ; REPLACE OLD WITH CURRENT
        MOV     #<D%MSR-C.SCR>,D0                       ; LOCATE MESSAGE LINE
        CALL    POSCRT                                  ; MOVE CURSOR
        TSTW    D2                                      ; TEST THAT L-WORD IF =0 OR (-)
        BEQ     200$                                    ; BRANCH IF 0
        
        MOV     #0,D1
        MOVW    D2,D1                                   ; MOV FOR PRINT OUT
        OCVT    8.,OT$TRM!OT$ZER!OT$TSP                 ; DISPLAY ON SCREEN IN OCTAL (or hex)/ NO LEAD ZERO/ W-TRAIL SP
        RTN                                             ; FINISHED WITH THIS RTN
        
200$:   LOW                                             ; TYPE LOW INTENSITY
        TYPE    < un-used>                              ; TELL THEM
        EVEN
        HIGH                                            ; NORM INTENSITY
        RTN
        

        END