msdos dissasembly

Any developer realated stuff
User avatar
ZeroZero
Posts: 286
Joined: Tue Mar 10, 2009 9:10 pm
Location: Germany

Post by ZeroZero »

@ Caracas

Bigpic contains the 63 pictures of Bards Tale (just like in C64 version).

The events are hardcoded in the main exe.

EDIT

The high order bit is set in text since the org version (Apple II)
had a font like that.
Maven
Posts: 138
Joined: Sat Apr 16, 2011 9:39 pm

Post by Maven »

Caracas wrote:.
Does anyone know of an application that can quickly translate lots of hex values to binary?
I would have thought hexdump would do that, but I didn't see any command line switches for 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.
Caracas
Posts: 89
Joined: Thu Jan 20, 2011 9:16 am
Location: Belgium

Post by Caracas »

Found the following in my memdump:

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
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.
Caracas
Posts: 89
Joined: Thu Jan 20, 2011 9:16 am
Location: Belgium

Post by Caracas »

Just an FYI

All the FF's in the code of my previous post is in fact the Items file that gets loaded at that location. If you modify the items file and take a memdump, your modifications will show there.

Not much valuable in that info, but nevertheless interesting to know.
Caracas
Posts: 89
Joined: Thu Jan 20, 2011 9:16 am
Location: Belgium

Post by Caracas »

Does anyone know of a way to reconstruct the images into .bmp or .jpg once you decoded them?
Would be nice to recreate the B0, B1, B2 and B3 pictures and the dungeon pics.
Maven
Posts: 138
Joined: Sat Apr 16, 2011 9:39 pm

Post by Maven »

I haven't messed with the pictures much, but I've seen the data in memory dumps. I expect it's complicated somewhat by the animation system, but if we can find straight graphics data we could pretty much attach a bmp header and it would become a .bmp file.
User avatar
ZeroZero
Posts: 286
Joined: Tue Mar 10, 2009 9:10 pm
Location: Germany

Post by ZeroZero »

I explained the animation and pic routine in detail in the C64 thread.

Should be same here, I made a prog in VB that decodes the pics and anims directly from a D64 file and can save them as bmp

Btw... the animated gif for my avatar here is from that proggy plus some tools
Caracas
Posts: 89
Joined: Thu Jan 20, 2011 9:16 am
Location: Belgium

Post by Caracas »

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:

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
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.
Caracas
Posts: 89
Joined: Thu Jan 20, 2011 9:16 am
Location: Belgium

Post by Caracas »

Ok, I managed to modify my header:

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
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 :D
Desmet Irkm
Posts: 35
Joined: Fri Nov 11, 2011 2:50 pm
Location: .de
Contact:

Post by Desmet Irkm »

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.
Caracas
Posts: 89
Joined: Thu Jan 20, 2011 9:16 am
Location: Belgium

Post by Caracas »

Don't know anything about Python, sorry :)

I'm just mainly trying to satisfy my curiousity... maybe even convert a self-made picture into a bardstale picture and changing the looks of the houses, dungeon walls,...
colors are the least of my concerns :lol:
Desmet Irkm
Posts: 35
Joined: Fri Nov 11, 2011 2:50 pm
Location: .de
Contact:

Post by Desmet Irkm »

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:

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
So the full header you put before the data should be:

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
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.
Desmet Irkm
Posts: 35
Joined: Fri Nov 11, 2011 2:50 pm
Location: .de
Contact:

Post by Desmet Irkm »

ZeroZero wrote:
Bigpic contains the 63 pictures of Bards Tale (just like in C64 version).
@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?
User avatar
ZeroZero
Posts: 286
Joined: Tue Mar 10, 2009 9:10 pm
Location: Germany

Post by ZeroZero »

I suggest you read here. Most is the same in all BT1 versions.
Desmet Irkm
Posts: 35
Joined: Fri Nov 11, 2011 2:50 pm
Location: .de
Contact:

Post by Desmet Irkm »

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