home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
UTILITYS
/
ADDLF15.ARC
/
ADDLF15.BAS
next >
Wrap
BASIC Source File
|
1990-07-21
|
6KB
|
104 lines
100 REM+======================================================================+
110 REM| |
120 REM|TITLE: [ADDLF.BAS - Add line-feeds to non-standard files for CP/M-80] |
130 REM| |
140 REM|DATE: [03/15/83] VERSION: [1.5] LANGUAGE: [MBASIC] |
150 REM|SQUEEZED NAME: [ADDLF15.BQS(4k)] LIBRARY NAME: [ADDLF15.LBR(24k)] |
160 REM|RELATED FILES: [ADDLF15.DQC(5k)->ADDLF15.DOC(6k), ADDLF15.COM(16k)] |
170 REM| |
180 REM|SYSTEM: [Standard CP/M-80, minimum 32k] |
190 REM| |
200 REM|PURPOSE: [To convert a text file received from a non-CP/M source |
210 REM| (i.e., via MODEM7 or APDOS) to a standard CP/M text file |
220 REM| that can be edited by a CP/M text editor such as ED or |
230 REM| WordStar.] |
240 REM| |
250 REM|SUMMARIZE REVISION: [N/A] |
260 REM| |
270 REM|SUBMITTED BY: [Harry Smith, 19628 Via Monte Dr., Saratoga, CA 95070] |
280 REM|ORIGINAL AUTHOR: [Harry Smith] |
290 REM|OTHER CONTRIBUTORS: [None] |
300 REM| |
310 REM|REFERENCE: [None] |
320 REM| |
330 REM|DOCUMENTATION: [User documentation given while executing program. |
340 REM| .DOC file explains all functions performed. |
350 REM| MBASIC code easy to follow with few REM statements.] |
360 REM| |
370 REM|PROGRAM USAGE: [Primarily designed to convert APPLE WRITER text files |
380 REM| to WordStar text files, but will convert many other |
390 REM| non-CP/M files. The source file can also easily be |
400 REM| edited to perform other usefull conversions.] |
410 REM| |
420 REM|RATING: [not rated] |
430 REM| |
440 REM+======================================================================+
450 REM
460 PRINT : PRINT "ADDLF VERSION 1.5 - MARCH 15, 1983"
470 PRINT " by Harry Smith"
480 PRINT " 19628 Via Monte Dr.
490 PRINT " Saratoga, CA 95070"
500 PRINT
510 PRINT "*** Add line-feeds to non-standard CP/M text files ***"
520 PRINT
530 PRINT "This program:"
540 PRINT "1) Removes all existing line-feeds (LF = 0A hex)."
550 PRINT "2) Adds a LF after each RETURN (CR = 0D hex)."
560 PRINT "3) Adds a LF after each SOFT-RETURN (SR = 8D hex)."
570 PRINT "4) Removes all nulls (NUL = 00 hex)."
580 PRINT "5) Stops at end of file character, if present (EOF = 1A hex)."
590 PRINT "6) Stops at physical EOF and adds EOF character, if not present."
600 PRINT "7) Inserts SOFT-RETURN and LF to replace first space after 55th"
610 PRINT " character of line if the WordStar option below is selected."
620 PRINT "8) Allows for upper or lower case in all operator inputs."
630 PRINT "9) Accepts file name of d: to list files on drive d:."
640 PRINT
650 INPUT "DO YOU ALSO WANT TO ADD SOFT-RETURNS FOR WordStar (Y/N) ";Q$
660 WS%=0 : IF Q$="Y" OR Q$="y" THEN WS%=1 : GOTO 680
670 IF Q$<>"N" AND Q$<>"n" THEN 650
680 SP$ = CHR$(32) : EF$ = CHR$(26) : LF$ = CHR$(10)
690 CR$ = CHR$(13) : NUL$ = CHR$(0) : SR$ = CHR$(128 + 13)
700 PRINT : PRINT "YOU MAY CHANGE DISKS NOW BEFORE ANSWERING NEXT QUESTION!"
710 PRINT "FILE NAMES MAY HAVE DRIVE INDICATOR, AS: B:filename.ext"
720 PRINT "TYPE CONTROL-C TO EXIT PROGRAM."
730 PRINT : INPUT "INPUT FILE NAME: "; FILE$ : GOSUB 1060
740 IN$ = UFILE$ : IF IN$="" THEN 700
750 RESET : OPEN "R", #1, IN$, 1 : FIELD #1, 1 AS A$ : GET #1
760 IF NOT EOF(1) THEN 790
770 PRINT "FILE DOES NOT EXIST"
780 KILL IN$ : PRINT : FILES : PRINT : GOTO 700
790 PRINT : INPUT "OUTPUT FILE NAME: "; FILE$ : GOSUB 1060
800 OT$=UFILE$ : IF OT$="" THEN 790
810 IF IN$<>OT$ THEN 830
820 PRINT "THE OUTPUT FILE CAN NOT BE THE INPUT FILE!" : GOTO 790
830 CLOSE #2 : OPEN "R", #2, OT$, 1 : FIELD #2, 1 AS Z$ : GET #2
840 IF EOF(2) THEN 890
850 PRINT "ERASE EXISTING FILE: "; OT$; : INPUT " (Y/N) "; Q$
860 IF Q$="N" OR Q$="n" THEN 790
870 IF Q$<>"Y" AND Q$<>"y" THEN 850
880 KILL OT$
890 CLOSE #2 : OPEN "R", #2, OT$, 1 : FIELD #2, 1 AS Z$
900 C%=0 : B=0 : GOTO 920
910 GET #1 : IF EOF(1) THEN 990
920 IF A$=NUL$ OR A$=LF$ THEN 910
930 IF A$=EF$ THEN 990
940 IF A$=CR$ OR A$=SR$ THEN LSET Z$=A$ : GOTO 980
950 C% = C% + WS%
960 IF C%>55 THEN IF A$=SP$ THEN LSET Z$=SR$ : GOTO 980
970 LSET Z$=A$ : PUT #2 : B=B+1 : GOTO 910
980 PUT #2 : LSET Z$=LF$ : PUT #2 : B=B+2 : C%=0 : GOTO 910
990 LSET Z$=EF$ : PUT #2 : CLOSE
1000 PRINT : PRINT "FILE CONVERTED. "; B; " BYTES OUTPUT." : PRINT
1010 INPUT "DO YOU WISH TO CONVERT ANOTHER FILE (Y/N) "; Q$
1020 IF Q$="Y" OR Q$="y" THEN 700
1030 IF Q$<>"N" AND Q$<>"n" THEN 1010
1040 END
1050 REM SUBROUTINE TO UPSHIFT FILE MAME
1060 UFILE$="" : IF FILE$="" THEN PRINT : FILES : PRINT : RETURN
1070 FOR I=1 TO LEN(FILE$) : T$ = MID$(FILE$, I, 1)
1080 IF T$>="a" AND T$<="z" THEN T$ = CHR$(ASC(T$) - 32)
1090 UFILE$ = UFILE$ + T$ : NEXT I
1100 IF LEN(UFILE$) <> 2 OR RIGHT$(UFILE$,1) <> ":" THEN RETURN
1110 PRINT : FILES UFILE$+"*.*" : PRINT : UFILE$=""
1120 RETURN