Files
Sprinter-SDCC/examples/seek/gen_bigfile.py
T
snark13 c71e249a4e Add full compiler toolchain, libc, examples and reference docs
First substantive commit: the entire Sprinter C compiler tree on top of
the bare README+gitignore initial commit.

What's in here:
  bin/sprinter-cc        — driver script invoking SDCC + linker + mkexe
  libc/                  — Sprinter-specific libc layer over ESTEX/BIOS
                           (conio, gfx, io, mem, stdio + headers)
  runtime/               — crt0 variants (default/small/banked/minimal)
                           + heap + bank trampolines
  toolchain/             — mkexe (SprintEXE packer, C + tests)
  examples/              — 30 demo programs (gfx, file I/O, env, time, …)
  lib/Makefile           — builds the libc archive (sprinter.lib)
  docs/                  — converted Sprinter manuals + asm reference samples
  third_party/           — solid-c reference compiler dump + sdcc setup script
  release_docs/          — packaging / release notes

gitignore overhaul:
  • Drop dangerous blanket patterns: *.asm (would hide docs/samples/*.asm)
    and *.exe (case-insensitive match was hiding third_party/solid-c/*.EXE
    on macOS APFS).  Replaced with examples/*/*.{asm,exe,…} and lib/*.lib.
  • Restore tracking of toolchain/mkexe/tests/{one,big}.bin — those are
    INPUT fixtures, not build outputs.
  • Collapse the duplicated SDCC/C/Sdcc sections into one section per
    concern (build outputs / vendored / OS-junk).
  • Add .sprinter-cc-*/, build/ (catches lib/build/ too), .claude/.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 16:13:21 +03:00

36 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""
Generate a >64 KB test file with predictable position-encoded content.
Every 256-byte block starts with a 32-character ASCII line
"[off=NNNNNNN] block #BBBB filler...\n"
where NNNNNNN is the absolute byte offset of the block start (padded to 7
decimal digits) and BBBB is the 4-digit block index. The line is padded
to 256 bytes with '.' so that seeking to any 256-aligned offset gives an
immediately-readable label.
"""
import sys
import os
def main():
path = sys.argv[1] if len(sys.argv) > 1 else "big.txt"
target_size = int(sys.argv[2]) if len(sys.argv) > 2 else 100 * 1024
block_size = 256
nblocks = (target_size + block_size - 1) // block_size
with open(path, "wb") as f:
for b in range(nblocks):
offset = b * block_size
header = f"[off={offset:07d}] block #{b:04d} "
body = header + ("." * (block_size - len(header) - 1)) + "\n"
assert len(body) == block_size, len(body)
f.write(body.encode("ascii"))
actual = os.path.getsize(path)
print(f"wrote {path}: {actual} bytes ({nblocks} blocks of {block_size} each)")
if __name__ == "__main__":
main()