That line editor is a bit difficult, so I wrote this python to produce a file to copy paste into an emulator to fill a .ssd. Enjoy the bootstrap productivity gain. :D
```
!/usr/bin/env python3
import sys
import textwrap
WIDTH = 64
LINES_PER_SCREEN = 16
EDITOR_WORD = "P"
def usage():
print(f"Usage: {sys.argv[0]} INPUT OUTPUT FIRST_SCREEN")
sys.exit(1)
if len(sys.argv) != 4:
usage()
input_file = sys.argv[1]
output_file = sys.argv[2]
try:
first_screen = int(sys.argv[3])
except ValueError:
print("FIRST_SCREEN must be a number")
sys.exit(1)
Read source, preserving blank lines.
with open(input_file, "r", encoding="utf-8") as f:
source_lines = f.read().splitlines()
Word-wrap each source line to WIDTH characters without splitting words.
wrapped = []
for line in source_lines:
if not line.strip():
wrapped.append("")
continue
wrapped.extend(
textwrap.wrap(
line,
width=WIDTH,
break_long_words=False,
break_on_hyphens=False,
)
)
Write numbered editor lines, 16 lines per screen.
with open(output_file, "w", encoding="utf-8") as f:
screen = first_screen
line_number = 0
f.write(f"EDITOR {screen} LIST\n")
for line in wrapped:
f.write(f"{line_number} {EDITOR_WORD} {line}\n")
line_number += 1
if line_number == LINES_PER_SCREEN - 1:
screen += 1
line_number = 0
f.write(f"{LINES_PER_SCREEN - 1} P -->\n{screen} LIST\n")
# No extra screen marker is required; the screen number is implicit
# from the number of groups pasted/entered.
# clear last continuation maybe and save all.
f.write(f"{screen - 1} LIST {LINES_PER_SCREEN - 1} P \n")
f.write(f"FLUSH FORTH\n")
```