40-Column Listing One-Liner

From Bitchin100 DocGarden
Jump to navigationJump to search

This program, COLIZE

COLIZE

prints out a text file as a non-word wrapped, 40-character column of text.

It was used to create the listing of this one-liner. The image was created by printing to VirtualT's FX-80 emulation, and post-processed using Ghostscript and GIMP to crop and scale to 72dpi.

NOTE: This version has a glitch on lines larger than 255 characters.

The following code works for all lines:

COLIZ2
10 CLEAR 512
20 INPUT "FILE";F$
30 OPEN F$ FOR INPUT AS 1
32 S$="IDLE"
40 A$=INPUT$(1,1)
50 C=ASC(A$)
60 IF S$="IDLE" AND C=13 THEN S$="SKIP":GOTO 100
70 IF S$="SKIP" AND C=10 THEN LPRINT T$:T$="":S$="IDLE":
   GOTO 100: ELSE IF S$="SKIP" THEN PRINT "CR W/OUT LF": END
80 T$=T$+A$
90 IF LEN(T$)=40 THEN LPRINT T$:T$=""
100 IF EOF(1) THEN LPRINT T$;:END ELSE GOTO 40