Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

29 rindas
950B

  1. # make-fixtures.py - write the PETSCII SEQ test files that c64project.json puts on the disk.
  2. # python test/make-fixtures.py
  3. import os
  4. def petscii(text):
  5. out = bytearray()
  6. for ch in text.encode("ascii"):
  7. if ch == 10:
  8. out.append(13)
  9. elif 0x61 <= ch <= 0x7A:
  10. out.append(ch - 0x20) # lower case -> $41-$5A
  11. elif 0x41 <= ch <= 0x5A:
  12. out.append(ch + 0x80) # upper case -> $C1-$DA
  13. else:
  14. out.append(ch)
  15. return bytes(out)
  16. here = os.path.dirname(os.path.abspath(__file__))
  17. files = {
  18. "sample.seq": "alpha\nbravo\ncharlie\ndelta\n",
  19. # 100 numbered lines, line 50 is 300 characters long (split at 240 on load)
  20. "long.seq": "".join(
  21. ("line %d " % n) + ("x" * 292 if n == 50 else "") + "\n" for n in range(1, 101)
  22. ),
  23. }
  24. for name, text in files.items():
  25. with open(os.path.join(here, name), "wb") as f:
  26. f.write(petscii(text))

Powered by TurnKey Linux.