Jump to content

Assembly Language


mxlr

Recommended Posts

hey guys im pretty new to programming (if you cant tell by my sig lol) im just wondering if it would be worth the time to learn assembly or would it be better to invest the time and money in a different lang eg java, c# c++

any feed back would be appricated :D

Link to comment
Share on other sites

yeah what are you instested in? if you learn say assembly/C++ (or any other reasonably powerful language) you can create devices and write firmware and drivers and such but if you want to make computer apps learn a coding language like C++

Link to comment
Share on other sites

Assembly language is definitely worth learning! Once you understand all the little details of whats going on the lower levels, the higher levels become even easier! everything becomes easier for you! ;)

push eax
mov eax, offset mxlr
mov dword ptr [eax], 0x539
pop eax

that says you are 1337 in assembly language!(well if you were a DOUBLE WORD that is :P)

WORD = 2 bytes; DWORD = 4 bytes

Link to comment
Share on other sites

there are advantages and disadvantages.

some advantages are that its an older language. so tutorials and guides and support is all over the place. free.

its a pretty powerful language and works well with hardware.

and (dunno for sure. i havent learned or researched it much) it seems to be held highly in the hacker community as a must know language which tells me its got a lot of uses.

some disadvantages are(im assuming based on what i know). its an old lower level language which tells me it will take more time and effort to code in than a language like c++. its made more for hardware than software from what i can tell.

all in all from what i've read and seen its worth learning. personally im gonna learn c++ first but i plan on learning assembly at some point. :).

Link to comment
Share on other sites

i would suggest learning java or c++ as you first langauge, to get an understanding of concepts & ideas, and so you can make graphical stuff (which is fun and helps ya learn).

After you got a good grasp on one of them & have an idea about what you do and dont like about programing, you can head in a more refined direction, be that assembly & hardware, smaller apps in python or ruby, or staying at c & j.

my personal recomendation would be java, but im horribly biased.

Link to comment
Share on other sites

thanks for your help guys i think i am going to learn c# or c++ (hard choice) and then assembly (i already know some of the basics from q basic and free basic if you guys count that as programming it taught me the concepts though)

Link to comment
Share on other sites

thanks for your help guys i think i am going to learn c# or c++ (hard choice) and then assembly (i already know some of the basics from q basic and free basic if you guys count that as programming it taught me the concepts though)

Is it really a hard choice? Ask your self a couple simple questions and I think you'll have the answer!

1. Do I want my programs to be dependent on .NET frameworks?

2. Do I want to lose performance because I'm using managed code, instead of good old unmanaged c++?

3. Do I like dots(".") so much that I must splatter them throughout my code?

Can anyone that programs in C# elaborate on why they think its better despite what was outlined above? And don't say the code is easier/faster to write, because I certainly don't think so...

here's an example of two programs the first in managed C# the second in unmanaged native C++

C#

// HelloWorld.cs
using System;

public class HelloWorld
{
    public static int Main()
    {
        Console.WriteLine("Hello World!");
        return 0;
    }
}

C++

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World!";
    return 0;
}

Compile either one, then open a command prompt("cmd.exe") then run either program from it, they both will do the exact same thing, write "Hello World!" to the console screen and exit.

The difference is the C# one compiles into IL(Intermediate Language) code and is stored in the EXE file, when run(requires .NET framework) the CLR(Common Language Runtime) converts it into machine code(Assembly code pretty much) that will run on the computer.

The C++ version compiles directly into machine code and is therefore ready to be run immediately. No dependencies unless you choose to be dependent on something. For example if you made a directX app, then your choosing to be dependent on the machine having directx...

Now although you won't really notice a difference in performance with this simple application(because it doesn't really do much) with code that does more, and code that is CPU intensive, the difference is pretty big, although you can optimize c# code to minimize performance loss, there will always be that overhead caused the .NET frameworks and CLR.

C++ is the highest performance you can get without going totally assembly.

Assembly is basically what you see is what you get, whatever you code, that's how it ends up in the EXE, it doesn't compile it assembles. The assembly opcodes are assembled into numerical byte codes that they are associated with. For example this opcode

"pop eax"

=

0x58 (58 hex)

these byte codes are machine code which with a disassembler you can see the assembly codes they represent, this is basically how reverse engineering takes place, studying the assembly codes you can figure out what a program is actually doing! you can't go from EXE back to source, but you can read the assembly code! ;)

so im going the end this with a quote from the masm32.com website

"Warning Danger Zone

High speed software"

although they changed the website for some reason, currently it can still be viewed in google's cache http://64.233.167.104/search?q=cache:SQSax...;cd=1&gl=us

Link to comment
Share on other sites

Is it really a hard choice? Ask your self a couple simple questions and I think you'll have the answer!

1. Do I want my programs to be dependent on .NET frameworks?

2. Do I want to lose performance because I'm using managed code, instead of good old unmanaged c++?

3. Do I like dots(".") so much that I must splatter them throughout my code?

Can anyone that programs in C# elaborate on why they think its better despite what was outlined above? And don't say the code is easier/faster to write, because I certainly don't think so...

here's an example of two programs the first in managed C# the second in unmanaged native C++

C#

// HelloWorld.cs
using System;

public class HelloWorld
{
    public static int Main()
    {
        Console.WriteLine("Hello World!");
        return 0;
    }
}

C++

#include <iostream>

using namespace std;

int main()
{
    cout << "Hello World!";
    return 0;
}

Compile either one, then open a command prompt("cmd.exe") then run either program from it, they both will do the exact same thing, write "Hello World!" to the console screen and exit.

The difference is the C# one compiles into IL(Intermediate Language) code and is stored in the EXE file, when run(requires .NET framework) the CLR(Common Language Runtime) converts it into machine code(Assembly code pretty much) that will run on the computer.

The C++ version compiles directly into machine code and is therefore ready to be run immediately. No dependencies unless you choose to be dependent on something. For example if you made a directX app, then your choosing to be dependent on the machine having directx...

Now although you won't really notice a difference in performance with this simple application(because it doesn't really do much) with code that does more, and code that is CPU intensive, the difference is pretty big, although you can optimize c# code to minimize performance loss, there will always be that overhead caused the .NET frameworks and CLR.

C++ is the highest performance you can get without going totally assembly.

Assembly is basically what you see is what you get, whatever you code, that's how it ends up in the EXE, it doesn't compile it assembles. The assembly opcodes are assembled into numerical byte codes that they are associated with. For example this opcode

"pop eax"

=

0x58 (58 hex)

these byte codes are machine code which with a disassembler you can see the assembly codes they represent, this is basically how reverse engineering takes place, studying the assembly codes you can figure out what a program is actually doing! you can't go from EXE back to source, but you can read the assembly code! ;)

so im going the end this with a quote from the masm32.com website

"Warning Danger Zone

High speed software"

although they changed the website for some reason, currently it can still be viewed in google's cache http://64.233.167.104/search?q=cache:SQSax...;cd=1&gl=us

You basically wrote a complete post bias towards C++. I frequently use C, C++ and C#, C/C++ is fine if you have time to write a lot of your own code. C# is good if you want great documentation and thorough libraries. C# cuts down the development time because it is high level and you don't have to worry about the low level things. If you had a choice of learning C# or C++, I would say C# first, then moving onto C++ when you're comfortable with C#. A lot of people will tell you to stay away from C# as it's a Microsoft creation, but those people tend to forget that C# is an open standard.

Link to comment
Share on other sites

  • 3 weeks later...

learn C then advance to C++

and then learn some asm and download ollydbg and activly disasmmble your code

it helped me learn quite a bit plus its cool to modify the .exe at machine level :P

as for a free compiler i would recomend MiniGW(bassicly DevC++)

and as an IDE Code::blocks nightly builds ftw

as for asm i belive tasm and tlink are still win

Link to comment
Share on other sites

learn C then advance to C++

and then learn some asm and download ollydbg and activly disasmmble your code

it helped me learn quite a bit plus its cool to modify the .exe at machine level :P

as for a free compiler i would recomend MiniGW(bassicly DevC++)

and as an IDE Code::blocks nightly builds ftw

as for asm i belive tasm and tlink are still win

Tasm and Tlink are years out of date and the fact they're 16 bit, you should probably use Nasm if you're serious about assembly.

Link to comment
Share on other sites

Is it really a hard choice? Ask your self a couple simple questions and I think you'll have the answer!

1. Do I want my programs to be dependent on .NET frameworks?

2. Do I want to lose performance because I'm using managed code, instead of good old unmanaged c++?

3. Do I like dots(".") so much that I must splatter them throughout my code?

Can anyone that programs in C# elaborate on why they think its better despite what was outlined above? And don't say the code is easier/faster to write, because I certainly don't think so...

It's not that one is necessarily better, it depends on what you're doing. If you're talking about enterprise business software, or even smaller web applications, you'd never consider C++ over C#. C# has almost 30 years of programming language and software engineering advancements over C++, so it's going to be a more robust language for the overwhelming amount of tasks. For example, there's much more concensus on development standards, and a lot of this was built into standard APIs vs. the C++ community having to develop versions of patterns to answer software programming delimas as they have come up. For that, and a number of other issues, it's facilitates much more managable code, and provides better tools to encapsulate business and data logic into maintenable tiers.

Certainly you can do anything you can do in C# in C++, but you can make the argument that you don't need a remote control because you can get up and turn on the TV by hand.

Link to comment
Share on other sites

Wow this thread quickly turned from a simple question into a "My language is better, fuck you".

Thanks for that positive reinforcement. ;)

Actually, part of what goes on around here is we like to debate over stuff like this. It gets old after a while, but it's nice to get other peoples perspective on things and you can make your mind up for yourself on what direction to go in after reading everyones opinions. Consensus does not mean any one language is better than the other, just that more people like it over another.

I personally would love to learn assembly more in depth as right now I can see how much it helps. Especially in the debugger/dissasembler department while trying to break down malware to see what they are really doing.

Link to comment
Share on other sites

Yeah since this is the "Assembly Language" thread, I thought I'd share something about it...

I'm remember now how I got started in C++! back in the day, I didn't know any coding languages! But I somehow felt like I wanted to code as it could bring me joy of creating something!

As much as I hate to admit it, I started with VB like back when I was really young! My uncle told me I should learn C++, but back then It was too difficult for me to even write a simple program besides hello world! So I put it aside, and I somehow heard about VB, and started with that. I wasn't creating much just simple GUI's which practically did nothing but It got me motivated to move up to better more powerful languages!

I started game hacking/reverse engineering games with "Cheat Engine" as that was fun for me!(still is)

Its always fun when you can look at the code of a game or program and take it apart break it down, figure out what's going on! Then you can modify it to make it how you want it! I remember hacking online games where people would get mad saying oh your ruining the game! But hell I wouldn't even of played the game if it wasn't hackable, I was hacking it to learn assembly and advance my skillz! I mostly didnt even play the game much really just tested out my hax and made them better! And I would sometimes even share them with other hackers who played the game as well!

In CE theres something called AutoAssemble! Its scripted assembly language, where you write your own scripts and it modifies the games code on the fly while its running! It seemed difficult at first but the more and more I studied other peoples scripts, and worked on my own, the easier and easier it became!

I got pretty good with assembly from that! understand what goes on, on the LOWEST level is very rewarding! Since you know whats going on under the hood, building the "car" is easier!

At some point I realized that hey since I'm good with assembly I could probably code in C++ now! and I was right! C++ started to make sense to me, and I was understanding it like never before! Then eventually I expanded beyond AutoAssemble, and started coding with MASM32, to create full apps not just little scripts to modify an already made app!

So those are my two coding languages of choice at this point in time! C++ and MASM32 :)

Assembly code is easier to write in general because you don't have to know a programming languages syntax, thats what it is, its just assembly! C++ you have to know the C++ syntax or your going to run into errors and problems that seem hard to solve! Which I had problems with at first, where my app would have errors that I didn't know how to get it to compile! But now I'm pretty good about them, sometimes you have to type cast and what not in c++! where as in assembly you just pass an address or pointer as a DWORD it doesn't care about syntax much

So if your thinking about coding whatever language that may be! LEARN ASSEMBLY FIRST! I'm not saying you have to become a pro assembly coder overnight! But just learn the basics at least! It will help you out no matter what your coding language of choice is!! trust me! :)

Link to comment
Share on other sites

Thanks for that positive reinforcement. ;)

Actually, part of what goes on around here is we like to debate over stuff like this. It gets old after a while, but it's nice to get other peoples perspective on things and you can make your mind up for yourself on what direction to go in after reading everyones opinions. Consensus does not mean any one language is better than the other, just that more people like it over another.

I personally would love to learn assembly more in depth as right now I can see how much it helps. Especially in the debugger/dissasembler department while trying to break down malware to see what they are really doing.

There is a difference between debating and bashing languages.

also steve C# is basically java made by microsoft XD.

Link to comment
Share on other sites

There is a difference between debating and bashing languages.

also steve C# is basically java made by microsoft XD.

you mean Microshaft right? lol well thats not why I don't like it! I have nothing against microshaft! infact I actually like microshaft alot because they made my favorite operating system which I'm on right now! WINDOWS XP PRO!

Although they seriously messed up and lost some points with me for making Vista... Its ok though I can just rebel and run XP forever! :)

anyway the reason why I don't like C# is because of the dependency on .NET frameworks! I'm not a big fan of dependencies!!!! In fact I switched to Dev C++ instead of using MSVC++ 2008 because the 2008 VC++ is dependent on the "Microsoft Visual C++ 2008 Redistributable Package" techno babble!!!

I really liked the 2008 compiler with its nice inline assembly syntax which in Dev is not anything like it! And the different builds release and debug which Dev doesn't have! + other things that I liked but I can't remember since I haven't used it in a while...

Well maybe I was a little harsh toward C# But at least I got my Anti-C# rant out of the way lol! So now when anyone talks about C# I'll just ignore it altogether and not even make a post! ;)

Link to comment
Share on other sites

I was coding un-managed native c++ code!

take a look at this link:

http://hak5.org/forums/index.php?showtopic=9249

thats something I coded in VC++ 2008! a while back tell me if that looks like managed code to you!

I'm working on version 2.0 of that program but this time im gonna compile it in DevCPP, so it wont have the dependency... Also I figured out nicatronTG's problem and how to solve it! so that fix will be included in the new version...

I believe the reason why its dependent on the 2008 package is because it links to MSVCRT90.dll

a dll which most computers don't have unless they have VC++ 2008 installed, or the 2008 package...

while DevCPP links to MSVCRT.dll which every windows computer has!!

so there probably is a way to get the 2008 compiler to link to the older dll, but I couldn't find any info online about it, to change it... But if you know how to do it that'd be nice to use that compiler again! If app's created with it can run on any windows machine.

here's what you get if you try to run an app coded in VC++2008 without having it installed or the package

missing2008package.png

I currently don't have either installed on my PC and that happens! Now if I recompile it in Dev, it will happily load up :)

Link to comment
Share on other sites

You were using functions specific to the 9.0 runtime.

As for the .NET dependency for C#, most up to date Windows systems have the latest .NET framework installed.

So if your thinking about coding whatever language that may be! LEARN ASSEMBLY FIRST! I'm not saying you have to become a pro assembly coder overnight! But just learn the basics at least! It will help you out no matter what your coding language of choice is!! trust me! smile.gif

I also believe this is bad advice. Don't learn Assembly as your first language.

Link to comment
Share on other sites

You were using functions specific to the 9.0 runtime.

As for the .NET dependency for C#, most up to date Windows systems have the latest .NET framework installed.

I also believe this is bad advice. Don't learn Assembly as your first language.

nah, actually there is a library in the VS9 lib folder named MSVCRT.lib which is actually MSVCR90.lib.

Made a new folder C:\MSVCRT\ and plopped the real MSVCRT.lib file into it and then added it as a library directory and it compiled using MSVCRT.dll.

Although it gave me some warnings.

1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Generating code
1>Finished generating code
1>MSVCRT.lib(cinitexe.obj) : warning LNK4254: section '.CRT' (40000040) merged into '.data' (C0000040) with different attributes
1>MSVCRT.lib(cinitexe.obj) : warning LNK4254: section '.CRT' (40000040) merged into '.data' (C0000040) with different attributes

adding /NODEFAULTLIB breaks it but I didn't seem to matter with those warnings.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...