8bitlenser/lenser/bbc/exporter.py
2026-07-03 19:35:35 -07:00

24 lines
1.1 KiB
Python

"""Build a BBC Micro DFS disk (.ssd) from a conversion."""
from __future__ import annotations
from . import ssd
from .viewer.assemble import LOAD_ADDR, build_viewer
def export_ssd(conv, output_path, source_path=None, display="forever",
seconds=0, video="pal") -> str:
"""Two DFS files: the !BOOT loader (sets mode + palette, *LOADs IMG) and the
IMG screen data. Boot option 2 (*RUN !BOOT) so SHIFT+BREAK autostarts it."""
if not output_path.lower().endswith(".ssd"):
output_path += ".ssd"
m = conv.meta
viewer = build_viewer(m["bbc_mode"], m["ncol"], m["physicals"], m["base"],
display=display, seconds=seconds, video=video)
# !BOOT autostarts on SHIFT+BREAK (real hardware); PIC is the same loader
# under a name with no '!' so it can be *RUN from a command line / emulator.
files = [
("!BOOT", LOAD_ADDR, LOAD_ADDR, viewer),
("PIC", LOAD_ADDR, LOAD_ADDR, viewer),
("IMG", m["base"], m["base"], conv.data),
]
return ssd.write_ssd(output_path, files, title="8BITLENSER", boot_option=2)