Page 2 of 4

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

Posted: Sat Dec 07, 2013 12:35 am
by robcfg
If I simply change the file extension to .cas, then you'll end with the same name if you try to convert a file that already has .cas extension... :lol:

What should I do in that case?

Sorry for being that picky about it, but I prefer my tools to work without a hitch if possible. :mrgreen:

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

Posted: Sat Dec 07, 2013 1:28 am
by zephyr
I want it to convert name.bin to name.cas. So that name.bin and name.cas are left after the conversion.

If I were then to convert the exact same name.bin to name.cas again, DrBinCas would simply overwrite the existing copy of name.cas with another name.cas which was exactly the same as the previous one.

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

Posted: Sat Dec 07, 2013 5:09 am
by robcfg
I think I didn't explained myself well on the subject.

If the source file is name.cas, the output file would be name.cas also, in that case the operation cannot be performed...

I'll just throw an error message in case input and output files end up having the same name.

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

Posted: Sat Dec 07, 2013 10:46 am
by zephyr
Well, to me its just a matter of applying a little common sense. I can't see why would anyone would give their binary source file a .cas extension.

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

Posted: Sat Dec 07, 2013 9:09 pm
by robcfg
Well, I finally implemented all the changes, so here you have it!

As usual, please tell me if you find any error. A Windows binary and the source file are provided. I haven't had time to compile it on Mac or Linux, but should work right away. Still not sure that everything will work if compiled on a processor with a different endian, like a PowerPC one.

I hope you like it!

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

Posted: Sat Dec 07, 2013 11:48 pm
by zephyr
Version 02 works perfectly, but v04 crashes every time. The only time it doesn't crash is if you just enter "drbincas" without arguments. I have attached the WinXP error report.

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

Posted: Sun Dec 08, 2013 3:15 am
by robcfg
Hmmmmm, it seems that the error code means STATUS_FATAL_APP_EXIT.

Are you using a 32-bit or a 64-bit Windows system? Mine is a 64 bit one, maybe you're trying to run it on a 32 bit system, thus the crash.

I'll take a look tomorrow, but if you could compile the code yourself and it works on your system, then it's a library/framework incompatibility.

Damn, they could show more meaningful error messages...

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

Posted: Sun Dec 08, 2013 11:41 am
by zephyr
robcfg wrote: Are you using a 32-bit or a 64-bit Windows system?
I'm using a 32-Bit Pentium 4 HT system @3.06 GHz. My operating system is Windows XP Pro SP3+.

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

Posted: Sun Dec 08, 2013 11:50 am
by KenH
Is there a utility to convert the other way around: CAS to BIN?
I couldn't find any.
Rob, this could be a useful addition :D

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

Posted: Sun Dec 08, 2013 12:02 pm
by tormod
Hi Rob,
FYI your program works well on Linux. I am pretty sure it is broken on big-endian architectures such as PowerPC though, due to the casting of short int to array of chars and getting LSB/MSB using "nameBlock[14] = pLoadAdd[1];". You could use loadAdd & 0xFF and loadAdd >> 8 instead.

Did I ever send you this patch (Allow hexadecimal load/exec address)?

Anyway, I mostly use makewav from ToolShed now, which can write CAS files as well (-k option).

Tormod