"""Build a bootable Atari .atr from a conversion.""" from __future__ import annotations from ..convert.base import Conversion from . import atr, car from .viewer.assemble import assemble_stub, build_cart_rom def export_atr(conv: Conversion, output_path: str, source_path: str | None = None, display: str = "forever", seconds: int = 0, video: str = "ntsc") -> str: """Write ``conv`` as a self-booting .atr at ``output_path``. ``display`` (forever/key/seconds) + ``seconds`` choose how long the viewer holds the picture; on key/seconds it warm-starts the OS. ``video`` sets the frame rate the seconds timer counts (50 PAL / 60 NTSC).""" if not output_path.lower().endswith(".atr"): output_path += ".atr" stub = assemble_stub(conv.viewer, display=display, seconds=seconds, video=video) blob = atr.build_blob(stub, conv.data) return atr.write_boot_atr(output_path, blob) def export_car(conv: Conversion, output_path: str, source_path: str | None = None, display: str = "forever", seconds: int = 0, video: str = "ntsc") -> str: """Write ``conv`` as an autostarting 16K Atari .car cartridge (reuses the disk viewer, so display-duration works the same).""" if not output_path.lower().endswith(".car"): output_path += ".car" rom = build_cart_rom(conv.viewer, conv.data, display=display, seconds=seconds, video=video) return car.write_car(rom, output_path)