Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revisionLast revisionBoth sides next revision | ||
blog:ql_dev1 [2021/12/14 13:09] – [C68 Cross-Compiler (aka XTC68)] john | blog:ql_dev1 [2021/12/15 19:53] – [Other Stuff] john | ||
---|---|---|---|
Line 181: | Line 181: | ||
* https:// | * https:// | ||
* Works with native QL floppy disks (DD 720K, HD 1440K or ED 3.2MB) or disk images to transfer files to/from those devices from Linux. | * Works with native QL floppy disks (DD 720K, HD 1440K or ED 3.2MB) or disk images to transfer files to/from those devices from Linux. | ||
+ | |||
+ | ==== Other Stuff ==== | ||
+ | |||
+ | I wrote a quick Python script to print out the value of an XTcc field in a binary produced by C68, GCC or similar. This is useful when copying an executable into a QL floppy or hard drive filesystem and you need to set the //dataspace parameter//: | ||
+ | |||
+ | < | ||
+ | # | ||
+ | |||
+ | #################################### | ||
+ | # | ||
+ | # Prints out the value of a Sinclar | ||
+ | # QL binary XTcc field, as needed to | ||
+ | # turn it into an executable file | ||
+ | # on the QL itself, or when transferred | ||
+ | # using qltool. | ||
+ | # | ||
+ | # John Snowdon, 2021 | ||
+ | # | ||
+ | #################################### | ||
+ | |||
+ | import sys | ||
+ | import os | ||
+ | |||
+ | if len(sys.argv) < 2: | ||
+ | print(" | ||
+ | sys.exit(-1) | ||
+ | |||
+ | ql_filename = sys.argv[1] | ||
+ | if (os.path.exists(ql_filename)): | ||
+ | f = open(ql_filename, | ||
+ | filedata = f.read() | ||
+ | offset = filedata.find(b' | ||
+ | |||
+ | if offset: | ||
+ | # First byte of " | ||
+ | f.seek(offset + 5) | ||
+ | dataspace = f.read(4) | ||
+ | |||
+ | # Print out the value of the dataspace field | ||
+ | print(int.from_bytes(dataspace, | ||
+ | |||
+ | f.close() | ||
+ | |||
+ | else: | ||
+ | print(" | ||
+ | sys.exit(-1) | ||
+ | </ | ||
+ | |||
+ | Just call the script with the name of your C68 executable. For example: | ||
+ | |||
+ | < | ||
+ | $ xtcc game.bin | ||
+ | 868 | ||
+ | </ | ||
+ | |||
+ | ... the value printed is the size of the dataspace needed. So you would then copy and mark your binary with qltools as follows: | ||
+ | |||
+ | < | ||
+ | $ xtcc game.bin | ||
+ | 868 | ||
+ | $ qltools floppy.img -W game.bin | ||
+ | $ qltools floppy.img -x game.bin 868 | ||
+ | </ | ||
+ | |||
+ | Or even easier, embed the xtcc call in backticks: | ||
+ | |||
+ | < | ||
+ | $ qltools floppy.img -W game.bin | ||
+ | $ qltools floppy.img -x game.bin `xtcc game.bin` | ||
+ | </ | ||
+ |