Page 1 of 1

Where to learn assembly

Posted: Mon Nov 09, 2009 11:11 pm
by animangaman690
I'm wanting to learn assembly so I can decompile and edit a few programs of mine. I've looked for books but found none. So does any one know where on the web I could find some tutorials or if there is a book out there.

Re: Where to learn assembly

Posted: Mon Nov 09, 2009 11:27 pm
by Falco Girgis
I've said this many times, and I'll say it again. I think you can't go wrong with college textbooks. Yes, they're extremely expensive, but you get a lot of bang for your buck. Part of learning assembly isn't just knowing opcodes, it's knowing what exactly the effect of these opcodes executing has on the hardware.

Find some sort of literature on x86 assembly. I must warn you, though. Wanting to learn assembly to screw with disassemblers (a decompiler produces C/++ code) is a pretty bad idea. All program structure is lost. It really isn't very human friendly.

Legitimate reasons to want to learn assembly would be something like wanting to write your own assembly programs/routines, or to learn more about architecture.

Re: Where to learn assembly

Posted: Mon Nov 09, 2009 11:31 pm
by Joeyotrevor

Re: Where to learn assembly

Posted: Tue Nov 10, 2009 12:03 am
by animangaman690
I must warn you, though. Wanting to learn assembly to screw with disassemblers (a decompiler produces C/++ code) is a pretty bad idea. All program structure is lost. It really isn't very human friendly.
The main reason I want to learn assemble is because Direct X encrypts output variables saved to files in assembly.
Thanks.

Re: Where to learn assembly

Posted: Tue Nov 10, 2009 12:46 am
by andrew
animangaman690 wrote:The main reason I want to learn assemble is because Direct X encrypts output variables saved to files in assembly.
DirectX comes with a tool to tell you what it's thinking as it is running. Not really sure if it's what you need. Here is a professional's experience with it.

This is a link to the MSDN documentation of it.

Re: Where to learn assembly

Posted: Tue Nov 10, 2009 9:04 am
by Falco Girgis
animangaman690 wrote:The main reason I want to learn assemble is because Direct X encrypts output variables saved to files in assembly.
It does what? Can I see a link or something to what you're talking about?

Re: Where to learn assembly

Posted: Tue Nov 10, 2009 8:47 pm
by animangaman690
GyroVorbis wrote:
animangaman690 wrote:The main reason I want to learn assemble is because Direct X encrypts output variables saved to files in assembly.
It does what? Can I see a link or something to what you're talking about?
My bad, I was half asleep and tired as hell when I wrote this. What I mean is that Direct X uses an assembly program to encrypt and save files. At least that's what
my Game Programing with Direct X book said. The program was in the content on the CD. I tried to decompile it and remove the encryption process, but it
failed and said "Cannot decompile this program. Prebuilt in lower level language. Error Code: 330482." That is where the decompiler came into place. But your right,
trying to mess with a disassembler could screw up the program.

I tried to make an ofstream, but ofstreams and DX don't mix well for me due to some of the settings for a DX project.
I'm probably going to find some other ways of saving my variables for my map files.

I would still like to learn assembly though. So I'll probably see if my dad has any of his old college programing text books.

Re: Where to learn assembly

Posted: Tue Nov 10, 2009 9:09 pm
by andrew
It sounds like you might be trying to solve the wrong problem. Using an ofstream should be completely independent from DirectX.
What are you trying to do exactly?

Re: Where to learn assembly

Posted: Tue Nov 10, 2009 9:18 pm
by animangaman690
Really, I'm trying to save my map files so that they can easily be read in something besides DX. That way I can move on to another API, because DX is very annoying to program in. It was a good start for game development back when it was first released, but now that it's tied in with Win32 it's a pain in the ass.

Re: Where to learn assembly

Posted: Tue Nov 10, 2009 9:28 pm
by andrew
You want to do something like this:

Code: Select all

bool Map::saveMap(char *filename)
{
    ofstream savefile(filename);
    if (!savefile.is_open())
    {
        cout << "Error opening map file!\n";
        return false;
    }

    savefile << map_w; // map width
    savefile << " ";
    savefile << map_h; // map height
    savefile << " ";
    savefile << n_layers; // number of layers
    savefile << endl;
    savefile << tile_w; // tile width
    savefile << " ";
    savefile << tile_h; // tile height
    savefile << endl;
    savefile << tilesetName; // tileset name
    savefile << endl;
    savefile << n_tiles;  // number of tiles
    savefile << endl;

    for (int layer = 0; layer < n_layers; ++layer)
    {
        for (int y = 0; y < map_h; ++y)
        {
            for (int x = 0; x < map_w; ++x)
            {
                savefile << mapdata[layer * (map_w * map_h) + (y * map_w) + x] << " ";
            }
            savefile << endl;
        }
        savefile << endl;
    }
    savefile.close();
    printf("Map saved\n");
    return true;
}
It's from a project I never finished. It saves the map as a text file.

I think this was the last version before I stopped working on it: zero051209.zip
Feel free to do whatever you want with it.

Re: Where to learn assembly

Posted: Tue Nov 10, 2009 9:44 pm
by animangaman690
Thanks I will try something like that when I move on from DX