.TITLE CRUPG .IDENT /X01.00/ ; ; Author: Gilbert J. DeLeeuw ; Date: July 9, 1985 ; Name: Compress and Restore Utility - Page Control ; Function: Subroutine to keep track of page number and indicate ; whether to process the current record. ; ; Algorithm: Increment page number depending on output format control ; type and test against desired page range. ; ; Parameter conventions: ; ; R2 = Length of record ; R3 = Address of record ; ; Returns with carry set if record is to be skipped ; LF = 12 FF = 14 ; ; CRUPGF:: CMPB #' ,(R3) ;Most expected character BEQ CRUPGL ;Standard increment of 1 line ; ; Test for double space CMPB #'0,(R3) ;Second most expected BNE 10$ ;No CALL NEWLN ;Extra line BR CRUPGL ;Standard increment of 1 line ; ; Test for form feed 10$: CMPB #'1,(R3) ;Test for form feed BNE 10$ ;No CALL NEWPG ;Increment page and reset line ; ; Test for overprint TSTB (R3) ;Null? BEQ CRUPGN ;Yes CMPB #'+,(R3) ;Plus? BEQ CRUPGN ;Yes ; ; CRUPGL:: CALL NEWLN ;Standard increment ; ; CRUPGN:: MOV R2,R4 ;Copy count BEQ PGTST ;Zero length record? MOV R3,R5 ;Copy starting address ; ; Since we are searching for LF and FF, put them in registers MOV #LF,R0 ; MOV #FF,R1 ; ; ; Loop over record to find any imbedded LF or FF LOOP: CMPB R0,(R5) ;LF? BNE 10$ ;No CALL NEWLN ;New line ; 10$: CMPB R1,(R5)+ ;Check for FF and increment pointer BNE 20$ ;No? CALL NEWPG ;New page CALL NEWLN ;And new line ; 20$: SOB R4,LOOP ;End of loop ; ; Test page number for zero PGTST: TST PAGE ;Page number zero? BNE CRUPST ;No INC PAGE ;Set to page 1 ; ; Page tests to see if this record should be processed CRUPST: TST PGST ;Start page specified? BEQ 10$ ;No CMP PAGE,PGST ;Test for starting page BLO 30$ ;Before start page ; 10$: TST PGND ;End page specified? BEQ 20$ ;No CMP PGND,PAGE ;Test for end page RTS PC ;Done ; 20$: CCC ;Set success 30$: RTS PC ;Done ; ; Subroutines for new line and new page NEWLN: BIT #PSMSK,MKWD ;Page size enabled? BEQ NDON ;No TST PSIZ ;Page size specified? BLE NDON ;No ; INC LINE ;Increment line CMP PSIZ,LINE ;Page break? BGE NDON ;No ; NEWPG: INC PAGE ;Increment page number CLR LINE ;Reset line number ; NDON: RTS PC ;Done .END