.TITLE REFTOT - Write REFormat Totals .IDENT /1.0/ .ENABL LC ;+ ; ; Free software BY ; Project Software & Development, Inc. ; ; This software is furnished for free and may be used and copied as ; desired. This software or any other copies thereof may be provided or ; otherwise made available to any other person. No title to and ; ownership of the software is hereby transferred or allowed. ; ; The information in this software is subject to change without notice ; and should not be construed as a commitment by PROJECT SOFTWARE ; AND DEVELOPMENT, INC. ; ; PROJECT SOFTWARE assumes no responsibility for the use or reliability ; of this software on any equipment whatsoever. ; ; Project Software & Development, Inc. ; 14 Story St. ; Cambridge, Ma. 02138 ; 617-661-1444 ; ; ; Title: REFTOT.MAC ; Author: Robin Miller ; Date: December 13, 1982 ; ; Description: ; ; Write the total records/bytes for REFormat. ; ; Modification History: ; ;- .ENABL AMA .NLIST BEX .MCALL PUT$ ; ASCII Messages: INM: .ASCIZ "Input file: " OUTM: .ASCIZ "Output file: " TOTREC: .ASCIZ " total number of records = " TOTBYT: .ASCIZ ", total number of bytes = " NMEBUF: .ASCIZ "%REF-I-DONE, reformatting of file " CMPBUF: .ASCIZ " complete" .EVEN .SBTTL CVTDEC - Convert Binary Number To Decimal ASCII ;+ ; ; CVTDEC - Convert binary number to Decimal ASCII. ; ; Inputs: ; R0 = the output buffer address. ; R1 = the binary number to convert. ; ; Outputs: ; R0 = the updated output buffer address. ; ; All other registers are preserved. ; ;- CVTDEC::JSR R5,.SAVR1 ; Save R1 - R5 MOV #030012,R2 ; WIDTH=6 ! ZERO-SUPPRESS ! DECIMAL CALL $CBTA ; Convert it to decimal ASCII. RETURN .SBTTL CVTDTD - Convert Double Precision Binary To Decimal ASCII ;+ ; ; CVTDTD - Convert double precision binary number to decimal ASCII. ; ; Inputs: ; R0 = the output buffer address. ; R1 = address of the double precision number. ; ; Outputs: ; R0 = the updated output buffer address. ; ; All other registers are preserved. ; ;- CVTDTD::JSR R5,.SAVR1 ; Save R1 - R5 CLR R2 ; Suppress leading zeroes. CALL $CDDMG ; Convert it to decimal ASCII. RETURN .SBTTL NAMWRT - Write the reformatted file done ;+ ; ; NAMWRT - Write the reformatted file done message ; ; Inputs: ; ; Outputs: ; ;- NAMWRT:: MOV #NMEBUF,R1 ; Address of first half of message MOV #WRKBUF,R0 ; Address of message buffer CALL MOVEC ; And move the message to buffer MOV #OUTFIL,R1 ; Address of the filename CALL MOVEC ; Move the filename to message buffer MOV #CMPBUF,R1 ; Address of last part of message CALL MOVEC ; Now move it MOV #WRKBUF,R1 ; Address of the output buffer. MOV R0,R2 ; Copy the updated buffer address. SUB R1,R2 ; Calulate the byte count. PUT$ #TOFDB,R1,R2 ; Write the totals. BCC 10$ ; If CC, success. CALL FILERR ; Else, report the file error. 10$: RETURN .SBTTL MOVEC - Move A Character String ;+ ; ; MOVEC - Move a character string. ; ; Inputs: ; R0 = the output buffer address. ; R1 = the character string to move (terminated by NULL). ; ; Outputs: ; R0 = the updated buffer address. ; ;- MOVEC:: MOVB (R1)+,(R0)+ ; Copy the next character. BNE MOVEC ; If NE, more to copy DEC R0 ; Point to the null byte RETURN ;+ ; ; WRTTOT - Write the totals. ; ; Inputs: ; INREC = number of input records. ; INCNT = input file byte count. ; OUTREC = number of output records. ; OUTCNT = output file byte count. ; ; Outputs: ; C bit clear/set = success/failure from write. ; ; All registers are preserved. ; ;- WRTTOT::JSR R2,$SAVVR ; Save R0 - R2. BIT #B.TOT,STATUS ; Should we output the totals ? BEQ 100$ ; If EQ, no. ; Do the input file statistics first. MOV #WRKBUF,R0 ; The output buffer address. MOV #INM,R1 ; Address of the input file message. CALL MOVEC ; opy it. ; Format the total number of input records. MOV #TOTREC,R1 ; Address of total records message. CALL MOVEC ; Copy it. MOV INREC,R1 ; Copy the number of records. CALL CVTDEC ; Convert it to decimal ASCII. ; Format the total number of input bytes. MOV #TOTBYT,R1 ; Address of total bytes message. CALL MOVEC ; Copy it. MOV #INCNT,R1 ; Address of double precision count. CALL CVTDTD ; Convert it to decimal ASCII. CALL 50$ ; Now write them to the terminal. BCS 100$ ; If CS, we had a write error. ; Now do the output file statistics. MOV #WRKBUF,R0 ; The output buffer address. MOV #OUTM,R1 ; Address of the output file message. CALL MOVEC ; opy it. ; Format the total number of input records. MOV #TOTREC,R1 ; Address of total records message. CALL MOVEC ; Copy it. MOV OUTREC,R1 ; Copy the number of records. CALL CVTDEC ; Convert it to decimal ASCII. ; Format the total number of input bytes. MOV #TOTBYT,R1 ; Address of total bytes message. CALL MOVEC ; Copy it. MOV #OUTCNT,R1 ; Address of double precision count. CALL CVTDTD ; Convert it to decimal ASCII. CALL 50$ ; Now write them to the terminal. BR 100$ ; And return ... ; Calculate the byte count and output the message. 50$: MOV #WRKBUF,R1 ; Address of the output buffer. MOV R0,R2 ; Copy the updated buffer address. SUB R1,R2 ; Calulate the byte count. PUT$ #TOFDB,R1,R2 ; Write the totals. BCC 60$ ; If CC, success. CALL FILERR ; Else, report the file error. 60$: RETURN 100$: RETURN .END