; SETFRM.M68 -- AMOSL Subroutine for setting the forms on a printer
;               used as is the following sample BASIC program
;
; SETFRM does not check whether form type is legal. It enters whatever
; you enter in the variable "FORMS". Use only letters and numerals with
; no embedded blanks. SETFRM is not re-entrant.
;
;==================================================================
;!SETFRM.BAS -- Set forms program
;!MIKE VANDEMAN  SYNANON CHURCH 5/3/83
;MAP1 FORMS,S,6
;MAP1 PRINTER'NAME,S,3
;
;       INPUT "PRINTER NAME, FORMS ? ", PRINTER'NAME, FORMS
;       XCALL SETFRM, PRINTER'NAME,FORMS
;       END
;==================================================================
;
;  REGISTER USAGE:      R0:     ADDRESS OF SPOOLER QUEUE ELEMENTS
;                       R1:     DESTINATION FOR PACKING
;                       R2:     SOURCE FOR PACKING
;                       R3:     -> PARAMETER LIST
;
       SEARCH  SYS
       SEARCH  SYSSYM
       OBJNAM  .SBR
       RADIX   10              ;use decimal arithmetic
       PHDR    -1,PV$RSM,PV$WSM,PV$REU

       MOV     4(A3),A2        ;get address of printer name
       LEA     A1,PRINTR       ;
       PACK
       PACK
       MOV     LPTQUE,A0       ;get address of spooler queue

CMPARE: CMMW    8(A0),PRINTR    ;correct printer ?
       BEQ     FINISH          ;if yes, goto finish
       TST     @A0             ;any more spoolers ?
       BEQ     ERROR           ;no, printer not found
       MOV     @A0,A0          ;get address of next spooler control block
       BR      CMPARE

ERROR:  TYPECR  <?printer not found>
       EXIT

FINISH: MOV     FORMS,12(A0)    ;enter forms in spooler control block
       RTN

FORMS:  BLKL    1
PRINTR: BLKL    1
       END