1234567891011121314151617181920212223242526 |
- #!/usr/bin/env python3
- template = """\
- 10 CLEAR 0,&H%s:BLOAD"%s"\n\
- 20 DEFUSR=&H%s\n\
- 30 A=USR(0)\n\
- 40 B=PEEK(&HF975)+256*PEEK(&HF976)+65536*PEEK(&HF977)\n\
- 50 ?B,A\n\
- """
- fnames = {'cas':'CAS:VDPtst', 'dsk':'vdptest.bin'}
- import sys
- def hx(n): return hex(n)[2:].upper()
- def main():
- if len(sys.argv) < 3 or sys.argv[1].lower() not in fnames:
- sys.stderr.write("Usage: python3 loadertpl.py {cas|dsk} <addr>\n")
- addr = int(sys.argv[2], 0)
- fname = fnames[sys.argv[1].lower()]
- tpl = template.replace('\n','\r\n')
- sys.stdout.buffer.write(
- (tpl % (hx(addr - 1), fname, hx(addr))).encode('latin1'))
- main()
|