;     FORMS.LIT         Hash Code 720-147-113-744
;
;     Have you ever wanted to know what forms were 'SET' on a printer, but
;upon typing a 'PRINT' command were stumped by the fact the queue was empty?
;
;     Do you have a large variety of forms in frequent use or more than one
;printer?
;
;     If you answered yes to either of the above questions then here's a
;short utility program for you. This program will display the forms currently
;'SET' on all printers in the line printer spooler queue.
;     The procedure is simple, simply type 'FORMS' and the names of all
;printers in the LPTSPL with their associated forms will be displayed. This
;program will work whether your system has just one printer or a dozen.
;
;
;     This program is written for the AMOS/L system.
;
;
;
;     The TCRT calls I have used work on the Televideo 925/950. I'm not
;familiar with other terminals, adjustments may have to be made to get
;the desired half/normal intensity printing.
;
;
;
;
; 2/27/84   Steven G. McNaughton     Quaker State Oil Refining Corp.
;                                    Research Center


SEARCH SYS.UNV
SEARCH TRM.UNV
SEARCH SYSSYM.UNV

OFINI                                   ;DEFINE IMPURE SPACE
OFDEF   RADBUF,4                        ;RAD50 BUFFER SPACE
OFDEF   ASCBUF,6                        ;ASCII STRING RESULT SPACE
OFDEF   FLAG,2                          ;END OF QUEUE FLAG
OFSIZ   IMPSIZ


TOP:
       GETIMP  IMPSIZ,A5,EXIT          ;GET AN IMPURE SPACE
       CTRLC   EXIT                    ;ON ABORT GO TO EXIT
       MOV     LPTQUE,A0               ;LOAD ADDRESS OF FIRST LP QUEUE BLOCK
       MOV     #-365,D1                ;HALF INTENSITY
       TCRT
       TYPESP  <Printer         Form>
       MOV     #177414,D1              ;RETURN TO NORMAL VIDEO
       TCRT
       CRLF
LOOP:   MOV     (A0),D0                 ;GET ADDRESS OF NEXT LPTQUE BLOCK
       TST     D0                      ;IS IT A ZERO (NO MORE QUEUE BLOCKS)
       BNE     NZFLG                   ;NO KEEP FLAG NON-ZERO
ZFLG:   LEA     A1,FLAG(A5)
       MOVW    #0,(A1)                 ;NO MORE QUEUE'S ZEROIZE FLAG
       BR      CONTIN
NZFLG:
       LEA     A1,FLAG(A5)             ;MORE LPTQUE'S SO MAKE FLAG NON-ZERO
       MOVW    #1,(A1)
CONTIN:
       CTRLC   EXIT
       LEA     A1,RADBUF(A5)           ;UNPACK MACRO USES A1 AS THE RAD50 ADDRESS
       LEA     A2,ASCBUF(A5)           ;AND A2 AS THE ASCII STRING ADDRESS
       CTRLC   EXIT
       MOV     10(A0),@A1              ;MOVE THE PRINTER NAME TO UNPACKED
       UNPACK
       UNPACK
       CTRLC   EXIT
       LEA     A2,ASCBUF(A5)           ;REPOSITION THE ASCII BUFFER
       CRLF
       CTRLC   EXIT
       TTYL    (A2)                    ;TYPE THE ASCII STRING
       LEA     A1,RADBUF(A5)           ;RELOAD THE RAD50 BUFFER
       LEA     A2,ASCBUF(A5)           ;RELOAD THE ASCII BUFFER
       MOV     14(A0),@A1              ;MOVE THE FORMS NAME TO BE UNPACKED
       UNPACK
       UNPACK
       CTRLC   EXIT
       LEA     A2,ASCBUF(A5)           ;REPOSITION THE ASCII BUFFER
       MOV     #-365,D1                ;HALF INTENSITY
       TCRT
       TYPESP  <........>
       MOV     #177414,D1              ;NORMAL VIDEO
       TCRT
       CTRLC   EXIT
       TTYL    (A2)                    ;TYPE THE ASCII STRING
       CRLF
       LEA     A1,FLAG(A5)             ;GET THE END OF QUEUE FLAG
       MOVW    (A1),D4                 ;PUT IN A REGISTER TO CHECK IT
       TST     D4                      ;IS IT ZERO?
       BEQ     EXIT                    ;IF SO ALL DONE - SO EXIT
       MOV     D0,A0                   ;NOT ZERO - MORE QUEUE BLOCKS -
       JMP     LOOP                    ;GO GET THE NEXT ONE
EXIT:
       CRLF
       EXIT
END