.TITLE EXMSPL .ENABL LC ; ; Purpose of program : ; ; Example of SPAL11 program ; ; ; Author: P. FABRE ; Ste INFI ; 3, rue des Pres-Aubry ; 92370, CHAVILLE ; FRANCE ; tel: 750-92-94 ; ; current PSECT .PSECT USROM ; external macros used .MCALL SPAL11 SPAL11 ; declare SPAL11 to the macro assembler ; internal macros ; none .ENABL GBL ; global references .GLOBL PAGSIZ ;number of lines max on 1 page of LP: .GLOBL FSTLIN ;number of 1st writable line .GLOBL MAXPAG ;number of max writable line .GLOBL LINCNT ;line counter for LP: .GLOBL COPFIN ;flag indicating if we are copiing .GLOBL LPNRDY ;flag = 1 if command stop copy has been struck .GLOBL LPACTF ;flag for lp: activated or not activated .GLOBL LPHALT ;flag = 1 if STOPCOP has been executed ; symbols used CR=15 ;carriage return LF=12 ;line feed FF=14 ;form feed BIP=007 ;code for bell CTRLZ=26. ;contol-z (^Z) LPSTRT:: REPEAT CLR LPACTF ;flag for printer no activated CALL SPRCVE ;get next command MOV #1,LPACTF ;printer activated BEGIN WITH ERROR BLOCK MOV RCVBUF,R4 ;R4 -> point to buffer MOV 6(R4),R2 ;code received in R2 EXIT TO ERROR BLOCK IF OR ASL R2 CALL @CODRTN(R2) ;execute command IFB <(R4) NE #377> ; needs to activate event ? CLR R2 BISB (R4),R2 ; if so, do it. END ERROR BLOCK MOV #MES4,R5 ;in case of error, print message CALL PMES END IF ;if prog has been stopped by command stop copy IF ;if EQ, LPSTOP has been executed CLR LPOKFL ;LP-ok flag= 0 -> LP not running END ENDIF UNTIL PMES:: BEGIN WHILEB <(R5) NE> EXIT IF ; exit if command stop copy has been struck MOVB (R5)+,R0 CALL LPPRNT END END RETURN LPPRNT:: PUSH R1,R2 BIC #177400,R0 CASE OFB INC LINCNT ;increment line counter IF ;if nb lines on 1 page > nb max allowed BEGIN NBLF MOV PAGSIZ,R1 MOV LINCNT,R2 SUB R2,R1 ADD FSTLIN,R1 INC R1 WHILE ;print as many LFs as necessary to reach ;1st writable line of next page MOV #LF,R0 CALL LPOUTPUT DEC R1 END MOV FSTLIN,LINCNT ;nb line=nb of 1st writable line END ELSE CALL LPOUTPUT END OFB INC LINCNT MOV #CR,R0 CALL LPOUTPUT INVOKE NBLF ;print as many LFs as necessary to reach ;1st writable line of next page OTHER ;if neither LF nor FF CALL LPOUTPUT END PULL R2,R1 RETURN .PSECT DATA$U D MES4: .ASCIZ /illegal code/<15><12> .EVEN .END