Utility for converting a binary file to a .CAS file

Hardware Hacking, Programming and Game Solutions/Cheats
User avatar
robcfg
Posts: 1529
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 »

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:
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 »

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.
User avatar
robcfg
Posts: 1529
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 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.
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 »

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.
User avatar
robcfg
Posts: 1529
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 »

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!
Attachments
DrBinCas_v04.7z
DrBinCas v0.4
(9.68 KiB) Downloaded 207 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 »

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.
Attachments
DrBinCas04_rep.zip
(129.65 KiB) Downloaded 216 times
User avatar
robcfg
Posts: 1529
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 »

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...
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: 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+.
Last edited by zephyr on Sun Dec 08, 2013 7:31 pm, edited 1 time in total.
KenH
Posts: 182
Joined: Fri Oct 12, 2012 9:50 am

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

Post 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
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

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

Post 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
Attachments
0001-Allow-hexadecimal-load-exec-address.patch.zip
(747 Bytes) Downloaded 193 times
Post Reply