Page 1 of 4

Utility for converting a binary file to a .CAS file

Posted: Mon Dec 20, 2010 4:14 pm
by robcfg
As Nitrofurano asked, I made a small command-line utility that takes a binary file and convert it into a Dragon .CAS file.

You need to specify the file name, the program name, and the load and exec addresses.

For what I've tested, it seems to work ok, but I don't discard that there could be any errors due to the short time I had to code it.

As I'm going tomorrow to Germany on holidays (If the snow doesn't get in my way...) I couldn't test it on a machine with a different endian than that of the x86, so if you compile it under PowerPc or similar, you have to swap the load and exec addresses bytes.

Anyway, here you have the source code and the win32 compiled version.

Please tell me if you find any errors, and I'll fix them when I come back in january.

Merry Christmas!

Re: Utility for converting a binary file to a .CAS file

Posted: Wed Dec 22, 2010 9:18 pm
by zephyr

Re: Utility for converting a binary file to a .CAS file

Posted: Fri Jan 28, 2011 12:01 am
by robcfg
While converting images to the Dragon, I notice that this utility had a couple of errors, so here you have the fixed version.

Note that the first version produces a corrupted file... :o

The file contains the Win32 compiled version and the source code, as usual.

Re: Utility for converting a binary file to a .CAS file

Posted: Fri Dec 06, 2013 6:27 pm
by zephyr
Rob, I would like to request a couple of minor additions to your DrBinCas utility:

(1) A command line option to enable overwriting .cas files with the same name without asking.

(2) A command line option to force the file name seen by the Dragon on loading to always be in upper case.

Re: Utility for converting a binary file to a .CAS file

Posted: Fri Dec 06, 2013 9:26 pm
by robcfg
Hi!

As for saving the name always in uppercase, that's easy. Would it be better to do it by default, or should I leave that to the user's choice? I'm not sure if having lowercase characters in the name could cause any error.

Regarding the overwrite of the files, as far as I know and I've tested on windows, the files get automatically overwritten unless they are write protected, where you get a message that it couldn't be opened for writing.

In that case I could try to change the file's permissions, but most probably will be OS specific.

Could you tell me a bit more how are you using the program and under which platform?

Regards,
Rob

Re: Utility for converting a binary file to a .CAS file

Posted: Fri Dec 06, 2013 11:19 pm
by zephyr
robcfg wrote: As for saving the name always in uppercase, that's easy. Would it be better to do it by default, or should I leave that to the user's choice?
Yes, I would prefer it to be the default, with a command line option to force lower case.
robcfg wrote: Regarding the overwrite of the files, as far as I know and I've tested on windows, the files get automatically overwritten unless they are write protected, where you get a message that it couldn't be opened for writing.

In that case I could try to change the file's permissions, but most probably will be OS specific.
Im using it from a command prompt under 32-Bit Windows XP pro.

Re: Utility for converting a binary file to a .CAS file

Posted: Fri Dec 06, 2013 11:24 pm
by robcfg
I have already the case thing working, but I cannot figure under which condition (other than the file being write protected) my program wouldn't overwrite a destination file...

Re: Utility for converting a binary file to a .CAS file

Posted: Fri Dec 06, 2013 11:38 pm
by zephyr
Sorry, My mistake. It does overwrite the previous file. Can you make it save the file as name.cas rather than name.bin.cas?

Re: Utility for converting a binary file to a .CAS file

Posted: Fri Dec 06, 2013 11:42 pm
by robcfg
Sure, I'll make a new version and upload it here tonight or tomorrow.

Re: Utility for converting a binary file to a .CAS file

Posted: Fri Dec 06, 2013 11:49 pm
by zephyr
Thanks, Rob. :) Could you also change it so that if you only enter a load address, it makes the exec address the same as the load address?