msdos dissasembly
I would have thought hexdump would do that, but I didn't see any command line switches for binary.Caracas wrote:.
Does anyone know of an application that can quickly translate lots of hex values to binary?
You could dump it to hex and pipe that through sed or ed and translate each hex char to its 4-character binary equivalent.
Found the following in my memdump:
at $039C:2E1CE
Was running around in Harkyn's castle level 1 and ran into a group of 4 monster groups, first group of 2, group of 3, another group of 3 and a group of 4... forgot to write down what monsters were in the group.
If you take a memdump just before you start fighting the berserkers, you'll find 63 63 63 63 instead of 02 03 03 04
no idea (yet) what the rest of the code means.
at $039C:2E1CE
Code: Select all
2A D4 09 00 00 00 [u]02 03 03 04[/u] 00 00 00 00 00 00 BB 0E 05 00 12 00 68 01 BB 0E 05 00 17 00 34 03 BB 0E 05 00 1A 00 3C 05 BB 0E 08 00 1F 00 1C 09 BB 0E 08 00 25 00 BC 0D BB 0E 08 00 2B 00 1C 13 BB 0E 09 00 30 00 DC 19 BB 0E 0C 00 3F 00 AC 25 BB 0E 0C 00 4A 00 8C 33 BB 0E 14 00 58 00 0C 4F BB 0E 10 00 58 00 0C 65 BB 0E 0C 00 58 00 8C 75 BB 0E 08 00 58 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
If you take a memdump just before you start fighting the berserkers, you'll find 63 63 63 63 instead of 02 03 03 04
no idea (yet) what the rest of the code means.
Well, I decoded B2.HUF and was able to create a bmp out of it. However:
- B2.HUF seems to use 1 nibble per pixel, so every byte contains 2 pixels.
- my .bmp is upside-down and mirrored.
- this is my .bmp header:
After the header, the actual data of the picture follows.
I created a script to translate every nibble to a 24 bit color value.
B2.HUF is 112 pixels wide and 88 pixels high.
- B2.HUF seems to use 1 nibble per pixel, so every byte contains 2 pixels.
- my .bmp is upside-down and mirrored.
- this is my .bmp header:
Code: Select all
42 4D B5 73 00 00 00 00 00 00 36 00 00 00 28 00 00 00 70 00 00 00 58 00 00 00 01 00 18 00 00 00 00 00 10 00 00 00 13 0B 00 00 13 0B 00 00 00 00 00 00 00 00 00 00
I created a script to translate every nibble to a 24 bit color value.
B2.HUF is 112 pixels wide and 88 pixels high.
Ok, I managed to modify my header:
Here, I can just add the decoded B2.HUF and then I get my image. No need anymore to translate the decoded hex values to 24 bit color values.
The colors look like crap though, but I guess that's normal.
And my house is still upside down and mirrored
Code: Select all
42 4D 75 13 00 00 00 00 00 00 36 00 00 00 28 00 00 00 70 00 00 00 58 00 00 00 01 00 04 00 00 00 00 00 00 00 00 00 13 0B 00 00 13 0B 00 00 00 00 00 00 00 00 00 00
The colors look like crap though, but I guess that's normal.
And my house is still upside down and mirrored
-
- Posts: 35
- Joined: Fri Nov 11, 2011 2:50 pm
- Location: .de
- Contact:
Did you use the CGA 16 Palette? I mean, CGA looks like crap anyway, but that's at least the way it ought to look.
If you want to have some code for this in Python, you can use mine under https://github.com/btdevel/bt/blob/mast ... btimage.py. It's incorrectly called palette_ega16 there, but the colors are correct. If you don't like the python stuff you can also copy the color values from
http://en.wikipedia.org/wiki/Color_Graphics_Adapter.
If you want to have some code for this in Python, you can use mine under https://github.com/btdevel/bt/blob/mast ... btimage.py. It's incorrectly called palette_ega16 there, but the colors are correct. If you don't like the python stuff you can also copy the color values from
http://en.wikipedia.org/wiki/Color_Graphics_Adapter.
-
- Posts: 35
- Joined: Fri Nov 11, 2011 2:50 pm
- Location: .de
- Contact:
Ahh, I just realised you directly write the bmp files. With 4 bits per pixel, as I see in your header, you need to specify the palette colors, which should come after the DIB header. Maybe you have it there, but I cannot see that from your post (it's cut off at that point). If you put your image data directly after the DIB you probably only have junk in the palette, namely some of the pixel values mistaken (by the graphics viewer) for palette data. The image shouldn't even load, as there is then data missing, but probably most graphics viewers load it anyway.
If you look at Color Table in http://en.wikipedia.org/wiki/BMP_file_format, you see that you need 4 bytes per color (rgb plus alpha), so for the CGA palette the palette/color table should look like:
So the full header you put before the data should be:
Ah, yes: if your image is still upside down: what about just reversing the string, and switching the high and low nibbles in each byte? Should work, I'd guess.
If you look at Color Table in http://en.wikipedia.org/wiki/BMP_file_format, you see that you need 4 bytes per color (rgb plus alpha), so for the CGA palette the palette/color table should look like:
Code: Select all
00 00 00 00 00 00 AA 00 00 AA 00 00 00 AA AA 00 AA 00 00 00 AA 00 AA 00 AA 55 00 00 AA AA AA 00 55 55 55 00 55 55 FF 00 55 FF 55 00 55 FF FF 00 FF 55 55 00 FF 55 FF 00 FF FF 55 00 FF FF FF 00
Code: Select all
42 4D 75 13 00 00 00 00 00 00 36 00 00 00 28 00 00 00 70 00 00 00 58 00 00 00 01 00 04 00 00 00 00 00 00 00 00 00 13 0B 00 00 13 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 AA 00 00 AA 00 00 00 AA AA 00 AA 00 00 00 AA 00 AA 00 AA 55 00 00 AA AA AA 00 55 55 55 00 55 55 FF 00 55 FF 55 00 55 FF FF 00 FF 55 55 00 FF 55 FF 00 FF FF 55 00 FF FF FF 00
-
- Posts: 35
- Joined: Fri Nov 11, 2011 2:50 pm
- Location: .de
- Contact:
@ZeroZero Do you know which encoding they use for the pictures in bigpic (I mean after the Huffman stuff). I can decode quite a few of the graphics files like b?.huf and dpics? but I have not much clue about bigpic. Is it some form of RLE encoding maybe?ZeroZero wrote:
Bigpic contains the 63 pictures of Bards Tale (just like in C64 version).
-
- Posts: 35
- Joined: Fri Nov 11, 2011 2:50 pm
- Location: .de
- Contact:
Wow! Lots of stuff. Incredible to me how figured all that out.
Hopefully they didn't change the animation stuff in the dos version. Some other graphics stuff seems to be dos specific at least, e.g. b?.huf and dpics? use the cga palette and bardtit and bardscr use also cga but with separated bitplanes(but no encoding except the huffman stuff). I'm even more interested in the Amiga files, but first I'll give the dos files a try. I'll tell you when it works...
Hopefully they didn't change the animation stuff in the dos version. Some other graphics stuff seems to be dos specific at least, e.g. b?.huf and dpics? use the cga palette and bardtit and bardscr use also cga but with separated bitplanes(but no encoding except the huffman stuff). I'm even more interested in the Amiga files, but first I'll give the dos files a try. I'll tell you when it works...