;*************************** AMUS Program Label ****************************** ; Filename: ADCRLF.M68 Date: 03/22/89 ; Category: UTIL Hash Code: 341-522-150-120 Version: 1.0(100) ; Initials: DAVE/AM Name: DAVE HEYLIGER ; Company: Alpha Micro Users Society Telephone #: 3034496917 ; Related Files: NONE ; Min. Op. Sys.: Expertise Level: BEG ; Special: ; Description: Adds Carriage Returns & Line Feeds to files which lack them. ; The CRLF is placed at every 75th character. You can change the 75 char. ; setting by changing the following line: CMP D4,#75. ;***************************************************************************** ; ; Directions: just type ADCRLF and follow the prompts! ; ;--- Get symbols and macros ; SEARCH SYS SEARCH SYSSYM SEARCH TRM ;--- Define version number ; VMAJOR=1. VMINOR=0. VEDIT=100. ;--- Define variables ; .OFINI .OFDEF IDDB,D.DDB ;Input DDB for input file .OFDEF ODDB,D.DDB ;Output DDB for output file .OFSIZ IMPSIZ ;--- Define a "PRINT TAB (#,#)" macro ; DEFINE PRTTAB AA,BB MOVB #AA,D1 LSLW D1,#10 MOVB #BB,D1 TCRT ENDM ;--- Program header and variable offset assignments ; PHDR -1,0,PH$REE!PH$REU ;re-entrant, re-usable GETIMP IMPSIZ,A3 ;A3 points to variables LEA A5,IDDB(A3) ;A5 points to input file LEA A4,ODDB(A3) ;A4 point to output file ;--- type out introduction ; PRTTAB -1,0 ;clear screen PRTTAB 6,34 ;tab to here TYPE PRTTAB 10,24 ;tab to here TYPE ;--- get input file and output file (not intensive error checking) ; PRTTAB 12,20 TYPE KBD FSPEC @A5 PRTTAB 13,20 TYPE KBD FSPEC @A4 INIT @A5 ;initialize both files INIT @A4 LOOKUP @A5 ;if input file not found JNE BOOBOO ;error LOOKUP @A4 ;if output file found JEQ BOOBOO ;error OPENI @A5 ;open them OPENO @A4 PRTTAB 15,1 TYPE ;gizmo effects! ;--- read input file byte-by-byte, write to output file byte-by-byte, ; but add a CRLF at every 75th character on the input file ; BYB2: CLR D4 ;clear counter BYB: FILINB @A5 ;get a byte TST IDDB+D.SIZ(A3) ;eof? BEQ EOF ;yup FILOTB @A4 ;nope, write the byte INC D4 ;increment count CMP D4,#75. ;75th character? BNE BYB ;nope, go get next character MOV #15,D1 ;yup, write a CR FILOTB @A4 ;as so MOV #12,D1 ;and an LF FILOTB @A4 ;as so TYPE <.> ;gizmo effects! BR BYB2 ;goto top ;--- if no input file or output file exists, type message ; BOOBOO: PRTTAB 15,23 TYPE MOV #7,D1 ;get a bell TTY ;beep! BR EXIT ;--- EOF hit, so close files, finish gizmo effects! ; EOF: CLOSE @A5 CLOSE @A4 EXIT: TYPECR EXIT END .