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...
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.
Utility for converting a binary file to a .CAS file
Re: Utility for converting a binary file to a .CAS file
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.
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
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.
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
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
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!
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 293 times
Re: Utility for converting a binary file to a .CAS file
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 285 times
Re: Utility for converting a binary file to a .CAS file
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...
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
I'm using a 32-Bit Pentium 4 HT system @3.06 GHz. My operating system is Windows XP Pro SP3+.robcfg wrote: Are you using a 32-bit or a 64-bit Windows system?
Last edited by zephyr on Sun Dec 08, 2013 7:31 pm, edited 1 time in total.
Re: Utility for converting a binary file to a .CAS file
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
I couldn't find any.
Rob, this could be a useful addition
Re: Utility for converting a binary file to a .CAS file
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
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 260 times