Utility for converting a binary file to a .CAS file

Hardware Hacking, Programming and Game Solutions/Cheats
User avatar
robcfg
Posts: 1532
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Utility for converting a binary file to a .CAS file

Post 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!
Attachments
DrBinCas.zip
Robcfg's file to cas utility.
(7.04 KiB) Downloaded 332 times
User avatar
robcfg
Posts: 1532
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

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

Post 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.
Attachments
DrBinCas_v02.7z
DrBinCas v0.2 by Robcfg
(7.15 KiB) Downloaded 315 times
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

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

Post 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.
User avatar
robcfg
Posts: 1532
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

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

Post 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
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

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

Post 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.
User avatar
robcfg
Posts: 1532
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

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

Post 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...
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

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

Post 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?
User avatar
robcfg
Posts: 1532
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

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

Post by robcfg »

Sure, I'll make a new version and upload it here tonight or tomorrow.
zephyr
Posts: 1474
Joined: Mon Jul 21, 2008 1:18 am

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

Post 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?
Post Reply